version 1.121, 2009/11/30 06:23:32
|
version 1.122, 2009/12/04 14:17:38
|
Line 323 sub handler {
|
Line 323 sub handler {
|
'helpsettings' => |
'helpsettings' => |
{text => 'Help page settings', |
{text => 'Help page settings', |
help => 'Domain_Configuration_Help_Settings', |
help => 'Domain_Configuration_Help_Settings', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Authenticated Help Settings', |
col2 => 'Value',}], |
col2 => ''}, |
|
{col1 => 'Unauthenticated Help Settings', |
|
col2 => ''}], |
}, |
}, |
'coursedefaults' => |
'coursedefaults' => |
{text => 'Course/Community defaults', |
{text => 'Course/Community defaults', |
Line 435 sub process_changes {
|
Line 437 sub process_changes {
|
} elsif ($action eq 'requestcourses') { |
} elsif ($action eq 'requestcourses') { |
$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($r,$dom,$confname,%domconfig); |
} elsif ($action eq 'coursedefaults') { |
} elsif ($action eq 'coursedefaults') { |
$output = &modify_coursedefaults($dom,%domconfig); |
$output = &modify_coursedefaults($dom,%domconfig); |
} |
} |
Line 463 sub print_config_box {
|
Line 465 sub print_config_box {
|
} |
} |
if ($numheaders > 1) { |
if ($numheaders > 1) { |
my $colspan = ''; |
my $colspan = ''; |
if (($action eq 'rolecolors') || ($action eq 'coursecategories')) { |
if (($action eq 'rolecolors') || ($action eq 'coursecategories') || ($action eq 'helpsettings')) { |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
} |
} |
$output .= ' |
$output .= ' |
Line 489 sub print_config_box {
|
Line 491 sub print_config_box {
|
} 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') { |
} elsif ($action eq 'helpsettings') { |
$output .= &print_helpsettings($dom,$settings,\$rowtotal); |
$output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal); |
} else { |
} elsif ($action eq 'rolecolors') { |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
} |
} |
$output .= ' |
$output .= ' |
Line 541 sub print_config_box {
|
Line 543 sub print_config_box {
|
$output .= &print_login('bottom',$dom,$confname,$phase,$settings,\$rowtotal); |
$output .= &print_login('bottom',$dom,$confname,$phase,$settings,\$rowtotal); |
} elsif ($action eq 'requestcourses') { |
} elsif ($action eq 'requestcourses') { |
$output .= &print_courserequestmail($dom,$settings,\$rowtotal); |
$output .= &print_courserequestmail($dom,$settings,\$rowtotal); |
} else { |
} elsif ($action eq 'helpsettings') { |
|
$output .= &print_helpsettings('bottom',$dom,$confname,$settings,\$rowtotal); |
|
} elsif ($action eq 'rolecolors') { |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
</table> |
</table> |
</td> |
</td> |
Line 626 sub print_config_box {
|
Line 630 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('top',$dom,$confname,$settings,\$rowtotal); |
} elsif ($action eq 'coursedefaults') { |
} elsif ($action eq 'coursedefaults') { |
$output .= &print_coursedefaults($dom,$settings,\$rowtotal); |
$output .= &print_coursedefaults($dom,$settings,\$rowtotal); |
} |
} |
Line 1946 sub print_contacts {
|
Line 1950 sub print_contacts {
|
} |
} |
|
|
sub print_helpsettings { |
sub print_helpsettings { |
my ($dom,$settings,$rowtotal) = @_; |
|
my ($css_class,$datatable); |
my ($position,$dom,$confname,$settings,$rowtotal) = @_; |
my $itemcount = 1; |
my ($css_class,$datatable); |
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); |
|
%choices = |
my $switchserver = &check_switchserver($dom,$confname); |
&Apache::lonlocal::texthash ( |
|
submitbugs => 'Display "Submit a bug" link?', |
my $itemcount = 1; |
); |
|
%defaultchecked = ('submitbugs' => 'on'); |
if ($position eq 'top') { |
@toggles = ('submitbugs',); |
|
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); |
\%choices,$itemcount); |
|
$$rowtotal += $itemcount; |
%choices = |
return $datatable; |
&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><span class="LC_nobreak"> </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 ++; |
|
} |
|
|
|
} else { |
|
|
|
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
|
|
|
$datatable .= '<tr'.$css_class.'>'; |
|
|
|
if (ref($settings) eq 'HASH') { |
|
if ($settings->{'loginhelpurl'} ne '') { |
|
my($directory, $filename) = $settings->{'loginhelpurl'} =~ m/(.*\/)(.*)$/; |
|
$datatable .= '<td width="33%"><span class="LC_left_item"><label><a href="'.$settings->{'loginhelpurl'}.'" target="_blank">'.&mt('Custom Login Page Help File In Use').'</a></label></span></td>'; |
|
$datatable .= '<td width="33%"><span class="LC_right_item"><label><input type="checkbox" name="loginhelpurl_del" value="1" />'.&mt('Delete?').'</label></span></td>' |
|
} else { |
|
$datatable .= '<td width="33%"><span class="LC_left_item"><label>'.&mt('Default Login Page Help File In Use').'</label></span></td>'; |
|
$datatable .= '<td width="33%"><span class="LC_right_item"> </span></td>'; |
|
} |
|
} else { |
|
$datatable .= '<td><span class="LC_left_item"> </span></td>'; |
|
$datatable .= '<td><span class="LC_right_item"> </span></td>'; |
|
} |
|
|
|
$datatable .= '<td width="33%"><span class="LC_right_item">'; |
|
if ($switchserver) { |
|
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= &mt('Upload Custom Login Page Help File:'); |
|
$datatable .='<input type="file" name="loginhelpurl" />'; |
|
} |
|
$datatable .= '</span></td></tr>'; |
|
|
|
} |
|
|
|
return $datatable; |
|
|
} |
} |
|
|
|
|
sub radiobutton_prefs { |
sub radiobutton_prefs { |
my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_; |
my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_; |
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && |
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && |
Line 5869 sub modify_serverstatuses {
|
Line 5950 sub modify_serverstatuses {
|
} |
} |
|
|
sub modify_helpsettings { |
sub modify_helpsettings { |
my ($dom,%domconfig) = @_; |
my ($r,$dom,$confname,%domconfig) = @_; |
my ($resulttext,$errors,%changes,%helphash); |
my ($resulttext,$errors,%changes,%helphash); |
|
|
|
my $customhelpfile = $env{'form.loginhelpurl.filename'}; |
|
my $defaulthelpfile = 'defaulthelp.html'; |
|
my $servadm = $r->dir_config('lonAdmEMail'); |
|
my ($configuserok,$author_ok,$switchserver) = |
|
&config_check($dom,$confname,$servadm); |
|
|
my %defaultchecked = ('submitbugs' => 'on'); |
my %defaultchecked = ('submitbugs' => 'on'); |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
my %title = ( submitbugs => 'Display link for users to submit a bug'); |
my %title = ( submitbugs => 'Display link for users to submit a bug', |
|
loginhelpurl => 'Unauthenticated login help page set to custom file'); |
|
|
my @toggles = ('submitbugs'); |
my @toggles = ('submitbugs'); |
|
|
$helphash{'helpsettings'} = {}; |
$helphash{'helpsettings'} = {}; |
Line 5905 sub modify_helpsettings {
|
Line 5994 sub modify_helpsettings {
|
} |
} |
} |
} |
$helphash{'helpsettings'}{$item} = $env{'form.'.$item}; |
$helphash{'helpsettings'}{$item} = $env{'form.'.$item}; |
} |
} |
|
|
|
if ($customhelpfile ne '') { |
|
my $error; |
|
if ($configuserok eq 'ok') { |
|
if ($switchserver) { |
|
$error = &mt("Upload of custom help file is not permitted to this server: [_1]",$switchserver); |
|
} else { |
|
if ($author_ok eq 'ok') { |
|
my ($result,$loginhelpurl) = |
|
&publishlogo($r,'upload','loginhelpurl',$dom, |
|
$confname,'help','','',$customhelpfile); |
|
if ($result eq 'ok') { |
|
$helphash{'helpsettings'}{'loginhelpurl'} = $loginhelpurl; |
|
$changes{'loginhelpurl'} = 1; |
|
} else { |
|
$error = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$customhelpfile,$result); |
|
} |
|
} else { |
|
$error = &mt("Upload of [_1] failed because an author role could not be assigned to a Domain Configuration user ([_2]) in domain: [_3]. Error was: [_4].",$customhelpfile,$confname,$dom,$author_ok); |
|
} |
|
} |
|
} else { |
|
$error = &mt("Upload of [_1] failed because a Domain Configuration user ([_2]) could not be created in domain: [_3]. Error was: [_4].",$customhelpfile,$confname,$dom,$configuserok); |
|
} |
|
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} |
|
|
|
if ($domconfig{'helpsettings'}{'loginhelpurl'} ne '') { |
|
if ($env{'form.loginhelpurl_del'}) { |
|
$helphash{'helpsettings'}{'loginhelpurl'} = ''; |
|
$changes{'loginhelpurl'} = 1; |
|
} |
|
} |
} |
} |
|
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%helphash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%helphash,$dom); |
$dom); |
|
|
|
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
Line 5918 sub modify_helpsettings {
|
Line 6042 sub modify_helpsettings {
|
if ($item eq 'submitbugs') { |
if ($item eq 'submitbugs') { |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
} |
} |
|
if ($item eq 'loginhelpurl') { |
|
if ($helphash{'helpsettings'}{'loginhelpurl'} eq '') { |
|
$resulttext .= '<li>'.&mt('[_1] help file removed; [_2] file will be used for the unathorized help page in this domain.',$customhelpfile,$defaulthelpfile).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt("$title{$item} [_1]",$customhelpfile).'</li>'; |
|
} |
|
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |