version 1.3, 2003/01/06 13:53:26
|
version 1.7, 2003/09/22 00:48:32
|
Line 33 use Apache::Constants qw(:common);
|
Line 33 use Apache::Constants qw(:common);
|
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use Apache::lonnet; |
use Apache::lonnet; |
|
use Apache::lonlocal; |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
|
|
Line 48 sub handler {
|
Line 49 sub handler {
|
</head> |
</head> |
ENDDOCUMENT |
ENDDOCUMENT |
|
|
# Is this even in a course? |
|
unless ($ENV{'request.course.id'}) { |
|
$r->print('<body>Not in a course</body>'); |
|
return OK; |
|
} |
|
|
|
unless (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) { |
|
$r->print('<body>No course listing</body>'); |
|
return OK; |
|
} |
|
|
|
|
|
|
|
&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']); |
|
# Allowed? |
|
|
|
unless (($ENV{'form.roles'}) || |
|
(($ENV{'request.course.id'}) && |
|
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})))) { |
|
$r->print('<body>No context.</body>'); |
|
return OK; |
|
} |
|
|
|
# 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='.'; } |
Line 79 function gochoose(uname,udom) {
|
Line 82 function gochoose(uname,udom) {
|
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[i]==udom) { slct.selectedIndex=i; } |
if (slct.options[i].value==udom) { slct.selectedIndex=i; } |
} |
} |
self.close(); |
self.close(); |
} |
} |
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
|
|
|
$r->print('<form>'); |
|
if ((&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) && |
|
(!$ENV{'form.roles'})) { |
|
# -------------------------------------------------------- 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= |
|
&Apache::lonnet::get_course_adv_roles(); |
|
$r->print('<table border="2">'); |
|
foreach my $role (sort keys %coursepersonnel) { |
|
foreach (split(/\,/,$coursepersonnel{$role})) { |
|
my ($puname,$pudom)=split(/\:/,$_); |
|
$r->print('<tr><td>'. |
|
'<input type="button" value="Select" onClick="gochoose('. |
|
"'".$puname."','".$pudom."')".'" /></td><td>'.$role.'</td><td>'. |
|
&Apache::loncommon::aboutmewrapper( |
|
&Apache::loncommon::plainname($puname, |
|
$pudom),$puname,$pudom).'</td></tr>'); |
|
} |
|
} |
|
$r->print('</table><p> '); |
if ($filter ne '.') { |
if ($filter ne '.') { |
$r->print('Name starting with "'.$filter.'"<br />'); |
$r->print('<br/ >'.&mt('Name starting with').' "'.$filter.'"<br />'); |
} |
} |
$r->print('<form><table>'); |
$r->print('</p><p><table>'); |
|
# ------------------------------------------------------------------ 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)= |
Line 101 ENDSCRIPT
|
Line 124 ENDSCRIPT
|
if (($uname=~/^$filter/) || |
if (($uname=~/^$filter/) || |
($fullname=~/^$filter/i)) { |
($fullname=~/^$filter/i)) { |
$r->print('<tr><td>'. |
$r->print('<tr><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>'.$udom. |
'<td><tt>'.$uname.'</tt></td><td> <tt>'.$udom. |
'</tt></td><td>'. |
'</tt></td><td>'. |
&Apache::loncommon::aboutmewrapper( |
&Apache::loncommon::aboutmewrapper( |
$fullname, |
$fullname, |
Line 113 ENDSCRIPT
|
Line 136 ENDSCRIPT
|
} |
} |
} |
} |
|
|
$r->print('</table></form></body></html>'); |
$r->print('</table></p>'); |
return OK; |
} else { |
|
$r->print('<h3>'.&mt('Users with Roles Assigned by').' '. |
|
&Apache::loncommon::plainname($ENV{'user.name'}, |
|
$ENV{'user.domain'}).'</h3>'); |
|
if ($filter ne '.') { |
|
$r->print('<br/ >'.&mt('Name starting with').' "'.$filter.'"<br />'); |
|
} |
|
$r->print('<p><table>'); |
|
my %users=&Apache::lonnet::get_my_roles(); |
|
foreach (sort keys %users) { |
|
if ($_=~/^(\w+)\:(\w+)\:(\w+)$/) { |
|
my ($uname,$udom,$urole)=($1,$2,$3); |
|
my $fullname=&Apache::loncommon::plainname($uname,$udom); |
|
if (($uname=~/^$filter/) || |
|
($fullname=~/^$filter/i)) { |
|
$r->print('<tr><td>'. |
|
'<input type="button" value="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><td>'. |
|
&Apache::lonnet::plaintext($urole). |
|
'</td></tr>'); |
|
} |
|
} |
|
} |
|
$r->print('</table></p>'); |
|
} |
|
$r->print('</form></body></html>'); |
|
return OK; |
} |
} |
|
|
1; |
1; |