version 1.7, 2003/09/22 00:48:32
|
version 1.13, 2006/03/16 21:34:04
|
Line 42 sub handler {
|
Line 42 sub handler {
|
return OK if $r->header_only; |
return OK if $r->header_only; |
|
|
# ------------------------------------------------------------ Print the screen |
# ------------------------------------------------------------ Print the screen |
$r->print(<<ENDDOCUMENT); |
$r->print(&Apache::loncommon::start_page("Selecting a User",undef, |
<html> |
{'no_nav_bar' => 1})); |
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
</head> |
|
ENDDOCUMENT |
|
|
|
|
|
|
|
|
|
&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']); |
# Allowed? |
# Allowed? |
|
my $allowed; |
|
my $scope = $env{'request.course.id'}; |
|
if (!($allowed = &Apache::lonnet::allowed('srm',$scope))) { |
|
$scope .= '/'.$env{'request.course.sec'}; |
|
$allowed = &Apache::lonnet::allowed('srm',$scope); |
|
if ($allowed) { $allowed = 'section'; } |
|
} |
|
|
unless (($ENV{'form.roles'}) || |
unless (($env{'form.roles'}) || |
(($ENV{'request.course.id'}) && |
(($env{'request.course.id'}) && ($allowed))) { |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})))) { |
$r->print(&mt('No context.'). |
$r->print('<body>No context.</body>'); |
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|
# See if filter present |
# See if filter present |
|
|
my $filter=$ENV{'form.filter'}; |
my $filter=$env{'form.filter'}; |
$filter=~s/\W//g; |
$filter=~s/\W//g; |
unless ($filter) { $filter='.'; } |
unless ($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 $classlist=&Apache::loncoursedata::get_classlist(); |
|
my %grouplist=&Apache::lonnet::get_group_membership($cdom,$cnum); |
|
my $now = time; |
|
my %allgroups; |
|
my @coursegroups = (); |
|
if (&Apache::loncommon::coursegroups(\%allgroups,$cdom,$cnum)) { |
|
@coursegroups = keys(%allgroups); |
|
} |
|
|
# --------------------------------------- There is such a user, get environment |
# --------------------------------------- There is such a user, get environment |
|
|
$r->print(&Apache::loncommon::bodytag("Selecting a User")); |
|
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script> |
<script> |
function gochoose(uname,udom) { |
function gochoose(uname,udom) { |
opener.document.$ENV{'form.form'}.$ENV{'form.unameelement'}.value=uname; |
opener.document.$env{'form.form'}.$env{'form.unameelement'}.value=uname; |
var slct=opener.document.$ENV{'form.form'}.$ENV{'form.udomelement'}; |
var slct=opener.document.$env{'form.form'}.$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 90 function gochoose(uname,udom) {
|
Line 99 function gochoose(uname,udom) {
|
ENDSCRIPT |
ENDSCRIPT |
|
|
$r->print('<form>'); |
$r->print('<form>'); |
if ((&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) && |
if ($allowed && (!$env{'form.roles'})) { |
(!$ENV{'form.roles'})) { |
|
# -------------------------------------------------------- Get course personnel |
# -------------------------------------------------------- Get course personnel |
$r->print('<h3>'.$ENV{'course.'.$ENV{'request.course.id'}.'.description'}. |
$r->print('<h3>'.$env{'course.'.$env{'request.course.id'}.'.description'}. |
'</h3>'); |
'</h3>'); |
my %coursepersonnel= |
my %coursepersonnel= |
&Apache::lonnet::get_course_adv_roles(); |
&Apache::lonnet::get_course_adv_roles(); |
Line 113 ENDSCRIPT
|
Line 121 ENDSCRIPT
|
if ($filter ne '.') { |
if ($filter ne '.') { |
$r->print('<br/ >'.&mt('Name starting with').' "'.$filter.'"<br />'); |
$r->print('<br/ >'.&mt('Name starting with').' "'.$filter.'"<br />'); |
} |
} |
$r->print('</p><p><table>'); |
$r->print('</p><p><table><tr><th> </th><th>username</th><th>domain</th><th>Name</th><th>ID</th><th>section</th><th>active group(s)</th>'); |
# ------------------------------------------------------------------ Students |
# ------------------------------------------------------------------ Students |
foreach (sort keys %$classlist) { |
foreach (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)= |
@{$classlist->{$_}}; |
@{$classlist->{$_}}; |
|
if ($allowed eq 'section' && $section ne $env{'request.course.sec'}) { |
|
next; |
|
} |
if ($_=~/^(\w+)\:(\w+)$/) { |
if ($_=~/^(\w+)\:(\w+)$/) { |
my ($uname,$udom)=($1,$2); |
my ($uname,$udom)=($1,$2); |
if (($uname=~/^$filter/) || |
if (($uname=~/^$filter/) || |
($fullname=~/^$filter/i)) { |
($fullname=~/^$filter/i)) { |
|
my $grouplist = ''; |
|
foreach my $group (@coursegroups) { |
|
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/,$//; |
$r->print('<tr><td>'. |
$r->print('<tr><td>'. |
'<input type="button" value="'.&mt('Select').'" onClick="gochoose('. |
'<input type="button" value="'.&mt('Select').'" onClick="gochoose('. |
"'".$uname."','".$udom."')".'" /></td>'. |
"'".$uname."','".$udom."')".'" /></td>'. |
Line 131 ENDSCRIPT
|
Line 152 ENDSCRIPT
|
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::aboutmewrapper( |
$fullname, |
$fullname, |
$uname,$udom).'</td><td>'.$id.'</td><td>'.$section. |
$uname,$udom).'</td><td>'.$id.'</td><td>'.$section. |
'</td></tr>'); |
'</td><td>'.$grouplist.'</td></tr>'); |
} |
} |
} |
} |
} |
} |
Line 139 ENDSCRIPT
|
Line 160 ENDSCRIPT
|
$r->print('</table></p>'); |
$r->print('</table></p>'); |
} 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'}, |
$ENV{'user.domain'}).'</h3>'); |
$env{'user.domain'}).'</h3>'); |
if ($filter ne '.') { |
if ($filter ne '.') { |
$r->print('<br/ >'.&mt('Name starting with').' "'.$filter.'"<br />'); |
$r->print('<br/ >'.&mt('Name starting with').' "'.$filter.'"<br />'); |
} |
} |
Line 167 ENDSCRIPT
|
Line 188 ENDSCRIPT
|
} |
} |
$r->print('</table></p>'); |
$r->print('</table></p>'); |
} |
} |
$r->print('</form></body></html>'); |
$r->print('</form>'.&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|