--- loncom/interface/domainprefs.pm 2014/05/23 08:34:54 1.160.6.48
+++ loncom/interface/domainprefs.pm 2015/03/13 13:53:07 1.160.6.58
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.48 2014/05/23 08:34:54 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.58 2015/03/13 13:53:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -250,6 +250,8 @@ sub handler {
header => [{col1 => 'Log-in Page Items',
col2 => '',},
{col1 => 'Log-in Help',
+ col2 => 'Value'},
+ {col1 => 'Custom HTML in document head',
col2 => 'Value'}],
print => \&print_login,
modify => \&modify_login,
@@ -463,6 +465,8 @@ sub handler {
{col1 => 'Log-in Page Items',
col2 => ''},
{col1 => 'Log-in Help',
+ col2 => 'Value'},
+ {col1 => 'Custom HTML in document head',
col2 => 'Value'}],
print => \&print_login,
modify => \&modify_login,
@@ -652,7 +656,7 @@ sub print_config_box {
my $colspan = '';
my $rightcolspan = '';
if (($action eq 'rolecolors') || ($action eq 'defaults') ||
- (($action eq 'login') && ($numheaders < 3))) {
+ (($action eq 'login') && ($numheaders < 4))) {
$colspan = ' colspan="2"';
}
if ($action eq 'usersessions') {
@@ -668,13 +672,13 @@ sub print_config_box {
';
$rowtotal ++;
if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') ||
- ($action eq 'usermodification') || ($action eq 'defaults') ||
+ ($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') ||
($action eq 'selfenrollment') || ($action eq 'usersessions')) {
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal);
} elsif ($action eq 'coursecategories') {
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);
} elsif ($action eq 'login') {
- if ($numheaders == 3) {
+ if ($numheaders == 4) {
$colspan = ' colspan="2"';
$output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal);
} else {
@@ -727,7 +731,7 @@ sub print_config_box {
($action eq 'defaults')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'login') {
- if ($numheaders == 3) {
+ if ($numheaders == 4) {
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
@@ -743,9 +747,31 @@ sub print_config_box {
} else {
$output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal);
}
+ $output .= '
+
+
+
+
+
+
+ ';
+ if ($numheaders == 4) {
+ $output .= '
+ '.&mt($item->{'header'}->[3]->{'col1'}).' |
+ '.&mt($item->{'header'}->[3]->{'col2'}).' |
+ ';
+ } else {
+ $output .= '
+ '.&mt($item->{'header'}->[2]->{'col1'}).' |
+ '.&mt($item->{'header'}->[2]->{'col2'}).' |
+ ';
+ }
+ $rowtotal ++;
+ $output .= &print_login('headtag',$dom,$confname,$phase,$settings,\$rowtotal);
} elsif ($action eq 'requestcourses') {
- $output .= &print_requestmail($dom,$action,$settings,\$rowtotal).
- &print_studentcode($settings,\$rowtotal).'
+ $output .= &print_requestmail($dom,$action,$settings,\$rowtotal);
+ $rowtotal ++;
+ $output .= &print_studentcode($settings,\$rowtotal).'
|
@@ -780,6 +806,7 @@ sub print_config_box {
&print_validation_rows('requestcourses',$dom,$settings,\$rowtotal);
} elsif ($action eq 'requestauthor') {
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal);
+ $rowtotal ++;
} elsif ($action eq 'rolecolors') {
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'
@@ -865,6 +892,8 @@ sub print_config_box {
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'helpsettings') {
$output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal);
+ } elsif ($action eq 'coursedefaults') {
+ $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
}
}
$output .= '
@@ -1161,6 +1190,57 @@ sub print_login {
$itemcount ++;
}
$datatable .= &captcha_choice('login',$settings,$itemcount);
+ } elsif ($caller eq 'headtag') {
+ my %domservers = &Apache::lonnet::get_servers($dom);
+ my $choice = $choices{'headtag'};
+ $css_class = ' class="LC_odd_row"';
+ $datatable .= ''.$choice.' | '.
+ ' |
';
}
return $datatable;
}
@@ -1194,6 +1274,9 @@ sub login_choices {
link => "Link",
alink => "Active link",
vlink => "Visited link",
+ headtag => "Custom markup",
+ action => "Action",
+ current => "Current",
);
return %choices;
}
@@ -2056,7 +2139,6 @@ sub print_requestmail {
$datatable .= &mt('There are no active Domain Coordinators');
}
$datatable .='';
- $$rowtotal += $rows;
return $datatable;
}
@@ -2065,9 +2147,11 @@ sub print_studentcode {
my $rownum = 0;
my ($output,%current);
my @crstypes = ('official','unofficial','community','textbook');
- if (ref($settings->{'uniquecode'}) eq 'HASH') {
- foreach my $type (@crstypes) {
- $current{$type} = $settings->{'uniquecode'}{$type};
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{'uniquecode'}) eq 'HASH') {
+ foreach my $type (@crstypes) {
+ $current{$type} = $settings->{'uniquecode'}{$type};
+ }
}
}
$output .= ''.
@@ -2501,13 +2585,15 @@ sub print_autocreate {
$createoff{'req'}.' value="0" />'.&mt('No').'';
my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',
'autocreate_xmldc',%currhash);
+ $datatable .= '
';
if ($numdc > 1) {
- $datatable .= ' |
'.
- &mt('Course creation processed as: (choose Dom. Coord.)').
- ' | '.$dctable.' |
';
+ $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)').
+ '';
} else {
- $datatable .= $dctable.' | ';
+ $datatable .= &mt('Course creation processed as:').
+ '';
}
+ $datatable .= $dctable.' | ';
$$rowtotal += $rows;
return $datatable;
}
@@ -2742,7 +2828,7 @@ sub print_helpsettings {
sub radiobutton_prefs {
my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick,
- $additional) = @_;
+ $additional,$align) = @_;
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&
(ref($choices) eq 'HASH'));
@@ -2776,8 +2862,14 @@ sub radiobutton_prefs {
$datatable .=
''.
''.$choices->{$item}.
- ' | '.
- ''.
+ ' | ';
+ if ($align eq 'left') {
+ $datatable .= '';
+ } else {
+ $datatable .= ' | ';
+ }
+ $datatable .=
+ ''.
' |
';
if ($numdc > 1) {
- $datatable .= ' |
'.
- &mt('Course creation processed as: (choose Dom. Coord.)').
- ' | '.$dctable.' |
';
+ $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)');
} else {
- $datatable .= $dctable.'';
+ $datatable .= &mt('Course creation processed as: ');
}
+ $datatable .= ''.$dctable.' | ';
$itemcount ++;
}
if (ref($rowtotal)) {
@@ -3635,9 +3778,10 @@ sub print_loadbalancing {
$disabled = ' disabled="disabled"';
}
$targettable .=
- ' | ';
+ '';
my $rem = $i%($numinrow);
if ($rem == 0) {
if (($i > 0) && ($i < $numspares-1)) {
@@ -3727,7 +3871,7 @@ sub loadbalancing_rules {
if (ref($currrules) eq 'HASH') {
$current = $currrules->{$type};
}
- if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) {
+ if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {
if ($dom ne &Apache::lonnet::host_domain($lonhost)) {
$current = '';
}
@@ -3779,7 +3923,7 @@ sub loadbalance_rule_row {
my @rulenames;
my %ruletitles = &offloadtype_text();
if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) {
- @rulenames = ('balancer','offloadedto');
+ @rulenames = ('balancer','offloadedto','specific');
} else {
@rulenames = ('default','homeserver');
if ($type eq '_LC_external') {
@@ -3790,7 +3934,7 @@ sub loadbalance_rule_row {
push(@rulenames,'none');
}
my $style = $targets_div_style;
- if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) {
+ if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {
$style = $homedom_div_style;
}
my $space;
@@ -3841,8 +3985,13 @@ sub loadbalance_rule_row {
' '.$ruletitles{$rulenames[$i]}.
- ''.$extra.'
'."\n";
+ ')"'.$checked.' /> ';
+ if (($rulenames[$i] eq 'specific') && ($type =~ /^_LC_ipchange/)) {
+ $output .= $ruletitles{'particular'};
+ } else {
+ $output .= $ruletitles{$rulenames[$i]};
+ }
+ $output .= ''.$extra.'
'."\n";
}
$output .= ''."\n";
return $output;
@@ -3857,6 +4006,7 @@ sub offloadtype_text {
'none' => 'No offload',
'balancer' => 'Session hosted on Load Balancer, after re-authentication',
'offloadedto' => 'Session hosted on offload server, after re-authentication',
+ 'particular' => 'Session hosted (after re-auth) on server:',
);
return %ruletitles;
}
@@ -4139,8 +4289,10 @@ sub print_selfcreation {
$datatable .= '';
}
my $currval;
- if (ref($createsettings->{'shibenv'}) eq 'HASH') {
- $currval = $createsettings->{'shibenv'}{$fields[$i]};
+ if (ref($createsettings) eq 'HASH') {
+ if (ref($createsettings->{'shibenv'}) eq 'HASH') {
+ $currval = $createsettings->{'shibenv'}{$fields[$i]};
+ }
}
$datatable .= ''.
''.
@@ -5144,14 +5296,14 @@ sub serverstatus_pages {
sub defaults_javascript {
my ($settings) = @_;
- my ($output,$jstext);
+ return unless (ref($settings) eq 'HASH');
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
my $maxnum = scalar(@{$settings->{'inststatusorder'}});
if ($maxnum eq '') {
$maxnum = 0;
}
$maxnum ++;
- $jstext = ' var inststatuses = Array('."'".join("','",@{$settings->{'inststatusorder'}})."'".');';
+ my $jstext = ' var inststatuses = Array('."'".join("','",@{$settings->{'inststatusorder'}})."'".');';
return <<"ENDSCRIPT";
|