version 1.102.2.6, 2010/01/02 21:50:54
|
version 1.102.2.7, 2010/01/02 22:02:44
|
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','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'); |
'requestcourses','coursecategories','serverstatuses', |
|
'coursedefaults'); |
my %prefs = ( |
my %prefs = ( |
'rolecolors' => |
'rolecolors' => |
{ text => 'Default color schemes', |
{ text => 'Default color schemes', |
Line 318 sub handler {
|
Line 319 sub handler {
|
col3 => 'Specific IPs', |
col3 => 'Specific IPs', |
}], |
}], |
}, |
}, |
|
'coursedefaults' => |
|
{text => 'Course/Community defaults', |
|
help => 'Domain_Configuration_Course_Defaults', |
|
header => [{col1 => 'Setting', |
|
col2 => 'Value',}], |
|
}, |
); |
); |
my @roles = ('student','coordinator','author','admin'); |
my @roles = ('student','coordinator','author','admin'); |
my @actions = &Apache::loncommon::get_env_multiple('form.actions'); |
my @actions = &Apache::loncommon::get_env_multiple('form.actions'); |
Line 404 sub process_changes {
|
Line 411 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 'coursedefaults') { |
|
$output = &modify_coursedefaults($dom,%domconfig); |
} |
} |
return $output; |
return $output; |
} |
} |
Line 581 sub print_config_box {
|
Line 590 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 'coursedefaults') { |
|
$output .= &print_coursedefaults($dom,$settings,\$rowtotal); |
} |
} |
} |
} |
$output .= ' |
$output .= ' |
Line 1828 sub print_contacts {
|
Line 1839 sub print_contacts {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
|
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" '; |
|
$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,$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 { |
my %titles = &Apache::lonlocal::texthash ( |
my %titles = &Apache::lonlocal::texthash ( |
'supportemail' => 'Support E-mail address', |
'supportemail' => 'Support E-mail address', |
Line 5617 sub modify_serverstatuses {
|
Line 5689 sub modify_serverstatuses {
|
} |
} |
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) = @_; |