version 1.24, 2007/09/02 01:30:34
|
version 1.29, 2011/01/23 01:04:26
|
Line 50 sub handler {
|
Line 50 sub handler {
|
|
|
&Apache::loncommon::get_unprocessed_cgi |
&Apache::loncommon::get_unprocessed_cgi |
($ENV{'QUERY_STRING'},['filter','form','unameelement','udomelement', |
($ENV{'QUERY_STRING'},['filter','form','unameelement','udomelement', |
'roles']); |
'roles','courseadvonly','clicker']); |
# Allowed? |
# Allowed? |
my $allowed; |
my $allowed; |
my $scope = $env{'request.course.id'}; |
my $scope = $env{'request.course.id'}; |
Line 83 FILTER
|
Line 83 FILTER
|
<input type="hidden" name="$name" value="$value" /> |
<input type="hidden" name="$name" value="$value" /> |
HIDDEN |
HIDDEN |
} |
} |
$filtermsg = '<br />'. |
unless ($env{'form.courseadvonly'}) { |
&mt('Showing users with a name starting with [_1]', |
$filtermsg = '<br />'. |
$filterbutton).'<br />'; |
&mt('Showing users with a name starting with [_1]', |
|
$filterbutton).'<br />'; |
|
} |
if ($filter eq '') { |
if ($filter eq '') { |
$filter = '.' |
$filter = '.' |
} |
} |
|
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $classlist=&Apache::loncoursedata::get_classlist(); |
|
my %grouplist=&Apache::lonnet::get_group_membership($cdom,$cnum); |
|
my $now = time; |
|
my %allgroups = &Apache::longroup::coursegroups($cdom,$cnum); |
|
|
|
# --------------------------------------- There is such a user, get environment |
# --------------------------------------- There is such a user, get environment |
|
|
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
function gochoose(uname,udom) { |
function gochoose(uname,udom) { |
opener.document.$env{'form.form'}.$env{'form.unameelement'}.value=uname; |
opener.document.$env{'form.form'}.elements['$env{'form.unameelement'}'].value=uname; |
var slct=opener.document.$env{'form.form'}.$env{'form.udomelement'}; |
var slct=opener.document.$env{'form.form'}.elements['$env{'form.udomelement'}']; |
var i; |
var i; |
for (i=0;i<slct.length;i++) { |
for (i=0;i<slct.length;i++) { |
if (slct.options[i].value==udom) { slct.selectedIndex=i; } |
if (slct.options[i].value==udom) { slct.selectedIndex=i; } |
Line 124 ENDSCRIPT
|
Line 119 ENDSCRIPT
|
foreach my $role (sort(keys(%coursepersonnel))) { |
foreach my $role (sort(keys(%coursepersonnel))) { |
foreach my $user (split(/\,/,$coursepersonnel{$role})) { |
foreach my $user (split(/\,/,$coursepersonnel{$role})) { |
my ($puname,$pudom)=split(/\:/,$user); |
my ($puname,$pudom)=split(/\:/,$user); |
$role = &Apache::lonnet::plaintext($role, |
|
&Apache::loncommon::course_type()); |
|
$r->print(&Apache::loncommon::start_data_table_row(). |
$r->print(&Apache::loncommon::start_data_table_row(). |
'<td>'. |
'<td>'. |
'<input type="button" value="Select" onClick="gochoose('. |
'<input type="button" value="'.&mt('Select').'" onClick="gochoose('. |
"'".$puname."','".$pudom."')".'" /></td><td>'.$role.'</td><td>'. |
"'".$puname."','".$pudom."')".'" /></td><td>'.$role.'</td><td>'. |
&Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($puname,$pudom),$puname,$pudom).'</td>'. |
&Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($puname,$pudom),$puname,$pudom).'</td>'. |
&Apache::loncommon::end_data_table_row()); |
&Apache::loncommon::end_data_table_row()); |
Line 140 ENDSCRIPT
|
Line 133 ENDSCRIPT
|
|
|
$r->print('</p>'); |
$r->print('</p>'); |
|
|
|
unless ($env{'form.courseadvonly'}) { |
|
|
# ------------------------------------------------------------------ Students |
# ------------------------------------------------------------------ Students |
my $result; |
|
foreach my $user (sort(keys(%$classlist))) { |
# Do we have a clicker? |
# the following undefs are for 'domain', and 'username' respectively. |
|
my (undef,undef,$end,$start,$id,$section,$fullname,$status)= |
my $clicker=$env{'form.clicker'}; |
@{$classlist->{$user}}; |
my @fragments=(); |
if ($allowed eq 'section' && $section ne $env{'request.course.sec'}) { |
if ($clicker) { |
next; |
$r->print('<h1>'.&mt('Clicker: [_1]',$clicker).'</h1>'); |
} |
my $clicklength=length($clicker); |
if ($user=~/^($LONCAPA::username_re)\:($LONCAPA::domain_re)$/) { |
my $maxlength=$clicklength-1; |
my ($uname,$udom)=($1,$2); |
if ($maxlength>2) { |
if (($uname=~/^$filter/) || |
my $minlength=$maxlength-2; |
($fullname=~/^$filter/i)) { |
if ($minlength<2) { $minlength=2; } |
my $grouplist = ''; |
for (my $length=$maxlength;$length>=$minlength;$length--) { |
foreach my $group (sort(keys(%allgroups))) { |
for (my $startidx=0; $startidx<=$clicklength-$length; $startidx++) { |
if (exists($grouplist{$group.':'.$uname.':'.$udom})) { |
push(@fragments,substr($clicker,$startidx,$length)); |
my ($end,$start) = split(/:/,$grouplist{$group.':'.$uname.':'.$udom}); |
} |
if (($end!=0) && ($end<$now)) { next; } |
} |
if (($start!=0) && ($start>$now)) {next; } |
} |
$grouplist .= " $group,"; |
} |
} |
|
|
my $result; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $classlist=&Apache::loncoursedata::get_classlist(); |
|
my %grouplist=&Apache::lonnet::get_group_membership($cdom,$cnum); |
|
my $now = time; |
|
my %allgroups = &Apache::longroup::coursegroups($cdom,$cnum); |
|
|
|
foreach my $user (sort(keys(%$classlist))) { |
|
# the following undefs are for 'domain', and 'username' respectively. |
|
my (undef,undef,$end,$start,$id,$section,$fullname,$status)= |
|
@{$classlist->{$user}}; |
|
if ($allowed eq 'section' && $section ne $env{'request.course.sec'}) { |
|
next; |
|
} |
|
if ($user=~/^($LONCAPA::username_re)\:($LONCAPA::domain_re)$/) { |
|
my ($uname,$udom)=($1,$2); |
|
if (($uname=~/^$filter/) || ($fullname=~/^$filter/i)) { |
|
my $grouplist = ''; |
|
foreach my $group (sort(keys(%allgroups))) { |
|
if (exists($grouplist{$group.':'.$uname.':'.$udom})) { |
|
my ($end,$start) = split(/:/,$grouplist{$group.':'.$uname.':'.$udom}); |
|
if (($end!=0) && ($end<$now)) { next; } |
|
if (($start!=0) && ($start>$now)) {next; } |
|
$grouplist .= " $group,"; |
|
} |
|
} |
|
$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)/<font color=\"green\" size=\"\+1\"><b>$1<\/b><\/font>/gis; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
$result .=&Apache::loncommon::start_data_table_row(). |
|
'<td>'. |
|
'<input type="button" value="'.&mt('Select').'" onClick="gochoose('. |
|
"'".$uname."','".$udom."')".'" /></td>'. |
|
'<td><tt>'.$uname.'</tt></td><td> <tt>'.$udom. |
|
'</tt></td><td>'. |
|
&Apache::loncommon::aboutmewrapper($fullname, |
|
$uname,$udom). |
|
'</td><td>'.$id.'</td><td>'.$section. |
|
'</td><td>'.$grouplist.'</td>'. |
|
($clicker?'<td>'.$markedupclicker.'</td>':''). |
|
&Apache::loncommon::end_data_table_row(); |
} |
} |
$grouplist =~ s/,$//; |
} |
$result .=&Apache::loncommon::start_data_table_row(). |
|
'<td>'. |
|
'<input type="button" value="'.&mt('Select').'" onClick="gochoose('. |
|
"'".$uname."','".$udom."')".'" /></td>'. |
|
'<td><tt>'.$uname.'</tt></td><td> <tt>'.$udom. |
|
'</tt></td><td>'. |
|
&Apache::loncommon::aboutmewrapper($fullname, |
|
$uname,$udom). |
|
'</td><td>'.$id.'</td><td>'.$section. |
|
'</td><td>'.$grouplist.'</td>'. |
|
&Apache::loncommon::end_data_table_row(); |
|
} |
|
} |
} |
} |
if (!$result) { |
if (!$result) { |
$r->print('<p>'.&mt('No students found.').'</p>'); |
$r->print('<p>'.&mt('No students found.').'</p>'); |
} else { |
} else { |
$r->print(&Apache::loncommon::start_data_table(). |
$r->print(&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::end_data_table_header_row(). |
&Apache::loncommon::end_data_table_header_row(). |
'<th> </th>'. |
'<th> </th>'. |
'<th>'.&mt('username').'</th>'. |
'<th>'.&mt('username').'</th>'. |
'<th>'.&mt('domain').'</th>'. |
'<th>'.&mt('domain').'</th>'. |
'<th>'.&mt('Name').'</th>'. |
'<th>'.&mt('Name').'</th>'. |
'<th>'.&mt('ID').'</th>'. |
'<th>'.&mt('ID').'</th>'. |
'<th>'.&mt('section').'</th>'. |
'<th>'.&mt('section').'</th>'. |
'<th>'.&mt('active group(s)').'</th>'. |
'<th>'.&mt('active group(s)').'</th>'. |
($clicker?'<th>'.&mt('clicker').'</th>':''). |
&Apache::loncommon::end_data_table_header_row(). |
&Apache::loncommon::end_data_table_header_row(). |
$result. |
$result. |
&Apache::loncommon::end_data_table()); |
&Apache::loncommon::end_data_table()); |
} |
} |
|
} |
} else { |
} else { |
$r->print('<h3>'.&mt('Users with Roles Assigned by').' '. |
$r->print('<h3>'.&mt('Users with Roles Assigned by').' '. |
&Apache::loncommon::plainname($env{'user.name'}, |
&Apache::loncommon::plainname($env{'user.name'}, |
Line 219 ENDSCRIPT
|
Line 257 ENDSCRIPT
|
my ($uname,$udom) = split(':',$user); |
my ($uname,$udom) = split(':',$user); |
$r->print(&Apache::loncommon::start_data_table_row(). |
$r->print(&Apache::loncommon::start_data_table_row(). |
'<td>'. |
'<td>'. |
'<input type="button" value="Select" onClick="gochoose('. |
'<input type="button" value="'.&mt('Select').'" onClick="gochoose('. |
"'".$uname."','".$udom."')".'" /></td>'. |
"'".$uname."','".$udom."')".'" /></td>'. |
'<td><tt>'.$uname.'</tt></td>'. |
'<td><tt>'.$uname.'</tt></td>'. |
'<td><tt>'.$udom.'</tt></td><td>'. |
'<td><tt>'.$udom.'</tt></td><td>'. |