version 1.112, 2009/10/06 21:54:50
|
version 1.117, 2009/10/25 15:53:25
|
Line 320 sub handler {
|
Line 320 sub handler {
|
}], |
}], |
}, |
}, |
); |
); |
my %servers = &Apache::lonnet::get_servers($dom); |
my %servers = &dom_servers($dom); |
if (keys(%servers) > 1) { |
if (keys(%servers) > 1) { |
$prefs{'login'} = { text => 'Log-in page options', |
$prefs{'login'} = { text => 'Log-in page options', |
help => 'Domain_Configuration_Login_Page', |
help => 'Domain_Configuration_Login_Page', |
Line 617 sub print_login {
|
Line 617 sub print_login {
|
my $itemcount = 1; |
my $itemcount = 1; |
|
|
if ($position eq 'top') { |
if ($position eq 'top') { |
my %servers = &Apache::lonnet::get_servers($dom); |
my %servers = &dom_servers($dom); |
my $choice = $choices{'disallowlogin'}; |
my $choice = $choices{'disallowlogin'}; |
$css_class = ' class="LC_odd_row"'; |
$css_class = ' class="LC_odd_row"'; |
$datatable .= '<tr'.$css_class.'><td>'.$choices{'disallowlogin'}.'</td>'. |
$datatable .= '<tr'.$css_class.'><td>'.$choices{'disallowlogin'}.'</td>'. |
Line 634 sub print_login {
|
Line 634 sub print_login {
|
if ($disallowed{$lonhost} eq '') { |
if ($disallowed{$lonhost} eq '') { |
$direct = ''; |
$direct = ''; |
} |
} |
$datatable .= '<tr><td>'.$lonhost.'</td>'. |
$datatable .= '<tr><td>'.$servers{$lonhost}.'</td>'. |
'<td><select name="'.$lonhost.'_serverurl">'. |
'<td><select name="'.$lonhost.'_serverurl">'. |
'<option value=""'.$direct.'>'.$choices{'directlogin'}. |
'<option value=""'.$direct.'>'.$choices{'directlogin'}. |
'</option>'; |
'</option>'; |
foreach my $hostid (keys(%servers)) { |
foreach my $hostid (keys(%servers)) { |
next if ($hostid eq $lonhost); |
next if ($servers{$hostid} eq $servers{$lonhost}); |
my $selected = ''; |
my $selected = ''; |
if ($hostid eq $disallowed{$lonhost}) { |
if ($hostid eq $disallowed{$lonhost}) { |
$selected = 'selected="selected"'; |
$selected = 'selected="selected"'; |
Line 657 sub print_login {
|
Line 657 sub print_login {
|
'coursecatalog' => 'on', |
'coursecatalog' => 'on', |
'adminmail' => 'off', |
'adminmail' => 'off', |
'newuser' => 'off', |
'newuser' => 'off', |
|
'submitbugs' => 'on', |
); |
); |
my @toggles = ('coursecatalog','adminmail','newuser'); |
my @toggles = ('coursecatalog','adminmail','newuser','submitbugs'); |
my (%checkedon,%checkedoff); |
my (%checkedon,%checkedoff); |
foreach my $item (@toggles) { |
foreach my $item (@toggles) { |
if ($defaultchecked{$item} eq 'on') { |
if ($defaultchecked{$item} eq 'on') { |
Line 787 sub print_login {
|
Line 788 sub print_login {
|
sub login_choices { |
sub login_choices { |
my %choices = |
my %choices = |
&Apache::lonlocal::texthash ( |
&Apache::lonlocal::texthash ( |
coursecatalog => 'Display Course Catalog link?', |
coursecatalog => 'Display Course/Community Catalog link?', |
adminmail => "Display Administrator's E-mail Address?", |
adminmail => "Display Administrator's E-mail Address?", |
disallowlogin => "Login page requests redirected", |
disallowlogin => "Login page requests redirected", |
|
submitbugs => "Display "Submit Bug" link?", |
hostid => "Server", |
hostid => "Server", |
serverurl => "Redirect to log-in via:", |
serverurl => "Redirect to log-in via:", |
directlogin => "No redirect", |
directlogin => "No redirect", |
Line 2721 sub print_serverstatuses {
|
Line 2723 sub print_serverstatuses {
|
sub serverstatus_pages { |
sub serverstatus_pages { |
return ('userstatus','lonstatus','loncron','server-status','codeversions', |
return ('userstatus','lonstatus','loncron','server-status','codeversions', |
'clusterstatus','metadata_keywords','metadata_harvest', |
'clusterstatus','metadata_keywords','metadata_harvest', |
'takeoffline','takeonline','showenv'); |
'takeoffline','takeonline','showenv','toggledebug'); |
} |
} |
|
|
sub coursecategories_javascript { |
sub coursecategories_javascript { |
Line 3137 sub modify_login {
|
Line 3139 sub modify_login {
|
my %title = ( coursecatalog => 'Display course catalog', |
my %title = ( coursecatalog => 'Display course catalog', |
adminmail => 'Display administrator E-mail address', |
adminmail => 'Display administrator E-mail address', |
newuser => 'Link for visitors to create a user account', |
newuser => 'Link for visitors to create a user account', |
|
submitbugs => 'Link for users to submit a bug', |
loginheader => 'Log-in box header'); |
loginheader => 'Log-in box header'); |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
my %curr_loginvia; |
my %curr_loginvia; |
Line 3150 sub modify_login {
|
Line 3153 sub modify_login {
|
my %loginhash; |
my %loginhash; |
($errors,%colchanges) = &modify_colors($r,$dom,$confname,['login'], |
($errors,%colchanges) = &modify_colors($r,$dom,$confname,['login'], |
\%domconfig,\%loginhash); |
\%domconfig,\%loginhash); |
my @toggles = ('coursecatalog','adminmail','newuser'); |
my @toggles = ('coursecatalog','adminmail','newuser','submitbugs'); |
foreach my $item (@toggles) { |
foreach my $item (@toggles) { |
$loginhash{login}{$item} = $env{'form.'.$item}; |
$loginhash{login}{$item} = $env{'form.'.$item}; |
} |
} |
Line 3160 sub modify_login {
|
Line 3163 sub modify_login {
|
\%loginhash); |
\%loginhash); |
} |
} |
|
|
my %servers = &Apache::lonnet::get_servers($dom); |
my %servers = &dom_servers($dom); |
if (keys(%servers) > 1) { |
if (keys(%servers) > 1) { |
foreach my $lonhost (keys(%servers)) { |
foreach my $lonhost (keys(%servers)) { |
next if ($env{'form.'.$lonhost.'_serverurl'} eq $curr_loginvia{$lonhost}); |
next if ($env{'form.'.$lonhost.'_serverurl'} eq $curr_loginvia{$lonhost}); |
Line 3180 sub modify_login {
|
Line 3183 sub modify_login {
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%loginhash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%loginhash, |
$dom); |
$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
my @toggles = ('coursecatalog','adminmail','newuser'); |
my @toggles = ('coursecatalog','adminmail','newuser','submitbugs'); |
my %defaultchecked = ( |
my %defaultchecked = ( |
'coursecatalog' => 'on', |
'coursecatalog' => 'on', |
'adminmail' => 'off', |
'adminmail' => 'off', |
'newuser' => 'off', |
'newuser' => 'off', |
|
'submitbugs' => 'on', |
); |
); |
if (ref($domconfig{'login'}) eq 'HASH') { |
if (ref($domconfig{'login'}) eq 'HASH') { |
foreach my $item (@toggles) { |
foreach my $item (@toggles) { |
Line 5662 sub recurse_cat_deletes {
|
Line 5666 sub recurse_cat_deletes {
|
return; |
return; |
} |
} |
|
|
|
sub dom_servers { |
|
my ($dom) = @_; |
|
my (%uniqservers,%servers); |
|
my $primaryserver = &Apache::lonnet::hostname(&Apache::lonnet::domain($dom,'primary')); |
|
my @machinedoms = &Apache::lonnet::machine_domains($primaryserver); |
|
foreach my $mdom (@machinedoms) { |
|
my %currservers = %servers; |
|
my %server = &Apache::lonnet::get_servers($mdom); |
|
%servers = (%currservers,%server); |
|
} |
|
my %by_hostname; |
|
foreach my $id (keys(%servers)) { |
|
push(@{$by_hostname{$servers{$id}}},$id); |
|
} |
|
foreach my $hostname (sort(keys(%by_hostname))) { |
|
if (@{$by_hostname{$hostname}} > 1) { |
|
my $match = 0; |
|
foreach my $id (@{$by_hostname{$hostname}}) { |
|
if (&Apache::lonnet::host_domain($id) eq $dom) { |
|
$uniqservers{$id} = $hostname; |
|
$match = 1; |
|
} |
|
} |
|
unless ($match) { |
|
$uniqservers{$by_hostname{$hostname}[0]} = $hostname; |
|
} |
|
} else { |
|
$uniqservers{$by_hostname{$hostname}[0]} = $hostname; |
|
} |
|
} |
|
return %uniqservers; |
|
} |
|
|
1; |
1; |