version 1.160.6.84.4.2, 2017/08/16 01:26:24
|
version 1.160.6.85, 2017/10/15 17:15:18
|
Line 265 sub handler {
|
Line 265 sub handler {
|
{col1 => 'Internal Authentication', |
{col1 => 'Internal Authentication', |
col2 => 'Value'}, |
col2 => 'Value'}, |
{col1 => 'Institutional user types', |
{col1 => 'Institutional user types', |
col2 => 'Name displayed'}], |
col2 => 'Assignable to e-mail usernames'}], |
print => \&print_defaults, |
print => \&print_defaults, |
modify => \&modify_defaults, |
modify => \&modify_defaults, |
}, |
}, |
Line 347 sub handler {
|
Line 347 sub handler {
|
col2 => 'Enabled?'}, |
col2 => 'Enabled?'}, |
{col1 => 'Institutional user type (login/SSO self-creation)', |
{col1 => 'Institutional user type (login/SSO self-creation)', |
col2 => 'Information user can enter'}, |
col2 => 'Information user can enter'}, |
{col1 => 'Self-creation with e-mail verification', |
{col1 => 'Self-creation with e-mail as username', |
col2 => 'Settings'}], |
col2 => 'Settings'}], |
print => \&print_selfcreation, |
print => \&print_selfcreation, |
modify => \&modify_selfcreation, |
modify => \&modify_selfcreation, |
Line 528 $javascript_validations
|
Line 528 $javascript_validations
|
$coursebrowserjs |
$coursebrowserjs |
END |
END |
} |
} |
if (grep(/^selfcreation$/,@actions)) { |
|
$js .= &selfcreate_javascript(); |
|
} |
|
if (grep(/^contacts$/,@actions)) { |
if (grep(/^contacts$/,@actions)) { |
$js .= &contacts_javascript(); |
$js .= &contacts_javascript(); |
} |
} |
Line 627 sub process_changes {
|
Line 624 sub process_changes {
|
} elsif ($action eq 'usercreation') { |
} elsif ($action eq 'usercreation') { |
$output = &modify_usercreation($dom,%domconfig); |
$output = &modify_usercreation($dom,%domconfig); |
} elsif ($action eq 'selfcreation') { |
} elsif ($action eq 'selfcreation') { |
$output = &modify_selfcreation($dom,$lastactref,%domconfig); |
$output = &modify_selfcreation($dom,%domconfig); |
} elsif ($action eq 'usermodification') { |
} elsif ($action eq 'usermodification') { |
$output = &modify_usermodification($dom,%domconfig); |
$output = &modify_usermodification($dom,%domconfig); |
} elsif ($action eq 'contacts') { |
} elsif ($action eq 'contacts') { |
Line 2150 sub print_quotas {
|
Line 2147 sub print_quotas {
|
} |
} |
|
|
sub print_requestmail { |
sub print_requestmail { |
my ($dom,$action,$settings,$rowtotal,$customcss,$rowstyle) = @_; |
my ($dom,$action,$settings,$rowtotal) = @_; |
my ($now,$datatable,%currapp); |
my ($now,$datatable,%currapp); |
$now = time; |
$now = time; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
Line 2162 sub print_requestmail {
|
Line 2159 sub print_requestmail {
|
} |
} |
my $numinrow = 2; |
my $numinrow = 2; |
my $css_class; |
my $css_class; |
if ($$rowtotal%2) { |
$css_class = ($$rowtotal%2? ' class="LC_odd_row"':''); |
$css_class = 'LC_odd_row'; |
|
} |
|
if ($customcss) { |
|
$css_class .= " $customcss"; |
|
} |
|
$css_class =~ s/^\s+//; |
|
if ($css_class) { |
|
$css_class = ' class="'.$css_class.'"'; |
|
} |
|
if ($rowstyle) { |
|
$css_class .= ' style="'.$rowstyle.'"'; |
|
} |
|
my $text; |
my $text; |
if ($action eq 'requestcourses') { |
if ($action eq 'requestcourses') { |
$text = &mt('Receive notification of course requests requiring approval'); |
$text = &mt('Receive notification of course requests requiring approval'); |
Line 2580 sub print_autoupdate {
|
Line 2565 sub print_autoupdate {
|
my $locknamesettings; |
my $locknamesettings; |
$datatable .= &insttypes_row($settings,$types,$usertypes, |
$datatable .= &insttypes_row($settings,$types,$usertypes, |
$dom,$numinrow,$othertitle, |
$dom,$numinrow,$othertitle, |
'lockablenames',$rowtotal); |
'lockablenames'); |
$$rowtotal ++; |
$$rowtotal ++; |
} else { |
} else { |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
Line 2723 sub print_directorysrch {
|
Line 2708 sub print_directorysrch {
|
if (ref($usertypes) eq 'HASH') { |
if (ref($usertypes) eq 'HASH') { |
if (keys(%{$usertypes}) > 0) { |
if (keys(%{$usertypes}) > 0) { |
$datatable .= &insttypes_row($settings,$types,$usertypes,$dom, |
$datatable .= &insttypes_row($settings,$types,$usertypes,$dom, |
$numinrow,$othertitle,'cansearch', |
$numinrow,$othertitle,'cansearch'); |
$rowtotal); |
|
$cansrchrow = 1; |
$cansrchrow = 1; |
} |
} |
} |
} |
Line 4646 sub loadbalancing_titles {
|
Line 4630 sub loadbalancing_titles {
|
'_LC_ipchange' => &mt('Non-SSO users with IP mismatch'), |
'_LC_ipchange' => &mt('Non-SSO users with IP mismatch'), |
); |
); |
my @alltypes = ('_LC_adv','_LC_author','_LC_internetdom','_LC_external','_LC_ipchangesso','_LC_ipchange'); |
my @alltypes = ('_LC_adv','_LC_author','_LC_internetdom','_LC_external','_LC_ipchangesso','_LC_ipchange'); |
my @available; |
|
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
@available = @{$types}; |
unshift(@alltypes,@{$types},'default'); |
} |
|
unless (grep(/^default$/,@available)) { |
|
push(@available,'default'); |
|
} |
} |
unshift(@alltypes,@available); |
|
my %titles; |
my %titles; |
foreach my $type (@alltypes) { |
foreach my $type (@alltypes) { |
if ($type =~ /^_LC_/) { |
if ($type =~ /^_LC_/) { |
Line 5006 sub print_usercreation {
|
Line 4985 sub print_usercreation {
|
|
|
sub print_selfcreation { |
sub print_selfcreation { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my (@selfcreate,$createsettings,$processing,$emailoptions,$emailverified, |
my (@selfcreate,$createsettings,$processing,$datatable); |
$emaildomain,$datatable); |
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'cancreate'}) eq 'HASH') { |
if (ref($settings->{'cancreate'}) eq 'HASH') { |
$createsettings = $settings->{'cancreate'}; |
$createsettings = $settings->{'cancreate'}; |
Line 5024 sub print_selfcreation {
|
Line 5002 sub print_selfcreation {
|
if (ref($createsettings->{'selfcreateprocessing'}) eq 'HASH') { |
if (ref($createsettings->{'selfcreateprocessing'}) eq 'HASH') { |
$processing = $createsettings->{'selfcreateprocessing'}; |
$processing = $createsettings->{'selfcreateprocessing'}; |
} |
} |
if (ref($createsettings->{'emailoptions'}) eq 'HASH') { |
|
$emailoptions = $createsettings->{'emailoptions'}; |
|
} |
|
if (ref($createsettings->{'emailverified'}) eq 'HASH') { |
|
$emailverified = $createsettings->{'emailverified'}; |
|
} |
|
if (ref($createsettings->{'emaildomain'}) eq 'HASH') { |
|
$emaildomain = $createsettings->{'emaildomain'}; |
|
} |
|
} |
} |
} |
} |
} |
} |
my %radiohash; |
my %radiohash; |
my $numinrow = 4; |
my $numinrow = 4; |
map { $radiohash{'cancreate_'.$_} = 1; } @selfcreate; |
map { $radiohash{'cancreate_'.$_} = 1; } @selfcreate; |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
if ($position eq 'top') { |
if ($position eq 'top') { |
my %choices = &Apache::lonlocal::texthash ( |
my %choices = &Apache::lonlocal::texthash ( |
cancreate_login => 'Institutional Login', |
cancreate_login => 'Institutional Login', |
Line 5055 sub print_selfcreation {
|
Line 5023 sub print_selfcreation {
|
\%choices,$itemcount,$onclick); |
\%choices,$itemcount,$onclick); |
$$rowtotal += $itemcount; |
$$rowtotal += $itemcount; |
|
|
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
|
if (ref($usertypes) eq 'HASH') { |
if (ref($usertypes) eq 'HASH') { |
if (keys(%{$usertypes}) > 0) { |
if (keys(%{$usertypes}) > 0) { |
$datatable .= &insttypes_row($createsettings,$types,$usertypes, |
$datatable .= &insttypes_row($createsettings,$types,$usertypes, |
$dom,$numinrow,$othertitle, |
$dom,$numinrow,$othertitle, |
'statustocreate',$rowtotal); |
'statustocreate',$$rowtotal); |
$$rowtotal ++; |
$$rowtotal ++; |
} |
} |
} |
} |
Line 5104 sub print_selfcreation {
|
Line 5074 sub print_selfcreation {
|
$$rowtotal ++; |
$$rowtotal ++; |
} elsif ($position eq 'middle') { |
} elsif ($position eq 'middle') { |
my %domconf = &Apache::lonnet::get_dom('configuration',['usermodification'],$dom); |
my %domconf = &Apache::lonnet::get_dom('configuration',['usermodification'],$dom); |
my @posstypes; |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
$usertypes->{'default'} = $othertitle; |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
@posstypes = @{$types}; |
push(@{$types},'default'); |
} |
$usertypes->{'default'} = $othertitle; |
unless (grep(/^default$/,@posstypes)) { |
foreach my $status (@{$types}) { |
push(@posstypes,'default'); |
$datatable .= &modifiable_userdata_row('selfcreate',$status,$domconf{'usermodification'}, |
} |
$numinrow,$$rowtotal,$usertypes); |
my %usertypeshash; |
$$rowtotal ++; |
if (ref($usertypes) eq 'HASH') { |
} |
%usertypeshash = %{$usertypes}; |
|
} |
|
$usertypeshash{'default'} = $othertitle; |
|
foreach my $status (@posstypes) { |
|
$datatable .= &modifiable_userdata_row('selfcreate',$status,$domconf{'usermodification'}, |
|
$numinrow,$$rowtotal,\%usertypeshash); |
|
$$rowtotal ++; |
|
} |
} |
} else { |
} else { |
my %choices = &Apache::lonlocal::texthash ( |
my %choices = &Apache::lonlocal::texthash ( |
'cancreate_email' => 'Non-institutional username (via e-mail verification)', |
cancreate_email => 'E-mail address as username', |
); |
); |
my @toggles = sort(keys(%choices)); |
my @toggles = sort(keys(%choices)); |
my %defaultchecked = ( |
my %defaultchecked = ( |
'cancreate_email' => 'off', |
'cancreate_email' => 'off', |
); |
); |
my $customclass = 'LC_selfcreate_email'; |
my $itemcount = 0; |
my $classprefix = 'LC_canmodify_emailusername_'; |
|
my $optionsprefix = 'LC_options_emailusername_'; |
|
my $display = 'none'; |
my $display = 'none'; |
my $rowstyle = 'display:none'; |
|
if (grep(/^\Qemail\E$/,@selfcreate)) { |
if (grep(/^\Qemail\E$/,@selfcreate)) { |
$display = 'block'; |
$display = 'block'; |
$rowstyle = 'display:table-row'; |
|
} |
} |
my $onclick = "toggleRows(this.form,'cancreate_email','selfassign','$customclass','$classprefix','$optionsprefix');"; |
my $onclick = "toggleDisplay(this.form,'emailoptions');"; |
($datatable,$$rowtotal) = &radiobutton_prefs(\%radiohash,\@toggles,\%defaultchecked, |
my $additional = '<div id="emailoptions" style="display: '.$display.'">'; |
\%choices,$$rowtotal,$onclick); |
|
$datatable .= &print_requestmail($dom,'selfcreation',$createsettings,$rowtotal,$customclass, |
|
$rowstyle); |
|
$$rowtotal ++; |
|
$datatable .= &captcha_choice('cancreate',$createsettings,$$rowtotal,$customclass, |
|
$rowstyle); |
|
$$rowtotal ++; |
|
my (@ordered,@posstypes,%usertypeshash); |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my ($emailrules,$emailruleorder) = |
my $usertypes = {}; |
&Apache::lonnet::inst_userrules($dom,'email'); |
my $order = []; |
my $primary_id = &Apache::lonnet::domain($dom,'primary'); |
if ((ref($domdefaults{'inststatustypes'}) eq 'HASH') && (ref($domdefaults{'inststatusguest'}) eq 'ARRAY')) { |
my $intdom = &Apache::lonnet::internet_dom($primary_id); |
$usertypes = $domdefaults{'inststatustypes'}; |
if (ref($types) eq 'ARRAY') { |
$order = $domdefaults{'inststatusguest'}; |
@posstypes = @{$types}; |
} |
} |
if (ref($order) eq 'ARRAY') { |
if (@posstypes) { |
push(@{$order},'default'); |
unless (grep(/^default$/,@posstypes)) { |
if (@{$order} > 1) { |
push(@posstypes,'default'); |
$usertypes->{'default'} = &mt('Other users'); |
} |
$additional .= '<table><tr>'; |
if (ref($usertypes) eq 'HASH') { |
foreach my $status (@{$order}) { |
%usertypeshash = %{$usertypes}; |
$additional .= '<th>'.$usertypes->{$status}.'</th>'; |
} |
} |
my $currassign; |
$additional .= '</tr><tr>'; |
if (ref($domdefaults{'inststatusguest'}) eq 'ARRAY') { |
foreach my $status (@{$order}) { |
$currassign = { |
$additional .= '<td>'.&email_as_username($rowtotal,$processing,$status).'</td>'; |
selfassign => $domdefaults{'inststatusguest'}, |
|
}; |
|
@ordered = @{$domdefaults{'inststatusguest'}}; |
|
} else { |
|
$currassign = { selfassign => [] }; |
|
} |
|
my $onclicktypes = "toggleDataRow(this.form,'selfassign','$customclass','$optionsprefix',);". |
|
"toggleDataRow(this.form,'selfassign','$customclass','$classprefix',1);"; |
|
$datatable .= &insttypes_row($currassign,$types,$usertypes,$dom, |
|
$numinrow,$othertitle,'selfassign', |
|
$rowtotal,$onclicktypes,$customclass, |
|
$rowstyle); |
|
$$rowtotal ++; |
|
$usertypeshash{'default'} = $othertitle; |
|
foreach my $status (@posstypes) { |
|
my $css_class; |
|
if ($$rowtotal%2) { |
|
$css_class = 'LC_odd_row '; |
|
} |
|
$css_class .= $customclass; |
|
my $rowid = $optionsprefix.$status; |
|
my $hidden = 1; |
|
my $currstyle = 'display:none'; |
|
if (grep(/^\Q$status\E$/,@ordered)) { |
|
$currstyle = $rowstyle; |
|
$hidden = 0; |
|
} |
|
$datatable .= &noninst_users($processing,$emailverified,$emailoptions,$emaildomain, |
|
$emailrules,$emailruleorder,$settings,$status,$rowid, |
|
$usertypeshash{$status},$css_class,$currstyle,$intdom); |
|
unless ($hidden) { |
|
$$rowtotal ++; |
|
} |
} |
|
$additional .= '</tr></table>'; |
|
} else { |
|
$usertypes->{'default'} = &mt('All users'); |
|
$additional .= &email_as_username($rowtotal,$processing); |
} |
} |
} else { |
|
my $css_class; |
|
if ($$rowtotal%2) { |
|
$css_class = 'LC_odd_row '; |
|
} |
|
$css_class .= $customclass; |
|
$usertypeshash{'default'} = $othertitle; |
|
$datatable .= &noninst_users($processing,$emailverified,$emailoptions,$emaildomain, |
|
$emailrules,$emailruleorder,$settings,'default','', |
|
$othertitle,$css_class,$rowstyle,$intdom); |
|
$$rowtotal ++; |
|
} |
} |
|
$additional .= '</div>'."\n"; |
|
|
|
($datatable,$itemcount) = &radiobutton_prefs(\%radiohash,\@toggles,\%defaultchecked, |
|
\%choices,$$rowtotal,$onclick,$additional); |
|
$$rowtotal ++; |
|
$datatable .= &print_requestmail($dom,'selfcreation',$createsettings,$rowtotal); |
|
$$rowtotal ++; |
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info(); |
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info(); |
$numinrow = 1; |
$numinrow = 1; |
if (@posstypes) { |
if (ref($order) eq 'ARRAY') { |
foreach my $status (@posstypes) { |
foreach my $status (@{$order}) { |
my $rowid = $classprefix.$status; |
|
my $datarowstyle = 'display:none'; |
|
if (grep(/^\Q$status\E$/,@ordered)) { |
|
$datarowstyle = $rowstyle; |
|
} |
|
$datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings, |
$datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings, |
$numinrow,$$rowtotal,\%usertypeshash,$infofields, |
$numinrow,$$rowtotal,$usertypes,$infofields,$infotitles); |
$infotitles,$rowid,$customclass,$datarowstyle); |
$$rowtotal ++; |
unless ($datarowstyle eq 'display:none') { |
|
$$rowtotal ++; |
|
} |
|
} |
} |
} else { |
|
$datatable .= &modifiable_userdata_row('cancreate','emailusername_default',$settings, |
|
$numinrow,$$rowtotal,\%usertypeshash,$infofields, |
|
$infotitles,'',$customclass,$rowstyle); |
|
} |
} |
} |
my ($emailrules,$emailruleorder) = |
return $datatable; |
&Apache::lonnet::inst_userrules($dom,'email'); |
} |
if (ref($emailrules) eq 'HASH') { |
|
if (keys(%{$emailrules}) > 0) { |
sub selfcreate_javascript { |
$datatable .= &user_formats_row('email',$settings,$emailrules, |
return <<"ENDSCRIPT"; |
$emailruleorder,$numinrow,$$rowtotal); |
|
$$rowtotal ++; |
<script type="text/javascript"> |
|
// <![CDATA[ |
|
|
|
function toggleRows(form,radio,checkbox,target,prefix,altprefix) { |
|
var x = document.getElementsByClassName(target); |
|
var insttypes = 0; |
|
var insttypeRegExp = new RegExp(prefix); |
|
if ((x.length != undefined) && (x.length > 0)) { |
|
if (form.elements[radio].length != undefined) { |
|
for (var i=0; i<form.elements[radio].length; i++) { |
|
if (form.elements[radio][i].checked) { |
|
if (form.elements[radio][i].value == 1) { |
|
for (var j=0; j<x.length; j++) { |
|
if (x[j].id == 'undefined') { |
|
x[j].style.display = 'table-row'; |
|
} else if (insttypeRegExp.test(x[j].id)) { |
|
insttypes ++; |
|
} else { |
|
x[j].style.display = 'table-row'; |
|
} |
|
} |
|
} else { |
|
for (var j=0; j<x.length; j++) { |
|
x[j].style.display = 'none'; |
|
} |
|
} |
|
break; |
|
} |
|
} |
|
if (insttypes > 0) { |
|
toggleDataRow(form,checkbox,target,altprefix); |
|
toggleDataRow(form,checkbox,target,prefix,1); |
|
} |
} |
} |
} |
|
$datatable .= &captcha_choice('cancreate',$createsettings,$$rowtotal); |
} |
} |
return; |
return $datatable; |
} |
} |
|
|
function toggleDataRow(form,checkbox,target,prefix,docount) { |
sub email_as_username { |
if (form.elements[checkbox].length != undefined) { |
my ($rowtotal,$processing,$type) = @_; |
var count = 0; |
my %choices = |
if (docount) { |
&Apache::lonlocal::texthash ( |
for (var i=0; i<form.elements[checkbox].length; i++) { |
automatic => 'Automatic approval', |
if (form.elements[checkbox][i].checked) { |
approval => 'Queued for approval', |
count ++; |
); |
} |
my $output; |
} |
foreach my $option ('automatic','approval') { |
} |
my $checked; |
for (var i=0; i<form.elements[checkbox].length; i++) { |
if (ref($processing) eq 'HASH') { |
var type = form.elements[checkbox][i].value; |
if ($type eq '') { |
if (document.getElementById(prefix+type)) { |
if (!exists($processing->{'default'})) { |
if (form.elements[checkbox][i].checked) { |
if ($option eq 'automatic') { |
document.getElementById(prefix+type).style.display = 'table-row'; |
$checked = ' checked="checked"'; |
if (count % 2 == 1) { |
|
document.getElementById(prefix+type).className = target+' LC_odd_row'; |
|
} else { |
|
document.getElementById(prefix+type).className = target; |
|
} |
} |
count ++; |
|
} else { |
} else { |
document.getElementById(prefix+type).style.display = 'none'; |
if ($processing->{'default'} eq $option) { |
} |
$checked = ' checked="checked"'; |
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function toggleEmailOptions(form,radio,prefix,altprefix,status) { |
|
var caller = radio+'_'+status; |
|
if (form.elements[caller].length != undefined) { |
|
for (var i=0; i<form.elements[caller].length; i++) { |
|
if (form.elements[caller][i].checked) { |
|
if (document.getElementById(altprefix+'_inst_'+status)) { |
|
var curr = form.elements[caller][i].value; |
|
if (prefix) { |
|
document.getElementById(prefix+'_'+status).style.display = 'none'; |
|
} |
|
document.getElementById(altprefix+'_inst_'+status).style.display = 'none'; |
|
document.getElementById(altprefix+'_noninst_'+status).style.display = 'none'; |
|
if (curr == 'custom') { |
|
if (prefix) { |
|
document.getElementById(prefix+'_'+status).style.display = 'inline'; |
|
} |
|
} else if (curr == 'inst') { |
|
document.getElementById(altprefix+'_inst_'+status).style.display = 'inline'; |
|
} else if (curr == 'noninst') { |
|
document.getElementById(altprefix+'_noninst_'+status).style.display = 'inline'; |
|
} |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
// ]]> |
|
</script> |
|
|
|
ENDSCRIPT |
|
} |
|
|
|
sub noninst_users { |
|
my ($processing,$emailverified,$emailoptions,$emaildomain,$emailrules, |
|
$emailruleorder,$settings,$type,$rowid,$typetitle,$css_class,$rowstyle,$intdom) = @_; |
|
my $class = 'LC_left_item'; |
|
if ($css_class) { |
|
$css_class = ' class="'.$css_class.'"'; |
|
} |
|
if ($rowid) { |
|
$rowid = ' id="'.$rowid.'"'; |
|
} |
|
if ($rowstyle) { |
|
$rowstyle = ' style="'.$rowstyle.'"'; |
|
} |
|
my ($output,$description); |
|
if ($type eq 'default') { |
|
$description = &mt('Requests for: [_1]',$typetitle); |
|
} else { |
|
$description = &mt('Requests for: [_1] (status self-reported)',$typetitle); |
|
} |
|
$output = '<tr'.$css_class.$rowid.$rowstyle.'>'. |
|
"<td>$description</td>\n". |
|
'<td class="'.$class.'" colspan="2">'. |
|
'<table><tr>'; |
|
my %headers = &Apache::lonlocal::texthash( |
|
approve => 'Processing', |
|
email => 'E-mail', |
|
username => 'Username', |
|
); |
|
foreach my $item ('approve','email','username') { |
|
$output .= '<th>'.$headers{$item}.'</th>'; |
|
} |
|
$output .= '</tr><tr>'; |
|
foreach my $item ('approve','email','username') { |
|
$output .= '<td valign="top">'; |
|
my (%choices,@options,$hashref,$defoption,$name,$onclick,$hascustom); |
|
if ($item eq 'approve') { |
|
%choices = &Apache::lonlocal::texthash ( |
|
automatic => 'Automatically approved', |
|
approval => 'Queued for approval', |
|
); |
|
@options = ('automatic','approval'); |
|
$hashref = $processing; |
|
$defoption = 'automatic'; |
|
$name = 'cancreate_emailprocess_'.$type; |
|
} elsif ($item eq 'email') { |
|
%choices = &Apache::lonlocal::texthash ( |
|
any => 'Any e-mail', |
|
inst => 'Institutional only', |
|
noninst => 'Non-institutional only', |
|
custom => 'Custom restrictions', |
|
); |
|
@options = ('any','inst','noninst'); |
|
my $showcustom; |
|
if (ref($emailrules) eq 'HASH') { |
|
if (keys(%{$emailrules}) > 0) { |
|
push(@options,'custom'); |
|
$showcustom = 'cancreate_emailrule'; |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{'email_rule'}) eq 'ARRAY') { |
|
foreach my $rule (@{$settings->{'email_rule'}}) { |
|
if (exists($emailrules->{$rule})) { |
|
$hascustom ++; |
|
} |
|
} |
|
} elsif (ref($settings->{'email_rule'}) eq 'HASH') { |
|
if (ref($settings->{'email_rule'}{$type}) eq 'ARRAY') { |
|
foreach my $rule (@{$settings->{'email_rule'}{$type}}) { |
|
if (exists($emailrules->{$rule})) { |
|
$hascustom ++; |
|
} |
|
} |
|
} |
|
} |
|
} |
} |
} |
} |
} |
} else { |
$onclick = ' onclick="toggleEmailOptions(this.form,'."'cancreate_emailoptions','$showcustom',". |
if (!exists($processing->{$type})) { |
"'cancreate_emaildomain','$type'".');"'; |
if ($option eq 'automatic') { |
$hashref = $emailoptions; |
$checked = ' checked="checked"'; |
$defoption = 'any'; |
|
$name = 'cancreate_emailoptions_'.$type; |
|
} elsif ($item eq 'username') { |
|
%choices = &Apache::lonlocal::texthash ( |
|
all => 'Same as e-mail', |
|
first => 'Omit @domain', |
|
free => 'Free to choose', |
|
); |
|
@options = ('all','first','free'); |
|
$hashref = $emailverified; |
|
$defoption = 'all'; |
|
$name = 'cancreate_usernameoptions_'.$type; |
|
} |
|
foreach my $option (@options) { |
|
my $checked; |
|
if (ref($hashref) eq 'HASH') { |
|
if ($type eq '') { |
|
if (!exists($hashref->{'default'})) { |
|
if ($option eq $defoption) { |
|
$checked = ' checked="checked"'; |
|
} |
|
} else { |
|
if ($hashref->{'default'} eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
} |
} |
} else { |
} else { |
if (!exists($hashref->{$type})) { |
if ($processing->{$type} eq $option) { |
if ($option eq $defoption) { |
$checked = ' checked="checked"'; |
$checked = ' checked="checked"'; |
|
} |
|
} else { |
|
if ($hashref->{$type} eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
} |
|
} |
|
} elsif (($item eq 'email') && ($hascustom)) { |
|
if ($option eq 'custom') { |
|
$checked = ' checked="checked"'; |
|
} |
|
} elsif ($option eq $defoption) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$output .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="'.$name.'"'. |
|
$checked.' value="'.$option.'"'.$onclick.' />'. |
|
$choices{$option}.'</label></span><br />'; |
|
if ($item eq 'email') { |
|
if ($option eq 'custom') { |
|
my $id = 'cancreate_emailrule_'.$type; |
|
my $display = 'none'; |
|
if ($checked) { |
|
$display = 'inline'; |
|
} |
|
my $numinrow = 2; |
|
$output .= '<fieldset id="'.$id.'" style="display:'.$display.';">'. |
|
'<legend>'.&mt('Disallow').'</legend><table>'. |
|
&user_formats_row('email',$settings,$emailrules, |
|
$emailruleorder,$numinrow,'',$type); |
|
'</table></fieldset>'; |
|
} elsif (($option eq 'inst') || ($option eq 'noninst')) { |
|
my %text = &Apache::lonlocal::texthash ( |
|
inst => 'must end:', |
|
noninst => 'cannot end:', |
|
); |
|
my $value; |
|
if (ref($emaildomain) eq 'HASH') { |
|
if (ref($emaildomain->{$type}) eq 'HASH') { |
|
$value = $emaildomain->{$type}->{$option}; |
|
} |
|
} |
|
if ($value eq '') { |
|
$value = '@'.$intdom; |
|
} |
|
my $condition = 'cancreate_emaildomain_'.$option.'_'.$type; |
|
my $display = 'none'; |
|
if ($checked) { |
|
$display = 'inline'; |
|
} |
} |
$output .= '<div id="'.$condition.'" style="display:'.$display.';">'. |
|
'<span class="LC_domprefs_email">'.$text{$option}.'</span> '. |
|
'<input type="text" name="'.$condition.'" value="'.$value.'" size="10" />'. |
|
'</div>'; |
|
} |
} |
} |
} |
|
} elsif ($option eq 'automatic') { |
|
$checked = ' checked="checked"'; |
|
} |
|
my $name = 'cancreate_emailprocess'; |
|
if (($type ne '') && ($type ne 'default')) { |
|
$name .= '_'.$type; |
|
} |
|
$output .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="'.$name.'"'. |
|
$checked.' value="'.$option.'" />'. |
|
$choices{$option}.'</label></span>'; |
|
if ($type eq '') { |
|
$output .= ' '; |
|
} else { |
|
$output .= '<br />'; |
} |
} |
$output .= '</td>'."\n"; |
|
} |
} |
$output .= "</tr></table></td></tr>\n"; |
$$rowtotal ++; |
return $output; |
return $output; |
} |
} |
|
|
sub captcha_choice { |
sub captcha_choice { |
my ($context,$settings,$itemcount,$customcss,$rowstyle) = @_; |
my ($context,$settings,$itemcount) = @_; |
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext, |
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext, |
$vertext,$currver); |
$vertext,$currver); |
my %lt = &captcha_phrases(); |
my %lt = &captcha_phrases(); |
Line 5548 sub captcha_choice {
|
Line 5242 sub captcha_choice {
|
} else { |
} else { |
$checked{'original'} = ' checked="checked"'; |
$checked{'original'} = ' checked="checked"'; |
} |
} |
my $css_class; |
my $css_class = $itemcount%2?' class="LC_odd_row"':''; |
if ($itemcount%2) { |
|
$css_class = 'LC_odd_row'; |
|
} |
|
if ($customcss) { |
|
$css_class .= " $customcss"; |
|
} |
|
$css_class =~ s/^\s+//; |
|
if ($css_class) { |
|
$css_class = ' class="'.$css_class.'"'; |
|
} |
|
if ($rowstyle) { |
|
$css_class .= ' style="'.$rowstyle.'"'; |
|
} |
|
my $output = '<tr'.$css_class.'>'. |
my $output = '<tr'.$css_class.'>'. |
'<td class="LC_left_item">'.$rowname.'</td><td class="LC_left_item" colspan="2">'."\n". |
'<td class="LC_left_item">'.$rowname.'</td><td class="LC_left_item" colspan="2">'."\n". |
'<table><tr><td>'."\n"; |
'<table><tr><td>'."\n"; |
Line 5580 sub captcha_choice {
|
Line 5261 sub captcha_choice {
|
# specified for use with the key should be broad enough to accommodate all servers in the LON-CAPA domain. |
# specified for use with the key should be broad enough to accommodate all servers in the LON-CAPA domain. |
# |
# |
$output .= '</td></tr>'."\n". |
$output .= '</td></tr>'."\n". |
'<tr><td class="LC_zero_height">'."\n". |
'<tr><td>'."\n". |
'<span class="LC_nobreak"><span id="'.$context.'_recaptchapubtxt">'.$pubtext.'</span> '."\n". |
'<span class="LC_nobreak"><span id="'.$context.'_recaptchapubtxt">'.$pubtext.'</span> '."\n". |
'<input type="'.$keyentry.'" id="'.$context.'_recaptchapub" name="'.$context.'_recaptchapub" value="'. |
'<input type="'.$keyentry.'" id="'.$context.'_recaptchapub" name="'.$context.'_recaptchapub" value="'. |
$currpub.'" size="40" /></span><br />'."\n". |
$currpub.'" size="40" /></span><br />'."\n". |
Line 5596 sub captcha_choice {
|
Line 5277 sub captcha_choice {
|
} |
} |
|
|
sub user_formats_row { |
sub user_formats_row { |
my ($type,$settings,$rules,$ruleorder,$numinrow,$rowcount,$status) = @_; |
my ($type,$settings,$rules,$ruleorder,$numinrow,$rowcount) = @_; |
my $output; |
my $output; |
my %text = ( |
my %text = ( |
'username' => 'new usernames', |
'username' => 'new usernames', |
'id' => 'IDs', |
'id' => 'IDs', |
|
'email' => 'self-created accounts (e-mail)', |
); |
); |
unless ($type eq 'email') { |
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
$output = '<tr '.$css_class.'>'. |
$output = '<tr '.$css_class.'>'. |
'<td><span class="LC_nobreak">'; |
'<td><span class="LC_nobreak">'. |
if ($type eq 'email') { |
&mt("Format rules to check for $text{$type}: "). |
$output .= &mt("Formats disallowed for $text{$type}: "); |
'</td><td class="LC_left_item" colspan="2"><table>'; |
} else { |
|
$output .= &mt("Format rules to check for $text{$type}: "); |
} |
} |
|
$output .= '</span></td>'. |
|
'<td class="LC_left_item" colspan="2"><table>'; |
my $rem; |
my $rem; |
if (ref($ruleorder) eq 'ARRAY') { |
if (ref($ruleorder) eq 'ARRAY') { |
for (my $i=0; $i<@{$ruleorder}; $i++) { |
for (my $i=0; $i<@{$ruleorder}; $i++) { |
Line 5626 sub user_formats_row {
|
Line 5311 sub user_formats_row {
|
if (grep(/^\Q$ruleorder->[$i]\E$/,@{$settings->{$type.'_rule'}})) { |
if (grep(/^\Q$ruleorder->[$i]\E$/,@{$settings->{$type.'_rule'}})) { |
$check = ' checked="checked" '; |
$check = ' checked="checked" '; |
} |
} |
} elsif ((ref($settings->{$type.'_rule'}) eq 'HASH') && ($status ne '')) { |
|
if (ref($settings->{$type.'_rule'}->{$status}) eq 'ARRAY') { |
|
if (grep(/^\Q$ruleorder->[$i]\E$/,@{$settings->{$type.'_rule'}->{$status}})) { |
|
$check = ' checked="checked" '; |
|
} |
|
} |
|
} |
} |
} |
} |
my $name = $type.'_rule'; |
|
if ($type eq 'email') { |
|
$name .= '_'.$status; |
|
} |
|
$output .= '<td class="LC_left_item">'. |
$output .= '<td class="LC_left_item">'. |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="'.$name.'" '. |
'<input type="checkbox" name="'.$type.'_rule" '. |
'value="'.$ruleorder->[$i].'"'.$check.'/>'. |
'value="'.$ruleorder->[$i].'"'.$check.'/>'. |
$rules->{$ruleorder->[$i]}{'name'}.'</label></span></td>'; |
$rules->{$ruleorder->[$i]}{'name'}.'</label></span></td>'; |
} |
} |
} |
} |
$rem = @{$ruleorder}%($numinrow); |
$rem = @{$ruleorder}%($numinrow); |
} |
} |
my $colsleft; |
my $colsleft = $numinrow - $rem; |
if ($rem) { |
|
$colsleft = $numinrow - $rem; |
|
} |
|
if ($colsleft > 1 ) { |
if ($colsleft > 1 ) { |
$output .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
$output .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
' </td>'; |
' </td>'; |
} elsif ($colsleft == 1) { |
} elsif ($colsleft == 1) { |
$output .= '<td class="LC_left_item"> </td>'; |
$output .= '<td class="LC_left_item"> </td>'; |
} |
} |
$output .= '</tr></table>'; |
$output .= '</tr></table></td></tr>'; |
unless ($type eq 'email') { |
|
$output .= '</td></tr>'; |
|
} |
|
return $output; |
return $output; |
} |
} |
|
|
Line 5882 sub print_defaults {
|
Line 5551 sub print_defaults {
|
} else { |
} else { |
my %defaults; |
my %defaults; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { |
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH') && |
|
(ref($settings->{'inststatusguest'}) eq 'ARRAY')) { |
my $maxnum = @{$settings->{'inststatusorder'}}; |
my $maxnum = @{$settings->{'inststatusorder'}}; |
for (my $i=0; $i<$maxnum; $i++) { |
for (my $i=0; $i<$maxnum; $i++) { |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
my $item = $settings->{'inststatusorder'}->[$i]; |
my $item = $settings->{'inststatusorder'}->[$i]; |
my $title = $settings->{'inststatustypes'}->{$item}; |
my $title = $settings->{'inststatustypes'}->{$item}; |
|
my $guestok; |
|
if (grep(/^\Q$item\E$/,@{$settings->{'inststatusguest'}})) { |
|
$guestok = 1; |
|
} |
my $chgstr = ' onchange="javascript:reorderTypes(this.form,'."'$item'".');"'; |
my $chgstr = ' onchange="javascript:reorderTypes(this.form,'."'$item'".');"'; |
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td><span class="LC_nobreak">'. |
'<td><span class="LC_nobreak">'. |
Line 5900 sub print_defaults {
|
Line 5574 sub print_defaults {
|
} |
} |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
|
my ($checkedon,$checkedoff); |
|
$checkedoff = ' checked="checked"'; |
|
if ($guestok) { |
|
$checkedon = $checkedoff; |
|
$checkedoff = ''; |
|
} |
$datatable .= '</select> '.&mt('Internal ID:').' <b>'.$item.'</b> '. |
$datatable .= '</select> '.&mt('Internal ID:').' <b>'.$item.'</b> '. |
'<input type="checkbox" name="inststatus_delete" value="'.$item.'" />'. |
'<input type="checkbox" name="inststatus_delete" value="'.$item.'" />'. |
&mt('delete').'</span></td>'. |
&mt('delete').'</span></td>'. |
'<td class="LC_left_item" colspan="2"><span class="LC_nobreak">'.&mt('Name displayed:'). |
'<td class="LC_left_item"><span class="LC_nobreak">'.&mt('Name displayed:'). |
'<input type="text" size="20" name="inststatus_title_'.$item.'" value="'.$title.'" />'. |
'<input type="text" size="20" name="inststatus_title_'.$item.'" value="'.$title.'" />'. |
'</span></td></tr>'; |
'</span></td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" value="1" name="inststatus_guest_'.$item.'"'.$checkedon.' />'. |
|
&mt('Yes').'</label>'.(' 'x2). |
|
'<label><input type="radio" value="0" name="inststatus_guest_'.$item.'"'.$checkedoff.' />'. |
|
&mt('No').'</label></span></td></tr>'; |
} |
} |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
my $chgstr = ' onchange="javascript:reorderTypes(this.form,'."'addinststatus_pos'".');"'; |
my $chgstr = ' onchange="javascript:reorderTypes(this.form,'."'addinststatus_pos'".');"'; |
Line 5922 sub print_defaults {
|
Line 5607 sub print_defaults {
|
$datatable .= '</select> '.&mt('Internal ID:'). |
$datatable .= '</select> '.&mt('Internal ID:'). |
'<input type="text" size="10" name="addinststatus" value="" />'. |
'<input type="text" size="10" name="addinststatus" value="" />'. |
' '.&mt('(new)'). |
' '.&mt('(new)'). |
'</span></td><td class="LC_left_item" colspan="2"><span class="LC_nobreak">'. |
'</span></td><td class="LC_left_item"><span class="LC_nobreak">'. |
&mt('Name displayed:'). |
&mt('Name displayed:'). |
'<input type="text" size="20" name="addinststatus_title" value="" /></span></td>'. |
'<input type="text" size="20" name="addinststatus_title" value="" /></span></td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" value="1" name="addinststatus_guest" />'. |
|
&mt('Yes').'</label>'.(' 'x2). |
|
'<label><input type="radio" value="0" name="addinststatus_guest" />'. |
|
&mt('No').'</label></span></td></tr>'; |
'</tr>'."\n"; |
'</tr>'."\n"; |
$rownum ++; |
$rownum ++; |
} |
} |
Line 6783 sub build_category_rows {
|
Line 6473 sub build_category_rows {
|
} |
} |
|
|
sub modifiable_userdata_row { |
sub modifiable_userdata_row { |
my ($context,$item,$settings,$numinrow,$rowcount,$usertypes,$fieldsref,$titlesref, |
my ($context,$item,$settings,$numinrow,$rowcount,$usertypes,$fieldsref,$titlesref) = @_; |
$rowid,$customcss,$rowstyle) = @_; |
|
my ($role,$rolename,$statustype); |
my ($role,$rolename,$statustype); |
$role = $item; |
$role = $item; |
if ($context eq 'cancreate') { |
if ($context eq 'cancreate') { |
if ($item =~ /^(emailusername)_(.+)$/) { |
if ($item =~ /^emailusername_(.+)$/) { |
$role = $1; |
$statustype = $1; |
$statustype = $2; |
$role = 'emailusername'; |
if (ref($usertypes) eq 'HASH') { |
if (ref($usertypes) eq 'HASH') { |
if ($usertypes->{$statustype}) { |
if ($usertypes->{$statustype}) { |
$rolename = &mt('Data provided by [_1]',$usertypes->{$statustype}); |
$rolename = &mt('Data provided by [_1]',$usertypes->{$statustype}); |
Line 6825 sub modifiable_userdata_row {
|
Line 6514 sub modifiable_userdata_row {
|
%fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
%fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
} |
} |
my $output; |
my $output; |
my $css_class; |
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
if ($rowcount%2) { |
$output = '<tr '.$css_class.'>'. |
$css_class = 'LC_odd_row'; |
|
} |
|
if ($customcss) { |
|
$css_class .= " $customcss"; |
|
} |
|
$css_class =~ s/^\s+//; |
|
if ($css_class) { |
|
$css_class = ' class="'.$css_class.'"'; |
|
} |
|
if ($rowstyle) { |
|
$css_class .= ' style="'.$rowstyle.'"'; |
|
} |
|
if ($rowid) { |
|
$rowid = ' id="'.$rowid.'"'; |
|
} |
|
|
|
$output = '<tr '.$css_class.$rowid.'>'. |
|
'<td><span class="LC_nobreak">'.$rolename.'</span></td>'. |
'<td><span class="LC_nobreak">'.$rolename.'</span></td>'. |
'<td class="LC_left_item" colspan="2"><table>'; |
'<td class="LC_left_item" colspan="2"><table>'; |
my $rem; |
my $rem; |
Line 6877 sub modifiable_userdata_row {
|
Line 6549 sub modifiable_userdata_row {
|
} |
} |
} |
} |
} |
} |
|
|
my $total = scalar(@fields); |
for (my $i=0; $i<@fields; $i++) { |
for (my $i=0; $i<$total; $i++) { |
my $rem = $i%($numinrow); |
$rem = $i%($numinrow); |
|
if ($rem == 0) { |
if ($rem == 0) { |
if ($i > 0) { |
if ($i > 0) { |
$output .= '</tr>'; |
$output .= '</tr>'; |
Line 6922 sub modifiable_userdata_row {
|
Line 6593 sub modifiable_userdata_row {
|
'</label>'; |
'</label>'; |
} |
} |
$output .= '</span></td>'; |
$output .= '</span></td>'; |
|
$rem = @fields%($numinrow); |
} |
} |
$rem = $total%$numinrow; |
my $colsleft = $numinrow - $rem; |
my $colsleft; |
if ($colsleft > 1 ) { |
if ($rem) { |
|
$colsleft = $numinrow - $rem; |
|
} |
|
if ($colsleft > 1) { |
|
$output .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
$output .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
' </td>'; |
' </td>'; |
} elsif ($colsleft == 1) { |
} elsif ($colsleft == 1) { |
Line 6939 sub modifiable_userdata_row {
|
Line 6607 sub modifiable_userdata_row {
|
} |
} |
|
|
sub insttypes_row { |
sub insttypes_row { |
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle,$context,$rowtotal,$onclick, |
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle,$context,$rownum) = @_; |
$customcss,$rowstyle) = @_; |
|
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
cansearch => 'Users allowed to search', |
cansearch => 'Users allowed to search', |
statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)', |
statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)', |
lockablenames => 'User preference to lock name', |
lockablenames => 'User preference to lock name', |
selfassign => 'Self-reportable affiliations', |
|
); |
); |
my $showdom; |
my $showdom; |
if ($context eq 'cansearch') { |
if ($context eq 'cansearch') { |
Line 6955 sub insttypes_row {
|
Line 6621 sub insttypes_row {
|
if ($context eq 'statustocreate') { |
if ($context eq 'statustocreate') { |
$class = 'LC_right_item'; |
$class = 'LC_right_item'; |
} |
} |
my $css_class; |
my $css_class = ' class="LC_odd_row"'; |
if ($$rowtotal%2) { |
if ($rownum ne '') { |
$css_class = 'LC_odd_row'; |
$css_class = ($rownum%2? ' class="LC_odd_row"':''); |
} |
|
if ($customcss) { |
|
$css_class .= ' '.$customcss; |
|
} |
|
$css_class =~ s/^\s+//; |
|
if ($css_class) { |
|
$css_class = ' class="'.$css_class.'"'; |
|
} |
|
if ($rowstyle) { |
|
$css_class .= ' style="'.$rowstyle.'"'; |
|
} |
|
if ($onclick) { |
|
$onclick = 'onclick="'.$onclick.'" '; |
|
} |
} |
my $output = '<tr'.$css_class.'>'. |
my $output = '<tr'.$css_class.'>'. |
'<td>'.$lt{$context}.$showdom. |
'<td>'.$lt{$context}.$showdom. |
Line 6999 sub insttypes_row {
|
Line 6652 sub insttypes_row {
|
$output .= '<td class="LC_left_item">'. |
$output .= '<td class="LC_left_item">'. |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="'.$context.'" '. |
'<input type="checkbox" name="'.$context.'" '. |
'value="'.$types->[$i].'"'.$check.$onclick.' />'. |
'value="'.$types->[$i].'"'.$check.'/>'. |
$usertypes->{$types->[$i]}.'</label></span></td>'; |
$usertypes->{$types->[$i]}.'</label></span></td>'; |
} |
} |
} |
} |
Line 7026 sub insttypes_row {
|
Line 6679 sub insttypes_row {
|
} |
} |
$output .= '<span class="LC_nobreak"><label>'. |
$output .= '<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="'.$context.'" '. |
'<input type="checkbox" name="'.$context.'" '. |
'value="default"'.$defcheck.$onclick.' />'. |
'value="default"'.$defcheck.'/>'. |
$othertitle.'</label></span></td>'. |
$othertitle.'</label></span></td>'. |
'</tr></table></td></tr>'; |
'</tr></table></td></tr>'; |
return $output; |
return $output; |
Line 9908 sub modify_usercreation {
|
Line 9561 sub modify_usercreation {
|
if ($key eq 'cancreate') { |
if ($key eq 'cancreate') { |
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
if (($item eq 'requestcrs') || ($item eq 'course') || ($item eq 'author')) { |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
($item eq 'captcha') || ($item eq 'recaptchakeys') || |
} else { |
($item eq 'recaptchaversion')) { |
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
|
} else { |
|
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
} |
} |
} |
} |
} |
} |
Line 10114 sub modify_usercreation {
|
Line 9769 sub modify_usercreation {
|
} |
} |
|
|
sub modify_selfcreation { |
sub modify_selfcreation { |
my ($dom,$lastactref,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,$warningmsg,%curr_usercreation,%curr_usermodify,%curr_inststatus,%changes,%cancreate); |
my ($resulttext,$warningmsg,%curr_usercreation,%curr_usermodify,%changes,%cancreate); |
my (%save_usercreate,%save_usermodify,%save_inststatus,@types,%usertypes); |
my (%save_usercreate,%save_usermodify); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypesref,$typesref) = &Apache::loncommon::sorted_inst_types($dom); |
if (ref($types) eq 'ARRAY') { |
if (ref($typesref) eq 'ARRAY') { |
$usertypes->{'default'} = $othertitle; |
@types = @{$typesref}; |
push(@{$types},'default'); |
} |
|
if (ref($usertypesref) eq 'HASH') { |
|
%usertypes = %{$usertypesref}; |
|
} |
} |
$usertypes{'default'} = $othertitle; |
|
# |
# |
# Retrieve current domain configuration for self-creation of usernames from $domconfig{'usercreation'}. |
# Retrieve current domain configuration for self-creation of usernames from $domconfig{'usercreation'}. |
# |
# |
Line 10135 sub modify_selfcreation {
|
Line 9786 sub modify_selfcreation {
|
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
($item eq 'captcha') || ($item eq 'recaptchakeys') || |
($item eq 'captcha') || ($item eq 'recaptchakeys') || |
($item eq 'recaptchaversion') || ($item eq 'notify') || |
($item eq 'recaptchaversion') || |
($item eq 'emailusername') || ($item eq 'shibenv') || |
($item eq 'emailusername') || ($item eq 'notify') || |
($item eq 'selfcreateprocessing') || ($item eq 'emailverified') || |
($item eq 'selfcreateprocessing') || ($item eq 'shibenv')) { |
($item eq 'emailoptions') || ($item eq 'emaildomain')) { |
|
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
} else { |
} else { |
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
Line 10165 sub modify_selfcreation {
|
Line 9815 sub modify_selfcreation {
|
} |
} |
} |
} |
} |
} |
# |
|
# Retrieve current domain configuration for institutional status types from $domconfig{'inststatus'}. |
|
# |
|
if (ref($domconfig{'inststatus'}) eq 'HASH') { |
|
foreach my $key (keys(%{$domconfig{'inststatus'}})) { |
|
if ($key eq 'inststatusguest') { |
|
$curr_inststatus{$key} = $domconfig{'inststatus'}{$key}; |
|
} else { |
|
$save_inststatus{$key} = $domconfig{'inststatus'}{$key}; |
|
} |
|
} |
|
} |
|
|
|
my @contexts = ('selfcreate'); |
my @contexts = ('selfcreate'); |
@{$cancreate{'selfcreate'}} = (); |
@{$cancreate{'selfcreate'}} = (); |
%{$cancreate{'emailusername'}} = (); |
%{$cancreate{'emailusername'}} = (); |
if (@types) { |
@{$cancreate{'statustocreate'}} = (); |
@{$cancreate{'statustocreate'}} = (); |
|
} |
|
%{$cancreate{'selfcreateprocessing'}} = (); |
%{$cancreate{'selfcreateprocessing'}} = (); |
%{$cancreate{'shibenv'}} = (); |
%{$cancreate{'shibenv'}} = (); |
%{$cancreate{'emailverified'}} = (); |
|
%{$cancreate{'emailoptions'}} = (); |
|
%{$cancreate{'emaildomain'}} = (); |
|
my %selfcreatetypes = ( |
my %selfcreatetypes = ( |
sso => 'users authenticated by institutional single sign on', |
sso => 'users authenticated by institutional single sign on', |
login => 'users authenticated by institutional log-in', |
login => 'users authenticated by institutional log-in', |
email => 'users verified by e-mail', |
email => 'users who provide a valid e-mail address for use as username', |
); |
); |
# |
# |
# Populate $cancreate{'selfcreate'} array reference with types of user, for which self-creation of user accounts |
# Populate $cancreate{'selfcreate'} array reference with types of user, for which self-creation of user accounts |
# is permitted. |
# is permitted. |
# |
# |
|
|
my ($emailrules,$emailruleorder) = &Apache::lonnet::inst_userrules($dom,'email'); |
my @statuses; |
|
if (ref($domconfig{'inststatus'}) eq 'HASH') { |
|
if (ref($domconfig{'inststatus'}{'inststatusguest'}) eq 'ARRAY') { |
|
@statuses = @{$domconfig{'inststatus'}{'inststatusguest'}}; |
|
} |
|
} |
|
push(@statuses,'default'); |
|
|
my (@statuses,%email_rule); |
|
foreach my $item ('login','sso','email') { |
foreach my $item ('login','sso','email') { |
if ($item eq 'email') { |
if ($item eq 'email') { |
if ($env{'form.cancreate_email'}) { |
if ($env{'form.cancreate_email'}) { |
if (@types) { |
push(@{$cancreate{'selfcreate'}},'email'); |
my @poss_statuses = &Apache::loncommon::get_env_multiple('form.selfassign'); |
push(@contexts,'selfcreateprocessing'); |
foreach my $status (@poss_statuses) { |
foreach my $type (@statuses) { |
if (grep(/^\Q$status\E$/,(@types,'default'))) { |
if ($type eq 'default') { |
push(@statuses,$status); |
$cancreate{'selfcreateprocessing'}{$type} = $env{'form.cancreate_emailprocess'}; |
} |
} else { |
} |
$cancreate{'selfcreateprocessing'}{$type} = $env{'form.cancreate_emailprocess_'.$type}; |
$save_inststatus{'inststatusguest'} = \@statuses; |
|
} else { |
|
push(@statuses,'default'); |
|
} |
|
if (@statuses) { |
|
my %curr_rule; |
|
if (ref($curr_usercreation{'email_rule'}) eq 'ARRAY') { |
|
foreach my $type (@statuses) { |
|
$curr_rule{$type} = $curr_usercreation{'email_rule'}; |
|
} |
|
} elsif (ref($curr_usercreation{'email_rule'}) eq 'HASH') { |
|
foreach my $type (@statuses) { |
|
$curr_rule{$type} = $curr_usercreation{'email_rule'}{$type}; |
|
} |
|
} |
|
push(@{$cancreate{'selfcreate'}},'email'); |
|
push(@contexts,('selfcreateprocessing','emailverified','emailoptions')); |
|
my %curremaildom; |
|
if (ref($curr_usercreation{'cancreate'}{'emaildomain'}) eq 'HASH') { |
|
%curremaildom = %{$curr_usercreation{'cancreate'}{'emaildomain'}}; |
|
} |
|
foreach my $type (@statuses) { |
|
if ($env{'form.cancreate_emailprocess_'.$type} =~ /^(?:approval|automatic)$/) { |
|
$cancreate{'selfcreateprocessing'}{$type} = $env{'form.cancreate_emailprocess_'.$type}; |
|
} |
|
if ($env{'form.cancreate_usernameoptions_'.$type} =~ /^(?:all|first|free)$/) { |
|
$cancreate{'emailverified'}{$type} = $env{'form.cancreate_usernameoptions_'.$type}; |
|
} |
|
if ($env{'form.cancreate_emailoptions_'.$type} =~ /^(any|inst|noninst|custom)$/) { |
|
# |
|
# Retrieve rules (if any) governing types of e-mail address which may be used to verify a username. |
|
# |
|
my $chosen = $1; |
|
if (($chosen eq 'inst') || ($chosen eq 'noninst')) { |
|
my $emaildom; |
|
if ($env{'form.cancreate_emaildomain_'.$chosen.'_'.$type} =~ /^\@[^\@]+$/) { |
|
$emaildom = $env{'form.cancreate_emaildomain_'.$chosen.'_'.$type}; |
|
$cancreate{'emaildomain'}{$type}{$chosen} = $emaildom; |
|
if (ref($curremaildom{$type}) eq 'HASH') { |
|
if (exists($curremaildom{$type}{$chosen})) { |
|
if ($curremaildom{$type}{$chosen} ne $emaildom) { |
|
push(@{$changes{'cancreate'}},'emaildomain'); |
|
} |
|
} elsif ($emaildom ne '') { |
|
push(@{$changes{'cancreate'}},'emaildomain'); |
|
} |
|
} elsif ($emaildom ne '') { |
|
push(@{$changes{'cancreate'}},'emaildomain'); |
|
} |
|
} |
|
$cancreate{'emailoptions'}{$type} = $env{'form.cancreate_emailoptions_'.$type}; |
|
} elsif ($chosen eq 'custom') { |
|
my @possemail_rules = &Apache::loncommon::get_env_multiple('form.email_rule_'.$type); |
|
$email_rule{$type} = []; |
|
if (ref($emailrules) eq 'HASH') { |
|
foreach my $rule (@possemail_rules) { |
|
if (exists($emailrules->{$rule})) { |
|
push(@{$email_rule{$type}},$rule); |
|
} |
|
} |
|
} |
|
if (@{$email_rule{$type}}) { |
|
$cancreate{'emailoptions'}{$type} = 'custom'; |
|
if (ref($curr_rule{$type}) eq 'ARRAY') { |
|
if (@{$curr_rule{$type}} > 0) { |
|
foreach my $rule (@{$curr_rule{$type}}) { |
|
if (!grep(/^\Q$rule\E$/,@{$email_rule{$type}})) { |
|
push(@{$changes{'email_rule'}},$type); |
|
} |
|
} |
|
} |
|
foreach my $type (@{$email_rule{$type}}) { |
|
if (!grep(/^\Q$type\E$/,@{$curr_rule{$type}})) { |
|
push(@{$changes{'email_rule'}},$type); |
|
} |
|
} |
|
} else { |
|
push(@{$changes{'email_rule'}},$type); |
|
} |
|
} |
|
} else { |
|
$cancreate{'emailoptions'}{$type} = $env{'form.cancreate_emailoptions_'.$type}; |
|
} |
|
} |
|
} |
|
if (@types) { |
|
if (ref($curr_inststatus{'inststatusguest'}) eq 'ARRAY') { |
|
my @changed = &Apache::loncommon::compare_arrays(\@statuses,$curr_inststatus{'inststatusguest'}); |
|
if (@changed) { |
|
push(@{$changes{'inststatus'}},'inststatusguest'); |
|
} |
|
} else { |
|
push(@{$changes{'inststatus'}},'inststatusguest'); |
|
} |
|
} |
|
} else { |
|
delete($env{'form.cancreate_email'}); |
|
if (ref($curr_inststatus{'inststatusguest'}) eq 'ARRAY') { |
|
if (@{$curr_inststatus{'inststatusguest'}} > 0) { |
|
push(@{$changes{'inststatus'}},'inststatusguest'); |
|
} |
|
} |
|
} |
|
} else { |
|
$save_inststatus{'inststatusguest'} = []; |
|
if (ref($curr_inststatus{'inststatusguest'}) eq 'ARRAY') { |
|
if (@{$curr_inststatus{'inststatusguest'}} > 0) { |
|
push(@{$changes{'inststatus'}},'inststatusguest'); |
|
} |
} |
} |
} |
} |
} |
Line 10329 sub modify_selfcreation {
|
Line 9859 sub modify_selfcreation {
|
} |
} |
} |
} |
} |
} |
my (%userinfo,%savecaptcha); |
my (@email_rule,%userinfo,%savecaptcha); |
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info(); |
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info(); |
# |
# |
# Populate $cancreate{'emailusername'}{$type} hash ref with information fields (if new user will provide data |
# Populate $cancreate{'emailusername'}{$type} hash ref with information fields (if new user will provide data |
Line 10338 sub modify_selfcreation {
|
Line 9868 sub modify_selfcreation {
|
|
|
if ($env{'form.cancreate_email'}) { |
if ($env{'form.cancreate_email'}) { |
push(@contexts,'emailusername'); |
push(@contexts,'emailusername'); |
if (@statuses) { |
if (ref($types) eq 'ARRAY') { |
foreach my $type (@statuses) { |
foreach my $type (@{$types}) { |
if (ref($infofields) eq 'ARRAY') { |
if (ref($infofields) eq 'ARRAY') { |
foreach my $field (@{$infofields}) { |
foreach my $field (@{$infofields}) { |
if ($env{'form.canmodify_emailusername_'.$type.'_'.$field} =~ /^(required|optional)$/) { |
if ($env{'form.canmodify_emailusername_'.$type.'_'.$field} =~ /^(required|optional)$/) { |
Line 10351 sub modify_selfcreation {
|
Line 9881 sub modify_selfcreation {
|
} |
} |
# |
# |
# Populate $cancreate{'notify'} hash ref with names of Domain Coordinators who are to be notified of |
# Populate $cancreate{'notify'} hash ref with names of Domain Coordinators who are to be notified of |
# queued requests for self-creation of account verified by e-mail. |
# queued requests for self-creation of account using e-mail address as username |
# |
# |
|
|
my @approvalnotify = &Apache::loncommon::get_env_multiple('form.selfcreationnotifyapproval'); |
my @approvalnotify = &Apache::loncommon::get_env_multiple('form.selfcreationnotifyapproval'); |
Line 10371 sub modify_selfcreation {
|
Line 9901 sub modify_selfcreation {
|
push(@{$changes{'cancreate'}},'notify'); |
push(@{$changes{'cancreate'}},'notify'); |
} |
} |
|
|
|
# |
|
# Retrieve rules (if any) governing types of e-mail address which may be used as a username |
|
# |
|
@email_rule = &Apache::loncommon::get_env_multiple('form.email_rule'); |
&process_captcha('cancreate',\%changes,\%savecaptcha,$curr_usercreation{'cancreate'}); |
&process_captcha('cancreate',\%changes,\%savecaptcha,$curr_usercreation{'cancreate'}); |
|
if (ref($curr_usercreation{'email_rule'}) eq 'ARRAY') { |
|
if (@{$curr_usercreation{'email_rule'}} > 0) { |
|
foreach my $type (@{$curr_usercreation{'email_rule'}}) { |
|
if (!grep(/^\Q$type\E$/,@email_rule)) { |
|
push(@{$changes{'email_rule'}},$type); |
|
} |
|
} |
|
} |
|
if (@email_rule > 0) { |
|
foreach my $type (@email_rule) { |
|
if (!grep(/^\Q$type\E$/,@{$curr_usercreation{'email_rule'}})) { |
|
push(@{$changes{'email_rule'}},$type); |
|
} |
|
} |
|
} |
|
} elsif (@email_rule > 0) { |
|
push(@{$changes{'email_rule'}},@email_rule); |
|
} |
} |
} |
# |
# |
# Check if domain default is set appropriately, if self-creation of accounts is to be available for |
# Check if domain default is set appropriately, if self-creation of accounts is to be available for |
# institutional log-in. |
# institutional log-in. |
# |
# |
if (grep(/^login$/,@{$cancreate{'selfcreate'}})) { |
if (grep(/^login$/,@{$cancreate{'selfcreate'}})) { |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
if (!((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || |
if (!((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || |
($domdefaults{'auth_def'} eq 'localauth'))) { |
($domdefaults{'auth_def'} eq 'localauth'))) { |
$warningmsg = &mt('Although account creation has been set to be available for institutional logins, currently default authentication in this domain has not been set to support this.').' '. |
$warningmsg = &mt('Although account creation has been set to be available for institutional logins, currently default authentication in this domain has not been set to support this.').' '. |
Line 10396 sub modify_selfcreation {
|
Line 9949 sub modify_selfcreation {
|
# which the user may supply, if institutional data is unavailable. |
# which the user may supply, if institutional data is unavailable. |
# |
# |
if (($env{'form.cancreate_login'}) || ($env{'form.cancreate_sso'})) { |
if (($env{'form.cancreate_login'}) || ($env{'form.cancreate_sso'})) { |
if (@types) { |
if (ref($types) eq 'ARRAY') { |
@{$cancreate{'statustocreate'}} = &Apache::loncommon::get_env_multiple('form.statustocreate'); |
if (@{$types} > 1) { |
push(@contexts,'statustocreate'); |
@{$cancreate{'statustocreate'}} = &Apache::loncommon::get_env_multiple('form.statustocreate'); |
foreach my $type (@types) { |
push(@contexts,'statustocreate'); |
|
} else { |
|
undef($cancreate{'statustocreate'}); |
|
} |
|
foreach my $type (@{$types}) { |
my @modifiable = &Apache::loncommon::get_env_multiple('form.canmodify_'.$type); |
my @modifiable = &Apache::loncommon::get_env_multiple('form.canmodify_'.$type); |
foreach my $field (@fields) { |
foreach my $field (@fields) { |
if (grep(/^\Q$field\E$/,@modifiable)) { |
if (grep(/^\Q$field\E$/,@modifiable)) { |
Line 10410 sub modify_selfcreation {
|
Line 9967 sub modify_selfcreation {
|
} |
} |
} |
} |
if (ref($curr_usermodify{'selfcreate'}) eq 'HASH') { |
if (ref($curr_usermodify{'selfcreate'}) eq 'HASH') { |
foreach my $type (@types) { |
foreach my $type (@{$types}) { |
if (ref($curr_usermodify{'selfcreate'}{$type}) eq 'HASH') { |
if (ref($curr_usermodify{'selfcreate'}{$type}) eq 'HASH') { |
foreach my $field (@fields) { |
foreach my $field (@fields) { |
if ($save_usermodify{'selfcreate'}{$type}{$field} ne |
if ($save_usermodify{'selfcreate'}{$type}{$field} ne |
Line 10422 sub modify_selfcreation {
|
Line 9979 sub modify_selfcreation {
|
} |
} |
} |
} |
} else { |
} else { |
foreach my $type (@types) { |
foreach my $type (@{$types}) { |
push(@{$changes{'selfcreate'}},$type); |
push(@{$changes{'selfcreate'}},$type); |
} |
} |
} |
} |
Line 10471 sub modify_selfcreation {
|
Line 10028 sub modify_selfcreation {
|
} |
} |
} elsif (ref($curr_usercreation{'cancreate'}{$item}) eq 'HASH') { |
} elsif (ref($curr_usercreation{'cancreate'}{$item}) eq 'HASH') { |
if (ref($cancreate{$item}) eq 'HASH') { |
if (ref($cancreate{$item}) eq 'HASH') { |
foreach my $type (keys(%{$curr_usercreation{'cancreate'}{$item}})) { |
foreach my $curr (keys(%{$curr_usercreation{'cancreate'}{$item}})) { |
if (ref($curr_usercreation{'cancreate'}{$item}{$type}) eq 'HASH') { |
if (ref($curr_usercreation{'cancreate'}{$item}{$curr}) eq 'HASH') { |
foreach my $field (keys(%{$curr_usercreation{'cancreate'}{$item}{$type}})) { |
foreach my $field (keys(%{$curr_usercreation{'cancreate'}{$item}{$curr}})) { |
unless ($curr_usercreation{'cancreate'}{$item}{$type}{$field} eq $cancreate{$item}{$type}{$field}) { |
unless ($curr_usercreation{'cancreate'}{$item}{$curr}{$field} eq $cancreate{$item}{$curr}{$field}) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
push(@{$changes{'cancreate'}},$item); |
push(@{$changes{'cancreate'}},$item); |
} |
} |
} |
} |
} |
} |
} elsif (($item eq 'selfcreateprocessing') || ($item eq 'emailverified') || ($item eq 'emailoptions')) { |
} elsif ($item eq 'selfcreateprocessing') { |
if ($cancreate{$item}{$type} ne $curr_usercreation{'cancreate'}{$item}{$type}) { |
if ($cancreate{$item}{$curr} ne $curr_usercreation{'cancreate'}{$item}{$curr}) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} else { |
|
if (!$cancreate{$item}{$curr}) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
push(@{$changes{'cancreate'}},$item); |
push(@{$changes{'cancreate'}},$item); |
} |
} |
} |
} |
} |
} |
} |
} |
foreach my $type (keys(%{$cancreate{$item}})) { |
foreach my $field (keys(%{$cancreate{$item}})) { |
if (ref($cancreate{$item}{$type}) eq 'HASH') { |
if (ref($cancreate{$item}{$field}) eq 'HASH') { |
foreach my $field (keys(%{$cancreate{$item}{$type}})) { |
foreach my $inner (keys(%{$cancreate{$item}{$field}})) { |
if (ref($curr_usercreation{'cancreate'}{$item}{$type}) eq 'HASH') { |
if (ref($curr_usercreation{'cancreate'}{$item}{$field}) eq 'HASH') { |
unless ($curr_usercreation{'cancreate'}{$item}{$type}{$field} eq $cancreate{$item}{$type}{$field}) { |
unless ($curr_usercreation{'cancreate'}{$item}{$field}{$inner} eq $cancreate{$item}{$field}{$inner}) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
push(@{$changes{'cancreate'}},$item); |
push(@{$changes{'cancreate'}},$item); |
} |
} |
Line 10503 sub modify_selfcreation {
|
Line 10066 sub modify_selfcreation {
|
} |
} |
} |
} |
} |
} |
} elsif (($item eq 'selfcreateprocessing') || ($item eq 'emailverified') || ($item eq 'emailoptions')) { |
} elsif ($item eq 'selfcreateprocessing') { |
if ($cancreate{$item}{$type} ne $curr_usercreation{'cancreate'}{$item}{$type}) { |
if ($cancreate{$item}{$field} ne $curr_usercreation{'cancreate'}{$item}{$field}) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} else { |
|
if (!$curr_usercreation{'cancreate'}{$item}{$field}) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
push(@{$changes{'cancreate'}},$item); |
push(@{$changes{'cancreate'}},$item); |
} |
} |
Line 10519 sub modify_selfcreation {
|
Line 10088 sub modify_selfcreation {
|
push(@{$changes{'cancreate'}},$item); |
push(@{$changes{'cancreate'}},$item); |
} |
} |
} |
} |
} |
} elsif (ref($cancreate{$item}) eq 'HASH') { |
} elsif (($item eq 'selfcreateprocessing') || ($item eq 'emailverified') || ($item eq 'emailoptions')) { |
if (!$cancreate{$item}{$curr_usercreation{'cancreate'}{$item}}) { |
if (ref($cancreate{$item}) eq 'HASH') { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
push(@{$changes{'cancreate'}},$item); |
push(@{$changes{'cancreate'}},$item); |
} |
} |
} |
} |
} |
} elsif ($item eq 'emailusername') { |
} elsif ($item eq 'emailusername') { |
Line 10556 sub modify_selfcreation {
|
Line 10125 sub modify_selfcreation {
|
if (ref($cancreate{'selfcreateprocessing'}) eq 'HASH') { |
if (ref($cancreate{'selfcreateprocessing'}) eq 'HASH') { |
$save_usercreate{'cancreate'}{'selfcreateprocessing'} = $cancreate{'selfcreateprocessing'}; |
$save_usercreate{'cancreate'}{'selfcreateprocessing'} = $cancreate{'selfcreateprocessing'}; |
} |
} |
if (ref($cancreate{'emailverified'}) eq 'HASH') { |
|
$save_usercreate{'cancreate'}{'emailverified'} = $cancreate{'emailverified'}; |
|
} |
|
if (ref($cancreate{'emailoptions'}) eq 'HASH') { |
|
$save_usercreate{'cancreate'}{'emailoptions'} = $cancreate{'emailoptions'}; |
|
} |
|
if (ref($cancreate{'emaildomain'}) eq 'HASH') { |
|
$save_usercreate{'cancreate'}{'emaildomain'} = $cancreate{'emaildomain'}; |
|
} |
|
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
$save_usercreate{'cancreate'}{'statustocreate'} = $cancreate{'statustocreate'}; |
$save_usercreate{'cancreate'}{'statustocreate'} = $cancreate{'statustocreate'}; |
} |
} |
Line 10572 sub modify_selfcreation {
|
Line 10132 sub modify_selfcreation {
|
$save_usercreate{'cancreate'}{'shibenv'} = $cancreate{'shibenv'}; |
$save_usercreate{'cancreate'}{'shibenv'} = $cancreate{'shibenv'}; |
} |
} |
$save_usercreate{'cancreate'}{'emailusername'} = $cancreate{'emailusername'}; |
$save_usercreate{'cancreate'}{'emailusername'} = $cancreate{'emailusername'}; |
$save_usercreate{'email_rule'} = \%email_rule; |
$save_usercreate{'email_rule'} = \@email_rule; |
|
|
my %userconfig_hash = ( |
my %userconfig_hash = ( |
usercreation => \%save_usercreate, |
usercreation => \%save_usercreate, |
usermodification => \%save_usermodify, |
usermodification => \%save_usermodify, |
inststatus => \%save_inststatus, |
|
); |
); |
|
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%userconfig_hash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%userconfig_hash, |
$dom); |
$dom); |
# |
# |
# Accumulate details of changes to domain configuration for self-creation of usernames in $resulttext |
# Accumulate details of changes to domain cofiguration for self-creation of usernames in $resulttext |
# |
# |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
Line 10591 sub modify_selfcreation {
|
Line 10149 sub modify_selfcreation {
|
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
my %lt = &selfcreation_types(); |
my %lt = &selfcreation_types(); |
foreach my $type (@{$changes{'cancreate'}}) { |
foreach my $type (@{$changes{'cancreate'}}) { |
my $chgtext = ''; |
my $chgtext; |
if ($type eq 'selfcreate') { |
if ($type eq 'selfcreate') { |
if (@{$cancreate{$type}} == 0) { |
if (@{$cancreate{$type}} == 0) { |
$chgtext .= &mt('Self creation of a new user account is not permitted.'); |
$chgtext .= &mt('Self creation of a new user account is not permitted.'); |
Line 10606 sub modify_selfcreation {
|
Line 10164 sub modify_selfcreation {
|
if (grep(/^(login|sso)$/,@{$cancreate{$type}})) { |
if (grep(/^(login|sso)$/,@{$cancreate{$type}})) { |
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
if (@{$cancreate{'statustocreate'}} == 0) { |
if (@{$cancreate{'statustocreate'}} == 0) { |
$chgtext .= '<span class="LC_warning">'. |
$chgtext .= '<br />'. |
&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts via log-in or single sign-on."). |
'<span class="LC_warning">'. |
'</span><br />'; |
&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts."). |
|
'</span>'; |
} |
} |
} |
} |
} |
} |
if (grep(/^email$/,@{$cancreate{$type}})) { |
|
if (!@statuses) { |
|
$chgtext .= '<span class="LC_warning">'. |
|
&mt("However, e-mail verification is currently set to 'unavailable' for all user types (including 'other'), so self-creation of accounts is not possible for non-institutional log-in."). |
|
'</span><br />'; |
|
|
|
} |
|
} |
|
} |
} |
} |
} |
} elsif ($type eq 'shibenv') { |
} elsif ($type eq 'shibenv') { |
if (keys(%{$cancreate{$type}}) == 0) { |
if (keys(%{$cancreate{$type}}) == 0) { |
$chgtext .= &mt('Shibboleth-autheticated user does not use environment variables to set user information').'<br />'; |
$chgtext .= &mt('Shibboleth-autheticated user does not use environment variables to set user information'); |
} else { |
} else { |
$chgtext .= &mt('Shibboleth-autheticated user information set from environment variables, as follows:'). |
$chgtext .= &mt('Shibboleth-autheticated user information set from environment variables, as follows:'). |
'<ul>'; |
'<ul>'; |
Line 10637 sub modify_selfcreation {
|
Line 10188 sub modify_selfcreation {
|
} |
} |
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
} |
} |
} elsif ($type eq 'statustocreate') { |
} elsif ($type eq 'statustocreate') { |
if ((ref($cancreate{'selfcreate'}) eq 'ARRAY') && |
if ((ref($cancreate{'selfcreate'}) eq 'ARRAY') && |
(ref($cancreate{'statustocreate'}) eq 'ARRAY')) { |
(ref($cancreate{'statustocreate'}) eq 'ARRAY')) { |
Line 10650 sub modify_selfcreation {
|
Line 10201 sub modify_selfcreation {
|
&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts."). |
&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts."). |
'</span>'; |
'</span>'; |
} |
} |
} elsif (keys(%usertypes) > 0) { |
} elsif (ref($usertypes) eq 'HASH') { |
if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
$chgtext .= &mt('Creation of a new account for an institutional user is restricted to the following institutional affiliation(s):'); |
$chgtext .= &mt('Creation of a new account for an institutional user is restricted to the following institutional affiliation(s):'); |
} else { |
} else { |
Line 10661 sub modify_selfcreation {
|
Line 10212 sub modify_selfcreation {
|
if ($case eq 'default') { |
if ($case eq 'default') { |
$chgtext .= '<li>'.$othertitle.'</li>'; |
$chgtext .= '<li>'.$othertitle.'</li>'; |
} else { |
} else { |
$chgtext .= '<li>'.$usertypes{$case}.'</li>'; |
$chgtext .= '<li>'.$usertypes->{$case}.'</li>'; |
} |
} |
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
if (!grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
if (!grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
$chgtext .= '<span class="LC_warning">'. |
$chgtext .= '<br /><span class="LC_warning">'. |
&mt('However, users authenticated by institutional login/single sign on are not currently permitted to create accounts.'). |
&mt('However, users authenticated by institutional login/single sign on are not currently permitted to create accounts.'). |
'</span>'; |
'</span>'; |
} |
} |
Line 10678 sub modify_selfcreation {
|
Line 10229 sub modify_selfcreation {
|
$chgtext .= &mt('Although institutional affiliations permitted to create accounts were changed, self creation of accounts is not currently permitted for any authentication types.'); |
$chgtext .= &mt('Although institutional affiliations permitted to create accounts were changed, self creation of accounts is not currently permitted for any authentication types.'); |
} |
} |
} |
} |
$chgtext .= '<br />'; |
|
} |
} |
} elsif ($type eq 'selfcreateprocessing') { |
} elsif ($type eq 'selfcreateprocessing') { |
my %choices = &Apache::lonlocal::texthash ( |
my %choices = &Apache::lonlocal::texthash ( |
automatic => 'Automatic approval', |
automatic => 'Automatic approval', |
approval => 'Queued for approval', |
approval => 'Queued for approval', |
); |
); |
if (@types) { |
if (@statuses > 1) { |
if (@statuses) { |
$chgtext .= &mt('Processing of requests to create account with e-mail address as username set as follows:'). |
$chgtext .= &mt('Processing of requests to create account with e-mail verification set as follows:'). |
'<ul>'; |
'<ul>'; |
foreach my $type (@statuses) { |
foreach my $status (@statuses) { |
if ($type eq 'default') { |
if ($status eq 'default') { |
$chgtext .= '<li>'.$othertitle.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$type}}.'</li>'; |
$chgtext .= '<li>'.$othertitle.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$status}}.'</li>'; |
} else { |
} else { |
$chgtext .= '<li>'.$usertypes->{$type}.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$type}}.'</li>'; |
$chgtext .= '<li>'.$usertypes{$status}.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$status}}.'</li>'; |
} |
} |
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
|
} |
|
} else { |
|
$chgtext .= &mt('Processing of requests to create account with e-mail verification set to: "[_1]"', |
|
$choices{$cancreate{'selfcreateprocessing'}{'default'}}); |
|
} |
|
} elsif ($type eq 'emailverified') { |
|
my %options = &Apache::lonlocal::texthash ( |
|
all => 'Same as e-mail', |
|
first => 'Omit @domain', |
|
free => 'Free to choose', |
|
); |
|
if (@types) { |
|
if (@statuses) { |
|
$chgtext .= &mt('For self-created accounts verified by e-mail address, username is set as follows:'). |
|
'<ul>'; |
|
foreach my $status (@statuses) { |
|
if ($type eq 'default') { |
|
$chgtext .= '<li>'.$othertitle.' -- '.$options{$cancreate{'emailverified'}{$status}}.'</li>'; |
|
} else { |
|
$chgtext .= '<li>'.$usertypes{$status}.' -- '.$options{$cancreate{'emailverified'}{$status}}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
} |
|
} else { |
|
$chgtext .= &mt("For self-created accounts verified by e-mail address, user's username is: '[_1]'", |
|
$options{$cancreate{'emailverified'}{'default'}}); |
|
} |
|
} elsif ($type eq 'emailoptions') { |
|
my %options = &Apache::lonlocal::texthash ( |
|
any => 'Any e-mail', |
|
inst => 'Institutional only', |
|
noninst => 'Non-institutional only', |
|
custom => 'Custom restrictions', |
|
); |
|
if (@types) { |
|
if (@statuses) { |
|
$chgtext .= &mt('For self-created accounts verified by e-mail address, requirements for e-mail address are as follows:'). |
|
'<ul>'; |
|
foreach my $status (@statuses) { |
|
if ($type eq 'default') { |
|
$chgtext .= '<li>'.$othertitle.' -- '.$options{$cancreate{'emailoptions'}{$status}}.'</li>'; |
|
} else { |
|
$chgtext .= '<li>'.$usertypes{$status}.' -- '.$options{$cancreate{'emailoptions'}{$status}}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
} |
|
} else { |
} else { |
if ($cancreate{'emailoptions'}{'default'} eq 'any') { |
$chgtext .= &mt('Processing of requests to create account with e-mail address as username set to: "[_1]"', |
$chgtext .= &mt('For self-created accounts verified by e-mail address, any e-mail may be used'); |
$choices{$cancreate{'selfcreateprocessing'}{'default'}}); |
} else { |
|
$chgtext .= &mt('For self-created accounts verified by e-mail address, e-mail restricted to: "[_1]"', |
|
$options{$cancreate{'emailoptions'}{'default'}}); |
|
} |
|
} |
|
} elsif ($type eq 'emaildomain') { |
|
my $output; |
|
if (@statuses) { |
|
foreach my $type (@statuses) { |
|
if (ref($cancreate{'emaildomain'}{$type}) eq 'HASH') { |
|
if ($cancreate{'emailoptions'}{$type} eq 'inst') { |
|
if ($type eq 'default') { |
|
if ((ref($cancreate{'emaildomain'}{$type}) ne 'HASH') || |
|
($cancreate{'emaildomain'}{$type}{'inst'} eq '')) { |
|
$output = '<li>'.$othertitle.' -- '.&mt('No restriction on e-mail domain').'</li>'; |
|
} else { |
|
$output = '<li>'.$othertitle.' -- '.&mt("User's e-mail address needs to end: [_1]", |
|
$cancreate{'emaildomain'}{$type}{'inst'}).'</li>'; |
|
} |
|
} else { |
|
if ((ref($cancreate{'emaildomain'}{$type}) ne 'HASH') || |
|
($cancreate{'emaildomain'}{$type}{'inst'} eq '')) { |
|
$output = '<li>'.$usertypes{$type}.' -- '.&mt('No restriction on e-mail domain').'</li>'; |
|
} else { |
|
$output = '<li>'.$usertypes{$type}.' -- '.&mt("User's e-mail address needs to end: [_1]", |
|
$cancreate{'emaildomain'}{$type}{'inst'}).'</li>'; |
|
} |
|
} |
|
} elsif ($cancreate{'emailoptions'}{$type} eq 'noninst') { |
|
if ($type eq 'default') { |
|
if ((ref($cancreate{'emaildomain'}{$type}) ne 'HASH') || |
|
($cancreate{'emaildomain'}{$type}{'noninst'} eq '')) { |
|
$output = '<li>'.$othertitle.' -- '.&mt('No restriction on e-mail domain').'</li>'; |
|
} else { |
|
$output = '<li>'.$othertitle.' -- '.&mt("User's e-mail address must not end: [_1]", |
|
$cancreate{'emaildomain'}{$type}{'noninst'}).'</li>'; |
|
} |
|
} else { |
|
if ((ref($cancreate{'emaildomain'}{$type}) ne 'HASH') || |
|
($cancreate{'emaildomain'}{$type}{'noninst'} eq '')) { |
|
$output = '<li>'.$usertypes{$type}.' -- '.&mt('No restriction on e-mail domain').'</li>'; |
|
} else { |
|
$output = '<li>'.$usertypes{$type}.' -- '.&mt("User's e-mail address must not end: [_1]", |
|
$cancreate{'emaildomain'}{$type}{'noninst'}).'</li>'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($output ne '') { |
|
$chgtext .= &mt('For self-created accounts verified by e-mail address:'). |
|
'<ul>'.$output.'</ul>'; |
|
} |
} |
} elsif ($type eq 'captcha') { |
} elsif ($type eq 'captcha') { |
if ($savecaptcha{$type} eq 'notused') { |
if ($savecaptcha{$type} eq 'notused') { |
Line 10837 sub modify_selfcreation {
|
Line 10285 sub modify_selfcreation {
|
} |
} |
} elsif ($type eq 'emailusername') { |
} elsif ($type eq 'emailusername') { |
if (ref($cancreate{'emailusername'}) eq 'HASH') { |
if (ref($cancreate{'emailusername'}) eq 'HASH') { |
if (@statuses) { |
if (ref($types) eq 'ARRAY') { |
foreach my $type (@statuses) { |
foreach my $type (@{$types}) { |
if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') { |
if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') { |
if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) { |
if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) { |
$chgtext .= &mt('When self-creating account with e-mail verification, the following information will be provided by [_1]:',"'$usertypes{$type}'"). |
$chgtext .= &mt('When self-creating account with e-mail as username, the following information will be provided by [_1]:',"'$usertypes->{$type}'"). |
'<ul>'; |
'<ul>'; |
foreach my $field (@{$infofields}) { |
foreach my $field (@{$infofields}) { |
if ($cancreate{'emailusername'}{$type}{$field}) { |
if ($cancreate{'emailusername'}{$type}{$field}) { |
Line 10850 sub modify_selfcreation {
|
Line 10298 sub modify_selfcreation {
|
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
} else { |
} else { |
$chgtext .= &mt('When self creating account with e-mail verification, no information besides e-mail address will be provided by [_1].',"'$usertypes{$type}'").'<br />'; |
$chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'<br />'; |
} |
} |
} else { |
} else { |
$chgtext .= &mt('When self creating account with e-mail verficiation, no information besides e-mail address will be provided by [_1].',"'$usertypes{$type}'").'<br />'; |
$chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'<br />'; |
} |
} |
} |
} |
} |
} |
} |
} |
} elsif ($type eq 'notify') { |
} elsif ($type eq 'notify') { |
my $numapprove = 0; |
$chgtext = &mt('No Domain Coordinators will receive notification of username requests requiring approval.'); |
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
if ((grep(/^notify$/,@{$changes{'cancreate'}})) && (ref($cancreate{'notify'}) eq 'HASH')) { |
if ((grep(/^notify$/,@{$changes{'cancreate'}})) && (ref($cancreate{'notify'}) eq 'HASH')) { |
if ($cancreate{'notify'}{'approval'}) { |
if ($cancreate{'notify'}{'approval'}) { |
$chgtext .= &mt('Notification of username requests requiring approval will be sent to: ').$cancreate{'notify'}{'approval'}; |
$chgtext = &mt('Notification of username requests requiring approval will be sent to: ').$cancreate{'notify'}{'approval'}; |
$numapprove ++; |
|
} |
} |
} |
} |
} |
} |
unless ($numapprove) { |
|
$chgtext .= &mt('No Domain Coordinators will receive notification of username requests requiring approval.'); |
|
} |
|
} |
} |
if ($chgtext) { |
if ($chgtext) { |
$resulttext .= '<li>'.$chgtext.'</li>'; |
$resulttext .= '<li>'.$chgtext.'</li>'; |
} |
} |
} |
} |
} |
} |
if ((ref($changes{'email_rule'}) eq 'ARRAY') && (@{$changes{'email_rule'}} > 0)) { |
if (ref($changes{'email_rule'}) eq 'ARRAY') { |
my ($emailrules,$emailruleorder) = |
my ($emailrules,$emailruleorder) = |
&Apache::lonnet::inst_userrules($dom,'email'); |
&Apache::lonnet::inst_userrules($dom,'email'); |
foreach my $type (@{$changes{'email_rule'}}) { |
my $chgtext = '<ul>'; |
if (ref($email_rule{$type}) eq 'ARRAY') { |
foreach my $type (@email_rule) { |
my $chgtext = '<ul>'; |
if (ref($emailrules->{$type}) eq 'HASH') { |
foreach my $rule (@{$email_rule{$type}}) { |
$chgtext .= '<li>'.$emailrules->{$type}{'name'}.'</li>'; |
if (ref($emailrules->{$rule}) eq 'HASH') { |
|
$chgtext .= '<li>'.$emailrules->{$rule}{'name'}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
my $typename; |
|
if (@types) { |
|
if ($type eq 'default') { |
|
$typename = $othertitle; |
|
} else { |
|
$typename = $usertypes{$type}; |
|
} |
|
$chgtext .= &mt('(Affiliation: [_1])',$typename); |
|
} |
|
if (@{$email_rule{$type}} > 0) { |
|
$resulttext .= '<li>'. |
|
&mt('Accounts may not be created by users verified by e-mail, for e-mail addresses of the following types: ', |
|
$usertypes{$type}). |
|
$chgtext. |
|
'</li>'; |
|
} else { |
|
$resulttext .= '<li>'. |
|
&mt('There are now no restrictions on e-mail addresses which may be used for verification when a user requests an account.'). |
|
'</li>'. |
|
&mt('(Affiliation: [_1])',$typename); |
|
} |
|
} |
} |
} |
} |
} |
$chgtext .= '</ul>'; |
if (ref($changes{'inststatus'}) eq 'ARRAY') { |
if (@email_rule > 0) { |
if (ref($save_inststatus{'inststatusguest'}) eq 'ARRAY') { |
$resulttext .= '<li>'. |
if (@{$save_inststatus{'inststatusguest'}} > 0) { |
&mt('Accounts may not be created by users self-enrolling with e-mail addresses of the following types: '). |
my $chgtext = '<ul>'; |
$chgtext. |
foreach my $type (@{$save_inststatus{'inststatusguest'}}) { |
'</li>'; |
$chgtext .= '<li>'.$usertypes{$type}.'</li>'; |
} else { |
} |
$resulttext .= '<li>'. |
$chgtext .= '</ul>'; |
&mt('There are now no restrictions on e-mail addresses which may be used as a username when self-enrolling.'). |
$resulttext .= '<li>'. |
'</li>'; |
&mt('A user will self-report one of the following affiliations when requesting an account verified by e-mail: '). |
|
$chgtext. |
|
'</li>'; |
|
} else { |
|
$resulttext .= '<li>'. |
|
&mt('No affiliations available for self-reporting when requesting an account verified by e-mail.'). |
|
'</li>'; |
|
} |
|
} |
} |
} |
} |
if (ref($changes{'selfcreate'}) eq 'ARRAY') { |
if (ref($changes{'selfcreate'}) eq 'ARRAY') { |
Line 10937 sub modify_selfcreation {
|
Line 10347 sub modify_selfcreation {
|
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
foreach my $type (@{$changes{'selfcreate'}}) { |
foreach my $type (@{$changes{'selfcreate'}}) { |
my $typename = $type; |
my $typename = $type; |
if (keys(%usertypes) > 0) { |
if (ref($usertypes) eq 'HASH') { |
if ($usertypes{$type} ne '') { |
if ($usertypes->{$type} ne '') { |
$typename = $usertypes{$type}; |
$typename = $usertypes->{$type}; |
} |
} |
} |
} |
my @modifiable; |
my @modifiable; |
Line 10962 sub modify_selfcreation {
|
Line 10372 sub modify_selfcreation {
|
$resulttext .= '</ul></li>'; |
$resulttext .= '</ul></li>'; |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
my $cachetime = 24*60*60; |
|
$domdefaults{'inststatusguest'} = $save_inststatus{'inststatusguest'}; |
|
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
|
if (ref($lastactref) eq 'HASH') { |
|
$lastactref->{'domdefaults'} = 1; |
|
} |
|
} else { |
} else { |
$resulttext = &mt('No changes made to self-creation settings'); |
$resulttext = &mt('No changes made to self-creation settings'); |
} |
} |
Line 11251 sub modify_defaults {
|
Line 10655 sub modify_defaults {
|
} |
} |
my @todelete = &Apache::loncommon::get_env_multiple('form.inststatus_delete'); |
my @todelete = &Apache::loncommon::get_env_multiple('form.inststatus_delete'); |
my @allpos; |
my @allpos; |
|
my %guests; |
my %alltypes; |
my %alltypes; |
my @inststatusguest; |
my ($currtitles,$currguests,$currorder); |
if (ref($currinststatus) eq 'HASH') { |
|
if (ref($currinststatus->{'inststatusguest'}) eq 'ARRAY') { |
|
foreach my $type (@{$currinststatus->{'inststatusguest'}}) { |
|
unless (grep(/^\Q$type\E$/,@todelete)) { |
|
push(@inststatusguest,$type); |
|
} |
|
} |
|
} |
|
} |
|
my ($currtitles,$currorder); |
|
if (ref($currinststatus) eq 'HASH') { |
if (ref($currinststatus) eq 'HASH') { |
if (ref($currinststatus->{'inststatusorder'}) eq 'ARRAY') { |
if (ref($currinststatus->{'inststatusorder'}) eq 'ARRAY') { |
foreach my $type (@{$currinststatus->{'inststatusorder'}}) { |
foreach my $type (@{$currinststatus->{'inststatusorder'}}) { |
Line 11277 sub modify_defaults {
|
Line 10672 sub modify_defaults {
|
$allpos[$position] = $type; |
$allpos[$position] = $type; |
$alltypes{$type} = $env{'form.inststatus_title_'.$type}; |
$alltypes{$type} = $env{'form.inststatus_title_'.$type}; |
$alltypes{$type} =~ s/`//g; |
$alltypes{$type} =~ s/`//g; |
|
if ($env{'form.inststatus_guest_'.$type}) { |
|
$guests{$type} = 1; |
|
} |
} |
} |
} |
} |
|
if (ref($currinststatus->{'inststatusguest'}) eq 'ARRAY') { |
|
$currguests = join(',',@{$currinststatus->{'inststatusguest'}}); |
|
} |
$currorder = join(',',@{$currinststatus->{'inststatusorder'}}); |
$currorder = join(',',@{$currinststatus->{'inststatusorder'}}); |
$currtitles =~ s/,$//; |
$currtitles =~ s/,$//; |
} |
} |
Line 11287 sub modify_defaults {
|
Line 10688 sub modify_defaults {
|
my $newtype = $env{'form.addinststatus'}; |
my $newtype = $env{'form.addinststatus'}; |
$newtype =~ s/\W//g; |
$newtype =~ s/\W//g; |
unless (exists($alltypes{$newtype})) { |
unless (exists($alltypes{$newtype})) { |
|
if ($env{'form.addinststatus_guest'}) { |
|
$guests{$newtype} = 1; |
|
} |
$alltypes{$newtype} = $env{'form.addinststatus_title'}; |
$alltypes{$newtype} = $env{'form.addinststatus_title'}; |
$alltypes{$newtype} =~ s/`//g; |
$alltypes{$newtype} =~ s/`//g; |
my $position = $env{'form.addinststatus_pos'}; |
my $position = $env{'form.addinststatus_pos'}; |
Line 11296 sub modify_defaults {
|
Line 10700 sub modify_defaults {
|
} |
} |
} |
} |
} |
} |
my @orderedstatus; |
my (@orderedstatus,@orderedguests); |
foreach my $type (@allpos) { |
foreach my $type (@allpos) { |
unless (($type eq '') || (grep(/^\Q$type\E$/,@orderedstatus))) { |
unless (($type eq '') || (grep(/^\Q$type\E$/,@orderedstatus))) { |
push(@orderedstatus,$type); |
push(@orderedstatus,$type); |
|
if ($guests{$type}) { |
|
push(@orderedguests,$type); |
|
} |
} |
} |
} |
} |
foreach my $type (keys(%alltypes)) { |
foreach my $type (keys(%alltypes)) { |
Line 11310 sub modify_defaults {
|
Line 10717 sub modify_defaults {
|
$defaults_hash{'inststatus'} = { |
$defaults_hash{'inststatus'} = { |
inststatustypes => \%alltypes, |
inststatustypes => \%alltypes, |
inststatusorder => \@orderedstatus, |
inststatusorder => \@orderedstatus, |
inststatusguest => \@inststatusguest, |
inststatusguest => \@orderedguests, |
}; |
}; |
if (ref($defaults_hash{'inststatus'}) eq 'HASH') { |
if (ref($defaults_hash{'inststatus'}) eq 'HASH') { |
foreach my $item ('inststatustypes','inststatusorder','inststatusguest') { |
foreach my $item ('inststatustypes','inststatusorder','inststatusguest') { |
Line 11320 sub modify_defaults {
|
Line 10727 sub modify_defaults {
|
if ($currorder ne join(',',@orderedstatus)) { |
if ($currorder ne join(',',@orderedstatus)) { |
$changes{'inststatus'}{'inststatusorder'} = 1; |
$changes{'inststatus'}{'inststatusorder'} = 1; |
} |
} |
|
if ($currguests ne join(',',@orderedguests)) { |
|
$changes{'inststatus'}{'inststatusguest'} = 1; |
|
} |
my $newtitles; |
my $newtitles; |
foreach my $item (@orderedstatus) { |
foreach my $item (@orderedstatus) { |
$newtitles .= $alltypes{$item}.','; |
$newtitles .= $alltypes{$item}.','; |
Line 11338 sub modify_defaults {
|
Line 10748 sub modify_defaults {
|
foreach my $item (sort(keys(%changes))) { |
foreach my $item (sort(keys(%changes))) { |
if ($item eq 'inststatus') { |
if ($item eq 'inststatus') { |
if (ref($changes{'inststatus'}) eq 'HASH') { |
if (ref($changes{'inststatus'}) eq 'HASH') { |
if (@orderedstatus) { |
if (($changes{'inststatus'}{'inststatustypes'}) || $changes{'inststatus'}{'inststatusorder'}) { |
$resulttext .= '<li>'.&mt('Institutional user status types set to:').' '; |
$resulttext .= '<li>'.&mt('Institutional user status types set to:').' '; |
foreach my $type (@orderedstatus) { |
foreach my $type (@orderedstatus) { |
$resulttext .= $alltypes{$type}.', '; |
$resulttext .= $alltypes{$type}.', '; |
} |
} |
$resulttext =~ s/, $//; |
$resulttext =~ s/, $//; |
$resulttext .= '</li>'; |
$resulttext .= '</li>'; |
} else { |
} |
$resulttext .= '<li>'.&mt('Institutional user status types deleted').'</li>'; |
if ($changes{'inststatus'}{'inststatusguest'}) { |
|
$resulttext .= '<li>'; |
|
if (@orderedguests) { |
|
$resulttext .= &mt('Types assignable to "non-institutional" usernames set to:').' '; |
|
foreach my $type (@orderedguests) { |
|
$resulttext .= $alltypes{$type}.', '; |
|
} |
|
$resulttext =~ s/, $//; |
|
} else { |
|
$resulttext .= &mt('Types assignable to "non-institutional" usernames set to none.'); |
|
} |
|
$resulttext .= '</li>'; |
} |
} |
} |
} |
} else { |
} else { |
Line 12809 sub modify_selfenrollment {
|
Line 12230 sub modify_selfenrollment {
|
$resulttext .= '</ul></li>'; |
$resulttext .= '</ul></li>'; |
} |
} |
} |
} |
} |
if ((exists($changes{'admin'})) || (exists($changes{'default'}))) { |
if ((exists($changes{'admin'})) || (exists($changes{'default'}))) { |
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
if (ref($lastactref) eq 'HASH') { |
if (ref($lastactref) eq 'HASH') { |
$lastactref->{'domdefaults'} = 1; |
$lastactref->{'domdefaults'} = 1; |
} |
} |
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
Line 14096 function toggleDisplay(domForm,caller) {
|
Line 13517 function toggleDisplay(domForm,caller) {
|
var optionsElement = domForm.coursecredits; |
var optionsElement = domForm.coursecredits; |
var checkval = 1; |
var checkval = 1; |
var dispval = 'block'; |
var dispval = 'block'; |
var selfcreateRegExp = /^cancreate_emailverified/; |
|
if (caller == 'emailoptions') { |
if (caller == 'emailoptions') { |
optionsElement = domForm.cancreate_email; |
optionsElement = domForm.cancreate_email; |
} |
} |
Line 14107 function toggleDisplay(domForm,caller) {
|
Line 13527 function toggleDisplay(domForm,caller) {
|
optionsElement = domForm.canclone; |
optionsElement = domForm.canclone; |
checkval = 'instcode'; |
checkval = 'instcode'; |
} |
} |
if (selfcreateRegExp.test(caller)) { |
|
optionsElement = domForm.elements[caller]; |
|
checkval = 'other'; |
|
dispval = 'inline' |
|
} |
|
if (optionsElement.length) { |
if (optionsElement.length) { |
var currval; |
var currval; |
for (var i=0; i<optionsElement.length; i++) { |
for (var i=0; i<optionsElement.length; i++) { |