[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm /lonnet/perl lonnet.pm
raeburn
raeburn at source.lon-capa.org
Mon Aug 8 20:54:49 EDT 2011
raeburn Tue Aug 9 00:54:49 2011 EDT
Modified files:
/loncom/interface domainprefs.pm
/loncom/lonnet/perl lonnet.pm
Log:
- Moving &dom_servers() from domainprefs.pm to &internet_dom_servers() in lonnet.pm
to facilitate re-use.
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.148 loncom/interface/domainprefs.pm:1.149
--- loncom/interface/domainprefs.pm:1.148 Tue Aug 2 03:11:48 2011
+++ loncom/interface/domainprefs.pm Tue Aug 9 00:54:43 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.148 2011/08/02 03:11:48 raeburn Exp $
+# $Id: domainprefs.pm,v 1.149 2011/08/09 00:54:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -362,7 +362,7 @@
col2 => 'Rules'}],
},
);
- my %servers = &dom_servers($dom);
+ my %servers = &Apache::lonnet::internet_dom_servers($dom);
if (keys(%servers) > 1) {
$prefs{'login'} = { text => 'Log-in page options',
help => 'Domain_Configuration_Login_Page',
@@ -707,7 +707,7 @@
my %choices = &login_choices();
if ($position eq 'top') {
- my %servers = &dom_servers($dom);
+ my %servers = &Apache::lonnet::internet_dom_servers($dom);
my $choice = $choices{'disallowlogin'};
$css_class = ' class="LC_odd_row"';
$datatable .= '<tr'.$css_class.'><td>'.$choice.'</td>'.
@@ -2307,7 +2307,7 @@
my @alldoms = &Apache::lonnet::all_domains();
my %uniques = &Apache::lonnet::get_unique_servers(\@alldoms);
- my %servers = &dom_servers($dom);
+ my %servers = &Apache::lonnet::internet_dom_servers($dom);
my $itemcount = 1;
if ($position eq 'top') {
if (keys(%uniques) > 1) {
@@ -3990,7 +3990,7 @@
\%loginhash);
}
- my %servers = &dom_servers($dom);
+ my %servers = &Apache::lonnet::internet_dom_servers($dom);
my @loginvia_attribs = ('serverpath','custompath','exempt');
if (keys(%servers) > 1) {
foreach my $lonhost (keys(%servers)) {
@@ -7062,7 +7062,7 @@
my @alldoms = &Apache::lonnet::all_domains();
my %uniques = &Apache::lonnet::get_unique_servers(\@alldoms);
- my %servers = &dom_servers($dom);
+ my %servers = &Apache::lonnet::internet_dom_servers($dom);
my %spareid = ¤t_offloads_to($dom,$domconfig{'usersessions'},\%servers);
my $savespares;
@@ -7254,39 +7254,6 @@
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;
-}
-
sub get_active_dcs {
my ($dom) = @_;
my %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc']);
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1126 loncom/lonnet/perl/lonnet.pm:1.1127
--- loncom/lonnet/perl/lonnet.pm:1.1126 Tue Aug 9 00:28:51 2011
+++ loncom/lonnet/perl/lonnet.pm Tue Aug 9 00:54:48 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.1126 2011/08/09 00:28:51 raeburn Exp $
+# $Id: lonnet.pm,v 1.1127 2011/08/09 00:54:48 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1185,6 +1185,39 @@
return;
}
+sub internet_dom_servers {
+ my ($dom) = @_;
+ my (%uniqservers,%servers);
+ my $primaryserver = &hostname(&domain($dom,'primary'));
+ my @machinedoms = &machine_domains($primaryserver);
+ foreach my $mdom (@machinedoms) {
+ my %currservers = %servers;
+ my %server = &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 (&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;
+}
+
# ---------------------- Find the homebase for a user from domain's lib servers
my %homecache;
More information about the LON-CAPA-cvs
mailing list