version 1.117, 2009/10/25 15:53:25
|
version 1.118, 2009/11/10 19:12:11
|
Line 202 sub handler {
|
Line 202 sub handler {
|
'quotas','autoenroll','autoupdate','directorysrch', |
'quotas','autoenroll','autoupdate','directorysrch', |
'usercreation','usermodification','contacts','defaults', |
'usercreation','usermodification','contacts','defaults', |
'scantron','coursecategories','serverstatuses', |
'scantron','coursecategories','serverstatuses', |
'requestcourses'],$dom); |
'requestcourses','helpsettings'],$dom); |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
'autoupdate','directorysrch','contacts', |
'autoupdate','directorysrch','contacts', |
'usercreation','usermodification','scantron', |
'usercreation','usermodification','scantron', |
'requestcourses','coursecategories','serverstatuses'); |
'requestcourses','coursecategories','serverstatuses','helpsettings'); |
my %prefs = ( |
my %prefs = ( |
'rolecolors' => |
'rolecolors' => |
{ text => 'Default color schemes', |
{ text => 'Default color schemes', |
Line 319 sub handler {
|
Line 319 sub handler {
|
col3 => 'Specific IPs', |
col3 => 'Specific IPs', |
}], |
}], |
}, |
}, |
|
'helpsettings' => |
|
{text => 'Help page settings', |
|
help => 'Domain_Configuration_Help_Settings', |
|
header => [{col1 => 'Setting', |
|
col2 => 'Value',}], |
|
}, |
); |
); |
my %servers = &dom_servers($dom); |
my %servers = &dom_servers($dom); |
if (keys(%servers) > 1) { |
if (keys(%servers) > 1) { |
Line 415 sub process_changes {
|
Line 421 sub process_changes {
|
$output = &modify_serverstatuses($dom,%domconfig); |
$output = &modify_serverstatuses($dom,%domconfig); |
} elsif ($action eq 'requestcourses') { |
} elsif ($action eq 'requestcourses') { |
$output = &modify_quotas($dom,$action,%domconfig); |
$output = &modify_quotas($dom,$action,%domconfig); |
|
} elsif ($action eq 'helpsettings') { |
|
$output = &modify_helpsettings($dom,%domconfig); |
} |
} |
return $output; |
return $output; |
} |
} |
Line 465 sub print_config_box {
|
Line 473 sub print_config_box {
|
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
} 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 'helpsettings') { |
|
$output .= &print_helpsettings($dom,$settings,\$rowtotal); |
} else { |
} else { |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
} |
} |
Line 600 sub print_config_box {
|
Line 610 sub print_config_box {
|
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); |
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); |
} elsif ($action eq 'serverstatuses') { |
} elsif ($action eq 'serverstatuses') { |
$output .= &print_serverstatuses($dom,$settings,\$rowtotal); |
$output .= &print_serverstatuses($dom,$settings,\$rowtotal); |
} |
} elsif ($action eq 'helpsettings') { |
|
$output .= &print_helpsettings($dom,$settings,\$rowtotal); |
|
} |
} |
} |
$output .= ' |
$output .= ' |
</table> |
</table> |
Line 657 sub print_login {
|
Line 669 sub print_login {
|
'coursecatalog' => 'on', |
'coursecatalog' => 'on', |
'adminmail' => 'off', |
'adminmail' => 'off', |
'newuser' => 'off', |
'newuser' => 'off', |
'submitbugs' => 'on', |
|
); |
); |
my @toggles = ('coursecatalog','adminmail','newuser','submitbugs'); |
my @toggles = ('coursecatalog','adminmail','newuser'); |
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 791 sub login_choices {
|
Line 802 sub login_choices {
|
coursecatalog => 'Display Course/Community 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 1918 sub print_contacts {
|
Line 1928 sub print_contacts {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub print_helpsettings { |
|
|
|
my ($dom,$settings,$rowtotal) = @_; |
|
my ($css_class,$datatable); |
|
my $itemcount = 1; |
|
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); |
|
|
|
%choices = |
|
&Apache::lonlocal::texthash ( |
|
submitbugs => 'Display "Submit a bug" link?', |
|
); |
|
|
|
%defaultchecked = ('submitbugs' => 'on'); |
|
|
|
@toggles = ('submitbugs',); |
|
|
|
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} = ' '; |
|
} |
|
} |
|
|
|
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 (@toggles) { |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= |
|
'<tr'.$css_class.'><td><span class="LC_nobreak">'.$choices{$item}. |
|
'</span></td>'. |
|
'<td class="LC_right_item"><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 ++; |
|
} |
|
return $datatable; |
|
|
|
} |
|
|
sub contact_titles { |
sub contact_titles { |
my %titles = &Apache::lonlocal::texthash ( |
my %titles = &Apache::lonlocal::texthash ( |
'supportemail' => 'Support E-mail address', |
'supportemail' => 'Support E-mail address', |
Line 3139 sub modify_login {
|
Line 3205 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 3153 sub modify_login {
|
Line 3218 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','submitbugs'); |
my @toggles = ('coursecatalog','adminmail','newuser'); |
foreach my $item (@toggles) { |
foreach my $item (@toggles) { |
$loginhash{login}{$item} = $env{'form.'.$item}; |
$loginhash{login}{$item} = $env{'form.'.$item}; |
} |
} |
Line 3183 sub modify_login {
|
Line 3248 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','submitbugs'); |
my @toggles = ('coursecatalog','adminmail','newuser'); |
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 5625 sub modify_serverstatuses {
|
Line 5689 sub modify_serverstatuses {
|
} |
} |
return $resulttext; |
return $resulttext; |
} |
} |
|
|
|
sub modify_helpsettings { |
|
my ($dom,%domconfig) = @_; |
|
my ($resulttext,$errors,%changes,%helphash); |
|
|
|
my %defaultchecked = ('submitbugs' => 'on'); |
|
my @offon = ('off','on'); |
|
my %title = ( submitbugs => 'Display link for users to submit a bug'); |
|
my @toggles = ('submitbugs'); |
|
|
|
$helphash{'helpsettings'} = {}; |
|
|
|
if (ref($domconfig{'helpsettings'}) ne 'HASH') { |
|
if ($domconfig{'helpsettings'} eq '') { |
|
$domconfig{'helpsettings'} = {}; |
|
} |
|
} |
|
|
|
if (ref($domconfig{'helpsettings'}) eq 'HASH') { |
|
|
|
foreach my $item (@toggles) { |
|
|
|
if ($defaultchecked{$item} eq 'on') { |
|
if (($domconfig{'helpsettings'}{$item} eq '') && |
|
($env{'form.'.$item} eq '0')) { |
|
$changes{$item} = 1; |
|
} elsif ($domconfig{'helpsettings'}{$item} ne $env{'form.'.$item}) { |
|
$changes{$item} = 1; |
|
} |
|
} elsif ($defaultchecked{$item} eq 'off') { |
|
if (($domconfig{'helpsettings'}{$item} eq '') && |
|
($env{'form.'.$item} eq '1')) { |
|
$changes{$item} = 1; |
|
} elsif ($domconfig{'helpsettings'}{$item} ne $env{'form.'.$item}) { |
|
$changes{$item} = 1; |
|
} |
|
} |
|
$helphash{'helpsettings'}{$item} = $env{'form.'.$item}; |
|
} |
|
} |
|
|
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%helphash, |
|
$dom); |
|
|
|
if ($putresult eq 'ok') { |
|
if (keys(%changes) > 0) { |
|
$resulttext = &mt('Changes made:').'<ul>'; |
|
foreach my $item (sort(keys(%changes))) { |
|
if ($item eq 'submitbugs') { |
|
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
|
} |
|
} |
|
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = &mt('No changes made to help settings'); |
|
} |
|
} else { |
|
$resulttext = '<span class="LC_error">'. |
|
&mt('An error occurred: [_1]',$putresult).'</span>'; |
|
} |
|
if ($errors) { |
|
$resulttext .= &mt('The following errors occurred: ').'<ul>'. |
|
$errors.'</ul>'; |
|
} |
|
return $resulttext; |
|
} |
|
|
sub recurse_check { |
sub recurse_check { |
my ($chkcats,$categories,$depth,$name) = @_; |
my ($chkcats,$categories,$depth,$name) = @_; |