--- loncom/interface/domainprefs.pm 2009/10/25 15:53:25 1.117 +++ loncom/interface/domainprefs.pm 2009/11/10 19:12:11 1.118 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.117 2009/10/25 15:53:25 raeburn Exp $ +# $Id: domainprefs.pm,v 1.118 2009/11/10 19:12:11 jms Exp $ # # Copyright Michigan State University Board of Trustees # @@ -202,11 +202,11 @@ sub handler { 'quotas','autoenroll','autoupdate','directorysrch', 'usercreation','usermodification','contacts','defaults', 'scantron','coursecategories','serverstatuses', - 'requestcourses'],$dom); + 'requestcourses','helpsettings'],$dom); my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', 'autoupdate','directorysrch','contacts', 'usercreation','usermodification','scantron', - 'requestcourses','coursecategories','serverstatuses'); + 'requestcourses','coursecategories','serverstatuses','helpsettings'); my %prefs = ( 'rolecolors' => { text => 'Default color schemes', @@ -319,6 +319,12 @@ sub handler { col3 => 'Specific IPs', }], }, + 'helpsettings' => + {text => 'Help page settings', + help => 'Domain_Configuration_Help_Settings', + header => [{col1 => 'Setting', + col2 => 'Value',}], + }, ); my %servers = &dom_servers($dom); if (keys(%servers) > 1) { @@ -415,6 +421,8 @@ sub process_changes { $output = &modify_serverstatuses($dom,%domconfig); } elsif ($action eq 'requestcourses') { $output = &modify_quotas($dom,$action,%domconfig); + } elsif ($action eq 'helpsettings') { + $output = &modify_helpsettings($dom,%domconfig); } return $output; } @@ -465,6 +473,8 @@ sub print_config_box { $colspan = ' colspan="2"'; } elsif ($action eq 'requestcourses') { $output .= &print_quotas($dom,$settings,\$rowtotal,$action); + } elsif ($action eq 'helpsettings') { + $output .= &print_helpsettings($dom,$settings,\$rowtotal); } else { $output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); } @@ -600,7 +610,9 @@ sub print_config_box { $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); } elsif ($action eq 'serverstatuses') { $output .= &print_serverstatuses($dom,$settings,\$rowtotal); - } + } elsif ($action eq 'helpsettings') { + $output .= &print_helpsettings($dom,$settings,\$rowtotal); + } } $output .= ' @@ -657,9 +669,8 @@ sub print_login { 'coursecatalog' => 'on', 'adminmail' => 'off', 'newuser' => 'off', - 'submitbugs' => 'on', ); - my @toggles = ('coursecatalog','adminmail','newuser','submitbugs'); + my @toggles = ('coursecatalog','adminmail','newuser'); my (%checkedon,%checkedoff); foreach my $item (@toggles) { if ($defaultchecked{$item} eq 'on') { @@ -791,7 +802,6 @@ sub login_choices { coursecatalog => 'Display Course/Community Catalog link?', adminmail => "Display Administrator's E-mail Address?", disallowlogin => "Login page requests redirected", - submitbugs => "Display "Submit Bug" link?", hostid => "Server", serverurl => "Redirect to log-in via:", directlogin => "No redirect", @@ -1918,6 +1928,62 @@ sub print_contacts { 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 .= + '