version 1.171, 2007/08/14 16:53:15
|
version 1.178, 2007/08/26 15:31:03
|
Line 216 sub print_username_entry_form {
|
Line 216 sub print_username_entry_form {
|
$jscript,{'add_entries' => \%loaditems,}); |
$jscript,{'add_entries' => \%loaditems,}); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:backPage(document.crtuser)", |
({href=>"javascript:backPage(document.crtuser)", |
text=>"User modify/custom role", |
text=>"User modify/custom role edit", |
faq=>282,bug=>'Instructor Interface',}); |
faq=>282,bug=>'Instructor Interface',}); |
|
|
my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management'); |
my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management'); |
Line 329 $jsback
|
Line 329 $jsback
|
ENDSCRIPT |
ENDSCRIPT |
|
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'srch' => "User Search to add/modify roles of", |
'srch' => "User Search to add/modify roles", |
'username' => "username", |
'username' => "username", |
'domain' => "domain", |
'domain' => "domain", |
'lastname' => "last name", |
'lastname' => "last name", |
Line 347 ENDSCRIPT
|
Line 347 ENDSCRIPT
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management')); |
$r->print("<b>$lt{'srch'}</b><br />"); |
$r->print("<b>$lt{'srch'}</b><br />"); |
$r->print(&entry_form($srch->{'srchdomain'},$srch)); |
$r->print(&entry_form($srch->{'srchdomain'},$srch)); |
$r->print('<h3>'.&mt('Select a user to add/modify roles of').'</h3>'); |
$r->print('<h3>'.&mt('Select a user to add/modify roles').'</h3>'); |
$r->print('<form name="usersrchform" method="post">'. |
$r->print('<form name="usersrchform" method="post">'. |
&Apache::loncommon::start_data_table()."\n". |
&Apache::loncommon::start_data_table()."\n". |
&Apache::loncommon::start_data_table_header_row()."\n". |
&Apache::loncommon::start_data_table_header_row()."\n". |
Line 783 ENDCHANGEUSER
|
Line 783 ENDCHANGEUSER
|
'<th>'.$lt{'fn'}.'</th><th>'.$lt{'mn'}.'</th><th>'.$lt{'ln'}.'</th><th>'.$lt{'gen'}.'</th><th>'.$lt{'email'}.'</th>'. |
'<th>'.$lt{'fn'}.'</th><th>'.$lt{'mn'}.'</th><th>'.$lt{'ln'}.'</th><th>'.$lt{'gen'}.'</th><th>'.$lt{'email'}.'</th>'. |
&Apache::loncommon::end_data_table_header_row(). |
&Apache::loncommon::end_data_table_header_row(). |
&Apache::loncommon::start_data_table_row()); |
&Apache::loncommon::start_data_table_row()); |
foreach my $item ('firstname','middlename','lastname','generation','permenanentemail') { |
foreach my $item ('firstname','middlename','lastname','generation','permanentemail') { |
if (&Apache::lonnet::allowed('mau',$ccdomain)) { |
if (&Apache::lonnet::allowed('mau',$ccdomain)) { |
$r->print(<<"END"); |
$r->print(<<"END"); |
<td><input type="text" name="c$item" value="$userenv{$item}" size="15" /></td> |
<td><input type="text" name="c$item" value="$userenv{$item}" size="15" /></td> |
Line 1446 sub update_user_data {
|
Line 1446 sub update_user_data {
|
$changeHash{'middlename'} = $env{'form.cmiddlename'}; |
$changeHash{'middlename'} = $env{'form.cmiddlename'}; |
$changeHash{'lastname'} = $env{'form.clastname'}; |
$changeHash{'lastname'} = $env{'form.clastname'}; |
$changeHash{'generation'} = $env{'form.cgeneration'}; |
$changeHash{'generation'} = $env{'form.cgeneration'}; |
$changeHash{'permanentemail'} = $env{'form.permanentemail'}; |
$changeHash{'permanentemail'} = $env{'form.cpermanentemail'}; |
my $putresult = &Apache::lonnet::put |
my $putresult = &Apache::lonnet::put |
('environment',\%changeHash, |
('environment',\%changeHash, |
$env{'form.ccdomain'},$env{'form.ccuname'}); |
$env{'form.ccdomain'},$env{'form.ccuname'}); |
Line 1471 sub update_user_data {
|
Line 1471 sub update_user_data {
|
<th>$lt{'mddl'}</th> |
<th>$lt{'mddl'}</th> |
<th>$lt{'lst'}</th> |
<th>$lt{'lst'}</th> |
<th>$lt{'gen'}</th> |
<th>$lt{'gen'}</th> |
<th>$lt{'disk'}<th></tr> |
<th>$lt{'mail'}</th> |
|
<th>$lt{'disk'}</th></tr> |
<tr><td>$lt{'prvs'}</td> |
<tr><td>$lt{'prvs'}</td> |
<td>$userenv{'firstname'} </td> |
<td>$userenv{'firstname'} </td> |
<td>$userenv{'middlename'} </td> |
<td>$userenv{'middlename'} </td> |
Line 2193 sub user_search_result {
|
Line 2194 sub user_search_result {
|
my %inst_matches; |
my %inst_matches; |
my %srch_results; |
my %srch_results; |
my ($response,$state,$forcenewuser); |
my ($response,$state,$forcenewuser); |
|
$srch->{'srchterm'} =~ s/^\s+//; |
|
$srch->{'srchterm'} =~ s/\s+$//; |
|
|
if ($srch->{'srchby'} !~ /^(uname|lastname|lastfirst)$/) { |
if ($srch->{'srchby'} !~ /^(uname|lastname|lastfirst)$/) { |
$response = &mt('Invalid search.'); |
$response = &mt('Invalid search.'); |
} |
} |
if ($srch->{'srchin'} !~ /^(crs|dom|alc|instd)$/) { |
if ($srch->{'srchin'} !~ /^(crs|dom|alc|instd)$/) { |
$response = &mt('Invalid search.'); |
$response = &mt('Invalid search.'); |
} |
} |
if ($srch->{'srchtype'} !~ /^(exact|contains)$/) { |
if ($srch->{'srchtype'} !~ /^(exact|contains|begins)$/) { |
$response = &mt('Invalid search.'); |
$response = &mt('Invalid search.'); |
} |
} |
if ($srch->{'srchterm'} eq '') { |
if ($srch->{'srchterm'} eq '') { |
Line 2214 sub user_search_result {
|
Line 2217 sub user_search_result {
|
} |
} |
if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') || |
if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') || |
($srch->{'srchin'} eq 'alc')) { |
($srch->{'srchin'} eq 'alc')) { |
if ($srch->{'srchterm'} !~ /^$match_username$/) { |
if ($srch->{'srchby'} eq 'uname') { |
$response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'); |
if ($srch->{'srchterm'} !~ /^$match_username$/) { |
|
$response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'); |
|
} |
} |
} |
} |
} |
if ($srch->{'srchin'} eq 'instd') { |
if ($srch->{'srchin'} eq 'instd') { |
Line 2269 sub user_search_result {
|
Line 2274 sub user_search_result {
|
foreach my $user (keys(%$courseusers)) { |
foreach my $user (keys(%$courseusers)) { |
my ($cuname,$cudomain) = split(/:/,$user); |
my ($cuname,$cudomain) = split(/:/,$user); |
if ($cudomain eq $srch->{'srchdomain'}) { |
if ($cudomain eq $srch->{'srchdomain'}) { |
if ($cuname =~ /\Q$srch->{'srchterm'}\E/i) { |
my $matched = 0; |
|
if ($srch->{'srchtype'} eq 'begins') { |
|
if ($cuname =~ /^\Q$srch->{'srchterm'}\E/i) { |
|
$matched = 1; |
|
} |
|
} else { |
|
if ($cuname =~ /\Q$srch->{'srchterm'}\E/i) { |
|
$matched = 1; |
|
} |
|
} |
|
if ($matched) { |
$srch_results{$user} = |
$srch_results{$user} = |
{&Apache::lonnet::get('environment', |
{&Apache::lonnet::get('environment', |
['firstname', |
['firstname', |
Line 2304 sub user_search_result {
|
Line 2319 sub user_search_result {
|
if ($srch->{'srchby'} eq 'lastname') { |
if ($srch->{'srchby'} eq 'lastname') { |
if ((($srch->{'srchtype'} eq 'exact') && |
if ((($srch->{'srchtype'} eq 'exact') && |
($names{'lastname'} eq $srch->{'srchterm'})) || |
($names{'lastname'} eq $srch->{'srchterm'})) || |
|
(($srch->{'srchtype'} eq 'begins') && |
|
($names{'lastname'} =~ /^\Q$srch->{'srchterm'}\E/i)) || |
(($srch->{'srchtype'} eq 'contains') && |
(($srch->{'srchtype'} eq 'contains') && |
($names{'lastname'} =~ /\Q$srch->{'srchterm'}\E/i))) { |
($names{'lastname'} =~ /\Q$srch->{'srchterm'}\E/i))) { |
$srch_results{$user} = {firstname => $names{'firstname'}, |
$srch_results{$user} = {firstname => $names{'firstname'}, |
Line 2313 sub user_search_result {
|
Line 2330 sub user_search_result {
|
} |
} |
} elsif ($srch->{'srchby'} eq 'lastfirst') { |
} elsif ($srch->{'srchby'} eq 'lastfirst') { |
my ($srchlast,$srchfirst) = split(/,/,$srch->{'srchterm'}); |
my ($srchlast,$srchfirst) = split(/,/,$srch->{'srchterm'}); |
|
$srchlast =~ s/\s+$//; |
|
$srchfirst =~ s/^\s+//; |
if ($srch->{'srchtype'} eq 'exact') { |
if ($srch->{'srchtype'} eq 'exact') { |
if (($names{'lastname'} eq $srchlast) && |
if (($names{'lastname'} eq $srchlast) && |
($names{'firstname'} eq $srchfirst)) { |
($names{'firstname'} eq $srchfirst)) { |
Line 2322 sub user_search_result {
|
Line 2341 sub user_search_result {
|
|
|
}; |
}; |
} |
} |
} elsif ($srch->{'srchtype'} eq 'contains') { |
} elsif ($srch->{'srchtype'} eq 'begins') { |
|
if (($names{'lastname'} =~ /^\Q$srchlast\E/i) && |
|
($names{'firstname'} =~ /^\Q$srchfirst\E/i)) { |
|
$srch_results{$user} = {firstname => $names{'firstname'}, |
|
lastname => $names{'lastname'}, |
|
permanentemail => $emails{'permanentemail'}, |
|
}; |
|
} |
|
} else { |
if (($names{'lastname'} =~ /\Q$srchlast\E/i) && |
if (($names{'lastname'} =~ /\Q$srchlast\E/i) && |
($names{'firstname'} =~ /\Q$srchfirst\E/i)) { |
($names{'firstname'} =~ /\Q$srchfirst\E/i)) { |
$srch_results{$user} = {firstname => $names{'firstname'}, |
$srch_results{$user} = {firstname => $names{'firstname'}, |
Line 2391 sub directorysrch_check {
|
Line 2418 sub directorysrch_check {
|
uname => 'username', |
uname => 'username', |
lastfirst => 'last name, first name', |
lastfirst => 'last name, first name', |
lastname => 'last name', |
lastname => 'last name', |
contains => 'is contained in', |
contains => 'contains', |
exact => 'as exact match to' |
exact => 'as exact match to', |
|
begins => 'begins with', |
); |
); |
if ($can_search) { |
if ($can_search) { |
if (ref($dom_inst_srch{'directorysrch'}{'searchby'}) eq 'ARRAY') { |
if (ref($dom_inst_srch{'directorysrch'}{'searchby'}) eq 'ARRAY') { |
if (!grep(/^\Q$srch->{'srchby'}\E$/,@{$dom_inst_srch{'directorysrch'}{'searchby'}})) { |
if (!grep(/^\Q$srch->{'srchby'}\E$/,@{$dom_inst_srch{'directorysrch'}{'searchby'}})) { |
return &mt('Directory search in domain: [_1] is not available for searching by [_2]',$srch->{'srchdomain'},$longtext{$srch->{'srchby'}}); |
return &mt('Directory search in domain: [_1] is not available for searching by "[_2]"',$srch->{'srchdomain'},$longtext{$srch->{'srchby'}}); |
} |
} |
} else { |
} else { |
return &mt('Directory search in domain: [_1] is not available.', $srch->{'srchdomain'}); |
return &mt('Directory search in domain: [_1] is not available.', $srch->{'srchdomain'}); |
} |
} |
} |
} |
if ($can_search) { |
if ($can_search) { |
if (($dom_inst_srch{'directorysrch'}{'searchtypes'} eq 'specify') || |
if (ref($dom_inst_srch{'directorysrch'}{'searchtypes'}) eq 'ARRAY') { |
($dom_inst_srch{'directorysrch'}{'searchtypes'} eq $srch->{'srchtype'})) { |
if (grep(/^\Q$srch->{'srchtype'}\E/,@{$dom_inst_srch{'directorysrch'}{'searchtypes'}})) { |
return 'ok'; |
return 'ok'; |
} else { |
} else { |
return &mt('Directory search in domain [_1] is not available for the requested search type: [_2]',$srch->{'srchdomain'},$longtext{$srch->{'srchtype'}}); |
return &mt('Directory search in domain [_1] is not available for the requested search type: "[_2]"',$srch->{'srchdomain'},$longtext{$srch->{'srchtype'}}); |
|
} |
|
} else { |
|
if ((($dom_inst_srch{'directorysrch'}{'searchtypes'} eq 'specify') && |
|
($srch->{'srchtype'} eq 'exact' || $srch->{'srchtype'} eq 'contains')) || |
|
($dom_inst_srch{'directorysrch'}{'searchtypes'} eq $srch->{'srchtype'})) { |
|
return 'ok'; |
|
} else { |
|
return &mt('Directory search in domain [_1] is not available for the requested search type: "[_2]"',$srch->{'srchdomain'},$longtext{$srch->{'srchtype'}}); |
|
} |
} |
} |
} |
} |
} |
} |
Line 2487 sub crumb_utilities {
|
Line 2524 sub crumb_utilities {
|
my %elements = ( |
my %elements = ( |
crtuser => { |
crtuser => { |
srchterm => 'text', |
srchterm => 'text', |
srchin => 'radio', |
srchin => 'selectbox', |
srchby => 'selectbox', |
srchby => 'selectbox', |
srchtype => 'selectbox', |
srchtype => 'selectbox', |
srchdomain => 'selectbox', |
srchdomain => 'selectbox', |