--- loncom/interface/loncreateuser.pm 2007/08/02 01:02:56 1.166
+++ loncom/interface/loncreateuser.pm 2007/08/10 23:00:13 1.169
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.166 2007/08/02 01:02:56 albertel Exp $
+# $Id: loncreateuser.pm,v 1.169 2007/08/10 23:00:13 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -360,11 +360,13 @@ ENDSCRIPT
$r->print(&Apache::loncommon::end_data_table_header_row());
my @sorted_users = sort {
- lc($srch_results->{$a}->{$sortby}) cmp lc($srch_results->{$b}->{$sortby})
+ lc($srch_results->{$a}->{$sortby}) cmp lc($srch_results->{$b}->{$sortby})
||
- lc($srch_results->{$a}->{lastname}) cmp lc($srch_results->{$b}->{lastname})
+ lc($srch_results->{$a}->{lastname}) cmp lc($srch_results->{$b}->{lastname})
||
lc($srch_results->{$a}->{firstname}) cmp lc($srch_results->{$b}->{firstname})
+ ||
+ lc($a) cmp lc($b)
} (keys(%$srch_results));
foreach my $user (@sorted_users) {
@@ -1134,7 +1136,7 @@ ENDNOPRIV
'.$lt{'ssd'}.' |
-
+ |
'.$lt{'sed'}.' | '."\n".
&Apache::loncommon::end_data_table_row()."\n".
@@ -1142,10 +1144,10 @@ ENDNOPRIV
' |
'.$lt{'caa'}.' |
'.$cudom.'_'.$cuname.' |
-
+ |
'.$lt{'ssd'}.' |
-
+ |
'.$lt{'sed'}.' | '."\n".
&Apache::loncommon::end_data_table_row()."\n".
@@ -1177,10 +1179,10 @@ ENDNOPRIV
' |
'.$plrole.' |
'.$thisdomain.' |
-
+ |
'.$lt{'ssd'}.' |
-
+ |
'.$lt{'sed'}.' | '.
&Apache::loncommon::end_data_table_row();
@@ -2237,20 +2239,24 @@ sub user_search_result {
&build_search_response($srch,%srch_results);
}
} else {
- my %courseusers = &get_courseusers();
+ my $courseusers = &get_courseusers();
if ($srch->{'srchtype'} eq 'exact') {
- if (exists($courseusers{$srch->{'srchterm'}.':'.$srch->{'srchdomain'}})) {
+ if (exists($courseusers->{$srch->{'srchterm'}.':'.$srch->{'srchdomain'}})) {
$state = 'modify';
} else {
($state,$response,$forcenewuser) =
&build_search_response($srch,%srch_results);
}
} else {
- foreach my $user (keys(%courseusers)) {
+ foreach my $user (keys(%$courseusers)) {
my ($cuname,$cudomain) = split(/:/,$user);
if ($cudomain eq $srch->{'srchdomain'}) {
if ($cuname =~ /\Q$srch->{'srchterm'}\E/i) {
- $srch_results{$user} = '';
+ $srch_results{$user} =
+ {&Apache::lonnet::get('environment',
+ ['firstname',
+ 'lastname',
+ 'permanentemail'])};
}
}
}
@@ -2272,8 +2278,8 @@ sub user_search_result {
($state,$response,$forcenewuser) =
&build_search_response($srch,%srch_results);
} elsif ($srch->{'srchin'} eq 'crs') {
- my %courseusers = &get_courseusers();
- foreach my $user (keys(%courseusers)) {
+ my $courseusers = &get_courseusers();
+ foreach my $user (keys(%$courseusers)) {
my ($uname,$udom) = split(/:/,$user);
my %names = &Apache::loncommon::getnames($uname,$udom);
my %emails = &Apache::loncommon::getemails($uname,$udom);
@@ -2364,11 +2370,11 @@ sub directorysrch_check {
return &mt('Directory search has not been configured for domain: [_1]',$srch->{'srchdomain'});
}
my %longtext = &Apache::lonlocal::texthash (
- uname => 'username',
+ uname => 'username',
lastfirst => 'last name, first name',
- lastname => 'last name',
- contains => 'is contained in',
- exact => 'as exact match to'
+ lastname => 'last name',
+ contains => 'is contained in',
+ exact => 'as exact match to'
);
if ($can_search) {
if (ref($dom_inst_srch{'directorysrch'}{'searchby'}) eq 'ARRAY') {
@@ -2392,15 +2398,16 @@ sub directorysrch_check {
sub get_courseusers {
my %advhash;
+ my $classlist = &Apache::loncoursedata::get_classlist();
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles();
foreach my $role (sort(keys(%coursepersonnel))) {
foreach my $user (split(/\,/,$coursepersonnel{$role})) {
- $advhash{$user} = '';
+ if (!exists($classlist->{$user})) {
+ $classlist->{$user} = [];
+ }
}
}
- my $classlist = &Apache::loncoursedata::get_classlist();
- my %combined = (%advhash, %{$classlist});
- return %combined;
+ return $classlist;
}
sub build_search_response {
@@ -2452,7 +2459,6 @@ sub build_search_response {
}
}
}
- $response .= '
'.&mt("To add as a new user:").'- '.&mt("Enter the proposed username in the 'Search for' box").'
- '.&mt("Set 'Make new user if no match found' to Yes").'
- '.&mt("Click 'Search'").'
'.&mt("Note: you can only create new users in the domain of your current role - [_1]",$env{'request.role.domain'}).'
';
}
}
}
@@ -2463,7 +2469,7 @@ sub crumb_utilities {
my %elements = (
crtuser => {
srchterm => 'text',
- srchin => 'selectbox',
+ srchin => 'radio',
srchby => 'selectbox',
srchtype => 'selectbox',
srchdomain => 'selectbox',
@@ -2548,10 +2554,10 @@ sub course_level_table {
$table .= '  | ';
}
$table .= <
+
$lt{'ssd'} |
-
+ |
$lt{'sed'} |
ENDTIMEENTRY
@@ -2584,10 +2590,10 @@ ENDTIMEENTRY
'name="sec_'.$customrole.'" />';
}
$table .= <
+
$lt{'ssd'} |
-
+ |
$lt{'sed'} |
ENDENTRY
@@ -2679,10 +2685,10 @@ sub course_level_dc {
''.
'';
$otheritems .= <
+
$lt{'ssd'} |
-
+ |
$lt{'sed'} |
ENDTIMEENTRY