version 1.167, 2012/08/25 22:55:00
|
version 1.168, 2012/08/27 00:53:22
|
Line 238 sub handler {
|
Line 238 sub handler {
|
'login' => |
'login' => |
{ text => 'Log-in page options', |
{ text => 'Log-in page options', |
help => 'Domain_Configuration_Login_Page', |
help => 'Domain_Configuration_Login_Page', |
header => [{col1 => 'Item', |
header => [{col1 => 'Log-in Page Items', |
col2 => '',}], |
col2 => '',}, |
|
{col1 => 'Log-in Help', |
|
col2 => 'Value'}], |
}, |
}, |
|
|
'defaults' => |
'defaults' => |
{ text => 'Default authentication/language/timezone/portal', |
{ text => 'Default authentication/language/timezone/portal', |
help => 'Domain_Configuration_LangTZAuth', |
help => 'Domain_Configuration_LangTZAuth', |
Line 354 sub handler {
|
Line 355 sub handler {
|
{text => 'Help page settings', |
{text => 'Help page settings', |
help => 'Domain_Configuration_Help_Settings', |
help => 'Domain_Configuration_Help_Settings', |
header => [{col1 => 'Help Settings (logged-in users)', |
header => [{col1 => 'Help Settings (logged-in users)', |
col2 => 'Value'}, |
|
{col1 => 'Help Settings (before log-in)', |
|
col2 => 'Value'}], |
col2 => 'Value'}], |
}, |
}, |
'coursedefaults' => |
'coursedefaults' => |
Line 398 sub handler {
|
Line 397 sub handler {
|
header => [{col1 => 'Log-in Service', |
header => [{col1 => 'Log-in Service', |
col2 => 'Server Setting',}, |
col2 => 'Server Setting',}, |
{col1 => 'Log-in Page Items', |
{col1 => 'Log-in Page Items', |
col2 => ''}], |
col2 => ''}, |
|
{col1 => 'Log-in Help', |
|
col2 => 'Value'}], |
}; |
}; |
} |
} |
my @roles = ('student','coordinator','author','admin'); |
my @roles = ('student','coordinator','author','admin'); |
Line 533 sub print_config_box {
|
Line 534 sub print_config_box {
|
if ($numheaders > 1) { |
if ($numheaders > 1) { |
my $colspan = ''; |
my $colspan = ''; |
my $rightcolspan = ''; |
my $rightcolspan = ''; |
if (($action eq 'rolecolors') || ($action eq 'coursecategories')) { |
if (($action eq 'rolecolors') || ($action eq 'coursecategories') || |
|
(($action eq 'login') && ($numheaders < 3))) { |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
} |
} |
if ($action eq 'usersessions') { |
if ($action eq 'usersessions') { |
Line 557 sub print_config_box {
|
Line 559 sub print_config_box {
|
} elsif ($action eq 'coursecategories') { |
} elsif ($action eq 'coursecategories') { |
$output .= &print_coursecategories('top',$dom,$item,$settings,\$rowtotal); |
$output .= &print_coursecategories('top',$dom,$item,$settings,\$rowtotal); |
} elsif ($action eq 'login') { |
} elsif ($action eq 'login') { |
$output .= &print_login('top',$dom,$confname,$phase,$settings,\$rowtotal); |
if ($numheaders == 3) { |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
|
$output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal); |
|
} else { |
|
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal); |
|
} |
} elsif ($action eq 'requestcourses') { |
} elsif ($action eq 'requestcourses') { |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
} elsif ($action eq 'requestauthor') { |
} elsif ($action eq 'requestauthor') { |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
} elsif ($action eq 'helpsettings') { |
|
$output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal); |
|
} elsif ($action eq 'usersessions') { |
} elsif ($action eq 'usersessions') { |
$output .= &print_usersessions('top',$dom,$settings,\$rowtotal); |
$output .= &print_usersessions('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'rolecolors') { |
} elsif ($action eq 'rolecolors') { |
Line 627 sub print_config_box {
|
Line 631 sub print_config_box {
|
} elsif ($action eq 'coursecategories') { |
} elsif ($action eq 'coursecategories') { |
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
} elsif ($action eq 'login') { |
} elsif ($action eq 'login') { |
$output .= &print_login('bottom',$dom,$confname,$phase,$settings,\$rowtotal); |
if ($numheaders == 3) { |
|
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).' |
|
</table> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td> |
|
<table class="LC_nested"> |
|
<tr class="LC_info_row"> |
|
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
|
<td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'. |
|
&print_login('help',$dom,$confname,$phase,$settings,\$rowtotal); |
|
$rowtotal ++; |
|
} else { |
|
$output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal); |
|
} |
} elsif ($action eq 'requestcourses') { |
} elsif ($action eq 'requestcourses') { |
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal); |
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal); |
} elsif ($action eq 'requestauthor') { |
} elsif ($action eq 'requestauthor') { |
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal); |
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal); |
} elsif ($action eq 'helpsettings') { |
|
$output .= &print_helpsettings('bottom',$dom,$confname,$settings,\$rowtotal); |
|
} elsif ($action eq 'usersessions') { |
} elsif ($action eq 'usersessions') { |
$output .= &print_usersessions('middle',$dom,$settings,\$rowtotal).' |
$output .= &print_usersessions('middle',$dom,$settings,\$rowtotal).' |
</table> |
</table> |
Line 725 sub print_config_box {
|
Line 742 sub print_config_box {
|
} |
} |
$output .= '</tr>'; |
$output .= '</tr>'; |
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'login') { |
if ($action eq 'quotas') { |
$output .= &print_login('bottom',$dom,$confname,$phase,$settings, |
|
\$rowtotal); |
|
} elsif ($action eq 'quotas') { |
|
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
} elsif ($action eq 'autoenroll') { |
} elsif ($action eq 'autoenroll') { |
$output .= &print_autoenroll($dom,$settings,\$rowtotal); |
$output .= &print_autoenroll($dom,$settings,\$rowtotal); |
Line 745 sub print_config_box {
|
Line 759 sub print_config_box {
|
} elsif ($action eq 'serverstatuses') { |
} elsif ($action eq 'serverstatuses') { |
$output .= &print_serverstatuses($dom,$settings,\$rowtotal); |
$output .= &print_serverstatuses($dom,$settings,\$rowtotal); |
} elsif ($action eq 'helpsettings') { |
} elsif ($action eq 'helpsettings') { |
$output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal); |
$output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal); |
} elsif ($action eq 'loadbalancing') { |
} elsif ($action eq 'loadbalancing') { |
$output .= &print_loadbalancing($dom,$settings,\$rowtotal); |
$output .= &print_loadbalancing($dom,$settings,\$rowtotal); |
} |
} |
Line 759 sub print_config_box {
|
Line 773 sub print_config_box {
|
} |
} |
|
|
sub print_login { |
sub print_login { |
my ($position,$dom,$confname,$phase,$settings,$rowtotal) = @_; |
my ($caller,$dom,$confname,$phase,$settings,$rowtotal) = @_; |
my ($css_class,$datatable); |
my ($css_class,$datatable); |
my %choices = &login_choices(); |
my %choices = &login_choices(); |
|
|
if ($position eq 'top') { |
if ($caller eq 'service') { |
my %servers = &Apache::lonnet::internet_dom_servers($dom); |
my %servers = &Apache::lonnet::internet_dom_servers($dom); |
my $choice = $choices{'disallowlogin'}; |
my $choice = $choices{'disallowlogin'}; |
$css_class = ' class="LC_odd_row"'; |
$css_class = ' class="LC_odd_row"'; |
Line 830 sub print_login {
|
Line 844 sub print_login {
|
} |
} |
$datatable .= '</table></td></tr>'; |
$datatable .= '</table></td></tr>'; |
return $datatable; |
return $datatable; |
} |
} elsif ($caller eq 'page') { |
|
my %defaultchecked = ( |
my %defaultchecked = ( |
'coursecatalog' => 'on', |
'coursecatalog' => 'on', |
'adminmail' => 'off', |
'adminmail' => 'off', |
'newuser' => 'off', |
'newuser' => 'off', |
); |
); |
my @toggles = ('coursecatalog','adminmail','newuser'); |
my @toggles = ('coursecatalog','adminmail','newuser'); |
my (%checkedon,%checkedoff); |
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) { |
foreach my $item (@toggles) { |
if ($settings->{$item} eq '1') { |
if ($defaultchecked{$item} eq 'on') { |
$checkedon{$item} = ' checked="checked" '; |
$checkedon{$item} = ' checked="checked" '; |
$checkedoff{$item} = ' '; |
$checkedoff{$item} = ' '; |
} elsif ($settings->{$item} eq '0') { |
} elsif ($defaultchecked{$item} eq 'off') { |
$checkedoff{$item} = ' checked="checked" '; |
$checkedoff{$item} = ' checked="checked" '; |
$checkedon{$item} = ' '; |
$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) { |
foreach my $item (@images) { |
if (defined($settings->{$item})) { |
$defaults{$item} = $defaultdesign{'login.'.$item}; |
$designs{$item} = $settings->{$item}; |
$defaults{'showlogo'}{$item} = 1; |
$is_custom{$item} = 1; |
} |
} |
foreach my $item (@bgs) { |
if (defined($settings->{'showlogo'}{$item})) { |
$defaults{'bgs'}{$item} = $defaultdesign{'login.'.$item}; |
$designs{'showlogo'}{$item} = $settings->{'showlogo'}{$item}; |
|
} |
|
} |
} |
foreach my $item (@logintext) { |
foreach my $item (@logintext) { |
if ($settings->{$item} ne '') { |
$defaults{'logintext'}{$item} = $defaultdesign{'login.'.$item}; |
$designs{'logintext'}{$item} = $settings->{$item}; |
|
$is_custom{$item} = 1; |
|
} |
|
} |
} |
if ($settings->{'font'} ne '') { |
foreach my $item (@links) { |
$designs{'font'} = $settings->{'font'}; |
$defaults{'links'}{$item} = $defaultdesign{'login.'.$item}; |
$is_custom{'font'} = 1; |
|
} |
} |
foreach my $item (@bgs) { |
if (ref($settings) eq 'HASH') { |
if ($settings->{$item} ne '') { |
foreach my $item (@toggles) { |
$designs{'bgs'}{$item} = $settings->{$item}; |
if ($settings->{$item} eq '1') { |
$is_custom{$item} = 1; |
$checkedon{$item} = ' checked="checked" '; |
|
$checkedoff{$item} = ' '; |
|
} elsif ($settings->{$item} eq '0') { |
|
$checkedoff{$item} = ' checked="checked" '; |
|
$checkedon{$item} = ' '; |
|
} |
} |
} |
} |
foreach my $item (@images) { |
foreach my $item (@links) { |
if (defined($settings->{$item})) { |
if ($settings->{$item} ne '') { |
$designs{$item} = $settings->{$item}; |
$designs{'links'}{$item} = $settings->{$item}; |
$is_custom{$item} = 1; |
$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 (@links) { |
|
if ($designhash{$dom.'.login.'.$item} ne '') { |
|
$designs{'links'}{$item} = $designhash{$dom.'.login.'.$item}; |
|
$is_custom{$item} = 1; |
|
} |
} |
} |
} |
} |
} else { |
my %alt_text = &Apache::lonlocal::texthash ( img => 'Log-in banner', |
if ($designhash{$dom.'.login.font'} ne '') { |
logo => 'Institution Logo', |
$designs{'font'} = $designhash{$dom.'.login.font'}; |
domlogo => 'Domain Logo', |
$is_custom{'font'} = 1; |
login => 'Login box'); |
|
my $itemcount = 1; |
|
foreach my $item (@toggles) { |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= |
|
'<tr'.$css_class.'><td colspan="2">'.$choices{$item}. |
|
'</td><td>'. |
|
'<span class="LC_nobreak"><label><input type="radio" name="'. |
|
$item.'"'.$checkedon{$item}.' value="1" />'.&mt('Yes'). |
|
'</label> <label><input type="radio" name="'.$item.'"'. |
|
$checkedoff{$item}.' value="0" />'.&mt('No').'</label></span></td>'. |
|
'</tr>'; |
|
$itemcount ++; |
} |
} |
foreach my $item (@images) { |
$datatable .= &display_color_options($dom,$confname,$phase,'login',$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal,\@logintext); |
if ($designhash{$dom.'.login.'.$item} ne '') { |
$datatable .= '</tr></table></td></tr>'; |
$designs{$item} = $designhash{$dom.'.login.'.$item}; |
} elsif ($caller eq 'help') { |
$is_custom{$item} = 1; |
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 (@bgs) { |
foreach my $lang ('nolang',sort(@currlangs)) { |
if ($designhash{$dom.'.login.'.$item} ne '') { |
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
$designs{'bgs'}{$item} = $designhash{$dom.'.login.'.$item}; |
$datatable .= '<tr'.$css_class.'>'; |
$is_custom{$item} = 1; |
if ($url{$lang} eq '') { |
|
$url{$lang} = $defaulturl; |
|
} |
|
if ($type{$lang} eq '') { |
|
$type{$lang} = $defaulttype; |
|
} |
|
$datatable .= '<td colspan="2"><span class="LC_nobreak">'; |
|
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 .= '</span></td>'."\n". |
|
'<td class="LC_left_item">'; |
|
if ($type{$lang} eq 'custom') { |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="loginhelpurl_del" value="'.$lang.'" />'. |
|
$lt{'del'}.'</label> '.$lt{'rep'}.'</span>'; |
|
} else { |
|
$datatable .= $lt{'upl'}; |
} |
} |
|
$datatable .='<br />'; |
|
if ($switchserver) { |
|
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= '<input type="file" name="loginhelpurl_'.$lang.'" />'; |
|
} |
|
$datatable .= '</td></tr>'; |
|
$itemcount ++; |
} |
} |
foreach my $item (@links) { |
my @addlangs; |
if ($designhash{$dom.'.login.'.$item} ne '') { |
foreach my $lang (sort(keys(%langchoices))) { |
$designs{'links'}{$item} = $designhash{$dom.'.login.'.$item}; |
next if ((grep(/^\Q$lang\E$/,@currlangs)) || ($lang eq 'x_chef')); |
$is_custom{$item} = 1; |
push(@addlangs,$lang); |
|
} |
|
if (@addlangs > 0) { |
|
my %toadd; |
|
map { $toadd{$_} = $langchoices{$_} ; } @addlangs; |
|
$toadd{''} = &mt('Select'); |
|
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
|
$datatable .= '<tr'.$css_class.'><td class="LC_left_item" colspan="2">'. |
|
&mt('Add log-in help page for a specific language:').' '. |
|
&Apache::loncommon::select_form('','loginhelpurl_add_lang',\%toadd). |
|
'</td><td class="LC_left_item">'.$lt{'upl'}.'<br />'; |
|
if ($switchserver) { |
|
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= '<input type="file" name="loginhelpurl_add_file" />'; |
} |
} |
|
$datatable .= '</td></tr>'; |
} |
} |
} |
} |
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 .= |
|
'<tr'.$css_class.'><td colspan="2">'.$choices{$item}. |
|
'</td><td>'. |
|
'<span class="LC_nobreak"><label><input type="radio" name="'. |
|
$item.'"'.$checkedon{$item}.' value="1" />'.&mt('Yes'). |
|
'</label> <label><input type="radio" name="'.$item.'"'. |
|
$checkedoff{$item}.' value="0" />'.&mt('No').'</label></span></td>'. |
|
'</tr>'; |
|
$itemcount ++; |
|
} |
|
$datatable .= &display_color_options($dom,$confname,$phase,'login',$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal,\@logintext); |
|
$datatable .= '</tr></table></td></tr>'; |
|
return $datatable; |
return $datatable; |
} |
} |
|
|
Line 2263 sub print_contacts {
|
Line 2364 sub print_contacts {
|
} |
} |
|
|
sub print_helpsettings { |
sub print_helpsettings { |
my ($position,$dom,$confname,$settings,$rowtotal) = @_; |
my ($dom,$confname,$settings,$rowtotal) = @_; |
my ($css_class,$datatable,$itemcount); |
my ($datatable,$itemcount); |
my $switchserver = &check_switchserver($dom,$confname); |
|
$itemcount = 1; |
$itemcount = 1; |
if ($position eq 'top') { |
my (%choices,%defaultchecked,@toggles); |
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles,$align); |
$choices{'submitbugs'} = &mt('Display link to: [_1]?', |
$choices{'submitbugs'} = &mt('Display link to: [_1]?', |
&Apache::loncommon::modal_link('http://bugs.loncapa.org', |
&Apache::loncommon::modal_link('http://bugs.loncapa.org', |
&mt('LON-CAPA bug tracker'),600,500)); |
&mt('LON-CAPA bug tracker'),600,500)); |
%defaultchecked = ('submitbugs' => 'on'); |
%defaultchecked = ('submitbugs' => 'on'); |
@toggles = ('submitbugs',); |
@toggles = ('submitbugs',); |
|
$align = 'LC_left_item'; |
|
|
|
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
\%choices,$itemcount); |
\%choices,$itemcount); |
} else { |
|
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
|
$datatable .= '<tr'.$css_class.'>'; |
|
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 .= '<td class="LC_left_item"><span class="LC_nobreak">'. |
|
&mt('Log-in help page currently in use: [_1]', |
|
&Apache::loncommon::modal_link($url,$lt{$type},600,500)). |
|
'</span></td>'."\n". |
|
'<td class="LC_left_item">'; |
|
if ($type eq 'custom') { |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="loginhelpurl_del" value="1" />'.$lt{'del'}. |
|
'</label> '.$lt{'rep'}.'</span>'; |
|
} else { |
|
$datatable .= $lt{'upl'}; |
|
} |
|
$datatable .='<br />'; |
|
if ($switchserver) { |
|
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= '<input type="file" name="loginhelpurl" />'; |
|
} |
|
$datatable .= '</td></tr>'; |
|
} |
|
return $datatable; |
return $datatable; |
} |
} |
|
|
Line 3527 sub print_defaults {
|
Line 3585 sub print_defaults {
|
my $includeempty = 1; |
my $includeempty = 1; |
$datatable .= &Apache::loncommon::select_datelocale($item,$domdefaults{$item},undef,$includeempty); |
$datatable .= &Apache::loncommon::select_datelocale($item,$domdefaults{$item},undef,$includeempty); |
} elsif ($item eq 'lang_def') { |
} elsif ($item eq 'lang_def') { |
my %langchoices=('' => 'No language preference'); |
my %langchoices = &get_languages_hash(); |
foreach my $id (&Apache::loncommon::languageids()) { |
$langchoices{''} = 'No language preference'; |
my $code = &Apache::loncommon::supportedlanguagecode($id); |
|
if ($code ne '') { |
|
$langchoices{$code} = &Apache::loncommon::plainlanguagedescription($id); |
|
} |
|
} |
|
%langchoices = &Apache::lonlocal::texthash(%langchoices); |
%langchoices = &Apache::lonlocal::texthash(%langchoices); |
$datatable .= &Apache::loncommon::select_form($domdefaults{$item},$item, |
$datatable .= &Apache::loncommon::select_form($domdefaults{$item},$item, |
\%langchoices); |
\%langchoices); |
Line 3552 sub print_defaults {
|
Line 3605 sub print_defaults {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub get_languages_hash { |
|
my %langchoices; |
|
foreach my $id (&Apache::loncommon::languageids()) { |
|
my $code = &Apache::loncommon::supportedlanguagecode($id); |
|
if ($code ne '') { |
|
$langchoices{$code} = &Apache::loncommon::plainlanguagedescription($id); |
|
} |
|
} |
|
return %langchoices; |
|
} |
|
|
sub defaults_titles { |
sub defaults_titles { |
my ($dom) = @_; |
my ($dom) = @_; |
my %titles = &Apache::lonlocal::texthash ( |
my %titles = &Apache::lonlocal::texthash ( |
Line 4463 sub usertype_update_row {
|
Line 4527 sub usertype_update_row {
|
|
|
sub modify_login { |
sub modify_login { |
my ($r,$dom,$confname,%domconfig) = @_; |
my ($r,$dom,$confname,%domconfig) = @_; |
my ($resulttext,$errors,$colchgtext,%changes,%colchanges); |
my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl, |
my %title = ( coursecatalog => 'Display course catalog', |
%curr_loginvia,%loginhash,@currlangs,@newlangs,$addedfile,%title,@offon); |
adminmail => 'Display administrator E-mail address', |
%title = ( coursecatalog => 'Display course catalog', |
newuser => 'Link for visitors to create a user account', |
adminmail => 'Display administrator E-mail address', |
loginheader => 'Log-in box header'); |
newuser => 'Link for visitors to create a user account', |
my @offon = ('off','on'); |
loginheader => 'Log-in box header'); |
my %curr_loginvia; |
@offon = ('off','on'); |
if (ref($domconfig{login}) eq 'HASH') { |
if (ref($domconfig{login}) eq 'HASH') { |
if (ref($domconfig{login}{loginvia}) eq 'HASH') { |
if (ref($domconfig{login}{loginvia}) eq 'HASH') { |
foreach my $lonhost (keys(%{$domconfig{login}{loginvia}})) { |
foreach my $lonhost (keys(%{$domconfig{login}{loginvia}})) { |
Line 4477 sub modify_login {
|
Line 4541 sub modify_login {
|
} |
} |
} |
} |
} |
} |
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'); |
Line 4576 sub modify_login {
|
Line 4639 sub modify_login {
|
} |
} |
} |
} |
|
|
|
my $servadm = $r->dir_config('lonAdmEMail'); |
|
my %langchoices = &Apache::lonlocal::texthash(&get_languages_hash()); |
|
if (ref($domconfig{'login'}) eq 'HASH') { |
|
if (ref($domconfig{'login'}{'helpurl'}) eq 'HASH') { |
|
foreach my $lang (sort(keys(%{$domconfig{'login'}{'helpurl'}}))) { |
|
if ($lang eq 'nolang') { |
|
push(@currlangs,$lang); |
|
} elsif (defined($langchoices{$lang})) { |
|
push(@currlangs,$lang); |
|
} else { |
|
next; |
|
} |
|
} |
|
} |
|
} |
|
my @delurls = &Apache::loncommon::get_env_multiple('form.loginhelpurl_del'); |
|
if (@currlangs > 0) { |
|
foreach my $lang (@currlangs) { |
|
if (grep(/^\Q$lang\E$/,@delurls)) { |
|
$changes{'helpurl'}{$lang} = 1; |
|
} elsif ($env{'form.loginhelpurl_'.$lang.'.filename'}) { |
|
$changes{'helpurl'}{$lang} = 1; |
|
$newfile{$lang} = $env{'form.loginhelpurl_'.$lang.'.filename'}; |
|
push(@newlangs,$lang); |
|
} else { |
|
$loginhash{'login'}{'helpurl'}{$lang} = $domconfig{'login'}{'helpurl'}{$lang}; |
|
} |
|
} |
|
} |
|
unless (grep(/^nolang$/,@currlangs)) { |
|
if ($env{'form.loginhelpurl_nolang.filename'}) { |
|
$changes{'helpurl'}{'nolang'} = 1; |
|
$newfile{'nolang'} = $env{'form.loginhelpurl_nolang.filename'}; |
|
push(@newlangs,'nolang'); |
|
} |
|
} |
|
if ($env{'form.loginhelpurl_add_lang'}) { |
|
if ((defined($langchoices{$env{'form.loginhelpurl_add_lang'}})) && |
|
($env{'form.loginhelpurl_add_file.filename'})) { |
|
$newfile{$env{'form.loginhelpurl_add_lang'}} = $env{'form.loginhelpurl_add_file.filename'}; |
|
$addedfile = $env{'form.loginhelpurl_add_lang'}; |
|
} |
|
} |
|
if ((@newlangs > 0) || ($addedfile)) { |
|
my $error; |
|
my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); |
|
if ($configuserok eq 'ok') { |
|
if ($switchserver) { |
|
$error = &mt("Upload of custom help file is not permitted to this server: [_1]",$switchserver); |
|
} elsif ($author_ok eq 'ok') { |
|
my @allnew = @newlangs; |
|
if ($addedfile ne '') { |
|
push(@allnew,$addedfile); |
|
} |
|
foreach my $lang (@allnew) { |
|
my $formelem = 'loginhelpurl_'.$lang; |
|
if ($lang eq $env{'form.loginhelpurl_add_lang'}) { |
|
$formelem = 'loginhelpurl_add_file'; |
|
} |
|
(my $result,$newurl{$lang}) = &publishlogo($r,'upload',$formelem,$dom,$confname, |
|
"help/$lang",'','',$newfile{$lang}); |
|
if ($result eq 'ok') { |
|
$loginhash{'login'}{'helpurl'}{$lang} = $newurl{$lang}; |
|
$changes{'helpurl'}{$lang} = 1; |
|
} else { |
|
my $puberror = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$newfile{$lang},$result); |
|
$errors .= '<li><span class="LC_error">'.$puberror.'</span></li>'; |
|
if ((grep(/^\Q$lang\E$/,@currlangs)) && |
|
(!grep(/^\Q$lang\E$/,@delurls))) { |
|
|
|
$loginhash{'login'}{'helpurl'}{$lang} = $domconfig{'login'}{'helpurl'}{$lang}; |
|
} |
|
} |
|
} |
|
} else { |
|
$error = &mt("Upload of custom log-in help file(s) failed because an author role could not be assigned to a Domain Configuration user ([_1]) in domain: [_2]. Error was: [_3].",$confname,$dom,$author_ok); |
|
} |
|
} else { |
|
$error = &mt("Upload of custom log-in help file(s) failed because a Domain Configuration user ([_1]) could not be created in domain: [_2]. Error was: [_3].",$confname,$dom,$configuserok); |
|
} |
|
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} |
|
|
|
my $defaulthelpfile = '/adm/loginproblems.html'; |
|
my $defaulttext = &mt('Default in use'); |
|
|
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') { |
Line 4641 sub modify_login {
|
Line 4793 sub modify_login {
|
} |
} |
$resulttext .= '</ul></li>'; |
$resulttext .= '</ul></li>'; |
} |
} |
|
} elsif ($item eq 'helpurl') { |
|
if (ref($changes{$item}) eq 'HASH') { |
|
foreach my $lang (sort(keys(%{$changes{$item}}))) { |
|
if (grep(/^\Q$lang\E$/,@delurls)) { |
|
my ($chg,$link); |
|
$link = &Apache::loncommon::modal_link($defaulthelpfile,$defaulttext,600,500); |
|
if ($lang eq 'nolang') { |
|
$chg = &mt('custom log-in help file removed for no preferred language; [_1]',$link); |
|
} else { |
|
$chg = &mt('custom log-in help file removed for specific language: [_1]; [_2]',$langchoices{$lang},$link); |
|
} |
|
$resulttext .= '<li>'.$chg.'</li>'; |
|
} else { |
|
my $chg; |
|
if ($lang eq 'nolang') { |
|
$chg = &mt('custom log-in help file for no preferred language'); |
|
} else { |
|
$chg = &mt('custom log-in help file for specific language: [_1]',$langchoices{$lang}); |
|
} |
|
$resulttext .= '<li>'.&Apache::loncommon::modal_link( |
|
$loginhash{'login'}{'helpurl'}{$lang}. |
|
'?inhibitmenu=yes',$chg,600,500). |
|
'</li>'; |
|
} |
|
} |
|
} |
} else { |
} else { |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
} |
} |
Line 7419 sub modify_serverstatuses {
|
Line 7597 sub modify_serverstatuses {
|
sub modify_helpsettings { |
sub modify_helpsettings { |
my ($r,$dom,$confname,%domconfig) = @_; |
my ($r,$dom,$confname,%domconfig) = @_; |
my ($resulttext,$errors,%changes,%helphash); |
my ($resulttext,$errors,%changes,%helphash); |
my $customhelpfile = $env{'form.loginhelpurl.filename'}; |
|
my $defaulthelpfile = '/adm/loginproblems.html'; |
|
my $defaulttext = &mt('Default in use'); |
|
my $servadm = $r->dir_config('lonAdmEMail'); |
|
my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); |
|
my %defaultchecked = ('submitbugs' => 'on'); |
my %defaultchecked = ('submitbugs' => 'on'); |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
my %title = ( |
|
submitbugs => 'Display link for users to submit a bug', |
|
loginhelpurl => 'Unauthenticated login help page set to custom file' |
|
); |
|
my @toggles = ('submitbugs'); |
my @toggles = ('submitbugs'); |
$helphash{'helpsettings'} = {}; |
|
if (ref($domconfig{'helpsettings'}) ne 'HASH') { |
|
if ($domconfig{'helpsettings'} eq '') { |
|
$domconfig{'helpsettings'} = {}; |
|
} |
|
} |
|
if (ref($domconfig{'helpsettings'}) eq 'HASH') { |
if (ref($domconfig{'helpsettings'}) eq 'HASH') { |
foreach my $item (@toggles) { |
foreach my $item (@toggles) { |
if ($defaultchecked{$item} eq 'on') { |
if ($defaultchecked{$item} eq 'on') { |
Line 7460 sub modify_helpsettings {
|
Line 7623 sub modify_helpsettings {
|
$helphash{'helpsettings'}{$item} = $env{'form.'.$item}; |
$helphash{'helpsettings'}{$item} = $env{'form.'.$item}; |
} |
} |
} |
} |
if ($customhelpfile ne '') { |
|
my $error; |
|
if ($configuserok eq 'ok') { |
|
if ($switchserver) { |
|
$error = &mt("Upload of custom help file is not permitted to this server: [_1]",$switchserver); |
|
} else { |
|
if ($author_ok eq 'ok') { |
|
my ($result,$loginhelpurl) = &publishlogo($r,'upload','loginhelpurl',$dom, |
|
$confname,'help','','',$customhelpfile); |
|
if ($result eq 'ok') { |
|
$helphash{'helpsettings'}{'loginhelpurl'} = $loginhelpurl; |
|
$changes{'loginhelpurl'} = 1; |
|
} else { |
|
$error = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$customhelpfile,$result); |
|
} |
|
} else { |
|
$error = &mt("Upload of [_1] failed because an author role could not be assigned to a Domain Configuration user ([_2]) in domain: [_3]. Error was: [_4].",$customhelpfile,$confname,$dom,$author_ok); |
|
} |
|
} |
|
} else { |
|
$error = &mt("Upload of [_1] failed because a Domain Configuration user ([_2]) could not be created in domain: [_3]. Error was: [_4].",$customhelpfile,$confname,$dom,$configuserok); |
|
} |
|
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} |
|
if ($domconfig{'helpsettings'}{'loginhelpurl'} ne '') { |
|
if ($env{'form.loginhelpurl_del'}) { |
|
$helphash{'helpsettings'}{'loginhelpurl'} = ''; |
|
$changes{'loginhelpurl'} = 1; |
|
} |
|
} |
|
} |
} |
my $putresult; |
my $putresult; |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
$putresult = &Apache::lonnet::put_dom('configuration',\%helphash,$dom); |
$putresult = &Apache::lonnet::put_dom('configuration',\%helphash,$dom); |
} else { |
if ($putresult eq 'ok') { |
$putresult = 'ok'; |
|
} |
|
if ($putresult eq 'ok') { |
|
if (keys(%changes) > 0) { |
|
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
foreach my $item (sort(keys(%changes))) { |
foreach my $item (sort(keys(%changes))) { |
if ($item eq 'submitbugs') { |
if ($item eq 'submitbugs') { |
Line 7509 sub modify_helpsettings {
|
Line 7635 sub modify_helpsettings {
|
&Apache::loncommon::modal_link('http://bugs.loncapa.org', |
&Apache::loncommon::modal_link('http://bugs.loncapa.org', |
&mt('LON-CAPA bug tracker'),600,500)).'</li>'; |
&mt('LON-CAPA bug tracker'),600,500)).'</li>'; |
} |
} |
if ($item eq 'loginhelpurl') { |
|
if ($helphash{'helpsettings'}{'loginhelpurl'} eq '') { |
|
$resulttext .= '<li>'.&mt('custom log-in help file removed.').' '. |
|
&Apache::loncommon::modal_link($defaulthelpfile, |
|
$defaulttext,600,500).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&Apache::loncommon::modal_link( |
|
$helphash{'helpsettings'}{'loginhelpurl'}. |
|
'?inhibitmenu=yes', |
|
&mt('custom log-in help file'),600,500). |
|
'</li>'; |
|
} |
|
} |
|
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
$resulttext = &mt('No changes made to help settings'); |
$resulttext = &mt('No changes made to help settings'); |
|
$errors .= '<li><span class="LC_error">'. |
|
&mt('An error occurred storing the settings: [_1]', |
|
$putresult).'</span></li>'; |
} |
} |
} else { |
|
$errors .= '<li><span class="LC_error">'.&mt('An error occurred storing the settings: [_1]', |
|
$putresult).'</span></li>'; |
|
} |
} |
if ($errors) { |
if ($errors) { |
$resulttext .= &mt('The following errors occurred: ').'<ul>'. |
$resulttext .= '<br />'.&mt('The following errors occurred: ').'<ul>'. |
$errors.'</ul>'; |
$errors.'</ul>'; |
} |
} |
return $resulttext; |
return $resulttext; |
Line 8115 sub recurse_cat_deletes {
|
Line 8228 sub recurse_cat_deletes {
|
delete($coursecategories->{$subitem}); |
delete($coursecategories->{$subitem}); |
$deletions->{$subitem} = 1; |
$deletions->{$subitem} = 1; |
&recurse_cat_deletes($subitem,$coursecategories,$deletions); |
&recurse_cat_deletes($subitem,$coursecategories,$deletions); |
} |
} |
} |
} |
} |
} |
return; |
return; |