version 1.21, 2007/07/21 00:48:55
|
version 1.26, 2009/03/01 01:17:20
|
Line 70 sub handler {
|
Line 70 sub handler {
|
# See if filter present |
# See if filter present |
my $filter=$env{'form.filter'}; |
my $filter=$env{'form.filter'}; |
my $filtermsg; |
my $filtermsg; |
if ($filter eq '') { |
my $encoded_filter = &HTML::Entities::encode($filter,'<>&"'); |
$filter = '.' |
$filter = quotemeta($filter); |
} else { |
my $change = &mt('Change'); |
my $encoded_filter = &HTML::Entities::encode($filter,'<>&"'); |
my $filterbutton =<<FILTER; |
$filter = quotemeta($filter); |
|
my $change = &mt('Change'); |
|
my $filterbutton =<<FILTER; |
|
<input type="text" name="filter" value="$encoded_filter" /> |
<input type="text" name="filter" value="$encoded_filter" /> |
<input type="submit" name="Change" value="$change" /> |
<input type="submit" name="Change" value="$change" /> |
FILTER |
FILTER |
foreach my $name ('form','unameelement','udomelement','roles') { |
foreach my $name ('form','unameelement','udomelement','roles') { |
my $value = &HTML::Entities::encode($env{"form.$name"},'<>&"'); |
my $value = &HTML::Entities::encode($env{"form.$name"},'<>&"'); |
$filterbutton .= <<HIDDEN; |
$filterbutton .= <<HIDDEN; |
<input type="hidden" name="$name" value="$value" /> |
<input type="hidden" name="$name" value="$value" /> |
HIDDEN |
HIDDEN |
} |
} |
$filtermsg = '<br />'. |
$filtermsg = '<br />'. |
&mt('Showing users with a name starting with [_1]', |
&mt('Showing users with a name starting with [_1]', |
$filterbutton).'<br />'; |
$filterbutton).'<br />'; |
|
if ($filter eq '') { |
|
$filter = '.' |
} |
} |
|
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 123 ENDSCRIPT
|
Line 122 ENDSCRIPT
|
&Apache::lonnet::get_course_adv_roles(); |
&Apache::lonnet::get_course_adv_roles(); |
$r->print(&Apache::loncommon::start_data_table()); |
$r->print(&Apache::loncommon::start_data_table()); |
foreach my $role (sort(keys(%coursepersonnel))) { |
foreach my $role (sort(keys(%coursepersonnel))) { |
foreach (split(/\,/,$coursepersonnel{$role})) { |
foreach my $user (split(/\,/,$coursepersonnel{$role})) { |
my ($puname,$pudom)=split(/\:/,$_); |
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 139 ENDSCRIPT
|
Line 136 ENDSCRIPT
|
|
|
$r->print($filtermsg); |
$r->print($filtermsg); |
|
|
$r->print('</p><p>'. |
$r->print('</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()); |
|
# ------------------------------------------------------------------ Students |
# ------------------------------------------------------------------ Students |
|
my $result; |
foreach my $user (sort(keys(%$classlist))) { |
foreach my $user (sort(keys(%$classlist))) { |
# the following undefs are for 'domain', and 'username' respectively. |
# the following undefs are for 'domain', and 'username' respectively. |
my (undef,undef,$end,$start,$id,$section,$fullname,$status)= |
my (undef,undef,$end,$start,$id,$section,$fullname,$status)= |
Line 173 ENDSCRIPT
|
Line 161 ENDSCRIPT
|
} |
} |
} |
} |
$grouplist =~ s/,$//; |
$grouplist =~ s/,$//; |
$r->print(&Apache::loncommon::start_data_table_row(). |
$result .=&Apache::loncommon::start_data_table_row(). |
'<td>'. |
'<td>'. |
'<input type="button" value="'.&mt('Select').'" onClick="gochoose('. |
'<input type="button" value="'.&mt('Select').'" onClick="gochoose('. |
"'".$uname."','".$udom."')".'" /></td>'. |
"'".$uname."','".$udom."')".'" /></td>'. |
Line 183 ENDSCRIPT
|
Line 171 ENDSCRIPT
|
$uname,$udom). |
$uname,$udom). |
'</td><td>'.$id.'</td><td>'.$section. |
'</td><td>'.$id.'</td><td>'.$section. |
'</td><td>'.$grouplist.'</td>'. |
'</td><td>'.$grouplist.'</td>'. |
&Apache::loncommon::end_data_table_row()); |
&Apache::loncommon::end_data_table_row(); |
} |
} |
} |
} |
} |
} |
|
if (!$result) { |
$r->print(&Apache::loncommon::end_data_table().'</p>'); |
$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 { |
} 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 196 ENDSCRIPT
|
Line 199 ENDSCRIPT
|
$r->print($filtermsg); |
$r->print($filtermsg); |
|
|
$r->print('<p>'.&Apache::loncommon::start_data_table()); |
$r->print('<p>'.&Apache::loncommon::start_data_table()); |
my %users=&Apache::lonnet::get_my_roles(); |
my %user_role=&Apache::lonnet::get_my_roles(); |
foreach my $user (sort(keys(%users))) { |
my %users; |
if ($user =~ |
foreach my $user_role (keys(%user_role)) { |
/^($LONCAPA::username_re)\:($LONCAPA::domain_re)\:(\w+)$/) { |
next if ($user_role !~ |
my ($uname,$udom,$urole)=($1,$2,$3); |
/^($LONCAPA::username_re):($LONCAPA::domain_re):(\w+)$/); |
my $fullname=&Apache::loncommon::plainname($uname,$udom); |
my ($uname,$udom,$urole)=($1,$2,$3); |
if (($uname=~/^$filter/) || |
my $fullname=&Apache::loncommon::plainname($uname,$udom); |
($fullname=~/^$filter/i)) { |
next if (($uname!~/^$filter/i) && ($fullname !~/^$filter/i)); |
$r->print(&Apache::loncommon::start_data_table_row(). |
|
'<td>'. |
if (!exists($users{"$uname:$udom"})) { |
'<input type="button" value="Select" onClick="gochoose('. |
$users{"$uname:$udom"} = {'fullname' => $fullname }; |
"'".$uname."','".$udom."')".'" /></td>'. |
|
'<td><tt>'.$uname.'</tt></td><td><tt>'.$udom. |
|
'</tt></td><td>'. |
|
&Apache::loncommon::aboutmewrapper( |
|
$fullname, |
|
$uname,$udom).'</td><td><td>'. |
|
&Apache::lonnet::plaintext($urole). |
|
'</td>'. |
|
&Apache::loncommon::end_data_table_row()); |
|
} |
|
} |
} |
|
push(@{$users{"$uname:$udom"}{'roles'}},$urole); |
|
} |
|
foreach my $user (sort {lc($a) cmp lc($b)} (keys(%users))) { |
|
my ($uname,$udom) = split(':',$user); |
|
$r->print(&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($users{$user}{'fullname'}, |
|
$uname,$udom).'</td>'. |
|
'<td>'. |
|
join(', ',sort(map {&Apache::lonnet::plaintext($_)} |
|
(@{$users{$user}{'roles'}}))). |
|
'</td>'. |
|
&Apache::loncommon::end_data_table_row()); |
} |
} |
$r->print(&Apache::loncommon::end_data_table().'</p>'); |
$r->print(&Apache::loncommon::end_data_table().'</p>'); |
} |
} |