version 1.120, 2009/11/23 21:45:18
|
version 1.121, 2009/11/30 06:23:32
|
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','helpsettings'],$dom); |
'requestcourses','helpsettings','coursedefaults'],$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','helpsettings'); |
'requestcourses','coursecategories','serverstatuses','helpsettings', |
|
'coursedefaults'); |
my %prefs = ( |
my %prefs = ( |
'rolecolors' => |
'rolecolors' => |
{ text => 'Default color schemes', |
{ text => 'Default color schemes', |
Line 325 sub handler {
|
Line 326 sub handler {
|
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
}, |
}, |
|
'coursedefaults' => |
|
{text => 'Course/Community defaults', |
|
help => 'Domain_Configuration_Course_Defaults', |
|
header => [{col1 => 'Setting', |
|
col2 => 'Value',}], |
|
}, |
'privacy' => |
'privacy' => |
{text => 'User Privacy', |
{text => 'User Privacy', |
help => 'Domain_Configuration_User_Privacy', |
help => 'Domain_Configuration_User_Privacy', |
Line 429 sub process_changes {
|
Line 436 sub process_changes {
|
$output = &modify_quotas($dom,$action,%domconfig); |
$output = &modify_quotas($dom,$action,%domconfig); |
} elsif ($action eq 'helpsettings') { |
} elsif ($action eq 'helpsettings') { |
$output = &modify_helpsettings($dom,%domconfig); |
$output = &modify_helpsettings($dom,%domconfig); |
|
} elsif ($action eq 'coursedefaults') { |
|
$output = &modify_coursedefaults($dom,%domconfig); |
} |
} |
return $output; |
return $output; |
} |
} |
Line 617 sub print_config_box {
|
Line 626 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($dom,$settings,\$rowtotal); |
$output .= &print_helpsettings($dom,$settings,\$rowtotal); |
} |
} elsif ($action eq 'coursedefaults') { |
|
$output .= &print_coursedefaults($dom,$settings,\$rowtotal); |
|
} |
} |
} |
$output .= ' |
$output .= ' |
</table> |
</table> |
Line 1935 sub print_contacts {
|
Line 1946 sub print_contacts {
|
} |
} |
|
|
sub print_helpsettings { |
sub print_helpsettings { |
|
my ($dom,$settings,$rowtotal) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my ($css_class,$datatable); |
my ($css_class,$datatable); |
my $itemcount = 1; |
my $itemcount = 1; |
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); |
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); |
%choices = |
|
|
%choices = |
|
&Apache::lonlocal::texthash ( |
&Apache::lonlocal::texthash ( |
submitbugs => 'Display "Submit a bug" link?', |
submitbugs => 'Display "Submit a bug" link?', |
); |
); |
|
%defaultchecked = ('submitbugs' => 'on'); |
%defaultchecked = ('submitbugs' => 'on'); |
@toggles = ('submitbugs',); |
|
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
@toggles = ('submitbugs',); |
\%choices,$itemcount); |
|
$$rowtotal += $itemcount; |
foreach my $item (@toggles) { |
return $datatable; |
if ($defaultchecked{$item} eq 'on') { |
} |
|
|
|
sub radiobutton_prefs { |
|
my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_; |
|
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && |
|
(ref($choices) eq 'HASH')); |
|
|
|
my (%checkedon,%checkedoff,$datatable,$css_class); |
|
|
|
foreach my $item (@{$toggles}) { |
|
if ($defaultchecked->{$item} eq 'on') { |
$checkedon{$item} = ' checked="checked" '; |
$checkedon{$item} = ' checked="checked" '; |
$checkedoff{$item} = ' '; |
$checkedoff{$item} = ' '; |
} elsif ($defaultchecked{$item} eq 'off') { |
} elsif ($defaultchecked->{$item} eq 'off') { |
$checkedoff{$item} = ' checked="checked" '; |
$checkedoff{$item} = ' checked="checked" '; |
$checkedon{$item} = ' '; |
$checkedon{$item} = ' '; |
} |
} |
} |
} |
|
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
foreach my $item (@toggles) { |
foreach my $item (@{$toggles}) { |
if ($settings->{$item} eq '1') { |
if ($settings->{$item} eq '1') { |
$checkedon{$item} = ' checked="checked" '; |
$checkedon{$item} = ' checked="checked" '; |
$checkedoff{$item} = ' '; |
$checkedoff{$item} = ' '; |
Line 1970 sub print_helpsettings {
|
Line 1988 sub print_helpsettings {
|
$checkedon{$item} = ' '; |
$checkedon{$item} = ' '; |
} |
} |
} |
} |
} |
} |
|
foreach my $item (@{$toggles}) { |
foreach my $item (@toggles) { |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= |
$datatable .= |
'<tr'.$css_class.'><td><span class="LC_nobreak">'.$choices{$item}. |
'<tr'.$css_class.'><td><span class="LC_nobreak">'.$choices->{$item}. |
'</span></td>'. |
'</span></td>'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<label><input type="radio" name="'. |
'<label><input type="radio" name="'. |
Line 1985 sub print_helpsettings {
|
Line 2002 sub print_helpsettings {
|
'</span></td>'. |
'</span></td>'. |
'</tr>'; |
'</tr>'; |
$itemcount ++; |
$itemcount ++; |
} |
} |
return $datatable; |
return ($datatable,$itemcount); |
|
} |
|
|
|
sub print_coursedefaults { |
|
my ($dom,$settings,$rowtotal) = @_; |
|
my ($css_class,$datatable); |
|
my $itemcount = 1; |
|
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); |
|
%choices = |
|
&Apache::lonlocal::texthash ( |
|
canuse_pdfforms => 'Course/Community users can create/upload PDF forms', |
|
); |
|
%defaultchecked = ('canuse_pdfforms' => 'off'); |
|
@toggles = ('canuse_pdfforms',); |
|
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
|
\%choices,$itemcount); |
|
$$rowtotal += $itemcount; |
|
return $datatable; |
} |
} |
|
|
sub contact_titles { |
sub contact_titles { |
Line 5900 sub modify_helpsettings {
|
Line 5933 sub modify_helpsettings {
|
} |
} |
return $resulttext; |
return $resulttext; |
} |
} |
|
|
|
sub modify_coursedefaults { |
|
my ($dom,%domconfig) = @_; |
|
my ($resulttext,$errors,%changes,%defaultshash); |
|
my %defaultchecked = ('canuse_pdfforms' => 'off'); |
|
my @offon = ('off','on'); |
|
my @toggles = ('canuse_pdfforms'); |
|
|
|
$defaultshash{'coursedefaults'} = {}; |
|
|
|
if (ref($domconfig{'coursedefaults'}) ne 'HASH') { |
|
if ($domconfig{'coursedefaults'} eq '') { |
|
$domconfig{'coursedefaults'} = {}; |
|
} |
|
} |
|
|
|
if (ref($domconfig{'coursedefaults'}) eq 'HASH') { |
|
foreach my $item (@toggles) { |
|
if ($defaultchecked{$item} eq 'on') { |
|
if (($domconfig{'coursedefaults'}{$item} eq '') && |
|
($env{'form.'.$item} eq '0')) { |
|
$changes{$item} = 1; |
|
} elsif ($domconfig{'coursdefaults'}{$item} ne $env{'form.'.$item}) { |
|
$changes{$item} = 1; |
|
} |
|
} elsif ($defaultchecked{$item} eq 'off') { |
|
if (($domconfig{'coursedefaults'}{$item} eq '') && |
|
($env{'form.'.$item} eq '1')) { |
|
$changes{$item} = 1; |
|
} elsif ($domconfig{'coursedefaults'}{$item} ne $env{'form.'.$item}) { |
|
$changes{$item} = 1; |
|
} |
|
} |
|
$defaultshash{'coursedefaults'}{$item} = $env{'form.'.$item}; |
|
} |
|
} |
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
|
$dom); |
|
if ($putresult eq 'ok') { |
|
if (keys(%changes) > 0) { |
|
if ($changes{'canuse_pdfforms'}) { |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
|
$domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'}; |
|
my $cachetime = 24*60*60; |
|
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
|
} |
|
$resulttext = &mt('Changes made:').'<ul>'; |
|
foreach my $item (sort(keys(%changes))) { |
|
if ($item eq 'canuse_pdfforms') { |
|
if ($env{'form.'.$item} eq '1') { |
|
$resulttext .= '<li>'.&mt("Course/Community users can create/upload PDF forms set to 'on'").'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "off"').'</li>'; |
|
} |
|
} |
|
} |
|
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = &mt('No changes made to course defaults'); |
|
} |
|
} else { |
|
$resulttext = '<span class="LC_error">'. |
|
&mt('An error occurred: [_1]',$putresult).'</span>'; |
|
} |
|
return $resulttext; |
|
} |
|
|
sub recurse_check { |
sub recurse_check { |
my ($chkcats,$categories,$depth,$name) = @_; |
my ($chkcats,$categories,$depth,$name) = @_; |