--- loncom/interface/domainprefs.pm 2013/02/02 02:54:04 1.160.6.15
+++ loncom/interface/domainprefs.pm 2012/08/25 21:48:12 1.166
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.15 2013/02/02 02:54:04 raeburn Exp $
+# $Id: domainprefs.pm,v 1.166 2012/08/25 21:48:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,7 +45,7 @@ described at http://www.lon-capa.org.
=head1 OVERVIEW
Each institution using LON-CAPA will typically have a single domain designated
-for use by individuals affiliated with the institution. Accordingly, each domain
+for use by individuals affliated with the institution. Accordingly, each domain
may define a default set of logos and a color scheme which can be used to "brand"
the LON-CAPA instance. In addition, an institution will typically have a language
and timezone which are used for the majority of courses.
@@ -86,7 +86,7 @@ $dom,$settings,$rowtotal,$action.
$dom is the domain, $settings is a reference to a hash of current settings for
the current context, $rowtotal is a reference to the scalar used to record the
-number of rows displayed on the page, and $action is the context (quotas,
+number of rows displayed on the page, and $action is the context (quotas,
requestcourses or requestauthor).
The print_quotas routine was orginally created to display/store information
@@ -210,18 +210,16 @@ sub handler {
'quotas','autoenroll','autoupdate','autocreate',
'directorysrch','usercreation','usermodification',
'contacts','defaults','scantron','coursecategories',
- 'serverstatuses','requestcourses','usersessions',
- 'loadbalancing','requestauthor'],$dom);
+ 'serverstatuses','requestcourses','helpsettings',
+ 'coursedefaults','usersessions','loadbalancing',
+ 'requestauthor'],$dom);
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
'autoupdate','autocreate','directorysrch','contacts',
'usercreation','usermodification','scantron',
'requestcourses','requestauthor','coursecategories',
- 'serverstatuses','usersessions');
- my %existing;
- if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
- %existing = %{$domconfig{'loadbalancing'}};
- }
- if ((keys(%servers) > 1) || (keys(%existing) > 0)) {
+ 'serverstatuses','helpsettings',
+ 'coursedefaults','usersessions');
+ if (keys(%servers) > 1) {
push(@prefs_order,'loadbalancing');
}
my %prefs = (
@@ -240,11 +238,10 @@ sub handler {
'login' =>
{ text => 'Log-in page options',
help => 'Domain_Configuration_Login_Page',
- header => [{col1 => 'Log-in Page Items',
- col2 => '',},
- {col1 => 'Log-in Help',
- col2 => 'Value'}],
+ header => [{col1 => 'Item',
+ col2 => '',}],
},
+
'defaults' =>
{ text => 'Default authentication/language/timezone/portal',
help => 'Domain_Configuration_LangTZAuth',
@@ -353,6 +350,28 @@ sub handler {
col3 => 'Specific IPs',
}],
},
+ 'helpsettings' =>
+ {text => 'Help page settings',
+ help => 'Domain_Configuration_Help_Settings',
+ header => [{col1 => 'Help Settings (logged-in users)',
+ col2 => 'Value'},
+ {col1 => 'Help Settings (before log-in)',
+ col2 => 'Value'}],
+ },
+ 'coursedefaults' =>
+ {text => 'Course/Community defaults',
+ help => 'Domain_Configuration_Course_Defaults',
+ header => [{col1 => 'Defaults which can be overridden in each course by a CC',
+ col2 => 'Value',},
+ {col1 => 'Defaults which can be overridden for each course by a DC',
+ col2 => 'Value',},],
+ },
+ 'privacy' =>
+ {text => 'User Privacy',
+ help => 'Domain_Configuration_User_Privacy',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ },
'usersessions' =>
{text => 'User session hosting/offloading',
help => 'Domain_Configuration_User_Sessions',
@@ -364,11 +383,11 @@ sub handler {
col2 => 'Rules'}],
},
'loadbalancing' =>
- {text => 'Dedicated Load Balancer(s)',
+ {text => 'Dedicated Load Balancer',
help => 'Domain_Configuration_Load_Balancing',
- header => [{col1 => 'Balancers',
+ header => [{col1 => 'Server',
col2 => 'Default destinations',
- col3 => 'User affiliation',
+ col3 => 'User affliation',
col4 => 'Overrides'},
],
},
@@ -379,62 +398,29 @@ sub handler {
header => [{col1 => 'Log-in Service',
col2 => 'Server Setting',},
{col1 => 'Log-in Page Items',
- col2 => ''},
- {col1 => 'Log-in Help',
- col2 => 'Value'}],
+ col2 => ''}],
};
}
-
my @roles = ('student','coordinator','author','admin');
my @actions = &Apache::loncommon::get_env_multiple('form.actions');
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:changePage(document.$phase,'pickactions')",
text=>"Settings to display/modify"});
my $confname = $dom.'-domainconfig';
-
if ($phase eq 'process') {
&Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,\@roles);
} elsif ($phase eq 'display') {
my $js = &recaptcha_js();
- if ((keys(%servers) > 1) || (keys(%existing) > 0)) {
+ if (keys(%servers) > 1) {
my ($othertitle,$usertypes,$types) =
&Apache::loncommon::sorted_inst_types($dom);
- $js .= &lonbalance_targets_js($dom,$types,\%servers,
- $domconfig{'loadbalancing'}).
- &new_spares_js().
- &common_domprefs_js().
- &Apache::loncommon::javascript_array_indexof();
+ $js = &lonbalance_targets_js($dom,$types,\%servers).
+ &new_spares_js().
+ &common_domprefs_js().
+ &Apache::loncommon::javascript_array_indexof();
}
&Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,$js);
} else {
-# check if domconfig user exists for the domain.
- my $servadm = $r->dir_config('lonAdmEMail');
- my ($configuserok,$author_ok,$switchserver) =
- &config_check($dom,$confname,$servadm);
- unless ($configuserok eq 'ok') {
- &Apache::lonconfigsettings::print_header($r,$phase,$context);
- $r->print(&mt('The domain configuration user "[_1]" has yet to be created.',
- $confname).
- '
'
- );
- if ($switchserver) {
- $r->print(&mt('Ordinarily, that domain configuration user is created when the ./UPDATE script is run to install LON-CAPA for the first time.').
- '
'.
- &mt('However, that does not apply when new domains are added to a multi-domain server, and ./UPDATE has not been run recently.').
- '
'.
- &mt('The "[_1]" user can be created automatically when a Domain Coordinator visits the web-based "Set domain configuration" screen, in a session hosted on the primary library server.',$confname).
- '
'.
- &mt('To do that now, use the following link: [_1]',$switchserver)
- );
- } else {
- $r->print(&mt('To create that user from the command line run the ./UPDATE script found in the top level directory of the extracted LON-CAPA tarball.').
- '
'.
- &mt('Once that is done, you will be able to use the web-based "Set domain configuration" to configure the domain')
- );
- }
- $r->print(&Apache::loncommon::end_page());
- return OK;
- }
if (keys(%domconfig) == 0) {
my $primarylibserv = &Apache::lonnet::domain($dom,'primary');
my @ids=&Apache::lonnet::current_machine_ids();
@@ -513,6 +499,10 @@ sub process_changes {
$output = &modify_quotas($dom,$action,%domconfig);
} elsif ($action eq 'requestauthor') {
$output = &modify_quotas($dom,$action,%domconfig);
+ } elsif ($action eq 'helpsettings') {
+ $output = &modify_helpsettings($r,$dom,$confname,%domconfig);
+ } elsif ($action eq 'coursedefaults') {
+ $output = &modify_coursedefaults($dom,%domconfig);
} elsif ($action eq 'usersessions') {
$output = &modify_usersessions($dom,%domconfig);
} elsif ($action eq 'loadbalancing') {
@@ -543,8 +533,7 @@ sub print_config_box {
if ($numheaders > 1) {
my $colspan = '';
my $rightcolspan = '';
- if (($action eq 'rolecolors') || ($action eq 'coursecategories') ||
- (($action eq 'login') && ($numheaders < 3))) {
+ if (($action eq 'rolecolors') || ($action eq 'coursecategories')) {
$colspan = ' colspan="2"';
}
if ($action eq 'usersessions') {
@@ -568,20 +557,20 @@ sub print_config_box {
} elsif ($action eq 'coursecategories') {
$output .= &print_coursecategories('top',$dom,$item,$settings,\$rowtotal);
} elsif ($action eq 'login') {
- if ($numheaders == 3) {
- $colspan = ' colspan="2"';
- $output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal);
- } else {
- $output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal);
- }
+ $output .= &print_login('top',$dom,$confname,$phase,$settings,\$rowtotal);
+ $colspan = ' colspan="2"';
} elsif ($action eq 'requestcourses') {
$output .= &print_quotas($dom,$settings,\$rowtotal,$action);
} elsif ($action eq 'requestauthor') {
$output .= &print_quotas($dom,$settings,\$rowtotal,$action);
+ } elsif ($action eq 'helpsettings') {
+ $output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'usersessions') {
$output .= &print_usersessions('top',$dom,$settings,\$rowtotal);
} elsif ($action eq 'rolecolors') {
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);
+ } elsif ($action eq 'coursedefaults') {
+ $output .= &print_coursedefaults('top',$dom,$settings,\$rowtotal);
}
$output .= '
@@ -638,26 +627,13 @@ sub print_config_box {
} elsif ($action eq 'coursecategories') {
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
} elsif ($action eq 'login') {
- if ($numheaders == 3) {
- $output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
-
-
-
-
-
-
-
- '.&mt($item->{'header'}->[2]->{'col1'}).' |
- '.&mt($item->{'header'}->[2]->{'col2'}).' | '.
- &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal);
- $rowtotal ++;
- } else {
- $output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal);
- }
+ $output .= &print_login('bottom',$dom,$confname,$phase,$settings,\$rowtotal);
} elsif ($action eq 'requestcourses') {
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal);
} elsif ($action eq 'requestauthor') {
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal);
+ } elsif ($action eq 'helpsettings') {
+ $output .= &print_helpsettings('bottom',$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'usersessions') {
$output .= &print_usersessions('middle',$dom,$settings,\$rowtotal).'
@@ -749,7 +725,10 @@ sub print_config_box {
}
$output .= ' |
';
$rowtotal ++;
- if ($action eq 'quotas') {
+ if ($action eq 'login') {
+ $output .= &print_login('bottom',$dom,$confname,$phase,$settings,
+ \$rowtotal);
+ } elsif ($action eq 'quotas') {
$output .= &print_quotas($dom,$settings,\$rowtotal,$action);
} elsif ($action eq 'autoenroll') {
$output .= &print_autoenroll($dom,$settings,\$rowtotal);
@@ -766,7 +745,7 @@ sub print_config_box {
} elsif ($action eq 'serverstatuses') {
$output .= &print_serverstatuses($dom,$settings,\$rowtotal);
} elsif ($action eq 'helpsettings') {
- $output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal);
+ $output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'loadbalancing') {
$output .= &print_loadbalancing($dom,$settings,\$rowtotal);
}
@@ -780,11 +759,11 @@ sub print_config_box {
}
sub print_login {
- my ($caller,$dom,$confname,$phase,$settings,$rowtotal) = @_;
+ my ($position,$dom,$confname,$phase,$settings,$rowtotal) = @_;
my ($css_class,$datatable);
my %choices = &login_choices();
- if ($caller eq 'service') {
+ if ($position eq 'top') {
my %servers = &Apache::lonnet::internet_dom_servers($dom);
my $choice = $choices{'disallowlogin'};
$css_class = ' class="LC_odd_row"';
@@ -811,7 +790,7 @@ sub print_login {
' | ';
return $datatable;
- } elsif ($caller eq 'page') {
- my %defaultchecked = (
- 'coursecatalog' => 'on',
- 'helpdesk' => 'on',
- 'adminmail' => 'off',
- 'newuser' => 'off',
- );
- my @toggles = ('coursecatalog','adminmail','helpdesk','newuser');
- my (%checkedon,%checkedoff);
+ }
+
+ my %defaultchecked = (
+ 'coursecatalog' => 'on',
+ 'adminmail' => 'off',
+ 'newuser' => 'off',
+ );
+ my @toggles = ('coursecatalog','adminmail','newuser');
+ my (%checkedon,%checkedoff);
+ foreach my $item (@toggles) {
+ if ($defaultchecked{$item} eq 'on') {
+ $checkedon{$item} = ' checked="checked" ';
+ $checkedoff{$item} = ' ';
+ } elsif ($defaultchecked{$item} eq 'off') {
+ $checkedoff{$item} = ' checked="checked" ';
+ $checkedon{$item} = ' ';
+ }
+ }
+ my @images = ('img','logo','domlogo','login');
+ my @logintext = ('textcol','bgcol');
+ my @bgs = ('pgbg','mainbg','sidebg');
+ my @links = ('link','alink','vlink');
+ my %designhash = &Apache::loncommon::get_domainconf($dom);
+ my %defaultdesign = %Apache::loncommon::defaultdesign;
+ my (%is_custom,%designs);
+ my %defaults = (
+ font => $defaultdesign{'login.font'},
+ );
+ foreach my $item (@images) {
+ $defaults{$item} = $defaultdesign{'login.'.$item};
+ $defaults{'showlogo'}{$item} = 1;
+ }
+ foreach my $item (@bgs) {
+ $defaults{'bgs'}{$item} = $defaultdesign{'login.'.$item};
+ }
+ foreach my $item (@logintext) {
+ $defaults{'logintext'}{$item} = $defaultdesign{'login.'.$item};
+ }
+ foreach my $item (@links) {
+ $defaults{'links'}{$item} = $defaultdesign{'login.'.$item};
+ }
+ if (ref($settings) eq 'HASH') {
foreach my $item (@toggles) {
- if ($defaultchecked{$item} eq 'on') {
- $checkedon{$item} = ' checked="checked" ';
+ if ($settings->{$item} eq '1') {
+ $checkedon{$item} = ' checked="checked" ';
$checkedoff{$item} = ' ';
- } elsif ($defaultchecked{$item} eq 'off') {
- $checkedoff{$item} = ' checked="checked" ';
+ } elsif ($settings->{$item} eq '0') {
+ $checkedoff{$item} = ' checked="checked" ';
$checkedon{$item} = ' ';
}
}
- my @images = ('img','logo','domlogo','login');
- my @logintext = ('textcol','bgcol');
- my @bgs = ('pgbg','mainbg','sidebg');
- my @links = ('link','alink','vlink');
- my %designhash = &Apache::loncommon::get_domainconf($dom);
- my %defaultdesign = %Apache::loncommon::defaultdesign;
- my (%is_custom,%designs);
- my %defaults = (
- font => $defaultdesign{'login.font'},
- );
foreach my $item (@images) {
- $defaults{$item} = $defaultdesign{'login.'.$item};
- $defaults{'showlogo'}{$item} = 1;
- }
- foreach my $item (@bgs) {
- $defaults{'bgs'}{$item} = $defaultdesign{'login.'.$item};
+ if (defined($settings->{$item})) {
+ $designs{$item} = $settings->{$item};
+ $is_custom{$item} = 1;
+ }
+ if (defined($settings->{'showlogo'}{$item})) {
+ $designs{'showlogo'}{$item} = $settings->{'showlogo'}{$item};
+ }
}
foreach my $item (@logintext) {
- $defaults{'logintext'}{$item} = $defaultdesign{'login.'.$item};
+ if ($settings->{$item} ne '') {
+ $designs{'logintext'}{$item} = $settings->{$item};
+ $is_custom{$item} = 1;
+ }
}
- foreach my $item (@links) {
- $defaults{'links'}{$item} = $defaultdesign{'login.'.$item};
+ if ($settings->{'font'} ne '') {
+ $designs{'font'} = $settings->{'font'};
+ $is_custom{'font'} = 1;
}
- if (ref($settings) eq 'HASH') {
- foreach my $item (@toggles) {
- if ($settings->{$item} eq '1') {
- $checkedon{$item} = ' checked="checked" ';
- $checkedoff{$item} = ' ';
- } elsif ($settings->{$item} eq '0') {
- $checkedoff{$item} = ' checked="checked" ';
- $checkedon{$item} = ' ';
- }
- }
- foreach my $item (@images) {
- if (defined($settings->{$item})) {
- $designs{$item} = $settings->{$item};
- $is_custom{$item} = 1;
- }
- if (defined($settings->{'showlogo'}{$item})) {
- $designs{'showlogo'}{$item} = $settings->{'showlogo'}{$item};
- }
- }
- foreach my $item (@logintext) {
- if ($settings->{$item} ne '') {
- $designs{'logintext'}{$item} = $settings->{$item};
- $is_custom{$item} = 1;
- }
- }
- if ($settings->{'font'} ne '') {
- $designs{'font'} = $settings->{'font'};
- $is_custom{'font'} = 1;
- }
- foreach my $item (@bgs) {
- if ($settings->{$item} ne '') {
- $designs{'bgs'}{$item} = $settings->{$item};
- $is_custom{$item} = 1;
- }
- }
- foreach my $item (@links) {
- if ($settings->{$item} ne '') {
- $designs{'links'}{$item} = $settings->{$item};
- $is_custom{$item} = 1;
- }
- }
- } else {
- if ($designhash{$dom.'.login.font'} ne '') {
- $designs{'font'} = $designhash{$dom.'.login.font'};
- $is_custom{'font'} = 1;
- }
- foreach my $item (@images) {
- if ($designhash{$dom.'.login.'.$item} ne '') {
- $designs{$item} = $designhash{$dom.'.login.'.$item};
- $is_custom{$item} = 1;
- }
- }
- foreach my $item (@bgs) {
- if ($designhash{$dom.'.login.'.$item} ne '') {
- $designs{'bgs'}{$item} = $designhash{$dom.'.login.'.$item};
- $is_custom{$item} = 1;
- }
+ foreach my $item (@bgs) {
+ if ($settings->{$item} ne '') {
+ $designs{'bgs'}{$item} = $settings->{$item};
+ $is_custom{$item} = 1;
}
- foreach my $item (@links) {
- if ($designhash{$dom.'.login.'.$item} ne '') {
- $designs{'links'}{$item} = $designhash{$dom.'.login.'.$item};
- $is_custom{$item} = 1;
- }
+ }
+ foreach my $item (@links) {
+ if ($settings->{$item} ne '') {
+ $designs{'links'}{$item} = $settings->{$item};
+ $is_custom{$item} = 1;
}
}
- my %alt_text = &Apache::lonlocal::texthash ( img => 'Log-in banner',
- logo => 'Institution Logo',
- domlogo => 'Domain Logo',
- login => 'Login box');
- my $itemcount = 1;
- foreach my $item (@toggles) {
- $css_class = $itemcount%2?' class="LC_odd_row"':'';
- $datatable .=
- ''.$choices{$item}.
- ' | '.
- ' | '.
- '
';
- $itemcount ++;
+ } else {
+ if ($designhash{$dom.'.login.font'} ne '') {
+ $designs{'font'} = $designhash{$dom.'.login.font'};
+ $is_custom{'font'} = 1;
}
- $datatable .= &display_color_options($dom,$confname,$phase,'login',$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal,\@logintext);
- $datatable .= '';
- } elsif ($caller eq 'help') {
- my ($defaulturl,$defaulttype,%url,%type,%lt,%langchoices);
- my $switchserver = &check_switchserver($dom,$confname);
- my $itemcount = 1;
- $defaulturl = '/adm/loginproblems.html';
- $defaulttype = 'default';
- %lt = &Apache::lonlocal::texthash (
- del => 'Delete?',
- rep => 'Replace:',
- upl => 'Upload:',
- default => 'Default',
- custom => 'Custom',
- );
- %langchoices = &Apache::lonlocal::texthash(&get_languages_hash());
- my @currlangs;
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{'helpurl'}) eq 'HASH') {
- foreach my $key (sort(keys(%{$settings->{'helpurl'}}))) {
- next if ($settings->{'helpurl'}{$key} eq '');
- $url{$key} = $settings->{'helpurl'}{$key}.'?inhibitmenu=yes';
- $type{$key} = 'custom';
- unless ($key eq 'nolang') {
- push(@currlangs,$key);
- }
- }
- } elsif ($settings->{'helpurl'} ne '') {
- $type{'nolang'} = 'custom';
- $url{'nolang'} = $settings->{'helpurl'}.'?inhibitmenu=yes';
+ foreach my $item (@images) {
+ if ($designhash{$dom.'.login.'.$item} ne '') {
+ $designs{$item} = $designhash{$dom.'.login.'.$item};
+ $is_custom{$item} = 1;
}
}
- foreach my $lang ('nolang',sort(@currlangs)) {
- $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- $datatable .= '';
- if ($url{$lang} eq '') {
- $url{$lang} = $defaulturl;
- }
- if ($type{$lang} eq '') {
- $type{$lang} = $defaulttype;
- }
- $datatable .= '';
- if ($lang eq 'nolang') {
- $datatable .= &mt('Log-in help page if no specific language file: [_1]',
- &Apache::loncommon::modal_link($url{$lang},$lt{$type{$lang}},600,500));
- } else {
- $datatable .= &mt('Log-in help page for language: [_1] is [_2]',
- $langchoices{$lang},
- &Apache::loncommon::modal_link($url{$lang},$lt{$type{$lang}},600,500));
- }
- $datatable .= ' | '."\n".
- '';
- if ($type{$lang} eq 'custom') {
- $datatable .= ' '.$lt{'rep'}.'';
- } else {
- $datatable .= $lt{'upl'};
- }
- $datatable .=' ';
- if ($switchserver) {
- $datatable .= &mt('Upload to library server: [_1]',$switchserver);
- } else {
- $datatable .= '';
+ foreach my $item (@bgs) {
+ if ($designhash{$dom.'.login.'.$item} ne '') {
+ $designs{'bgs'}{$item} = $designhash{$dom.'.login.'.$item};
+ $is_custom{$item} = 1;
}
- $datatable .= ' |
';
- $itemcount ++;
}
- my @addlangs;
- foreach my $lang (sort(keys(%langchoices))) {
- next if ((grep(/^\Q$lang\E$/,@currlangs)) || ($lang eq 'x_chef'));
- push(@addlangs,$lang);
- }
- if (@addlangs > 0) {
- my %toadd;
- map { $toadd{$_} = $langchoices{$_} ; } @addlangs;
- $toadd{''} = &mt('Select');
- $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- $datatable .= ''.
- &mt('Add log-in help page for a specific language:').' '.
- &Apache::loncommon::select_form('','loginhelpurl_add_lang',\%toadd).
- ' | '.$lt{'upl'}.' ';
- if ($switchserver) {
- $datatable .= &mt('Upload to library server: [_1]',$switchserver);
- } else {
- $datatable .= '';
+ foreach my $item (@links) {
+ if ($designhash{$dom.'.login.'.$item} ne '') {
+ $designs{'links'}{$item} = $designhash{$dom.'.login.'.$item};
+ $is_custom{$item} = 1;
}
- $datatable .= ' |
';
- $itemcount ++;
}
- $datatable .= &captcha_choice('login',$settings,$itemcount);
}
+ my %alt_text = &Apache::lonlocal::texthash ( img => 'Log-in banner',
+ logo => 'Institution Logo',
+ domlogo => 'Domain Logo',
+ login => 'Login box');
+ my $itemcount = 1;
+ foreach my $item (@toggles) {
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .=
+ ''.$choices{$item}.
+ ' | '.
+ ' | '.
+ '
';
+ $itemcount ++;
+ }
+ $datatable .= &display_color_options($dom,$confname,$phase,'login',$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal,\@logintext);
+ $datatable .= '';
return $datatable;
}
@@ -1074,7 +963,6 @@ sub login_choices {
&Apache::lonlocal::texthash (
coursecatalog => 'Display Course/Community Catalog link?',
adminmail => "Display Administrator's E-mail Address?",
- helpdesk => 'Display "Contact Helpdesk" link',
disallowlogin => "Login page requests redirected",
hostid => "Server",
server => "Redirect to:",
@@ -1195,12 +1083,13 @@ sub display_color_options {
} else {
$datatable .= ' | ';
}
- my $current_color = $designs->{'font'} ? $designs->{'font'} : $defaults->{'font'};
-
+ my $fontlink = &color_pick($phase,$role,'font',$choices->{'font'},$designs->{'font'});
$datatable .= ''.
- ' '.
- ' | ';
+ ' '.$fontlink.
+ ' '.
+ '';
unless ($role eq 'login') {
$datatable .= ''.
''.$choices->{'fontmenu'}.' | ';
@@ -1209,13 +1098,13 @@ sub display_color_options {
} else {
$datatable .= ' | ';
}
- $current_color = $designs->{'fontmenu'} ?
- $designs->{'fontmenu'} : $defaults->{'fontmenu'};
+ $fontlink = &color_pick($phase,$role,'fontmenu',$choices->{'fontmenu'},$designs->{'fontmenu'});
$datatable .= ''.
- ' '.
- ' |
';
+ ' '.$fontlink.
+ ' '.
+ '';
}
my $switchserver = &check_switchserver($dom,$confname);
foreach my $img (@{$images}) {
@@ -1342,14 +1231,13 @@ sub display_color_options {
}
$datatable .= ''.
' | ';
@@ -1371,13 +1259,13 @@ sub display_color_options {
$datatable .= ''.
'';
foreach my $item (@{$links}) {
- my $color = $designs->{'link'}{$item} ? $designs->{'link'}{$item} : $defaults->{'links'}{$item};
- $datatable .= ''."\n";
-
+ $datatable .= ' | '."\n".
+ &color_pick($phase,$role,$item,$choices->{$item},
+ $designs->{'links'}{$item});
if ($designs->{'links'}{$item}) {
- $datatable.=' ';
+ $datatable.=' ';
}
- $datatable .= '
| ';
}
$$rowtotal += $itemcount;
@@ -1507,7 +1395,7 @@ sub print_quotas {
} elsif ($context eq 'requestauthor') {
@usertools = ('author');
@options = ('norequest','approval','automatic');
- %titles = &authorrequest_titles();
+ %titles = &authorrequest_titles();
} else {
@usertools = ('aboutme','blog','webdav','portfolio');
%titles = &tool_titles();
@@ -1718,7 +1606,9 @@ sub print_quotas {
} elsif ($context eq 'requestauthor') {
my $curroption;
if (ref($settings) eq 'HASH') {
- $curroption = $settings->{'default'};
+ if (ref($settings->{'requestauthor'}) eq 'HASH') {
+ $curroption = $settings->{'requestauthor'};
+ }
}
if (!$curroption) {
$curroption = 'norequest';
@@ -1863,8 +1753,8 @@ sub print_quotas {
$checked = ' checked="checked"';
}
$datatable .= ' ';
}
} else {
@@ -1967,7 +1857,7 @@ sub print_requestmail {
$datatable .= '';
+ $fullname.'';
}
$datatable .= ' ';
} else {
@@ -2294,7 +2184,7 @@ sub print_contacts {
my @contacts = ('adminemail','supportemail');
my (%checked,%to,%otheremails,%bccemails);
my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail',
- 'requestsmail','updatesmail');
+ 'requestsmail');
foreach my $type (@mailings) {
$otheremails{$type} = '';
}
@@ -2330,7 +2220,6 @@ sub print_contacts {
$checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" ';
$checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
$checked{'requestsmail'}{'adminemail'} = ' checked="checked" ';
- $checked{'updatesmail'}{'adminemail'} = ' checked="checked" ';
}
my ($titles,$short_titles) = &contact_titles();
my $rownum = 0;
@@ -2374,18 +2263,61 @@ sub print_contacts {
}
sub print_helpsettings {
- my ($dom,$confname,$settings,$rowtotal) = @_;
- my ($datatable,$itemcount);
+ my ($position,$dom,$confname,$settings,$rowtotal) = @_;
+ my ($css_class,$datatable,$itemcount);
+ my $switchserver = &check_switchserver($dom,$confname);
$itemcount = 1;
- my (%choices,%defaultchecked,@toggles);
- $choices{'submitbugs'} = &mt('Display link to: [_1]?',
- &Apache::loncommon::modal_link('http://bugs.loncapa.org',
- &mt('LON-CAPA bug tracker'),600,500));
- %defaultchecked = ('submitbugs' => 'on');
- @toggles = ('submitbugs',);
+ if ($position eq 'top') {
+ my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles,$align);
+ $choices{'submitbugs'} = &mt('Display link to: [_1]?',
+ &Apache::loncommon::modal_link('http://bugs.loncapa.org',
+ &mt('LON-CAPA bug tracker'),600,500));
+ %defaultchecked = ('submitbugs' => 'on');
+ @toggles = ('submitbugs',);
+ $align = 'LC_left_item';
- ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
- \%choices,$itemcount);
+ ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
+ \%choices,$itemcount);
+ } else {
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable .= ' | ';
+ my $url = '/adm/loginproblems.html';
+ my $type = 'default';
+ my %lt = &Apache::lonlocal::texthash (
+ del => 'Delete?',
+ rep => 'Replace:',
+ upl => 'Upload:',
+ default => 'Default',
+ custom => 'Custom',
+ );
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{'loginhelpurl'}) eq 'HASH') {
+
+ } elsif ($settings->{'loginhelpurl'} ne '') {
+ $type = 'custom';
+ $url = $settings->{'loginhelpurl'}.'?inhibitmenu=yes';
+ }
+ }
+ $datatable .= ''.
+ &mt('Log-in help page currently in use: [_1]',
+ &Apache::loncommon::modal_link($url,$lt{$type},600,500)).
+ ' | '."\n".
+ '';
+ if ($type eq 'custom') {
+ $datatable .= ' '.$lt{'rep'}.'';
+ } else {
+ $datatable .= $lt{'upl'};
+ }
+ $datatable .=' ';
+ if ($switchserver) {
+ $datatable .= &mt('Upload to library server: [_1]',$switchserver);
+ } else {
+ $datatable .= '';
+ }
+ $datatable .= ' |
';
+ }
return $datatable;
}
@@ -2394,7 +2326,7 @@ sub radiobutton_prefs {
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&
(ref($choices) eq 'HASH'));
- my (%checkedon,%checkedoff,$datatable,$css_class);
+ my (%checkedon,%checkedoff,$datatable,$css_class,$cell_colspan);
foreach my $item (@{$toggles}) {
if ($defaultchecked->{$item} eq 'on') {
@@ -2761,10 +2693,7 @@ sub spares_row {
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
$datatable .= '
- '.
- &mt('[_1] when busy, offloads to:'
- ,''.$server.'').
- "\n";
+ '.$server.' when busy, offloads to: | '."\n";
my (%current,%canselect);
my @choices =
&possible_newspares($server,$spareid->{$server},$serverhomes,$altids);
@@ -2888,13 +2817,16 @@ sub print_loadbalancing {
my $numinrow = 1;
my $datatable;
my %servers = &Apache::lonnet::internet_dom_servers($dom);
- my (%currbalancer,%currtargets,%currrules,%existing);
- if (ref($settings) eq 'HASH') {
- %existing = %{$settings};
- }
- if ((keys(%servers) > 1) || (keys(%existing) > 0)) {
- &get_loadbalancers_config(\%servers,\%existing,\%currbalancer,
- \%currtargets,\%currrules);
+ my ($currbalancer,$currtargets,$currrules);
+ if (keys(%servers) > 1) {
+ if (ref($settings) eq 'HASH') {
+ $currbalancer = $settings->{'lonhost'};
+ $currtargets = $settings->{'targets'};
+ $currrules = $settings->{'rules'};
+ } else {
+ ($currbalancer,$currtargets) =
+ &Apache::lonnet::get_lonbalancer_config(\%servers);
+ }
} else {
return;
}
@@ -2904,190 +2836,104 @@ sub print_loadbalancing {
if (ref($types) eq 'ARRAY') {
$rownum += scalar(@{$types});
}
- my @css_class = ('LC_odd_row','LC_even_row');
- my $balnum = 0;
- my $islast;
- my (@toshow,$disabledtext);
- if (keys(%currbalancer) > 0) {
- @toshow = sort(keys(%currbalancer));
- if (scalar(@toshow) < scalar(keys(%servers)) + 1) {
- push(@toshow,'');
- }
- } else {
- @toshow = ('');
- $disabledtext = &mt('No existing load balancer');
- }
- foreach my $lonhost (@toshow) {
- if ($balnum == scalar(@toshow)-1) {
- $islast = 1;
- } else {
- $islast = 0;
- }
- my $cssidx = $balnum%2;
- my $targets_div_style = 'display: none';
- my $disabled_div_style = 'display: block';
- my $homedom_div_style = 'display: none';
- $datatable .= '
'.
- ''.
- ' ';
- if ($lonhost eq '') {
- $datatable .= '';
- if (keys(%currbalancer) > 0) {
- $datatable .= &mt('Add balancer:');
- } else {
- $datatable .= &mt('Enable balancer:');
- }
- $datatable .= ' '.
- ''."\n".
- ' '."\n";
- } else {
- $datatable .= ''.$lonhost.' '.
- ''.
- '';
- $targets_div_style = 'display: block';
- $disabled_div_style = 'display: none';
- if ($dom eq &Apache::lonnet::host_domain($lonhost)) {
- $homedom_div_style = 'display: block';
- }
- }
- $datatable .= ' | '.
- ' '.$disabledtext.' '."\n".
- ''.&mt('Offloads to:').' ';
- my ($numspares,@spares) = &count_servers($lonhost,%servers);
- my @sparestypes = ('primary','default');
- my %typetitles = &sparestype_titles();
- foreach my $sparetype (@sparestypes) {
- my $targettable;
- for (my $i=0; $i<$numspares; $i++) {
- my $checked;
- if (ref($currtargets{$lonhost}) eq 'HASH') {
- if (ref($currtargets{$lonhost}{$sparetype}) eq 'ARRAY') {
- if (grep(/^\Q$spares[$i]\E$/,@{$currtargets{$lonhost}{$sparetype}})) {
- $checked = ' checked="checked"';
- }
- }
- }
- my ($chkboxval,$disabled);
- if (($lonhost ne '') && (exists($servers{$lonhost}))) {
- $chkboxval = $spares[$i];
- }
- if (exists($currbalancer{$spares[$i]})) {
- $disabled = ' disabled="disabled"';
- }
- $targettable .=
- ' | | ';
- my $rem = $i%($numinrow);
- if ($rem == 0) {
- if (($i > 0) && ($i < $numspares-1)) {
- $targettable .= '
';
- }
- if ($i < $numspares-1) {
- $targettable .= '';
+ my $css_class = ' class="LC_odd_row"';
+ my $targets_div_style = 'display: none';
+ my $disabled_div_style = 'display: block';
+ my $homedom_div_style = 'display: none';
+ $datatable = '
'.
+ ''.
+ ' | '.
+ ' '.&mt('No dedicated Load Balancer').' '."\n".
+ ''.&mt('Offloads to:').' ';
+ my ($numspares,@spares) = &count_servers($currbalancer,%servers);
+ my @sparestypes = ('primary','default');
+ my %typetitles = &sparestype_titles();
+ foreach my $sparetype (@sparestypes) {
+ my $targettable;
+ for (my $i=0; $i<$numspares; $i++) {
+ my $checked;
+ if (ref($currtargets) eq 'HASH') {
+ if (ref($currtargets->{$sparetype}) eq 'ARRAY') {
+ if (grep(/^\Q$spares[$i]\E$/,@{$currtargets->{$sparetype}})) {
+ $checked = ' checked="checked"';
}
}
}
- if ($targettable ne '') {
- my $rem = $numspares%($numinrow);
- my $colsleft = $numinrow - $rem;
- if ($colsleft > 1 ) {
- $targettable .= ' '.
- ' | ';
- } elsif ($colsleft == 1) {
- $targettable .= ' | ';
- }
- $datatable .= ' '.$typetitles{$sparetype}.''.
- ' ';
- }
- }
- $datatable .= ' |
'.
- &loadbalancing_rules($dom,$intdom,$currrules{$lonhost},
- $othertitle,$usertypes,$types,\%servers,
- \%currbalancer,$lonhost,
- $targets_div_style,$homedom_div_style,
- $css_class[$cssidx],$balnum,$islast);
- $$rowtotal += $rownum;
- $balnum ++;
- }
- $datatable .= '';
- return $datatable;
-}
-
-sub get_loadbalancers_config {
- 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'));
- if (keys(%{$existing}) > 0) {
- my $oldlonhost;
- foreach my $key (sort(keys(%{$existing}))) {
- if ($key eq 'lonhost') {
- $oldlonhost = $existing->{'lonhost'};
- $currbalancer->{$oldlonhost} = 1;
- } elsif ($key eq 'targets') {
- if ($oldlonhost) {
- $currtargets->{$oldlonhost} = $existing->{'targets'};
- }
- } elsif ($key eq 'rules') {
- if ($oldlonhost) {
- $currrules->{$oldlonhost} = $existing->{'rules'};
- }
- } elsif (ref($existing->{$key}) eq 'HASH') {
- $currbalancer->{$key} = 1;
- $currtargets->{$key} = $existing->{$key}{'targets'};
- $currrules->{$key} = $existing->{$key}{'rules'};
+ my $chkboxval;
+ if (($currbalancer ne '') && (grep((/^\Q$currbalancer\E$/,keys(%servers))))) {
+ $chkboxval = $spares[$i];
+ }
+ $targettable .= ' | ';
+ my $rem = $i%($numinrow);
+ if ($rem == 0) {
+ if ($i > 0) {
+ $targettable .= '';
+ }
+ $targettable .= '';
}
}
- } else {
- my ($balancerref,$targetsref) =
- &Apache::lonnet::get_lonbalancer_config($servers);
- if ((ref($balancerref) eq 'HASH') && (ref($targetsref) eq 'HASH')) {
- foreach my $server (sort(keys(%{$balancerref}))) {
- $currbalancer->{$server} = 1;
- $currtargets->{$server} = $targetsref->{$server};
+ if ($targettable ne '') {
+ my $rem = $numspares%($numinrow);
+ my $colsleft = $numinrow - $rem;
+ if ($colsleft > 1 ) {
+ $targettable .= ''.
+ ' | ';
+ } elsif ($colsleft == 1) {
+ $targettable .= ' | ';
}
+ $datatable .= ''.$typetitles{$sparetype}.'
'.
+ '
';
}
}
- return;
+ $datatable .= '
'.
+ &loadbalancing_rules($dom,$intdom,$currrules,$othertitle,
+ $usertypes,$types,\%servers,$currbalancer,
+ $targets_div_style,$homedom_div_style,$css_class);
+ $$rowtotal += $rownum;
+ return $datatable;
}
sub loadbalancing_rules {
my ($dom,$intdom,$currrules,$othertitle,$usertypes,$types,$servers,
- $currbalancer,$lonhost,$targets_div_style,$homedom_div_style,
- $css_class,$balnum,$islast) = @_;
+ $currbalancer,$targets_div_style,$homedom_div_style,$css_class) = @_;
my $output;
- my $num = 0;
- my ($alltypes,$othertypes,$titles) =
+ my ($alltypes,$othertypes,$titles) =
&loadbalancing_titles($dom,$intdom,$usertypes,$types);
if ((ref($alltypes) eq 'ARRAY') && (ref($titles) eq 'HASH')) {
foreach my $type (@{$alltypes}) {
- $num ++;
my $current;
if (ref($currrules) eq 'HASH') {
$current = $currrules->{$type};
}
if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {
- if ($dom ne &Apache::lonnet::host_domain($lonhost)) {
+ if ($dom ne &Apache::lonnet::host_domain($currbalancer)) {
$current = '';
}
}
$output .= &loadbalance_rule_row($type,$titles->{$type},$current,
- $servers,$currbalancer,$lonhost,$dom,
- $targets_div_style,$homedom_div_style,
- $css_class,$balnum,$num,$islast);
+ $servers,$currbalancer,$dom,
+ $targets_div_style,$homedom_div_style,$css_class);
}
}
return $output;
@@ -3124,8 +2970,8 @@ sub loadbalancing_titles {
}
sub loadbalance_rule_row {
- my ($type,$title,$current,$servers,$currbalancer,$lonhost,$dom,
- $targets_div_style,$homedom_div_style,$css_class,$balnum,$num,$islast) = @_;
+ my ($type,$title,$current,$servers,$currbalancer,$dom,$targets_div_style,
+ $homedom_div_style,$css_class) = @_;
my @rulenames = ('default','homeserver');
my %ruletitles = &offloadtype_text();
if ($type eq '_LC_external') {
@@ -3138,15 +2984,9 @@ sub loadbalance_rule_row {
if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {
$style = $homedom_div_style;
}
- my $space;
- if ($islast && $num == 1) {
- $space = '
';
- }
- my $output =
- ''.$space.
- ' '.$title.' | '."\n".
- ''.$space.
- ''."\n";
+ my $output =
+ ' '.$title.' | '."\n".
+ ''."\n";
for (my $i=0; $i<@rulenames; $i++) {
my $rule = $rulenames[$i];
my ($checked,$extra);
@@ -3162,20 +3002,17 @@ sub loadbalance_rule_row {
unless ($checked) {
$default = ' selected="selected"';
}
- $extra =
- ': | |