- '.$lt{$type}.'
-
-
- | ';
- if ($type eq 'version') {
- my $selector = ' |
'.
+ $datatable .= ''.
&loadbalancing_rules($dom,$intdom,$currrules{$lonhost},
$othertitle,$usertypes,$types,\%servers,
\%currbalancer,$lonhost,
@@ -5241,11 +5219,10 @@ sub print_loadbalancing {
}
sub get_loadbalancers_config {
- my ($servers,$existing,$currbalancer,$currtargets,$currrules,$currcookies) = @_;
+ my ($servers,$existing,$currbalancer,$currtargets,$currrules) = @_;
return unless ((ref($servers) eq 'HASH') &&
(ref($existing) eq 'HASH') && (ref($currbalancer) eq 'HASH') &&
- (ref($currtargets) eq 'HASH') && (ref($currrules) eq 'HASH') &&
- (ref($currcookies) eq 'HASH'));
+ (ref($currtargets) eq 'HASH') && (ref($currrules) eq 'HASH'));
if (keys(%{$existing}) > 0) {
my $oldlonhost;
foreach my $key (sort(keys(%{$existing}))) {
@@ -5264,9 +5241,6 @@ sub get_loadbalancers_config {
$currbalancer->{$key} = 1;
$currtargets->{$key} = $existing->{$key}{'targets'};
$currrules->{$key} = $existing->{$key}{'rules'};
- if ($existing->{$key}{'cookie'}) {
- $currcookies->{$key} = 1;
- }
}
}
} else {
@@ -5322,14 +5296,9 @@ sub loadbalancing_titles {
'_LC_ipchange' => &mt('Non-SSO users with IP mismatch'),
);
my @alltypes = ('_LC_adv','_LC_author','_LC_internetdom','_LC_external','_LC_ipchangesso','_LC_ipchange');
- my @available;
if (ref($types) eq 'ARRAY') {
- @available = @{$types};
+ unshift(@alltypes,@{$types},'default');
}
- unless (grep(/^default$/,@available)) {
- push(@available,'default');
- }
- unshift(@alltypes,@available);
my %titles;
foreach my $type (@alltypes) {
if ($type =~ /^_LC_/) {
@@ -5456,13 +5425,12 @@ sub contact_titles {
'adminemail' => 'Default Server Admin E-mail address',
'errormail' => 'Error reports to be e-mailed to',
'packagesmail' => 'Package update alerts to be e-mailed to',
- 'helpdeskmail' => "Helpdesk requests from all users in this domain",
- 'otherdomsmail' => 'Helpdesk requests from users in other (unconfigured) domains',
+ 'helpdeskmail' => "Helpdesk requests for this domain's users",
+ 'otherdomsmail' => 'Helpdesk requests for other (unconfigured) domains',
'lonstatusmail' => 'E-mail from nightly status check (warnings/errors)',
'requestsmail' => 'E-mail from course requests requiring approval',
'updatesmail' => 'E-mail from nightly check of LON-CAPA module integrity/updates',
'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID',
- 'hostipmail' => 'E-mail from nightly check of hostname/IP network changes',
);
my %short_titles = &Apache::lonlocal::texthash (
adminemail => 'Admin E-mail address',
@@ -5509,6 +5477,7 @@ sub tool_titles {
unofficial => 'Unofficial courses',
community => 'Communities',
textbook => 'Textbook courses',
+ placement => 'Placement tests',
);
return %titles;
}
@@ -5519,6 +5488,7 @@ sub courserequest_titles {
unofficial => 'Unofficial',
community => 'Communities',
textbook => 'Textbook',
+ placement => 'Placement tests',
norequest => 'Not allowed',
approval => 'Approval by Dom. Coord.',
validate => 'With validation',
@@ -5683,8 +5653,7 @@ sub print_usercreation {
sub print_selfcreation {
my ($position,$dom,$settings,$rowtotal) = @_;
- my (@selfcreate,$createsettings,$processing,$emailoptions,$emailverified,
- $emaildomain,$datatable);
+ my (@selfcreate,$createsettings,$processing,$datatable);
if (ref($settings) eq 'HASH') {
if (ref($settings->{'cancreate'}) eq 'HASH') {
$createsettings = $settings->{'cancreate'};
@@ -5701,22 +5670,12 @@ sub print_selfcreation {
if (ref($createsettings->{'selfcreateprocessing'}) eq 'HASH') {
$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 $numinrow = 4;
map { $radiohash{'cancreate_'.$_} = 1; } @selfcreate;
- my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
if ($position eq 'top') {
my %choices = &Apache::lonlocal::texthash (
cancreate_login => 'Institutional Login',
@@ -5731,12 +5690,14 @@ sub print_selfcreation {
($datatable,$itemcount) = &radiobutton_prefs(\%radiohash,\@toggles,\%defaultchecked,
\%choices,$itemcount,$onclick);
$$rowtotal += $itemcount;
+
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
if (ref($usertypes) eq 'HASH') {
if (keys(%{$usertypes}) > 0) {
$datatable .= &insttypes_row($createsettings,$types,$usertypes,
$dom,$numinrow,$othertitle,
- 'statustocreate',$rowtotal);
+ 'statustocreate',$$rowtotal);
$$rowtotal ++;
}
}
@@ -5749,7 +5710,7 @@ sub print_selfcreation {
$datatable .= ''.
''.&mt('Mapping of Shibboleth environment variable names to user data fields (SSO auth)').' | '.
''."\n".
- ''."\n";
+ ''."\n";
for (my $i=0; $i<@fields; $i++) {
$rem = $i%($numperrow);
if ($rem == 0) {
@@ -5781,430 +5742,150 @@ sub print_selfcreation {
$$rowtotal ++;
} elsif ($position eq 'middle') {
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') {
- @posstypes = @{$types};
- }
- unless (grep(/^default$/,@posstypes)) {
- push(@posstypes,'default');
- }
- my %usertypeshash;
- 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 ++;
+ push(@{$types},'default');
+ $usertypes->{'default'} = $othertitle;
+ foreach my $status (@{$types}) {
+ $datatable .= &modifiable_userdata_row('selfcreate',$status,$domconf{'usermodification'},
+ $numinrow,$$rowtotal,$usertypes);
+ $$rowtotal ++;
+ }
}
} else {
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 %defaultchecked = (
'cancreate_email' => 'off',
);
- my $customclass = 'LC_selfcreate_email';
- my $classprefix = 'LC_canmodify_emailusername_';
- my $optionsprefix = 'LC_options_emailusername_';
+ my $itemcount = 0;
my $display = 'none';
- my $rowstyle = 'display:none';
if (grep(/^\Qemail\E$/,@selfcreate)) {
$display = 'block';
- $rowstyle = 'display:table-row';
}
- my $onclick = "toggleRows(this.form,'cancreate_email','selfassign','$customclass','$classprefix','$optionsprefix');";
- ($datatable,$$rowtotal) = &radiobutton_prefs(\%radiohash,\@toggles,\%defaultchecked,
- \%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 $onclick = "toggleDisplay(this.form,'emailoptions');";
+ my $additional = '';
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
- my ($emailrules,$emailruleorder) =
- &Apache::lonnet::inst_userrules($dom,'email');
- my $primary_id = &Apache::lonnet::domain($dom,'primary');
- my $intdom = &Apache::lonnet::internet_dom($primary_id);
- if (ref($types) eq 'ARRAY') {
- @posstypes = @{$types};
- }
- if (@posstypes) {
- unless (grep(/^default$/,@posstypes)) {
- push(@posstypes,'default');
- }
- if (ref($usertypes) eq 'HASH') {
- %usertypeshash = %{$usertypes};
- }
- my $currassign;
- if (ref($domdefaults{'inststatusguest'}) eq 'ARRAY') {
- $currassign = {
- 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 ++;
+ my $usertypes = {};
+ my $order = [];
+ if ((ref($domdefaults{'inststatustypes'}) eq 'HASH') && (ref($domdefaults{'inststatusguest'}) eq 'ARRAY')) {
+ $usertypes = $domdefaults{'inststatustypes'};
+ $order = $domdefaults{'inststatusguest'};
+ }
+ if (ref($order) eq 'ARRAY') {
+ push(@{$order},'default');
+ if (@{$order} > 1) {
+ $usertypes->{'default'} = &mt('Other users');
+ $additional .= ' ';
+ foreach my $status (@{$order}) {
+ $additional .= ''.$usertypes->{$status}.' | ';
+ }
+ $additional .= ' ';
+ foreach my $status (@{$order}) {
+ $additional .= ''.&email_as_username($rowtotal,$processing,$status).' | ';
}
+ $additional .= '
';
+ } 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 .= ' '."\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();
$numinrow = 1;
- if (@posstypes) {
- foreach my $status (@posstypes) {
- my $rowid = $classprefix.$status;
- my $datarowstyle = 'display:none';
- if (grep(/^\Q$status\E$/,@ordered)) {
- $datarowstyle = $rowstyle;
- }
+ if (ref($order) eq 'ARRAY') {
+ foreach my $status (@{$order}) {
$datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings,
- $numinrow,$$rowtotal,\%usertypeshash,$infofields,
- $infotitles,$rowid,$customclass,$datarowstyle);
- unless ($datarowstyle eq 'display:none') {
- $$rowtotal ++;
- }
+ $numinrow,$$rowtotal,$usertypes,$infofields,$infotitles);
+ $$rowtotal ++;
}
- } else {
- $datatable .= &modifiable_userdata_row('cancreate','emailusername_default',$settings,
- $numinrow,$$rowtotal,\%usertypeshash,$infofields,
- $infotitles,'',$customclass,$rowstyle);
}
- }
- return $datatable;
-}
-
-sub selfcreate_javascript {
- return <<"ENDSCRIPT";
-
-
-
-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 = ' | '.
- "$description | \n".
- ''.
- '';
- my %headers = &Apache::lonlocal::texthash(
- approve => 'Processing',
- email => 'E-mail',
- username => 'Username',
- );
- foreach my $item ('approve','email','username') {
- $output .= ''.$headers{$item}.' | ';
- }
- $output .= ' ';
- foreach my $item ('approve','email','username') {
- $output .= '';
- 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 ++;
- }
- }
- }
- }
+ if ($processing->{'default'} eq $option) {
+ $checked = ' checked="checked"';
}
}
- }
- $onclick = ' onclick="toggleEmailOptions(this.form,'."'cancreate_emailoptions','$showcustom',".
- "'cancreate_emaildomain','$type'".');"';
- $hashref = $emailoptions;
- $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 {
+ if (!exists($processing->{$type})) {
+ if ($option eq 'automatic') {
+ $checked = ' checked="checked"';
}
} else {
- if (!exists($hashref->{$type})) {
- if ($option eq $defoption) {
- $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 .= ' ';
- if ($item eq 'email') {
- if ($option eq 'custom') {
- my $id = 'cancreate_emailrule_'.$type;
- my $display = 'none';
- if ($checked) {
- $display = 'inline';
- }
- my $numinrow = 2;
- $output .= '';
- } 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';
+ if ($processing->{$type} eq $option) {
+ $checked = ' checked="checked"';
}
- $output .= ''.
- ''.$text{$option}.' '.
- ''.
- ' ';
}
}
+ } elsif ($option eq 'automatic') {
+ $checked = ' checked="checked"';
+ }
+ my $name = 'cancreate_emailprocess';
+ if (($type ne '') && ($type ne 'default')) {
+ $name .= '_'.$type;
+ }
+ $output .= '';
+ if ($type eq '') {
+ $output .= ' ';
+ } else {
+ $output .= ' ';
}
- $output .= ' | '."\n";
}
- $output .= "
| \n";
+ $$rowtotal ++;
return $output;
}
sub captcha_choice {
- my ($context,$settings,$itemcount,$customcss,$rowstyle) = @_;
+ my ($context,$settings,$itemcount) = @_;
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext,
- $vertext,$currver);
+ $vertext,$currver);
my %lt = &captcha_phrases();
$keyentry = 'hidden';
- my $colspan=2;
if ($context eq 'cancreate') {
$rowname = &mt('CAPTCHA validation');
} elsif ($context eq 'login') {
$rowname = &mt('"Contact helpdesk" CAPTCHA validation');
- } elsif ($context eq 'passwords') {
- $rowname = &mt('"Forgot Password" CAPTCHA validation');
- $colspan=1;
}
if (ref($settings) eq 'HASH') {
if ($settings->{'captcha'}) {
@@ -6229,22 +5910,9 @@ sub captcha_choice {
} else {
$checked{'original'} = ' checked="checked"';
}
- my $css_class;
- 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 $css_class = $itemcount%2?' class="LC_odd_row"':'';
my $output = ''.
- ''.$rowname.' | '."\n".
+ ' | '.$rowname.' | '."\n".
''."\n";
foreach my $option ('original','recaptcha','notused') {
$output .= ' | '.
+ ''.
+ ''.(' 'x2).
+ ' | ';
}
$css_class = $rownum%2?' class="LC_odd_row"':'';
my $chgstr = ' onchange="javascript:reorderTypes(this.form,'."'addinststatus_pos'".');"';
@@ -6527,6 +6197,11 @@ sub print_defaults {
''.
&mt('Name displayed:').
' | '.
+ ''.
+ ''.(' 'x2).
+ ' | ';
''."\n";
$rownum ++;
}
@@ -6556,9 +6231,6 @@ sub defaults_titles {
'timezone_def' => 'Default timezone',
'datelocale_def' => 'Default locale for dates',
'portal_def' => 'Portal/Default URL',
- 'intauth_cost' => 'Encryption cost for bcrypt (positive integer)',
- 'intauth_check' => 'Check bcrypt cost if authenticated',
- 'intauth_switch' => 'Existing crypt-based switched to bcrypt on authentication',
);
if ($dom) {
my $uprimary_id = &Apache::lonnet::domain($dom,'primary');
@@ -6573,58 +6245,6 @@ sub defaults_titles {
return (\%titles);
}
-sub print_scantron {
- my ($r,$position,$dom,$confname,$settings,$rowtotal) = @_;
- if ($position eq 'top') {
- return &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
- } else {
- return &print_scantronconfig($dom,$settings,\$rowtotal);
- }
-}
-
-sub scantron_javascript {
- return <<"ENDSCRIPT";
-
-
-
-ENDSCRIPT
-
-}
-
sub print_scantronformat {
my ($r,$dom,$confname,$settings,$rowtotal) = @_;
my $itemcount = 1;
@@ -6651,8 +6271,8 @@ sub print_scantronformat {
if ($configuserok eq 'ok') {
if ($author_ok eq 'ok') {
my %legacyfile = (
- default => $Apache::lonnet::perlvar{'lonTabDir'}.'/default_scantronformat.tab',
- custom => $Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab',
+ default => $Apache::lonnet::perlvar{'lonTabDir'}.'/default_scantronformat.tab',
+ custom => $Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab',
);
my %md5chk;
foreach my $type (keys(%legacyfile)) {
@@ -6661,7 +6281,7 @@ sub print_scantronformat {
}
if ($md5chk{'default'} ne $md5chk{'custom'}) {
foreach my $type (keys(%legacyfile)) {
- ($scantronurls{$type},my $error) =
+ ($scantronurls{$type},my $error) =
&legacy_scantronformat($r,$dom,$confname,
$type,$legacyfile{$type},
$scantronurls{$type},
@@ -6672,13 +6292,13 @@ sub print_scantronformat {
}
if (keys(%error) == 0) {
$is_custom = 1;
- $confhash{'scantron'}{'scantronformat'} =
+ $confhash{'scantron'}{'scantronformat'} =
$scantronurls{'custom'};
- my $putresult =
+ my $putresult =
&Apache::lonnet::put_dom('configuration',
\%confhash,$dom);
if ($putresult ne 'ok') {
- $error{'custom'} =
+ $error{'custom'} =
''.
&mt('An error occurred updating the domain configuration: [_1]',$putresult).'';
}
@@ -6798,129 +6418,6 @@ sub legacy_scantronformat {
return ($url,$error);
}
-sub print_scantronconfig {
- my ($dom,$settings,$rowtotal) = @_;
- my $itemcount = 2;
- my $is_checked = ' checked="checked"';
- my %optionson = (
- hdr => ' checked="checked"',
- pad => ' checked="checked"',
- rem => ' checked="checked"',
- );
- my %optionsoff = (
- hdr => '',
- pad => '',
- rem => '',
- );
- my $currcsvsty = 'none';
- my ($datatable,%csvfields,%checked,%onclick,%csvoptions);
- my @fields = &scantroncsv_fields();
- my %titles = &scantronconfig_titles();
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{config}) eq 'HASH') {
- if ($settings->{config}->{dat}) {
- $checked{'dat'} = $is_checked;
- }
- if (ref($settings->{config}->{csv}) eq 'HASH') {
- if (ref($settings->{config}->{csv}->{fields}) eq 'HASH') {
- %csvfields = %{$settings->{config}->{csv}->{fields}};
- if (keys(%csvfields) > 0) {
- $checked{'csv'} = $is_checked;
- $currcsvsty = 'block';
- }
- }
- if (ref($settings->{config}->{csv}->{options}) eq 'HASH') {
- %csvoptions = %{$settings->{config}->{csv}->{options}};
- foreach my $option (keys(%optionson)) {
- unless ($csvoptions{$option}) {
- $optionsoff{$option} = $optionson{$option};
- $optionson{$option} = '';
- }
- }
- }
- }
- } else {
- $checked{'dat'} = $is_checked;
- }
- } else {
- $checked{'dat'} = $is_checked;
- }
- $onclick{'csv'} = ' onclick="toggleScantron(this.form);"';
- my $css_class = $itemcount%2? ' class="LC_odd_row"':'';
- $datatable = ''.&mt('Supported formats').' | '.
- '';
- foreach my $item ('dat','csv') {
- my $id;
- if ($item eq 'csv') {
- $id = 'id="scantronconfcsv" ';
- }
- $datatable .= ''.(' 'x3);
- if ($item eq 'csv') {
- $datatable .= ''.
- '';
- $itemcount ++;
- }
- }
- $datatable .= ' | ';
- $$rowtotal ++;
- return $datatable;
-}
-
-sub scantronconfig_titles {
- return &Apache::lonlocal::texthash(
- dat => 'Standard format (.dat)',
- csv => 'Comma separated values (.csv)',
- hdr => 'Remove first line in file (contains column titles)',
- pad => 'Prepend 0s to PaperID',
- rem => 'Remove leading spaces (except Question Response columns)',
- CODE => 'CODE',
- ID => 'Student ID',
- PaperID => 'Paper ID',
- FirstName => 'First Name',
- LastName => 'Last Name',
- FirstQuestion => 'First Question Response',
- Section => 'Section',
- );
-}
-
-sub scantroncsv_fields {
- return ('PaperID','LastName','FirstName','ID','Section','CODE','FirstQuestion');
-}
-
sub print_coursecategories {
my ($position,$dom,$hdritem,$settings,$rowtotal) = @_;
my $datatable;
@@ -6963,7 +6460,7 @@ sub print_coursecategories {
''.$lt{$type}.' ';
}
- $datatable .= '';
+ $datatable .= '';
$itemcount ++;
}
$$rowtotal += $itemcount;
@@ -6976,6 +6473,10 @@ sub print_coursecategories {
my $toggle_catscomm_dom = ' checked="checked" ';
my $can_catcomm_comm = ' ';
my $can_catcomm_dom = ' checked="checked" ';
+ my $toggle_catsplace_place = ' ';
+ my $toggle_catsplace_dom = ' checked="checked" ';
+ my $can_catplace_place = ' ';
+ my $can_catplace_dom = ' checked="checked" ';
if (ref($settings) eq 'HASH') {
if ($settings->{'togglecats'} eq 'crs') {
@@ -6994,17 +6495,28 @@ sub print_coursecategories {
$can_catcomm_comm = $can_catcomm_dom;
$can_catcomm_dom = ' ';
}
+ if ($settings->{'togglecatsplace'} eq 'place') {
+ $toggle_catsplace_place = $toggle_catsplace_dom;
+ $toggle_catsplace_dom = ' ';
+ }
+ if ($settings->{'categorizeplace'} eq 'place') {
+ $can_catplace_place = $can_catplace_dom;
+ $can_catplace_dom = ' ';
+ }
}
my %title = &Apache::lonlocal::texthash (
- togglecats => 'Show/Hide a course in catalog',
- togglecatscomm => 'Show/Hide a community in catalog',
- categorize => 'Assign a category to a course',
- categorizecomm => 'Assign a category to a community',
+ togglecats => 'Show/Hide a course in catalog',
+ togglecatscomm => 'Show/Hide a community in catalog',
+ togglecatsplace => 'Show/Hide a placement test in catalog',
+ categorize => 'Assign a category to a course',
+ categorizecomm => 'Assign a category to a community',
+ categorizeplace => 'Assign a category to a placement test',
);
my %level = &Apache::lonlocal::texthash (
- dom => 'Set in Domain',
- crs => 'Set in Course',
- comm => 'Set in Community',
+ dom => 'Set in Domain',
+ crs => 'Set in Course',
+ comm => 'Set in Community',
+ place => 'Set in Placement Test',
);
$datatable = ''.
''.$title{'togglecats'}.' | '.
@@ -7034,8 +6546,22 @@ sub print_coursecategories {
$can_catcomm_dom.' value="dom" />'.$level{'dom'}.' '.
''.
+ ' '.
+ ''.$title{'togglecatsplace'}.' | '.
+ ' '.
+ ' | '.
+ ' '.
+ ''.$title{'categorizeplace'}.' | '.
+ ''.
+ ' '.
+ ' | '.
' ';
- $$rowtotal += 4;
+ $$rowtotal += 6;
} else {
my $css_class;
my $itemcount = 1;
@@ -7060,12 +6586,15 @@ sub print_coursecategories {
my %default_names = (
instcode => &mt('Official courses'),
communities => &mt('Communities'),
+ placement => &mt('Placement Tests'),
);
if ((!grep(/^instcode$/,@{$cats[0]})) ||
($cathash->{'instcode::0'} eq '') ||
(!grep(/^communities$/,@{$cats[0]})) ||
- ($cathash->{'communities::0'} eq '')) {
+ ($cathash->{'communities::0'} eq '') ||
+ (!grep(/^placement$/,@{$cats[0]})) ||
+ ($cathash->{'placement::0'} eq '')) {
$maxnum ++;
}
my $lastidx;
@@ -7086,7 +6615,7 @@ sub print_coursecategories {
$datatable .= '';
}
$datatable .= '';
- if ($parent eq 'instcode' || $parent eq 'communities') {
+ if ($parent eq 'instcode' || $parent eq 'communities' || $parent eq 'placement') {
$datatable .= ''
.$default_names{$parent}.'';
if ($parent eq 'instcode') {
@@ -7109,7 +6638,7 @@ sub print_coursecategories {
$datatable .= '';
- if ($parent eq 'communities') {
+ if (($parent eq 'communities') || ($parent eq 'placement')) {
$datatable .= ' | ';
}
$datatable .= ' | ';
@@ -7141,7 +6670,7 @@ sub print_coursecategories {
.''
.' '."\n";
$itemcount ++;
- foreach my $default ('instcode','communities') {
+ foreach my $default ('instcode','communities','placement') {
if ((!grep(/^\Q$default\E$/,@{$cats[0]})) || ($cathash->{$default.'::0'} eq '')) {
$css_class = $itemcount%2?' class="LC_odd_row"':'';
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$default"."_pos','$lastidx'".');"';
@@ -7174,7 +6703,7 @@ sub print_coursecategories {
$datatable .= &initialize_categories($itemcount);
}
} else {
- $datatable .= ''.$hdritem->{'header'}->[1]->{'col2'}.' | '
+ $datatable .= ''.$hdritem->{'header'}->[1]->{'col2'}.' | '
.&initialize_categories($itemcount);
}
$$rowtotal += $itemcount;
@@ -7222,7 +6751,7 @@ sub print_serverstatuses {
''.
''.
- ''."\n";
+ ''."\n";
}
$$rowtotal += $rownum;
return $datatable;
@@ -7230,9 +6759,9 @@ sub print_serverstatuses {
sub serverstatus_pages {
return ('userstatus','lonstatus','loncron','server-status','codeversions',
- 'checksums','clusterstatus','metadata_keywords','metadata_harvest',
- 'takeoffline','takeonline','showenv','toggledebug','ping','domconf',
- 'uniquecodes','diskusage','coursecatalog');
+ 'checksums','clusterstatus','certstatus','metadata_keywords',
+ 'metadata_harvest','takeoffline','takeonline','showenv','toggledebug',
+ 'ping','domconf','uniquecodes','diskusage','coursecatalog');
}
sub defaults_javascript {
@@ -7298,94 +6827,6 @@ ENDSCRIPT
}
}
-sub passwords_javascript {
- my %intalert = &Apache::lonlocal::texthash (
- authcheck => 'Warning: disallowing login for an authenticated user if the stored cost is less than the default will require a password reset by/for the user.',
- authcost => 'Warning: bcrypt encryption cost for internal authentication must be an integer.',
- passmin => 'Warning: minimum password length must be a positive integer greater than 6.',
- passmax => 'Warning: maximum password length must be a positive integer (or blank).',
- passexp => 'Warning: days before password expiration must be a positive integer (or blank).',
- passnum => 'Warning: number of previous passwords to save must be a positive integer (or blank).',
- );
- &js_escape(\%intalert);
- my $defmin = $Apache::lonnet::passwdmin;
- my $intauthjs = <<"ENDSCRIPT";
-
-function warnIntAuth(field) {
- if (field.name == 'intauth_check') {
- if (field.value == '2') {
- alert('$intalert{authcheck}');
- }
- }
- if (field.name == 'intauth_cost') {
- field.value.replace(/\s/g,'');
- if (field.value != '') {
- var regexdigit=/^\\d+\$/;
- if (!regexdigit.test(field.value)) {
- alert('$intalert{authcost}');
- }
- }
- }
- return;
-}
-
-function warnIntPass(field) {
- field.value.replace(/^\s+/,'');
- field.value.replace(/\s+\$/,'');
- var regexdigit=/^\\d+\$/;
- if (field.name == 'passwords_min') {
- if (field.value == '') {
- alert('$intalert{passmin}');
- field.value = '$defmin';
- } else {
- if (!regexdigit.test(field.value)) {
- alert('$intalert{passmin}');
- field.value = '$defmin';
- }
- var minval = parseInt(field.value,10);
- if (minval < $defmin) {
- alert('$intalert{passmin}');
- field.value = '$defmin';
- }
- }
- } else {
- if (field.value == '0') {
- field.value = '';
- }
- if (field.value != '') {
- if (field.name == 'passwords_expire') {
- var regexpposnum=/^\\d+(|\\.\\d*)\$/;
- if (!regexpposnum.test(field.value)) {
- alert('$intalert{passexp}');
- field.value = '';
- } else {
- var expval = parseFloat(field.value);
- if (expval == 0) {
- alert('$intalert{passexp}');
- field.value = '';
- }
- }
- } else {
- if (!regexdigit.test(field.value)) {
- if (field.name == 'passwords_max') {
- alert('$intalert{passmax}');
- } else {
- if (field.name == 'passwords_numsaved') {
- alert('$intalert{passnum}');
- }
- }
- field.value = '';
- }
- }
- }
- }
- return;
-}
-
-ENDSCRIPT
- return &Apache::lonhtmlcommon::scripttag($intauthjs);
-}
-
sub coursecategories_javascript {
my ($settings) = @_;
my ($output,$jstext,$cathash);
@@ -7410,9 +6851,11 @@ sub coursecategories_javascript {
}
my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"');
my $communities_reserved = &mt('The name: [_1] is a reserved category.','"communities"');
+ my $placement_reserved = &mt('The name: [_1] is a reserved category.','"placement"');
my $choose_again = "\n".&mt('Please use a different name for the new top level category.');
&js_escape(\$instcode_reserved);
&js_escape(\$communities_reserved);
+ &js_escape(\$placement_reserved);
&js_escape(\$choose_again);
$output = <<"ENDSCRIPT";
|