- '.$item->{'header'}->[0]->{'col1'}.' |
- '.$item->{'header'}->[0]->{'col2'}.' |
+ '.&mt($item->{'header'}->[0]->{'col1'}).' |
+ '.&mt($item->{'header'}->[0]->{'col2'}).' |
';
$rowtotal ++;
if ($action eq 'autoupdate') {
@@ -389,6 +406,8 @@ sub print_config_box {
$output .= &print_usercreation('top',$dom,$settings,\$rowtotal);
} elsif ($action eq 'usermodification') {
$output .= &print_usermodification('top',$dom,$settings,\$rowtotal);
+ } elsif ($action eq 'coursecategories') {
+ $output .= &print_coursecategories('top',$dom,$item,$settings,\$rowtotal);
} else {
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);
}
@@ -400,8 +419,10 @@ sub print_config_box {
- '.$item->{'header'}->[1]->{'col1'}.' |
- '.$item->{'header'}->[1]->{'col2'}.' |
+ '.&mt($item->{'header'}->[1]->{'col1'}).' | ';
+ my $colspan = ($action eq 'coursecategories')?' colspan="2"':'';
+ $output .= '
+ '.&mt($item->{'header'}->[1]->{'col2'}).' |
';
$rowtotal ++;
if ($action eq 'autoupdate') {
@@ -415,12 +436,14 @@ 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);
+ } elsif ($action eq 'coursecategories') {
+ $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
} else {
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'
@@ -430,8 +453,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).'
@@ -441,8 +464,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;
@@ -455,15 +478,15 @@ 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 ++;
+ $rowtotal ++;
if ($action eq 'login') {
$output .= &print_login($dom,$confname,$phase,$settings,\$rowtotal);
} elsif ($action eq 'quotas') {
@@ -498,7 +521,7 @@ function changePage(formname,newphase) {
numchecked = 0;
if (formname == document.pickactions) {
if (formname.actions.length > 0) {
- for (var i = 0; i {'cancreate'}) eq 'HASH') {
foreach my $item (@creators) {
$checked{$item} = $settings->{'cancreate'}{$item};
}
+ if (ref($settings->{'cancreate'}{'selfcreate'}) eq 'ARRAY') {
+ @selfcreate = @{$settings->{'cancreate'}{'selfcreate'}};
+ } elsif ($settings->{'cancreate'}{'selfcreate'} ne '') {
+ if ($settings->{'cancreate'}{'selfcreate'} eq 'any') {
+ @selfcreate = ('email','login','sso');
+ } elsif ($settings->{'cancreate'}{'selfcreate'} ne 'none') {
+ @selfcreate = ($settings->{'cancreate'}{'selfcreate'});
+ }
+ }
} elsif (ref($settings->{'cancreate'}) eq 'ARRAY') {
foreach my $item (@creators) {
if (grep(/^\Q$item\E$/,@{$settings->{'cancreate'}})) {
@@ -1542,10 +1575,8 @@ sub print_usercreation {
my $rownum = 0;
foreach my $item (@creators) {
$rownum ++;
- if ($checked{$item} eq '') {
- if ($item eq 'selfcreate') {
- $checked{$item} = 'none';
- } else {
+ if ($item ne 'selfcreate') {
+ if ($checked{$item} eq '') {
$checked{$item} = 'any';
}
}
@@ -1558,24 +1589,33 @@ sub print_usercreation {
$datatable .= ''.
''.$lt{$item}.
' | ';
- my @options = ('any');
+ my @options;
if ($item eq 'selfcreate') {
push(@options,('email','login','sso'));
} else {
+ @options = ('any');
if (ref($rules) eq 'HASH') {
if (keys(%{$rules}) > 0) {
push(@options,('official','unofficial'));
}
}
+ push(@options,'none');
}
- push(@options,'none');
foreach my $option (@options) {
+ my $type = 'radio';
my $check = ' ';
- if ($checked{$item} eq $option) {
- $check = ' checked="checked" ';
+ if ($item eq 'selfcreate') {
+ $type = 'checkbox';
+ if (grep(/^\Q$option\E$/,@selfcreate)) {
+ $check = ' checked="checked" ';
+ }
+ } else {
+ if ($checked{$item} eq $option) {
+ $check = ' checked="checked" ';
+ }
}
$datatable .= ' ';
}
@@ -1699,7 +1739,7 @@ sub usercreation_types {
none => 'None',
);
return %lt;
-}
+}
sub authtype_names {
my %lt = &Apache::lonlocal::texthash(
@@ -1748,7 +1788,7 @@ sub print_usermodification {
sub print_defaults {
my ($dom,$rowtotal) = @_;
- my @items = ('auth_def','auth_arg_def','lang_def');
+ my @items = ('auth_def','auth_arg_def','lang_def','timezone_def');
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
my $titles = &defaults_titles();
my $rownum = 0;
@@ -1780,6 +1820,9 @@ sub print_defaults {
'" value="'.$auth.'"'.$checked.'/>'.
$authnames{$shortauth{$auth}}.' ';
}
+ } elsif ($item eq 'timezone_def') {
+ my $includeempty = 1;
+ $datatable .= &Apache::loncommon::select_timezone($item,$domdefaults{$item},undef,$includeempty);
} else {
$datatable .= '';
@@ -1796,6 +1839,7 @@ sub defaults_titles {
'auth_def' => 'Default authentication type',
'auth_arg_def' => 'Default authentication argument',
'lang_def' => 'Default language',
+ 'timezone_def' => 'Default timezone',
);
return (\%titles);
}
@@ -1803,7 +1847,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',
@@ -1830,23 +1875,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;
+ }
}
}
}
@@ -1867,7 +1941,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 .= ' | ';
@@ -1879,14 +1957,26 @@ 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').''
.' | | | |