version 1.123.2.5, 2010/12/08 04:22:16
|
version 1.124, 2010/01/02 20:26:10
|
Line 229 sub handler {
|
Line 229 sub handler {
|
}, |
}, |
|
|
'defaults' => |
'defaults' => |
{ text => 'Default authentication/language/timezone/portal', |
{ text => 'Default authentication/language/timezone', |
help => 'Domain_Configuration_LangTZAuth', |
help => 'Domain_Configuration_LangTZAuth', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value'}], |
col2 => 'Value'}], |
Line 328 sub handler {
|
Line 328 sub handler {
|
{col1 => 'Unauthenticated Help Settings', |
{col1 => 'Unauthenticated Help Settings', |
col2 => ''}], |
col2 => ''}], |
}, |
}, |
'coursedefaults' => |
'coursedefaults' => |
{text => 'Course/Community defaults', |
{text => 'Course/Community defaults', |
help => 'Domain_Configuration_Course_Defaults', |
help => 'Domain_Configuration_Course_Defaults', |
header => [{col1 => 'Defaults which can be overridden for each course by a DC', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
}, |
}, |
'privacy' => |
'privacy' => |
Line 2092 sub print_coursedefaults {
|
Line 2092 sub print_coursedefaults {
|
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); |
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
%choices = |
my %choices = |
|
&Apache::lonlocal::texthash ( |
&Apache::lonlocal::texthash ( |
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys', |
canuse_pdfforms => 'Course/Community users can create/upload PDF forms', |
); |
); |
my $currdefresponder; |
%defaultchecked = ('canuse_pdfforms' => 'off'); |
if (ref($settings) eq 'HASH') { |
@toggles = ('canuse_pdfforms',); |
$currdefresponder = $settings->{'anonsurvey_threshold'}; |
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
} |
\%choices,$itemcount); |
if (!$currdefresponder) { |
|
$currdefresponder = 10; |
|
} elsif ($currdefresponder < 1) { |
|
$currdefresponder = 1; |
|
} |
|
$datatable .= |
|
'<tr'.$css_class.'><td><span class="LC_nobreak">'.$choices{'anonsurvey_threshold'}. |
|
'</span></td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="anonsurvey_threshold"'. |
|
' value="'.$currdefresponder.'" size="5" /></span>'. |
|
'</td></tr>'; |
|
$$rowtotal += $itemcount; |
$$rowtotal += $itemcount; |
return $datatable; |
return $datatable; |
} |
} |
Line 2488 sub print_usermodification {
|
Line 2475 sub print_usermodification {
|
sub print_defaults { |
sub print_defaults { |
my ($dom,$rowtotal) = @_; |
my ($dom,$rowtotal) = @_; |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def', |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def', |
'datelocale_def','portal_def'); |
'datelocale_def'); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my $titles = &defaults_titles($dom); |
my $titles = &defaults_titles(); |
my $rownum = 0; |
my $rownum = 0; |
my ($datatable,$css_class); |
my ($datatable,$css_class); |
foreach my $item (@items) { |
foreach my $item (@items) { |
Line 2527 sub print_defaults {
|
Line 2514 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); |
} else { |
} else { |
my $size; |
|
if ($item eq 'portal_def') { |
|
$size = ' size="25"'; |
|
} |
|
$datatable .= '<input type="text" name="'.$item.'" value="'. |
$datatable .= '<input type="text" name="'.$item.'" value="'. |
$domdefaults{$item}.'"'.$size.' />'; |
$domdefaults{$item}.'" />'; |
} |
} |
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
$rownum ++; |
$rownum ++; |
Line 2542 sub print_defaults {
|
Line 2525 sub print_defaults {
|
} |
} |
|
|
sub defaults_titles { |
sub defaults_titles { |
my ($dom) = @_; |
|
my %titles = &Apache::lonlocal::texthash ( |
my %titles = &Apache::lonlocal::texthash ( |
'auth_def' => 'Default authentication type', |
'auth_def' => 'Default authentication type', |
'auth_arg_def' => 'Default authentication argument', |
'auth_arg_def' => 'Default authentication argument', |
'lang_def' => 'Default language', |
'lang_def' => 'Default language', |
'timezone_def' => 'Default timezone', |
'timezone_def' => 'Default timezone', |
'datelocale_def' => 'Default locale for dates', |
'datelocale_def' => 'Default locale for dates', |
'portal_def' => 'Portal/Default URL', |
|
); |
); |
if ($dom) { |
|
my $uprimary_id = &Apache::lonnet::domain($dom,'primary'); |
|
my $uint_dom = &Apache::lonnet::internet_dom($uprimary_id); |
|
my $protocol = $Apache::lonnet::protocol{$uprimary_id}; |
|
$protocol = 'http' if ($protocol ne 'https'); |
|
if ($uint_dom) { |
|
$titles{'portal_def'} .= ' '.&mt('(for example: [_1])',$protocol.'://loncapa.'. |
|
$uint_dom); |
|
} |
|
} |
|
return (\%titles); |
return (\%titles); |
} |
} |
|
|
Line 5451 sub modify_defaults {
|
Line 5422 sub modify_defaults {
|
my ($dom,$r) = @_; |
my ($dom,$r) = @_; |
my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors); |
my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def', |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def'); |
'portal_def'); |
|
my @authtypes = ('internal','krb4','krb5','localauth'); |
my @authtypes = ('internal','krb4','krb5','localauth'); |
my @doms = &Apache::lonnet::current_machine_domains(); |
|
my @langs; |
|
foreach my $dom (@doms) { |
|
if ($dom =~ /^(\w{2})\w?itest$/) { |
|
push (@langs,$1.'t'); |
|
} elsif ($dom =~ /^(\w{2})\w?i$/) { |
|
push(@langs,$1.'i'); |
|
} |
|
} |
|
foreach my $item (@items) { |
foreach my $item (@items) { |
$newvalues{$item} = $env{'form.'.$item}; |
$newvalues{$item} = $env{'form.'.$item}; |
if ($item eq 'auth_def') { |
if ($item eq 'auth_def') { |
Line 5475 sub modify_defaults {
|
Line 5436 sub modify_defaults {
|
if ($newvalues{$item} ne '') { |
if ($newvalues{$item} ne '') { |
if ($newvalues{$item} =~ /^(\w+)/) { |
if ($newvalues{$item} =~ /^(\w+)/) { |
my $langcode = $1; |
my $langcode = $1; |
if ((!grep(/^\Q$langcode\E/,@langs)) && |
if ($langcode ne 'x_chef') { |
($langcode ne 'x_chef')) { |
|
if (code2language($langcode) eq '') { |
if (code2language($langcode) eq '') { |
push(@errors,$item); |
push(@errors,$item); |
} |
} |
Line 5498 sub modify_defaults {
|
Line 5458 sub modify_defaults {
|
push(@errors,$item); |
push(@errors,$item); |
} |
} |
} |
} |
} elsif ($item eq 'portal_def') { |
|
if ($newvalues{$item} ne '') { |
|
unless ($newvalues{$item} =~ /^https?\:\/\/(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])\/?$/) { |
|
push(@errors,$item); |
|
} |
|
} |
|
} |
} |
if (grep(/^\Q$item\E$/,@errors)) { |
if (grep(/^\Q$item\E$/,@errors)) { |
$newvalues{$item} = $domdefaults{$item}; |
$newvalues{$item} = $domdefaults{$item}; |
Line 5670 sub modify_coursecategories {
|
Line 5624 sub modify_coursecategories {
|
} else { |
} else { |
$changes{'togglecats'} = 1; |
$changes{'togglecats'} = 1; |
$changes{'categorize'} = 1; |
$changes{'categorize'} = 1; |
$domconfig{'coursecategories'} = { |
|
togglecats => $env{'form.togglecats'}, |
|
categorize => $env{'form.categorize'}, |
|
}; |
|
$changes{'togglecatscomm'} = 1; |
$changes{'togglecatscomm'} = 1; |
$changes{'categorizecomm'} = 1; |
$changes{'categorizecomm'} = 1; |
$domconfig{'coursecategories'} = { |
$domconfig{'coursecategories'} = { |
togglecats => $env{'form.togglecatscomm'}, |
togglecats => $env{'form.togglecats'}, |
categorize => $env{'form.categorizecomm'}, |
categorize => $env{'form.categorize'}, |
|
togglecatscomm => $env{'form.togglecatscomm'}, |
|
categorizecomm => $env{'form.categorizecomm'}, |
}; |
}; |
} |
} |
if (ref($cathash) eq 'HASH') { |
if (ref($cathash) eq 'HASH') { |
Line 6152 sub modify_coursedefaults {
|
Line 6104 sub modify_coursedefaults {
|
} |
} |
$defaultshash{'coursedefaults'}{$item} = $env{'form.'.$item}; |
$defaultshash{'coursedefaults'}{$item} = $env{'form.'.$item}; |
} |
} |
my $currdefresponder = $domconfig{'coursedefaults'}{'anonsurvey_threshold'}; |
|
my $newdefresponder = $env{'form.anonsurvey_threshold'}; |
|
$newdefresponder =~ s/\D//g; |
|
if ($newdefresponder eq '' || $newdefresponder < 1) { |
|
$newdefresponder = 1; |
|
} |
|
$defaultshash{'coursedefaults'}{'anonsurvey_threshold'} = $newdefresponder; |
|
if ($currdefresponder ne $newdefresponder) { |
|
unless ($currdefresponder eq '' && $newdefresponder == 10) { |
|
$changes{'anonsurvey_threshold'} = 1; |
|
} |
|
} |
|
} |
} |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
$dom); |
$dom); |
Line 6183 sub modify_coursedefaults {
|
Line 6123 sub modify_coursedefaults {
|
} else { |
} else { |
$resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "off"').'</li>'; |
$resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "off"').'</li>'; |
} |
} |
} elsif ($item eq 'anonsurvey_threshold') { |
|
$resulttext .= '<li>'.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'</li>'; |
|
} |
} |
|
|
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |