version 1.295.2.10, 2009/08/23 13:09:54
|
version 1.295.2.16, 2010/01/03 03:14:45
|
Line 110 sub initialize_authen_forms {
|
Line 110 sub initialize_authen_forms {
|
|
|
sub auth_abbrev { |
sub auth_abbrev { |
my %abv_auth = ( |
my %abv_auth = ( |
|
krb5 => 'krb', |
krb4 => 'krb', |
krb4 => 'krb', |
internal => 'int', |
internal => 'int', |
localuth => 'loc', |
localuth => 'loc', |
Line 228 sub build_tools_display {
|
Line 229 sub build_tools_display {
|
'usde' => "Use default", |
'usde' => "Use default", |
'uscu' => "Use custom", |
'uscu' => "Use custom", |
'official' => 'Can request creation of official courses', |
'official' => 'Can request creation of official courses', |
'unofficial' => 'Can request creation of unofficial courses', |
'unofficial' => 'Can request creation of unofficial courses', |
); |
); |
if ($context eq 'requestcourses') { |
if ($context eq 'requestcourses') { |
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, |
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, |
Line 291 sub build_tools_display {
|
Line 292 sub build_tools_display {
|
} |
} |
if ($curroption =~ /^autolimit=(\d*)$/) { |
if ($curroption =~ /^autolimit=(\d*)$/) { |
$currlimit = $1; |
$currlimit = $1; |
$currdisp = &mt('Yes, up to [quant,_1,request]/user',$currlimit); |
if ($currlimit eq '') { |
|
$currdisp = &mt('Yes, automatic creation'); |
|
} else { |
|
$currdisp = &mt('Yes, up to [quant,_1,request]/user',$currlimit); |
|
} |
} else { |
} else { |
$currdisp = $reqdisplay{$curroption}; |
$currdisp = $reqdisplay{$curroption}; |
} |
} |
Line 325 sub build_tools_display {
|
Line 330 sub build_tools_display {
|
if ($option eq 'autolimit') { |
if ($option eq 'autolimit') { |
$custdisp .= '<input type="text" name="crsreq_'. |
$custdisp .= '<input type="text" name="crsreq_'. |
$item.'_limit" size="1" '. |
$item.'_limit" size="1" '. |
'value="'.$currlimit.'" />'; |
'value="'.$currlimit.'" /></span><br />'. |
|
$reqtitles{'unlimited'}; |
|
} else { |
|
$custdisp .= '</span>'; |
} |
} |
$custdisp .= '</span></td></tr>'; |
$custdisp .= '</td></tr>'; |
} |
} |
$custdisp .= '</table>'; |
$custdisp .= '</table>'; |
$custradio = '</span></td><td>'.&mt('Custom setting').'<br />'.$custdisp; |
$custradio = '</span></td><td>'.&mt('Custom setting').'<br />'.$custdisp; |
Line 377 sub coursereq_externaluser {
|
Line 385 sub coursereq_externaluser {
|
my ($curroption,$currlimit,$tooloff); |
my ($curroption,$currlimit,$tooloff); |
if ($userenv{'reqcrsotherdom.'.$item} ne '') { |
if ($userenv{'reqcrsotherdom.'.$item} ne '') { |
my @curr = split(',',$userenv{'reqcrsotherdom.'.$item}); |
my @curr = split(',',$userenv{'reqcrsotherdom.'.$item}); |
if (grep(/^\Q$cdom\E:($optregex)=?(\d*)$/,@curr)) { |
foreach my $req (@curr) { |
$curroption = $1; |
if ($req =~ /^\Q$cdom\E\:($optregex)=?(\d*)$/) { |
$currlimit = $2; |
$curroption = $1; |
if (!$curroption) { |
$currlimit = $2; |
$curroption = 'norequest'; |
last; |
} |
} |
} |
} |
|
if (!$curroption) { |
|
$curroption = 'norequest'; |
|
$tooloff = ' checked="checked"'; |
|
} |
} else { |
} else { |
$curroption = 'norequest'; |
$curroption = 'norequest'; |
$tooloff = ' checked="checked"'; |
$tooloff = ' checked="checked"'; |
} |
} |
$output.= &Apache::loncommon::start_data_table_row()."\n". |
$output.= &Apache::loncommon::start_data_table_row()."\n". |
' <td><span class="LC_nobreak">'.$lt{$item}.': '. |
' <td><span class="LC_nobreak">'.$lt{$item}.': </span></td><td>'. |
|
'<table><tr><td valign="top">'."\n". |
'<label><input type="radio" name="reqcrsotherdom_'.$item. |
'<label><input type="radio" name="reqcrsotherdom_'.$item. |
'" value="0"'.$tooloff.' />'.$reqtitles{'norequest'}. |
'" value=""'.$tooloff.' />'.$reqtitles{'norequest'}. |
'</label> '; |
'</label></td>'; |
foreach my $option (@options) { |
foreach my $option (@options) { |
if ($option eq 'validate') { |
if ($option eq 'validate') { |
my $canvalidate = 0; |
my $canvalidate = 0; |
Line 407 sub coursereq_externaluser {
|
Line 420 sub coursereq_externaluser {
|
if ($option eq $curroption) { |
if ($option eq $curroption) { |
$checked = ' checked="checked"'; |
$checked = ' checked="checked"'; |
} |
} |
$output .= '<span class="LC_nobreak"><label>'. |
$output .= '<td valign="top"><span class="LC_nobreak"><label>'. |
'<input type="radio" name="reqcrsotherdom_'.$item. |
'<input type="radio" name="reqcrsotherdom_'.$item. |
'" value="'.$option.'"'.$checked.' />'. |
'" value="'.$option.'"'.$checked.' />'. |
$reqtitles{$option}.'</label> '; |
$reqtitles{$option}.'</label>'; |
if ($option eq 'autolimit') { |
if ($option eq 'autolimit') { |
$output .= '<input type="text" name="reqcrsotherdom_'. |
$output .= ' <input type="text" name="reqcrsotherdom_'. |
$item.'_limit" size="1" '. |
$item.'_limit" size="1" '. |
'value="'.$currlimit.'" />'; |
'value="'.$currlimit.'" /></span>'. |
|
'<br />'.$reqtitles{'unlimited'}; |
|
} else { |
|
$output .= '</span>'; |
} |
} |
$output .= ' ' |
$output .= '</td>'; |
} |
} |
$output .= '</span></td>'."\n". |
$output .= '</td></tr></table></td>'."\n". |
&Apache::loncommon::end_data_table_row()."\n"; |
&Apache::loncommon::end_data_table_row()."\n"; |
} |
} |
return $output; |
return $output; |
Line 433 sub courserequest_titles {
|
Line 449 sub courserequest_titles {
|
approval => 'Approval by Dom. Coord.', |
approval => 'Approval by Dom. Coord.', |
validate => 'With validation', |
validate => 'With validation', |
autolimit => 'Numerical limit', |
autolimit => 'Numerical limit', |
|
unlimited => '(blank for unlimited)', |
); |
); |
return %titles; |
return %titles; |
} |
} |
|
|
sub courserequest_display { |
sub courserequest_display { |
my %titles = &Apache::lonlocal::texthash ( |
my %titles = &Apache::lonlocal::texthash ( |
approval => 'Yes, need approval', |
approval => 'Yes, need approval', |
validate => 'Yes, with validation', |
validate => 'Yes, with validation', |
norequest => 'No', |
norequest => 'No', |
); |
); |
return %titles; |
return %titles; |
} |
} |
|
|
Line 708 ENDSCRIPT
|
Line 725 ENDSCRIPT
|
faq=>282,bug=>'Instructor Interface',}); |
faq=>282,bug=>'Instructor Interface',}); |
if ($env{'form.action'} eq 'singleuser') { |
if ($env{'form.action'} eq 'singleuser') { |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management', |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management', |
'Course_Change_Privileges')); |
'Course_Change_Privileges')); |
$r->print("<b>$lt{'usrch'}</b><br />"); |
$r->print("<b>$lt{'usrch'}</b><br />"); |
$r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context)); |
$r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context)); |
$r->print('<h3>'.$lt{'usel'}.'</h3>'); |
$r->print('<h3>'.$lt{'usel'}.'</h3>'); |
} elsif ($env{'form.action'} eq 'singlestudent') { |
} elsif ($env{'form.action'} eq 'singlestudent') { |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management', |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management', |
'Course_Add_Student')); |
'Course_Add_Student')); |
$r->print($jscript."<b>$lt{'stusrch'}</b><br />"); |
$r->print($jscript."<b>$lt{'stusrch'}</b><br />"); |
$r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context)); |
$r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context)); |
$r->print('</form><h3>'.$lt{'stusel'}.'</h3>'); |
$r->print('</form><h3>'.$lt{'stusel'}.'</h3>'); |
Line 1411 sub display_existing_roles {
|
Line 1428 sub display_existing_roles {
|
} |
} |
$row.= '</td><td>'.$plaintext. |
$row.= '</td><td>'.$plaintext. |
'</td><td>'.$area. |
'</td><td>'.$area. |
'</td><td>'.($role_start_time?localtime($role_start_time) |
'</td><td>'.($role_start_time?&Apache::lonlocal::locallocaltime($role_start_time) |
: ' ' ). |
: ' ' ). |
'</td><td>'.($role_end_time ?localtime($role_end_time) |
'</td><td>'.($role_end_time ?&Apache::lonlocal::locallocaltime($role_end_time) |
: ' ' ) |
: ' ' ) |
."</td>"; |
."</td>"; |
$sortrole{$sortkey}=$envkey; |
$sortrole{$sortkey}=$envkey; |
Line 1556 sub new_domain_roles {
|
Line 1573 sub new_domain_roles {
|
&mt('Extent').'</th>'. |
&mt('Extent').'</th>'. |
'<th>'.&mt('Start').'</th><th>'.&mt('End').'</th>'. |
'<th>'.&mt('Start').'</th><th>'.&mt('End').'</th>'. |
&Apache::loncommon::end_data_table_header_row(); |
&Apache::loncommon::end_data_table_header_row(); |
|
my @allroles = &Apache::lonuserutils::roles_by_context('domain'); |
foreach my $thisdomain (sort(&Apache::lonnet::all_domains())) { |
foreach my $thisdomain (sort(&Apache::lonnet::all_domains())) { |
foreach my $role ('dc','li','dg','au','sc') { |
foreach my $role (@allroles) { |
|
next if ($role eq 'ad'); |
if (&Apache::lonnet::allowed('c'.$role,$thisdomain)) { |
if (&Apache::lonnet::allowed('c'.$role,$thisdomain)) { |
my $plrole=&Apache::lonnet::plaintext($role); |
my $plrole=&Apache::lonnet::plaintext($role); |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
Line 2443 sub update_user_data {
|
Line 2462 sub update_user_data {
|
} |
} |
&tool_changes('tools',\@usertools,\%oldaccess,\%oldaccesstext,\%userenv, |
&tool_changes('tools',\@usertools,\%oldaccess,\%oldaccesstext,\%userenv, |
\%changeHash,\%changed,\%newaccess,\%newaccesstext); |
\%changeHash,\%changed,\%newaccess,\%newaccesstext); |
|
|
if ($env{'form.ccdomain'} eq $env{'request.role.domain'}) { |
if ($env{'form.ccdomain'} eq $env{'request.role.domain'}) { |
&tool_changes('requestcourses',\@requestcourses,\%oldaccess,\%oldaccesstext, |
&tool_changes('requestcourses',\@requestcourses,\%oldaccess,\%oldaccesstext, |
\%userenv,\%changeHash,\%changed,\%newaccess,\%newaccesstext); |
\%userenv,\%changeHash,\%changed,\%newaccess,\%newaccesstext); |
Line 2480 sub update_user_data {
|
Line 2498 sub update_user_data {
|
$newenvhash{'environment.requestcourses.'.$key} = |
$newenvhash{'environment.requestcourses.'.$key} = |
$changeHash{'requestcourses.'.$key}; |
$changeHash{'requestcourses.'.$key}; |
if ($changeHash{'requestcourses.'.$key} ne '') { |
if ($changeHash{'requestcourses.'.$key} ne '') { |
$newenvhash{'environment.canrequest.'.$key} = |
$newenvhash{'environment.canrequest.'.$key} = 1; |
$changeHash{'requestcourses.'.$key}; |
|
} else { |
} else { |
$newenvhash{'environment.canrequest.'.$key} = |
$newenvhash{'environment.canrequest.'.$key} = |
&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'}, |
&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'}, |
Line 2690 END
|
Line 2707 END
|
'aboutme' => "Personal Information Page Availability", |
'aboutme' => "Personal Information Page Availability", |
'portfolio' => "Portfolio Availability", |
'portfolio' => "Portfolio Availability", |
'official' => "Can Request Official Courses", |
'official' => "Can Request Official Courses", |
'unofficial' => "Can Request Unofficial Course", |
'unofficial' => "Can Request Unofficial Courses", |
'inststatus' => "Affiliation", |
'inststatus' => "Affiliation", |
); |
); |
$r->print(<<"END"); |
$r->print(<<"END"); |
Line 2810 sub tool_changes {
|
Line 2827 sub tool_changes {
|
my %reqdisplay = &courserequest_display(); |
my %reqdisplay = &courserequest_display(); |
my $cdom = $env{'request.role.domain'}; |
my $cdom = $env{'request.role.domain'}; |
foreach my $tool (@{$usertools}) { |
foreach my $tool (@{$usertools}) { |
$oldaccesstext->{$tool} = &mt('no'); |
$oldaccesstext->{$tool} = &mt('No'); |
|
$newaccesstext->{$tool} = $oldaccesstext->{$tool}; |
$changeHash->{$context.'.'.$tool} = $userenv->{$context.'.'.$tool}; |
$changeHash->{$context.'.'.$tool} = $userenv->{$context.'.'.$tool}; |
|
my $newop; |
|
if ($env{'form.'.$context.'_'.$tool}) { |
|
$newop = $env{'form.'.$context.'_'.$tool}; |
|
if ($newop eq 'autolimit') { |
|
my $limit = $env{'form.'.$context.'_'.$tool.'_limit'}; |
|
$limit =~ s/\D+//g; |
|
$newop .= '='.$limit; |
|
} |
|
} |
if ($userenv->{$context.'.'.$tool} eq '') { |
if ($userenv->{$context.'.'.$tool} eq '') { |
if ($env{'form.'.$context.'_'.$tool}) { |
if ($newop) { |
$changed->{$tool}=&tool_admin($tool,$cdom, |
$changed->{$tool}=&tool_admin($tool,$cdom.':'.$newop, |
$changeHash,$context); |
$changeHash,$context); |
if ($changed->{$tool}) { |
if ($changed->{$tool}) { |
$newaccesstext->{$tool} = &mt('yes'); |
$newaccesstext->{$tool} = &mt('Yes'); |
} else { |
} else { |
$newaccesstext->{$tool} = $oldaccesstext->{$tool}; } |
$newaccesstext->{$tool} = $oldaccesstext->{$tool}; |
|
} |
} |
} |
} else { |
} else { |
my @curr = split(',',$userenv->{$context.'.'.$tool}); |
my @curr = split(',',$userenv->{$context.'.'.$tool}); |
my @new; |
my @new; |
my $changedoms; |
my $changedoms; |
my $newop = $env{'form.'.$context.'_'.$tool}; |
foreach my $req (@curr) { |
if ($newop eq 'autolimit') { |
if ($req =~ /^\Q$cdom\E\:($optregex\=?\d*)$/) { |
$newop .= '='; |
$oldaccesstext->{$tool} = &mt('Yes'); |
unless ($env{'form.'.$context.'_'.$tool.'_limit'} =~ /\D/) { |
my $oldop = $1; |
$newop .= $env{'form.'.$context.'_'.$tool.'_limit'}; |
if ($oldop ne $newop) { |
} |
$changedoms = 1; |
} |
foreach my $item (@curr) { |
if (grep(/^\Q$cdom:($optregex\=?\d*)\E$/,@curr)) { |
my ($reqdom,$option) = split(':',$item); |
$oldaccesstext->{$tool} = &mt('yes'); |
unless ($reqdom eq $cdom) { |
my $oldop = $1; |
push(@new,$item); |
if ($oldop ne $newop) { |
} |
$changedoms = 1; |
|
foreach my $dom (@curr) { |
|
unless ($dom eq $cdom) { |
|
push(@new,$dom); |
|
} |
} |
|
if ($newop) { |
|
push(@new,$cdom.':'.$newop); |
|
} |
|
@new = sort(@new); |
} |
} |
if ($newop) { |
last; |
push(@new,$cdom.':'.$newop); |
|
} |
|
@new = sort(@new); |
|
} |
} |
} elsif ($env{'form.'.$context.'_'.$tool}) { |
} |
|
if ((!$changedoms) && ($newop)) { |
$changedoms = 1; |
$changedoms = 1; |
@new = sort(@curr,$cdom.':'.$newop); |
@new = sort(@curr,$cdom.':'.$newop); |
} |
} |
$newaccesstext->{$tool} = $oldaccesstext->{$tool}; |
|
if ($changedoms) { |
if ($changedoms) { |
my $newdomstr; |
my $newdomstr; |
if (@new) { |
if (@new) { |
Line 2862 sub tool_changes {
|
Line 2887 sub tool_changes {
|
if ($changed->{$tool}) { |
if ($changed->{$tool}) { |
if ($env{'form.'.$context.'_'.$tool}) { |
if ($env{'form.'.$context.'_'.$tool}) { |
if ($env{'form.'.$context.'_'.$tool} eq 'autolimit') { |
if ($env{'form.'.$context.'_'.$tool} eq 'autolimit') { |
if ($env{'form.'.$context.'_'.$tool.'_limit'} =~ /\D/) { |
my $limit = $env{'form.'.$context.'_'.$tool.'_limit'}; |
$newaccesstext->{$tool} = &mt('Yes, processed automatically'); |
$limit =~ s/\D+//g; |
|
if ($limit) { |
|
$newaccesstext->{$tool} = &mt('Yes, up to limit of [quant,_1,request] per user.',$limit); |
} else { |
} else { |
$newaccesstext->{$tool} = &mt('Yes, up to limit of [quant,_1,request] per user).',$env{'form.'.$context.'_'.$tool.'_limit'}); |
$newaccesstext->{$tool} = &mt('Yes, processed automatically'); |
} |
} |
} else { |
} else { |
$newaccesstext->{$tool} = $reqdisplay{$env{'form.'.$context.'_'.$tool}}; |
$newaccesstext->{$tool} = $reqdisplay{$env{'form.'.$context.'_'.$tool}}; |
Line 5045 sub rolechg_contexts {
|
Line 5072 sub rolechg_contexts {
|
createcourse => 'Course Creation', |
createcourse => 'Course Creation', |
course => 'User Management in course', |
course => 'User Management in course', |
domain => 'User Management in domain', |
domain => 'User Management in domain', |
selfenroll => 'Self-enrolled', |
selfenroll => 'Self-enrolled', |
|
requestcourses => 'Course Request', |
); |
); |
return %lt; |
return %lt; |
} |
} |
Line 5130 sub user_search_result {
|
Line 5158 sub user_search_result {
|
&build_search_response($context,$srch,%srch_results); |
&build_search_response($context,$srch,%srch_results); |
} else { |
} else { |
$currstate = 'modify'; |
$currstate = 'modify'; |
|
my $uname = $srch->{'srchterm'}; |
|
my $udom = $srch->{'srchdomain'}; |
|
$srch_results{$uname.':'.$udom} = |
|
{ &Apache::lonnet::get('environment', |
|
['firstname', |
|
'lastname', |
|
'permanentemail'], |
|
$udom,$uname) |
|
}; |
} |
} |
} else { |
} else { |
%srch_results = &Apache::lonnet::usersearch($srch); |
%srch_results = &Apache::lonnet::usersearch($srch); |