- '.$item->{'header'}->[0]->{'col1'}.' |
- '.$item->{'header'}->[0]->{'col2'}.' |
+ '.&mt($item->{'header'}->[0]->{'col1'}).' |
+ '.&mt($item->{'header'}->[0]->{'col2'}).' |
';
$rowtotal ++;
if ($action eq 'autoupdate') {
@@ -419,10 +425,9 @@ sub print_config_box {
- '.$item->{'header'}->[1]->{'col1'}.' | ';
- my $colspan = ($action eq 'coursecategories')?' colspan="2"':'';
+ '.&mt($item->{'header'}->[1]->{'col1'}).' | ';
$output .= '
- '.$item->{'header'}->[1]->{'col2'}.' |
+ '.&mt($item->{'header'}->[1]->{'col2'}).' |
';
$rowtotal ++;
if ($action eq 'autoupdate') {
@@ -436,12 +441,24 @@ sub print_config_box {
- '.$item->{'header'}->[2]->{'col1'}.' |
- '.$item->{'header'}->[2]->{'col2'}.' | '.
+ '.&mt($item->{'header'}->[2]->{'col1'}).' |
+ '.&mt($item->{'header'}->[2]->{'col2'}).' | '.
&print_usercreation('bottom',$dom,$settings,\$rowtotal);
$rowtotal ++;
} elsif ($action eq 'usermodification') {
- $output .= &print_usermodification('bottom',$dom,$settings,\$rowtotal);
+ $output .= &print_usermodification('middle',$dom,$settings,\$rowtotal).'
+
+ |
+
+
+
+
+
+ '.&mt($item->{'header'}->[2]->{'col1'}).' |
+ '.&mt($item->{'header'}->[2]->{'col2'}).' | '.
+
+ &print_usermodification('bottom',$dom,$settings,\$rowtotal);
+ $rowtotal ++;
} elsif ($action eq 'coursecategories') {
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
} else {
@@ -453,8 +470,8 @@ sub print_config_box {
- '.$item->{'header'}->[2]->{'col1'}.' |
- '.$item->{'header'}->[2]->{'col2'}.' |
+ '.&mt($item->{'header'}->[2]->{'col1'}).' |
+ '.&mt($item->{'header'}->[2]->{'col2'}).' |
'.
&print_rolecolors($phase,'author',$dom,$confname,$settings,\$rowtotal).'
@@ -464,8 +481,8 @@ sub print_config_box {
|
- '.$item->{'header'}->[3]->{'col1'}.' |
- '.$item->{'header'}->[3]->{'col2'}.' |
+ '.&mt($item->{'header'}->[3]->{'col1'}).' |
+ '.&mt($item->{'header'}->[3]->{'col2'}).' |
'.
&print_rolecolors($phase,'admin',$dom,$confname,$settings,\$rowtotal);
$rowtotal += 2;
@@ -478,13 +495,13 @@ sub print_config_box {
';
if (($action eq 'login') || ($action eq 'directorysrch')) {
$output .= '
- '.$item->{'header'}->[0]->{'col1'}.' | ';
+ '.&mt($item->{'header'}->[0]->{'col1'}).' | ';
} else {
$output .= '
- '.$item->{'header'}->[0]->{'col1'}.' | ';
+ '.&mt($item->{'header'}->[0]->{'col1'}).' | ';
}
$output .= '
- '.$item->{'header'}->[0]->{'col2'}.' |
+ '.&mt($item->{'header'}->[0]->{'col2'}).' |
';
$rowtotal ++;
if ($action eq 'login') {
@@ -1682,10 +1699,14 @@ sub user_formats_row {
);
my $css_class = $rowcount%2?' class="LC_odd_row"':'';
$output = ''.
- ''.
- &mt("Format rules to check for $text{$type}: ").
- ' | '.
- '';
+ '';
+ if ($type eq 'email') {
+ $output .= &mt("Formats disallowed for $text{$type}: ");
+ } else {
+ $output .= &mt("Format rules to check for $text{$type}: ");
+ }
+ $output .= ' | '.
+ '';
my $rem;
if (ref($ruleorder) eq 'ARRAY') {
for (my $i=0; $i<@{$ruleorder}; $i++) {
@@ -1773,7 +1794,7 @@ sub print_usermodification {
$$rowtotal ++;
$rowcount ++;
}
- } else {
+ } elsif ($position eq 'middle') {
$context = 'course';
$rowcount = 0;
foreach my $role ('st','ep','ta','in','cr') {
@@ -1782,6 +1803,20 @@ sub print_usermodification {
$$rowtotal ++;
$rowcount ++;
}
+ } elsif ($position eq 'bottom') {
+ $context = 'selfcreate';
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
+ $usertypes->{'default'} = $othertitle;
+ if (ref($types) eq 'ARRAY') {
+ push(@{$types},'default');
+ $usertypes->{'default'} = $othertitle;
+ foreach my $status (@{$types}) {
+ $datatable .= &modifiable_userdata_row($context,$status,$settings,
+ $numinrow,$rowcount,$usertypes);
+ $$rowtotal ++;
+ $rowcount ++;
+ }
+ }
}
return $datatable;
}
@@ -1847,7 +1882,8 @@ sub defaults_titles {
sub print_scantronformat {
my ($r,$dom,$confname,$settings,$rowtotal) = @_;
my $itemcount = 1;
- my ($datatable,$css_class,$scantronurl,$is_custom,%error,%scantronurls);
+ my ($datatable,$css_class,$scantronurl,$is_custom,%error,%scantronurls,
+ %confhash);
my $switchserver = &check_switchserver($dom,$confname);
my %lt = &Apache::lonlocal::texthash (
default => 'Default scantron format file error',
@@ -1874,23 +1910,52 @@ sub print_scantronformat {
);
my %md5chk;
foreach my $type (keys(%legacyfile)) {
- $md5chk{$type} = split(/ /,`md5sum $legacyfile{$type}`);
- chop($md5chk{$type});
+ ($md5chk{$type}) = split(/ /,`md5sum $legacyfile{$type}`);
+ chomp($md5chk{$type});
}
if ($md5chk{'default'} ne $md5chk{'custom'}) {
foreach my $type (keys(%legacyfile)) {
- ($scantronurls{$type},$error{$type}) =
+ ($scantronurls{$type},my $error) =
&legacy_scantronformat($r,$dom,$confname,
$type,$legacyfile{$type},
$scantronurls{$type},
$scantronfiles{$type});
+ if ($error ne '') {
+ $error{$type} = $error;
+ }
+ }
+ if (keys(%error) == 0) {
+ $is_custom = 1;
+ $confhash{'scantron'}{'scantronformat'} =
+ $scantronurls{'custom'};
+ my $putresult =
+ &Apache::lonnet::put_dom('configuration',
+ \%confhash,$dom);
+ if ($putresult ne 'ok') {
+ $error{'custom'} =
+ ''.
+ &mt('An error occurred updating the domain configuration: [_1]',$putresult).'';
+ }
}
} else {
- ($scantronurls{'default'},$error{'default'}) =
+ ($scantronurls{'default'},my $error) =
&legacy_scantronformat($r,$dom,$confname,
'default',$legacyfile{'default'},
$scantronurls{'default'},
$scantronfiles{'default'});
+ if ($error eq '') {
+ $confhash{'scantron'}{'scantronformat'} = '';
+ my $putresult =
+ &Apache::lonnet::put_dom('configuration',
+ \%confhash,$dom);
+ if ($putresult ne 'ok') {
+ $error{'default'} =
+ ''.
+ &mt('An error occurred updating the domain configuration: [_1]',$putresult).'';
+ }
+ } else {
+ $error{'default'} = $error;
+ }
}
}
}
@@ -1911,7 +1976,11 @@ sub print_scantronformat {
$scantronurl = $scantronurls{'default'};
}
} else {
- $scantronurl = $scantronurls{'default'};
+ if ($is_custom) {
+ $scantronurl = $scantronurls{'custom'};
+ } else {
+ $scantronurl = $scantronurls{'default'};
+ }
}
$css_class = $itemcount%2?' class="LC_odd_row"':'';
$datatable .= '';
@@ -1923,16 +1992,29 @@ sub print_scantronformat {
} else {
$datatable = &mt('File unavailable for display');
}
- $datatable .= ''.&mt('Upload:').' ';
+ $datatable .= ' | ';
+ if (keys(%error) == 0) {
+ $datatable .= '';
+ if (!$switchserver) {
+ $datatable .= &mt('Upload:').' ';
+ }
+ } else {
+ my $errorstr;
+ foreach my $key (sort(keys(%error))) {
+ $errorstr .= $lt{$key}.': '.$error{$key}.' ';
+ }
+ $datatable .= ' | '.$errorstr;
+ }
} else {
if (keys(%error) > 0) {
my $errorstr;
foreach my $key (sort(keys(%error))) {
$errorstr .= $lt{$key}.': '.$error{$key}.' ';
}
- $datatable .= ' | '.$errorstr.' | ';
+ $datatable .= ' | '.$errorstr.' | ';
} elsif ($scantronurl) {
- $datatable .= ' | ' .&mt('Custom scantron format file').''
+ $datatable .= ' | '
+ .&mt('Custom scantron format file').''
.' | '
@@ -1990,7 +2072,7 @@ sub print_coursecategories {
);
my %level = &Apache::lonlocal::texthash (
dom => 'Set in "Modify Course" (Domain)',
- crs => 'Set in "Parameters" (Course)',
+ crs => 'Set in "Modify Parameters" (Course)',
);
$datatable = ' '.
''.$title{'togglecats'}.' | '.
@@ -2081,7 +2163,7 @@ sub print_coursecategories {
}
$datatable .= '';
}
- $datatable .= ''.&mt('New:').' '
+ $datatable .= ' | '.&mt('Add category:').' '
.' | '
.' '."\n";
$itemcount ++;
@@ -2282,7 +2364,7 @@ sub build_category_rows {
pop(@{$path});
}
} else {
- $text .= &mt('New:').' '.&mt('Target user with [_1] role',$rolename).' - '.&mt('modifiable fields: ');
+ if ($context eq 'selfcreate') {
+ $resulttext .= ''.&mt('Self-creation of account by users with status: [_1] ',$rolename).' - '.&mt('modifiable fields (if institutional data blank): ');
+ } else {
+ $resulttext .= ''.&mt('Target user with [_1] role',$rolename).' - '.&mt('modifiable fields: ');
+ }
foreach my $field (@fields) {
if ($modifyhash{$context}{$role}{$field}) {
push(@modifiable,$fieldtitles{$field});
@@ -4161,8 +4271,7 @@ sub modify_defaults {
}
} elsif ($item eq 'timezone_def') {
if ($newvalues{$item} ne '') {
- my @timezones = &DateTime::TimeZone->all_names;
- if (!grep(/^\Q$newvalues{$item}\E/,@timezones)) {
+ if (!DateTime::TimeZone->is_valid_name($newvalues{$item})) {
push(@errors,$item);
}
}
| | | | |