version 1.23, 2007/08/10 23:20:09
|
version 1.27, 2009/04/24 05:28:55
|
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']); |
# 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); |
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; |
my $result; |
foreach my $user (sort(keys(%$classlist))) { |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
# the following undefs are for 'domain', and 'username' respectively. |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my (undef,undef,$end,$start,$id,$section,$fullname,$status)= |
my $classlist=&Apache::loncoursedata::get_classlist(); |
@{$classlist->{$user}}; |
my %grouplist=&Apache::lonnet::get_group_membership($cdom,$cnum); |
if ($allowed eq 'section' && $section ne $env{'request.course.sec'}) { |
my $now = time; |
next; |
my %allgroups = &Apache::longroup::coursegroups($cdom,$cnum); |
} |
|
if ($user=~/^($LONCAPA::username_re)\:($LONCAPA::domain_re)$/) { |
foreach my $user (sort(keys(%$classlist))) { |
my ($uname,$udom)=($1,$2); |
# the following undefs are for 'domain', and 'username' respectively. |
if (($uname=~/^$filter/) || |
my (undef,undef,$end,$start,$id,$section,$fullname,$status)= |
($fullname=~/^$filter/i)) { |
@{$classlist->{$user}}; |
my $grouplist = ''; |
if ($allowed eq 'section' && $section ne $env{'request.course.sec'}) { |
foreach my $group (sort(keys(%allgroups))) { |
next; |
if (exists($grouplist{$group.':'.$uname.':'.$udom})) { |
} |
my ($end,$start) = split(/:/,$grouplist{$group.':'.$uname.':'.$udom}); |
if ($user=~/^($LONCAPA::username_re)\:($LONCAPA::domain_re)$/) { |
if (($end!=0) && ($end<$now)) { next; } |
my ($uname,$udom)=($1,$2); |
if (($start!=0) && ($start>$now)) {next; } |
if (($uname=~/^$filter/) || ($fullname=~/^$filter/i)) { |
$grouplist .= " $group,"; |
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/,$//; |
|
$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(); |
} |
} |
$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>'. |
&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 208 ENDSCRIPT
|
Line 210 ENDSCRIPT
|
/^($LONCAPA::username_re):($LONCAPA::domain_re):(\w+)$/); |
/^($LONCAPA::username_re):($LONCAPA::domain_re):(\w+)$/); |
my ($uname,$udom,$urole)=($1,$2,$3); |
my ($uname,$udom,$urole)=($1,$2,$3); |
my $fullname=&Apache::loncommon::plainname($uname,$udom); |
my $fullname=&Apache::loncommon::plainname($uname,$udom); |
next if (($uname!~/^$filter/i) && ($fullname=~/^$filter/i)); |
next if (($uname!~/^$filter/i) && ($fullname !~/^$filter/i)); |
|
|
if (!exists($users{"$uname:$udom"})) { |
if (!exists($users{"$uname:$udom"})) { |
$users{"$uname:$udom"} = {'fullname' => $fullname }; |
$users{"$uname:$udom"} = {'fullname' => $fullname }; |
Line 219 ENDSCRIPT
|
Line 221 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>'. |