--- loncom/interface/domainprefs.pm 2010/08/24 13:37:50 1.139
+++ loncom/interface/domainprefs.pm 2011/02/07 21:04:09 1.142
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.139 2010/08/24 13:37:50 raeburn Exp $
+# $Id: domainprefs.pm,v 1.142 2011/02/07 21:04:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -230,7 +230,7 @@ sub handler {
},
'defaults' =>
- { text => 'Default authentication/language/timezone',
+ { text => 'Default authentication/language/timezone/portal',
help => 'Domain_Configuration_LangTZAuth',
header => [{col1 => 'Setting',
col2 => 'Value'}],
@@ -351,7 +351,7 @@ sub handler {
header => [{col1 => 'Setting',
col2 => 'Value',}],
},
- 'usersessions' =>
+ 'usersessions' =>
{text => 'User session hosting',
help => 'Domain_Configuration_User_Sessions',
header => [{col1 => 'Hosting of users from other domains',
@@ -867,7 +867,6 @@ sub print_login {
domlogo => 'Domain Logo',
login => 'Login box');
my $itemcount = 1;
- my ($css_class,$datatable);
foreach my $item (@toggles) {
$css_class = $itemcount%2?' class="LC_odd_row"':'';
$datatable .=
@@ -2287,9 +2286,17 @@ sub print_coursedefaults {
sub print_usersessions {
my ($position,$dom,$settings,$rowtotal) = @_;
my ($css_class,$datatable,%checked,%choices);
+ my (%by_ip,%by_location,@intdoms);
+ &build_location_hashes(\@intdoms,\%by_ip,\%by_location);
+ if (keys(%by_location) == 0) {
+ if ($position eq 'top') {
+ $datatable .= '
'.
+ &mt('Nothing to set here, as the cluster to which this domain belongs only contains this institution.');
+ }
+ }
my %lt = &usersession_titles();
my $itemcount = 1;
- my $numinrow = 6;
+ my $numinrow = 5;
my $prefix;
my @types;
if ($position eq 'top') {
@@ -2301,8 +2308,6 @@ sub print_usersessions {
}
my (%current,%checkedon,%checkedoff);
my @lcversions = &Apache::lonnet::all_loncaparevs();
- my (%by_ip,%by_location,@intdoms);
- &build_location_hashes(\@intdoms,\%by_ip,\%by_location);
my @locations = sort(keys(%by_location));
foreach my $type (@types) {
$checkedon{$type} = '';
@@ -2325,6 +2330,7 @@ sub print_usersessions {
}
}
foreach my $type (@types) {
+ next if ($type ne 'version' && !@locations);
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
$datatable .= '
'.$lt{$type}.'
@@ -2818,9 +2824,9 @@ sub print_usermodification {
sub print_defaults {
my ($dom,$rowtotal) = @_;
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def',
- 'datelocale_def');
+ 'datelocale_def','portal_def');
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
- my $titles = &defaults_titles();
+ my $titles = &defaults_titles($dom);
my $rownum = 0;
my ($datatable,$css_class);
foreach my $item (@items) {
@@ -2857,8 +2863,12 @@ sub print_defaults {
my $includeempty = 1;
$datatable .= &Apache::loncommon::select_datelocale($item,$domdefaults{$item},undef,$includeempty);
} else {
+ my $size;
+ if ($item eq 'portal_def') {
+ $size = ' size="25"';
+ }
$datatable .= '';
+ $domdefaults{$item}.'"'.$size.' />';
}
$datatable .= '
';
$rownum ++;
@@ -2868,13 +2878,25 @@ sub print_defaults {
}
sub defaults_titles {
+ my ($dom) = @_;
my %titles = &Apache::lonlocal::texthash (
'auth_def' => 'Default authentication type',
'auth_arg_def' => 'Default authentication argument',
'lang_def' => 'Default language',
'timezone_def' => 'Default timezone',
'datelocale_def' => 'Default locale for dates',
+ 'portal_def' => 'Portal/Default URL',
);
+ if ($dom) {
+ my $uprimary_id = &Apache::lonnet::domain($dom,'primary');
+ my $uint_dom = &Apache::lonnet::internet_dom($uprimary_id);
+ my $protocol = $Apache::lonnet::protocol{$uprimary_id};
+ $protocol = 'http' if ($protocol ne 'https');
+ if ($uint_dom) {
+ $titles{'portal_def'} .= ' '.&mt('(for example: [_1])',$protocol.'://loncapa.'.
+ $uint_dom);
+ }
+ }
return (\%titles);
}
@@ -4966,7 +4988,7 @@ sub modify_autoupdate {
middlename => 'Middle Name',
generation => 'Generation',
);
- my $othertitle = &mt('All users');
+ $othertitle = &mt('All users');
if (keys(%{$usertypes}) > 0) {
$othertitle = &mt('Other users');
}
@@ -6010,7 +6032,7 @@ sub modify_defaults {
my ($dom,$r) = @_;
my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors);
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
- my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def');
+ my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def','portal_def');
my @authtypes = ('internal','krb4','krb5','localauth');
foreach my $item (@items) {
$newvalues{$item} = $env{'form.'.$item};
@@ -6046,6 +6068,12 @@ sub modify_defaults {
push(@errors,$item);
}
}
+ } elsif ($item eq 'portal_def') {
+ if ($newvalues{$item} ne '') {
+ unless ($newvalues{$item} =~ /^https?\:\/\/(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])\/?$/) {
+ push(@errors,$item);
+ }
+ }
}
if (grep(/^\Q$item\E$/,@errors)) {
$newvalues{$item} = $domdefaults{$item};
@@ -6462,7 +6490,6 @@ sub modify_serverstatuses {
my %serverstatushash = (
serverstatuses => \%newserverstatus,
);
- my %changes;
foreach my $type (@pages) {
foreach my $setting ('namedusers','machines') {
my (@current,@new);
@@ -6725,7 +6752,7 @@ sub modify_coursedefaults {
}
} elsif ($item eq 'anonsurvey_threshold') {
$resulttext .= '
'.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'