version 1.31, 2007/09/27 15:36:23
|
version 1.32, 2007/11/10 03:51:46
|
Line 1289 sub contact_titles {
|
Line 1289 sub contact_titles {
|
sub print_usercreation { |
sub print_usercreation { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my $numinrow = 4; |
my $numinrow = 4; |
my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($dom); |
|
my $datatable; |
my $datatable; |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
nondc => 'User creation other than by Domain Coordinator: ', |
nondc => 'User creation other than by Domain Coordinator: ', |
Line 1316 sub print_usercreation {
|
Line 1315 sub print_usercreation {
|
} |
} |
$datatable .= '</table></td></tr>'; |
$datatable .= '</table></td></tr>'; |
$$rowtotal ++; |
$$rowtotal ++; |
|
my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($dom,'username'); |
|
my $rowcount = 0; |
if (ref($rules) eq 'HASH') { |
if (ref($rules) eq 'HASH') { |
if (keys(%{$rules}) > 0) { |
if (keys(%{$rules}) > 0) { |
$datatable .= &username_formats_row($settings,$rules, |
$datatable .= &user_formats_row('username',$settings,$rules, |
$ruleorder,$numinrow); |
$ruleorder,$numinrow,$rowcount); |
$$rowtotal ++; |
$$rowtotal ++; |
|
$rowcount ++; |
|
} |
|
} |
|
my ($idrules,$idruleorder) = &Apache::lonnet::inst_userrules($dom,'id'); |
|
if (ref($idrules) eq 'HASH') { |
|
if (keys(%{$idrules}) > 0) { |
|
$datatable .= &user_formats_row('id',$settings,$idrules, |
|
$idruleorder,$numinrow,$rowcount); |
|
$$rowtotal ++; |
|
$rowcount ++; |
} |
} |
} |
} |
} else { |
} else { |
Line 1369 sub print_usercreation {
|
Line 1380 sub print_usercreation {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
sub username_formats_row { |
sub user_formats_row { |
my ($settings,$rules,$ruleorder,$numinrow) = @_; |
my ($type,$settings,$rules,$ruleorder,$numinrow,$rowcount) = @_; |
my $output = '<tr>'. |
my $output; |
'<td><span class="LC_nobreak">'. |
my %text = ( |
&mt('Format rules to check for new usernames: '). |
'username' => 'new usernames', |
'</span></td>'. |
'id' => 'IDs', |
'<td class="LC_left_item" colspan="2"><table>'; |
); |
|
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
|
$output = '<tr '.$css_class.'>'. |
|
'<td><span class="LC_nobreak">'. |
|
&mt("Format rules to check for $text{$type}: "). |
|
'</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 1388 sub username_formats_row {
|
Line 1405 sub username_formats_row {
|
$output .= '<tr>'; |
$output .= '<tr>'; |
} |
} |
my $check = ' '; |
my $check = ' '; |
if (ref($settings->{'username_rule'}) eq 'ARRAY') { |
if (ref($settings->{$type.'_rule'}) eq 'ARRAY') { |
if (grep(/^\Q$ruleorder->[$i]\E$/,@{$settings->{'username_rule'}})) { |
if (grep(/^\Q$ruleorder->[$i]\E$/,@{$settings->{$type.'_rule'}})) { |
$check = ' checked="checked" '; |
$check = ' checked="checked" '; |
} |
} |
} |
} |
$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="username_rule" '. |
'<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>'; |
} |
} |
Line 2728 sub modify_usercreation {
|
Line 2745 sub modify_usercreation {
|
course => 'adding users to a course', |
course => 'adding users to a course', |
); |
); |
my @username_rule = &Apache::loncommon::get_env_multiple('form.username_rule'); |
my @username_rule = &Apache::loncommon::get_env_multiple('form.username_rule'); |
|
my @id_rule = &Apache::loncommon::get_env_multiple('form.id_rule'); |
my @cancreate = &Apache::loncommon::get_env_multiple('form.can_createuser'); |
my @cancreate = &Apache::loncommon::get_env_multiple('form.can_createuser'); |
if (ref($curr_usercreation{'cancreate'}) eq 'ARRAY') { |
if (ref($curr_usercreation{'cancreate'}) eq 'ARRAY') { |
foreach my $type (@{$curr_usercreation{'cancreate'}}) { |
foreach my $type (@{$curr_usercreation{'cancreate'}}) { |
Line 2758 sub modify_usercreation {
|
Line 2776 sub modify_usercreation {
|
push(@{$changes{'username_rule'}},@username_rule); |
push(@{$changes{'username_rule'}},@username_rule); |
} |
} |
|
|
|
if (ref($curr_usercreation{'id_rule'}) eq 'ARRAY') { |
|
foreach my $type (@{$curr_usercreation{'id_rule'}}) { |
|
if (!grep(/^\Q$type\E$/,@id_rule)) { |
|
push(@{$changes{'id_rule'}},$type); |
|
} |
|
} |
|
foreach my $type (@id_rule) { |
|
if (!grep(/^\Q$type\E$/,@{$curr_usercreation{'id_rule'}})) { |
|
push(@{$changes{'id_rule'}},$type); |
|
} |
|
} |
|
} else { |
|
push(@{$changes{'id_rule'}},@id_rule); |
|
} |
|
|
my @contexts = ('author','course','domain'); |
my @contexts = ('author','course','domain'); |
my @authtypes = ('int','krb4','krb5','loc'); |
my @authtypes = ('int','krb4','krb5','loc'); |
my %authhash; |
my %authhash; |
Line 2792 sub modify_usercreation {
|
Line 2825 sub modify_usercreation {
|
usercreation => { |
usercreation => { |
cancreate => \@cancreate, |
cancreate => \@cancreate, |
username_rule => \@username_rule, |
username_rule => \@username_rule, |
authtypes => \%authhash, |
id_rule => \@id_rule, |
|
authtypes => \%authhash, |
} |
} |
); |
); |
|
|
Line 2814 sub modify_usercreation {
|
Line 2848 sub modify_usercreation {
|
} |
} |
} |
} |
if (ref($changes{'username_rule'}) eq 'ARRAY') { |
if (ref($changes{'username_rule'}) eq 'ARRAY') { |
my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($dom); |
my ($rules,$ruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'username'); |
my $chgtext = '<ul>'; |
my $chgtext = '<ul>'; |
foreach my $type (@username_rule) { |
foreach my $type (@username_rule) { |
if (ref($rules->{$type}) eq 'HASH') { |
if (ref($rules->{$type}) eq 'HASH') { |
Line 2828 sub modify_usercreation {
|
Line 2863 sub modify_usercreation {
|
$resulttext .= '<li>'.&mt('There are now no username formats restricted to verified users in the institutional directory.').'</li>'; |
$resulttext .= '<li>'.&mt('There are now no username formats restricted to verified users in the institutional directory.').'</li>'; |
} |
} |
} |
} |
|
if (ref($changes{'id_rule'}) eq 'ARRAY') { |
|
my ($idrules,$idruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'id'); |
|
my $chgtext = '<ul>'; |
|
foreach my $type (@id_rule) { |
|
if (ref($idrules->{$type}) eq 'HASH') { |
|
$chgtext .= '<li>'.$idrules->{$type}{'name'}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
if (@id_rule > 0) { |
|
$resulttext .= '<li>'.&mt('IDs with the following formats are restricted to verified users in the institutional directory: ').$chgtext.'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('There are now no ID formats restricted to verified users in the institutional directory.').'</li>'; |
|
} |
|
} |
my %authname = &authtype_names(); |
my %authname = &authtype_names(); |
my %context_title = &context_names(); |
my %context_title = &context_names(); |
if (ref($changes{'authtypes'}) eq 'ARRAY') { |
if (ref($changes{'authtypes'}) eq 'ARRAY') { |