version 1.52, 2008/05/29 02:58:41
|
version 1.71, 2008/12/03 13:09:56
|
Line 37 use Apache::loncommon();
|
Line 37 use Apache::loncommon();
|
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonmsg(); |
use Apache::lonmsg(); |
use LONCAPA; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA::Enrollment; |
use LONCAPA::Enrollment; |
|
use LONCAPA::loncgi(); |
use File::Copy; |
use File::Copy; |
use Locale::Language; |
use Locale::Language; |
|
use DateTime::TimeZone; |
|
use DateTime::Locale; |
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
Line 62 sub handler {
|
Line 65 sub handler {
|
} |
} |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['phase']); |
['phase','actions']); |
my $phase = 'pickactions'; |
my $phase = 'pickactions'; |
if ( exists($env{'form.phase'}) ) { |
if ( exists($env{'form.phase'}) ) { |
$phase = $env{'form.phase'}; |
$phase = $env{'form.phase'}; |
Line 71 sub handler {
|
Line 74 sub handler {
|
&Apache::lonnet::get_dom('configuration',['login','rolecolors', |
&Apache::lonnet::get_dom('configuration',['login','rolecolors', |
'quotas','autoenroll','autoupdate','directorysrch', |
'quotas','autoenroll','autoupdate','directorysrch', |
'usercreation','usermodification','contacts','defaults', |
'usercreation','usermodification','contacts','defaults', |
'scantron','coursecategories'],$dom); |
'scantron','coursecategories','serverstatuses'],$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', |
'coursecategories'); |
'coursecategories','serverstatuses'); |
my %prefs = ( |
my %prefs = ( |
'rolecolors' => |
'rolecolors' => |
{ text => 'Default color schemes', |
{ text => 'Default color schemes', |
help => 'Default_Color_Schemes', |
help => 'Domain_Configuration_Color_Schemes', |
header => [{col1 => 'Student Settings', |
header => [{col1 => 'Student Settings', |
col2 => '',}, |
col2 => '',}, |
{col1 => 'Coordinator Settings', |
{col1 => 'Coordinator Settings', |
Line 91 sub handler {
|
Line 94 sub handler {
|
}, |
}, |
'login' => |
'login' => |
{ text => 'Log-in page options', |
{ text => 'Log-in page options', |
help => 'Domain_Log-in_Page', |
help => 'Domain_Configuration_Login_Page', |
header => [{col1 => 'Item', |
header => [{col1 => 'Item', |
col2 => '',}], |
col2 => '',}], |
}, |
}, |
'defaults' => |
'defaults' => |
{ text => 'Default authentication/language', |
{ text => 'Default authentication/language/timezone', |
help => '', |
help => 'Domain_Configuration_LangTZAuth', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value'}], |
col2 => 'Value'}], |
}, |
}, |
'quotas' => |
'quotas' => |
{ text => 'Default quotas for user portfolios', |
{ text => 'Default quotas for user portfolios', |
help => 'Default_User_Quota', |
help => 'Domain_Configuration_Quotas', |
header => [{col1 => 'User type', |
header => [{col1 => 'User type', |
col2 => 'Default quota'}], |
col2 => 'Default quota'}], |
}, |
}, |
'autoenroll' => |
'autoenroll' => |
{ text => 'Auto-enrollment settings', |
{ text => 'Auto-enrollment settings', |
help => 'Domain_Auto_Enrollment', |
help => 'Domain_Configuration_Auto_Enrollment', |
header => [{col1 => 'Configuration setting', |
header => [{col1 => 'Configuration setting', |
col2 => 'Value(s)'}], |
col2 => 'Value(s)'}], |
}, |
}, |
'autoupdate' => |
'autoupdate' => |
{ text => 'Auto-update settings', |
{ text => 'Auto-update settings', |
help => 'Domain_Auto_Update', |
help => 'Domain_Configuration_Auto_Updates', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}, |
col2 => 'Value',}, |
{col1 => 'User population', |
{col1 => 'User population', |
Line 123 sub handler {
|
Line 126 sub handler {
|
}, |
}, |
'directorysrch' => |
'directorysrch' => |
{ text => 'Institutional directory searches', |
{ text => 'Institutional directory searches', |
help => 'Domain_Directory_Search', |
help => 'Domain_Configuration_InstDirectory_Search', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
}, |
}, |
'contacts' => |
'contacts' => |
{ text => 'Contact Information', |
{ text => 'Contact Information', |
help => 'Domain_Contact_Information', |
help => 'Domain_Configuration_Contact_Info', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
}, |
}, |
|
|
'usercreation' => |
'usercreation' => |
{ text => 'User creation', |
{ text => 'User creation', |
help => 'Domain_User_Creation', |
help => 'Domain_Configuration_User_Creation', |
header => [{col1 => 'Format rule type', |
header => [{col1 => 'Format rule type', |
col2 => 'Format rules in force'}, |
col2 => 'Format rules in force'}, |
{col1 => 'User account creation', |
{col1 => 'User account creation', |
Line 144 sub handler {
|
Line 147 sub handler {
|
{col1 => 'Context', |
{col1 => 'Context', |
col2 => 'Assignable authentication types'}], |
col2 => 'Assignable authentication types'}], |
}, |
}, |
'usermodification' => |
'usermodification' => |
{ text => 'User modification', |
{ text => 'User modification', |
help => 'Domain_User_Modification', |
help => 'Domain_Configuration_User_Modification', |
header => [{col1 => 'Target user has role', |
header => [{col1 => 'Target user has role', |
col2 => 'User information updateable in author context'}, |
col2 => 'User information updateable in author context'}, |
{col1 => 'Target user has role', |
{col1 => 'Target user has role', |
col2 => 'User information updateable in course context'}], |
col2 => 'User information updateable in course context'}, |
|
{col1 => "Status of user", |
|
col2 => 'Information settable when self-creating account (if directory data blank)'}], |
}, |
}, |
'scantron' => |
'scantron' => |
{ text => 'Scantron format file', |
{ text => 'Scantron format file', |
help => 'Domain_Scantron_Formats', |
help => 'Domain_Configuration_Scantron_Format', |
header => [ {col1 => 'Item', |
header => [ {col1 => 'Item', |
col2 => '', |
col2 => '', |
}], |
}], |
}, |
}, |
'coursecategories' => |
'coursecategories' => |
{ text => 'Cataloging of courses', |
{ text => 'Cataloging of courses', |
help => 'Domain_Course_Catalog', |
help => 'Domain_Configuration_Cataloging_Courses', |
header => [ {col1 => 'Categories', |
header => [{col1 => 'Category settings', |
col2 => '', |
col2 => '',}, |
}], |
{col1 => 'Categories', |
} |
col2 => '', |
|
}], |
|
}, |
|
'serverstatuses' => |
|
{text => 'Access to Server Status Pages', |
|
help => 'Domain_Configuration_Server_Status', |
|
header => [{col1 => 'Status Page', |
|
col2 => 'Other named users', |
|
col3 => 'Specific IPs', |
|
}], |
|
}, |
); |
); |
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 300 sub handler {
|
Line 315 sub handler {
|
$r->print('<h3>'.&mt('Functionality to display/modify').'</h3>'); |
$r->print('<h3>'.&mt('Functionality to display/modify').'</h3>'); |
$r->print('<script type="text/javascript">'."\n". |
$r->print('<script type="text/javascript">'."\n". |
&Apache::loncommon::check_uncheck_jscript()."\n". |
&Apache::loncommon::check_uncheck_jscript()."\n". |
'</script>'."\n".'<p><input type="button" value="check all" '. |
'</script>'."\n".'<p><input type="button" value="'.&mt('check all').'" '. |
'onclick="javascript:checkAll(document.pickactions.actions)"'. |
'onclick="javascript:checkAll(document.pickactions.actions)"'. |
' /> '. |
' /> '. |
'<input type="button" value="uncheck all" '. |
'<input type="button" value="'.&mt('uncheck all').'" '. |
'onclick="javascript:uncheckAll(document.pickactions.actions)"'. |
'onclick="javascript:uncheckAll(document.pickactions.actions)"'. |
' /></p><div class="LC_left_float">'); |
' /></p><div class="LC_left_float">'); |
my ($numitems,$midpoint,$seconddiv,$count); |
my ($numitems,$midpoint,$seconddiv,$count); |
Line 314 sub handler {
|
Line 329 sub handler {
|
} |
} |
$count = 0; |
$count = 0; |
foreach my $item (@prefs_order) { |
foreach my $item (@prefs_order) { |
$r->print('<h4><label><input type="checkbox" name="actions" value="'.$item.'" /> '.$prefs{$item}->{'text'}.'</label></h4>'); |
$r->print('<h4>'. |
|
&Apache::loncommon::help_open_topic($prefs{$item}->{'help'}). |
|
'<label><input type="checkbox" name="actions" value="'.$item. |
|
'" /> '.&mt($prefs{$item}->{'text'}).'</label></h4>'); |
$count ++; |
$count ++; |
if ((!$seconddiv) && ($count >= $midpoint)) { |
if ((!$seconddiv) && ($count >= $midpoint)) { |
$r->print('</div>'."\n".'<div class="LC_left_float">'."\n"); |
$r->print('</div>'."\n".'<div class="LC_left_float">'."\n"); |
Line 363 sub process_changes {
|
Line 381 sub process_changes {
|
$output = &modify_scantron($r,$dom,$confname,%domconfig); |
$output = &modify_scantron($r,$dom,$confname,%domconfig); |
} elsif ($action eq 'coursecategories') { |
} elsif ($action eq 'coursecategories') { |
$output = &modify_coursecategories($dom,%domconfig); |
$output = &modify_coursecategories($dom,%domconfig); |
|
} elsif ($action eq 'serverstatuses') { |
|
$output = &modify_serverstatuses($dom,%domconfig); |
} |
} |
return $output; |
return $output; |
} |
} |
Line 377 sub print_config_box {
|
Line 397 sub print_config_box {
|
$output .= |
$output .= |
'<table class="LC_nested_outer"> |
'<table class="LC_nested_outer"> |
<tr> |
<tr> |
<th align="left"><span class="LC_nobreak">'.&mt($item->{text}). |
<th align="left" valign="middle"><span class="LC_nobreak">'. |
' </span></th></tr>'; |
&mt($item->{text}).' '. |
# |
&Apache::loncommon::help_open_topic($item->{'help'}).'</span></th>'."\n". |
# FIXME - put the help link back in when the help files exist |
'</tr>'; |
# <th>'.&mt($item->{text}).' '. |
|
# &Apache::loncommon::help_open_topic($item->{'help'}).'</th> |
|
# </tr>'); |
|
$rowtotal ++; |
$rowtotal ++; |
if (($action eq 'autoupdate') || ($action eq 'rolecolors') || |
if (($action eq 'autoupdate') || ($action eq 'rolecolors') || |
($action eq 'usercreation') || ($action eq 'usermodification')) { |
($action eq 'usercreation') || ($action eq 'usermodification') || |
my $colspan = ($action eq 'rolecolors')?' colspan="2"':''; |
($action eq 'coursecategories')) { |
|
my $colspan = ''; |
|
if (($action eq 'rolecolors') || ($action eq 'coursecategories')) { |
|
$colspan = ' colspan="2"'; |
|
} |
$output .= ' |
$output .= ' |
<tr> |
<tr> |
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[0]->{'col1'}.'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[0]->{'col1'}).'</td> |
<td class="LC_right_item">'.$item->{'header'}->[0]->{'col2'}.'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[0]->{'col2'}).'</td> |
</tr>'; |
</tr>'; |
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'autoupdate') { |
if ($action eq 'autoupdate') { |
$output .= &print_autoupdate('top',$dom,$settings,\$rowtotal); |
$output .= &print_autoupdate('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'usercreation') { |
} elsif ($action eq 'usercreation') { |
$output .= &print_usercreation('top',$dom,$settings,\$rowtotal); |
$output .= &print_usercreation('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'usermodification') { |
} elsif ($action eq 'usermodification') { |
$output .= &print_usermodification('top',$dom,$settings,\$rowtotal); |
$output .= &print_usermodification('top',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'coursecategories') { |
|
$output .= &print_coursecategories('top',$dom,$item,$settings,\$rowtotal); |
} else { |
} else { |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
} |
} |
Line 414 sub print_config_box {
|
Line 437 sub print_config_box {
|
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[1]->{'col1'}.'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[1]->{'col1'}).'</td>'; |
<td class="LC_right_item">'.$item->{'header'}->[1]->{'col2'}.'</td> |
$output .= ' |
|
<td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[1]->{'col2'}).'</td> |
</tr>'; |
</tr>'; |
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'autoupdate') { |
if ($action eq 'autoupdate') { |
Line 429 sub print_config_box {
|
Line 453 sub print_config_box {
|
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[2]->{'col1'}.'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
<td class="LC_right_item">'.$item->{'header'}->[2]->{'col2'}.'</td> </tr>'. |
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'. |
&print_usercreation('bottom',$dom,$settings,\$rowtotal); |
&print_usercreation('bottom',$dom,$settings,\$rowtotal); |
$rowtotal ++; |
$rowtotal ++; |
} elsif ($action eq 'usermodification') { |
} elsif ($action eq 'usermodification') { |
$output .= &print_usermodification('bottom',$dom,$settings,\$rowtotal); |
$output .= &print_usermodification('middle',$dom,$settings,\$rowtotal).' |
|
</table> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td> |
|
<table class="LC_nested"> |
|
<tr class="LC_info_row"> |
|
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
|
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'. |
|
|
|
&print_usermodification('bottom',$dom,$settings,\$rowtotal); |
|
$rowtotal ++; |
|
} elsif ($action eq 'coursecategories') { |
|
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
} else { |
} else { |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
</table> |
</table> |
Line 444 sub print_config_box {
|
Line 482 sub print_config_box {
|
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[2]->{'col1'}.'</td> |
<td class="LC_left_item"'.$colspan.' valign="top">'. |
<td class="LC_right_item">'.$item->{'header'}->[2]->{'col2'}.'</td> |
&mt($item->{'header'}->[2]->{'col1'}).'</td> |
|
<td class="LC_right_item" valign="top">'. |
|
&mt($item->{'header'}->[2]->{'col2'}).'</td> |
</tr>'. |
</tr>'. |
&print_rolecolors($phase,'author',$dom,$confname,$settings,\$rowtotal).' |
&print_rolecolors($phase,'author',$dom,$confname,$settings,\$rowtotal).' |
</table> |
</table> |
Line 455 sub print_config_box {
|
Line 495 sub print_config_box {
|
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[3]->{'col1'}.'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td> |
<td class="LC_right_item">'.$item->{'header'}->[3]->{'col2'}.'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[3]->{'col2'}).'</td> |
</tr>'. |
</tr>'. |
&print_rolecolors($phase,'admin',$dom,$confname,$settings,\$rowtotal); |
&print_rolecolors($phase,'admin',$dom,$confname,$settings,\$rowtotal); |
$rowtotal += 2; |
$rowtotal += 2; |
Line 469 sub print_config_box {
|
Line 509 sub print_config_box {
|
<tr class="LC_info_row">'; |
<tr class="LC_info_row">'; |
if (($action eq 'login') || ($action eq 'directorysrch')) { |
if (($action eq 'login') || ($action eq 'directorysrch')) { |
$output .= ' |
$output .= ' |
<td class="LC_left_item" colspan="2">'.$item->{'header'}->[0]->{'col1'}.'</td>'; |
<td class="LC_left_item" colspan="2">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>'; |
|
} elsif ($action eq 'serverstatuses') { |
|
$output .= ' |
|
<td class="LC_left_item" valign="top">'.&mt($item->{'header'}->[0]->{'col1'}). |
|
'<br />('.&mt('Automatic access for Dom. Coords.').')</td>'; |
|
|
} else { |
} else { |
$output .= ' |
$output .= ' |
<td class="LC_left_item">'.$item->{'header'}->[0]->{'col1'}.'</td>'; |
<td class="LC_left_item" valign="top">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>'; |
} |
} |
my $colspan = ($action eq 'coursecategories')?' colspan="2"':''; |
if ($action eq 'serverstatuses') { |
$output .= ' |
$output .= '<td class="LC_left_item" valign="top">'. |
<td class="LC_right_item"'.$colspan.'>'.$item->{'header'}->[0]->{'col2'}.'</td> |
&mt($item->{'header'}->[0]->{'col2'}). |
</tr>'; |
'<br />(<tt>'.&mt('user1:domain1,user2:domain2 etc.').'</tt>)'; |
|
} else { |
|
$output .= '<td class="LC_right_item" valign="top">'. |
|
&mt($item->{'header'}->[0]->{'col2'}); |
|
} |
|
$output .= '</td>'; |
|
if ($item->{'header'}->[0]->{'col3'}) { |
|
$output .= '<td class="LC_right_item" valign="top">'. |
|
&mt($item->{'header'}->[0]->{'col3'}); |
|
if ($action eq 'serverstatuses') { |
|
$output .= '<br />(<tt>'.&mt('IP1,IP2 etc.').'</tt>)'; |
|
} |
|
$output .= '</td>'; |
|
} |
|
$output .= '</tr>'; |
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'login') { |
if ($action eq 'login') { |
$output .= &print_login($dom,$confname,$phase,$settings,\$rowtotal); |
$output .= &print_login($dom,$confname,$phase,$settings,\$rowtotal); |
Line 493 sub print_config_box {
|
Line 552 sub print_config_box {
|
$output .= &print_defaults($dom,\$rowtotal); |
$output .= &print_defaults($dom,\$rowtotal); |
} elsif ($action eq 'scantron') { |
} elsif ($action eq 'scantron') { |
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); |
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); |
} elsif ($action eq 'coursecategories'){ |
} elsif ($action eq 'serverstatuses') { |
$output .= &print_coursecategories($dom,$item,$settings,\$rowtotal); |
$output .= &print_serverstatuses($dom,$settings,\$rowtotal); |
} |
} |
} |
} |
$output .= ' |
$output .= ' |
Line 638 sub print_login {
|
Line 697 sub print_login {
|
); |
); |
foreach my $item (@images) { |
foreach my $item (@images) { |
$defaults{$item} = $defaultdesign{'login.'.$item}; |
$defaults{$item} = $defaultdesign{'login.'.$item}; |
|
$defaults{'showlogo'}{$item} = 1; |
} |
} |
foreach my $item (@bgs) { |
foreach my $item (@bgs) { |
$defaults{'bgs'}{$item} = $defaultdesign{'login.'.$item}; |
$defaults{'bgs'}{$item} = $defaultdesign{'login.'.$item}; |
Line 659 sub print_login {
|
Line 719 sub print_login {
|
} |
} |
} |
} |
foreach my $item (@images) { |
foreach my $item (@images) { |
if ($settings->{$item} ne '') { |
if (defined($settings->{$item})) { |
$designs{$item} = $settings->{$item}; |
$designs{$item} = $settings->{$item}; |
$is_custom{$item} = 1; |
$is_custom{$item} = 1; |
} |
} |
|
if (defined($settings->{'showlogo'}{$item})) { |
|
$designs{'showlogo'}{$item} = $settings->{'showlogo'}{$item}; |
|
} |
} |
} |
foreach my $item (@logintext) { |
foreach my $item (@logintext) { |
if ($settings->{$item} ne '') { |
if ($settings->{$item} ne '') { |
Line 751 sub login_choices {
|
Line 814 sub login_choices {
|
bgs => "Background colors", |
bgs => "Background colors", |
links => "Link colors", |
links => "Link colors", |
font => "Font color", |
font => "Font color", |
pgbg => "Page", |
pgbg => "Header", |
mainbg => "Main panel", |
mainbg => "Page", |
sidebg => "Side panel", |
sidebg => "Container", |
link => "Link", |
link => "Link", |
alink => "Active link", |
alink => "Active link", |
vlink => "Visited link", |
vlink => "Visited link", |
Line 856 sub display_color_options {
|
Line 919 sub display_color_options {
|
$itemcount ++; |
$itemcount ++; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td>'.$choices->{$img}.'</td>'; |
'<td>'.$choices->{$img}; |
my ($imgfile,$img_import,$login_hdr_pick,$logincolors); |
my ($imgfile,$img_import,$login_hdr_pick,$logincolors); |
|
if ($role eq 'login') { |
|
if ($img eq 'login') { |
|
$login_hdr_pick = |
|
&login_header_options($img,$role,$defaults,$is_custom,$choices, |
|
$loginheader); |
|
$logincolors = |
|
&login_text_colors($img,$role,$logintext,$phase,$choices, |
|
$designs); |
|
} elsif ($img ne 'domlogo') { |
|
$datatable.= &logo_display_options($img,$defaults,$designs); |
|
} |
|
} |
|
$datatable .= '</td>'; |
if ($designs->{$img} ne '') { |
if ($designs->{$img} ne '') { |
$imgfile = $designs->{$img}; |
$imgfile = $designs->{$img}; |
$img_import = ($imgfile =~ m{^/adm/}); |
$img_import = ($imgfile =~ m{^/adm/}); |
} else { |
} else { |
$imgfile = $defaults->{$img}; |
$imgfile = $defaults->{$img}; |
} |
} |
if ($img eq 'login') { |
|
$login_hdr_pick = &login_header_options($img,$role,$defaults,$is_custom,$choices, |
|
$loginheader); |
|
$logincolors = |
|
&login_text_colors($img,$role,$logintext,$phase,$choices,$designs); |
|
} |
|
if ($imgfile) { |
if ($imgfile) { |
my ($showfile,$fullsize); |
my ($showfile,$fullsize); |
if ($imgfile =~ m-^(/res/\Q$dom\E/\Q$confname\E/\Q$img\E)/([^/]+)$-) { |
if ($imgfile =~ m-^(/res/\Q$dom\E/\Q$confname\E/\Q$img\E)/([^/]+)$-) { |
Line 958 sub display_color_options {
|
Line 1028 sub display_color_options {
|
my $bgs_def; |
my $bgs_def; |
foreach my $item (@{$bgs}) { |
foreach my $item (@{$bgs}) { |
if (!$is_custom->{$item}) { |
if (!$is_custom->{$item}) { |
$bgs_def .= '<td>'.$choices->{$item}.' <span id="css_default_'.$role.'_'.$item.'" style="background-color: '.$defaults->{'bgs'}{$item}.';"> </span><br />'.$defaults->{'bgs'}{$item}.'</td>'; |
$bgs_def .= '<td><span class="LC_nobreak">'.$choices->{$item}.'</span> <span id="css_default_'.$role.'_'.$item.'" style="background-color: '.$defaults->{'bgs'}{$item}.';"> </span><br />'.$defaults->{'bgs'}{$item}.'</td>'; |
} |
} |
} |
} |
if ($bgs_def) { |
if ($bgs_def) { |
Line 1009 sub display_color_options {
|
Line 1079 sub display_color_options {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub logo_display_options { |
|
my ($img,$defaults,$designs) = @_; |
|
my $checkedon; |
|
if (ref($defaults) eq 'HASH') { |
|
if (ref($defaults->{'showlogo'}) eq 'HASH') { |
|
if ($defaults->{'showlogo'}{$img}) { |
|
$checkedon = 'checked="checked" '; |
|
} |
|
} |
|
} |
|
if (ref($designs) eq 'HASH') { |
|
if (ref($designs->{'showlogo'}) eq 'HASH') { |
|
if (defined($designs->{'showlogo'}{$img})) { |
|
if ($designs->{'showlogo'}{$img} == 0) { |
|
$checkedon = ''; |
|
} elsif ($designs->{'showlogo'}{$img} == 1) { |
|
$checkedon = 'checked="checked" '; |
|
} |
|
} |
|
} |
|
} |
|
return '<br /><label> <input type="checkbox" name="'. |
|
'login_showlogo_'.$img.'" value="1" '.$checkedon.'/>'. |
|
&mt('show').'</label>'."\n"; |
|
} |
|
|
sub login_header_options { |
sub login_header_options { |
my ($img,$role,$defaults,$is_custom,$choices,$loginheader) = @_; |
my ($img,$role,$defaults,$is_custom,$choices,$loginheader) = @_; |
my $image_checked = ' checked="checked" '; |
my $image_checked = ' checked="checked" '; |
Line 1060 sub image_changes {
|
Line 1156 sub image_changes {
|
my ($is_custom,$alt_text,$img_import,$showfile,$fullsize,$role,$img,$imgfile,$logincolors) = @_; |
my ($is_custom,$alt_text,$img_import,$showfile,$fullsize,$role,$img,$imgfile,$logincolors) = @_; |
my $output; |
my $output; |
if (!$is_custom) { |
if (!$is_custom) { |
if ($img eq 'login') { |
if ($img ne 'domlogo') { |
$output .= &mt('Default image:').'<br />'; |
$output .= &mt('Default image:').'<br />'; |
} else { |
} else { |
$output .= &mt('Default in use:').'<br />'; |
$output .= &mt('Default in use:').'<br />'; |
Line 1442 sub print_contacts {
|
Line 1538 sub print_contacts {
|
my $rownum = 0; |
my $rownum = 0; |
my $css_class; |
my $css_class; |
foreach my $item (@contacts) { |
foreach my $item (@contacts) { |
if ($rownum%2) { |
$rownum ++; |
$css_class = ''; |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
} else { |
|
$css_class = ' class="LC_odd_row" '; |
|
} |
|
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td><span class="LC_nobreak">'.$titles->{$item}. |
'<td><span class="LC_nobreak">'.$titles->{$item}. |
'</span></td><td class="LC_right_item">'. |
'</span></td><td class="LC_right_item">'. |
'<input type="text" name="'.$item.'" value="'. |
'<input type="text" name="'.$item.'" value="'. |
$to{$item}.'" /></td></tr>'; |
$to{$item}.'" /></td></tr>'; |
$rownum ++; |
|
} |
} |
foreach my $type (@mailings) { |
foreach my $type (@mailings) { |
if ($rownum%2) { |
$rownum ++; |
$css_class = ''; |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
} else { |
|
$css_class = ' class="LC_odd_row" '; |
|
} |
|
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td><span class="LC_nobreak">'. |
'<td><span class="LC_nobreak">'. |
$titles->{$type}.': </span></td>'. |
$titles->{$type}.': </span></td>'. |
Line 1476 sub print_contacts {
|
Line 1565 sub print_contacts {
|
'<input type="text" name="'.$type.'_others" '. |
'<input type="text" name="'.$type.'_others" '. |
'value="'.$otheremails{$type}.'" />'. |
'value="'.$otheremails{$type}.'" />'. |
'</td></tr>'."\n"; |
'</td></tr>'."\n"; |
$rownum ++; |
|
} |
} |
$$rowtotal += $rownum; |
$$rowtotal += $rownum; |
return $datatable; |
return $datatable; |
Line 1485 sub print_contacts {
|
Line 1573 sub print_contacts {
|
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', |
'adminemail' => 'Default Server Admin E-mail address', |
'adminemail' => 'Default Server Admin E-mail address', |
'errormail' => 'Error reports to be e-mailed to', |
'errormail' => 'Error reports to be e-mailed to', |
'packagesmail' => 'Package update alerts to be e-mailed to', |
'packagesmail' => 'Package update alerts to be e-mailed to', |
'helpdeskmail' => 'Helpdesk requests to be e-mailed to' |
'helpdeskmail' => 'Helpdesk requests to be e-mailed to' |
Line 1676 sub user_formats_row {
|
Line 1764 sub user_formats_row {
|
); |
); |
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
$output = '<tr '.$css_class.'>'. |
$output = '<tr '.$css_class.'>'. |
'<td><span class="LC_nobreak">'. |
'<td><span class="LC_nobreak">'; |
&mt("Format rules to check for $text{$type}: "). |
if ($type eq 'email') { |
'</span></td>'. |
$output .= &mt("Formats disallowed for $text{$type}: "); |
'<td class="LC_left_item" colspan="2"><table>'; |
} else { |
|
$output .= &mt("Format rules to check for $text{$type}: "); |
|
} |
|
$output .= '</span></td>'. |
|
'<td class="LC_left_item" colspan="2"><table>'; |
my $rem; |
my $rem; |
if (ref($ruleorder) eq 'ARRAY') { |
if (ref($ruleorder) eq 'ARRAY') { |
for (my $i=0; $i<@{$ruleorder}; $i++) { |
for (my $i=0; $i<@{$ruleorder}; $i++) { |
Line 1767 sub print_usermodification {
|
Line 1859 sub print_usermodification {
|
$$rowtotal ++; |
$$rowtotal ++; |
$rowcount ++; |
$rowcount ++; |
} |
} |
} else { |
} elsif ($position eq 'middle') { |
$context = 'course'; |
$context = 'course'; |
$rowcount = 0; |
$rowcount = 0; |
foreach my $role ('st','ep','ta','in','cr') { |
foreach my $role ('st','ep','ta','in','cr') { |
Line 1776 sub print_usermodification {
|
Line 1868 sub print_usermodification {
|
$$rowtotal ++; |
$$rowtotal ++; |
$rowcount ++; |
$rowcount ++; |
} |
} |
|
} elsif ($position eq 'bottom') { |
|
$context = 'selfcreate'; |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
$usertypes->{'default'} = $othertitle; |
|
if (ref($types) eq 'ARRAY') { |
|
push(@{$types},'default'); |
|
$usertypes->{'default'} = $othertitle; |
|
foreach my $status (@{$types}) { |
|
$datatable .= &modifiable_userdata_row($context,$status,$settings, |
|
$numinrow,$rowcount,$usertypes); |
|
$$rowtotal ++; |
|
$rowcount ++; |
|
} |
|
} |
} |
} |
return $datatable; |
return $datatable; |
} |
} |
|
|
sub print_defaults { |
sub print_defaults { |
my ($dom,$rowtotal) = @_; |
my ($dom,$rowtotal) = @_; |
my @items = ('auth_def','auth_arg_def','lang_def'); |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def', |
|
'datelocale_def'); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my $titles = &defaults_titles(); |
my $titles = &defaults_titles(); |
my $rownum = 0; |
my $rownum = 0; |
Line 1814 sub print_defaults {
|
Line 1921 sub print_defaults {
|
'" value="'.$auth.'"'.$checked.'/>'. |
'" value="'.$auth.'"'.$checked.'/>'. |
$authnames{$shortauth{$auth}}.'</label> '; |
$authnames{$shortauth{$auth}}.'</label> '; |
} |
} |
|
} elsif ($item eq 'timezone_def') { |
|
my $includeempty = 1; |
|
$datatable .= &Apache::loncommon::select_timezone($item,$domdefaults{$item},undef,$includeempty); |
|
} elsif ($item eq 'datelocale_def') { |
|
my $includeempty = 1; |
|
$datatable .= &Apache::loncommon::select_datelocale($item,$domdefaults{$item},undef,$includeempty); |
} else { |
} else { |
$datatable .= '<input type="text" name="'.$item.'" value="'. |
$datatable .= '<input type="text" name="'.$item.'" value="'. |
$domdefaults{$item}.'" />'; |
$domdefaults{$item}.'" />'; |
Line 1830 sub defaults_titles {
|
Line 1943 sub defaults_titles {
|
'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', |
|
'datelocale_def' => 'Default locale for dates', |
); |
); |
return (\%titles); |
return (\%titles); |
} |
} |
Line 1837 sub defaults_titles {
|
Line 1952 sub defaults_titles {
|
sub print_scantronformat { |
sub print_scantronformat { |
my ($r,$dom,$confname,$settings,$rowtotal) = @_; |
my ($r,$dom,$confname,$settings,$rowtotal) = @_; |
my $itemcount = 1; |
my $itemcount = 1; |
my ($datatable,$css_class,$scantronurl,$is_custom,%error,%scantronurls); |
my ($datatable,$css_class,$scantronurl,$is_custom,%error,%scantronurls, |
|
%confhash); |
my $switchserver = &check_switchserver($dom,$confname); |
my $switchserver = &check_switchserver($dom,$confname); |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
default => 'Default scantron format file error', |
default => 'Default scantron format file error', |
Line 1864 sub print_scantronformat {
|
Line 1980 sub print_scantronformat {
|
); |
); |
my %md5chk; |
my %md5chk; |
foreach my $type (keys(%legacyfile)) { |
foreach my $type (keys(%legacyfile)) { |
$md5chk{$type} = split(/ /,`md5sum $legacyfile{$type}`); |
($md5chk{$type}) = split(/ /,`md5sum $legacyfile{$type}`); |
chop($md5chk{$type}); |
chomp($md5chk{$type}); |
} |
} |
if ($md5chk{'default'} ne $md5chk{'custom'}) { |
if ($md5chk{'default'} ne $md5chk{'custom'}) { |
foreach my $type (keys(%legacyfile)) { |
foreach my $type (keys(%legacyfile)) { |
($scantronurls{$type},$error{$type}) = |
($scantronurls{$type},my $error) = |
&legacy_scantronformat($r,$dom,$confname, |
&legacy_scantronformat($r,$dom,$confname, |
$type,$legacyfile{$type}, |
$type,$legacyfile{$type}, |
$scantronurls{$type}, |
$scantronurls{$type}, |
$scantronfiles{$type}); |
$scantronfiles{$type}); |
|
if ($error ne '') { |
|
$error{$type} = $error; |
|
} |
|
} |
|
if (keys(%error) == 0) { |
|
$is_custom = 1; |
|
$confhash{'scantron'}{'scantronformat'} = |
|
$scantronurls{'custom'}; |
|
my $putresult = |
|
&Apache::lonnet::put_dom('configuration', |
|
\%confhash,$dom); |
|
if ($putresult ne 'ok') { |
|
$error{'custom'} = |
|
'<span class="LC_error">'. |
|
&mt('An error occurred updating the domain configuration: [_1]',$putresult).'</span>'; |
|
} |
} |
} |
} else { |
} else { |
($scantronurls{'default'},$error{'default'}) = |
($scantronurls{'default'},my $error) = |
&legacy_scantronformat($r,$dom,$confname, |
&legacy_scantronformat($r,$dom,$confname, |
'default',$legacyfile{'default'}, |
'default',$legacyfile{'default'}, |
$scantronurls{'default'}, |
$scantronurls{'default'}, |
$scantronfiles{'default'}); |
$scantronfiles{'default'}); |
|
if ($error eq '') { |
|
$confhash{'scantron'}{'scantronformat'} = ''; |
|
my $putresult = |
|
&Apache::lonnet::put_dom('configuration', |
|
\%confhash,$dom); |
|
if ($putresult ne 'ok') { |
|
$error{'default'} = |
|
'<span class="LC_error">'. |
|
&mt('An error occurred updating the domain configuration: [_1]',$putresult).'</span>'; |
|
} |
|
} else { |
|
$error{'default'} = $error; |
|
} |
} |
} |
} |
} |
} |
} |
Line 1901 sub print_scantronformat {
|
Line 2046 sub print_scantronformat {
|
$scantronurl = $scantronurls{'default'}; |
$scantronurl = $scantronurls{'default'}; |
} |
} |
} else { |
} else { |
$scantronurl = $scantronurls{'default'}; |
if ($is_custom) { |
|
$scantronurl = $scantronurls{'custom'}; |
|
} else { |
|
$scantronurl = $scantronurls{'default'}; |
|
} |
} |
} |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr'.$css_class.'>'; |
$datatable .= '<tr'.$css_class.'>'; |
if (!$is_custom) { |
if (!$is_custom) { |
$datatable .= '<td>'.&mt('Default in use:').'<br />'; |
$datatable .= '<td>'.&mt('Default in use:').'<br />'. |
|
'<span class="LC_nobreak">'; |
if ($scantronurl) { |
if ($scantronurl) { |
$datatable .= '<a href="'.$scantronurl.'" target="_blank">'. |
$datatable .= '<a href="'.$scantronurl.'" target="_blank">'. |
&mt('Default scantron format file').'</a>'; |
&mt('Default scantron format file').'</a>'; |
} else { |
} else { |
$datatable = &mt('File unavailable for display'); |
$datatable = &mt('File unavailable for display'); |
} |
} |
$datatable .= '</td><td valign="bottom">'.&mt('Upload:').'<br />'; |
$datatable .= '</span></td>'; |
|
if (keys(%error) == 0) { |
|
$datatable .= '<td valign="bottom">'; |
|
if (!$switchserver) { |
|
$datatable .= &mt('Upload:').'<br />'; |
|
} |
|
} else { |
|
my $errorstr; |
|
foreach my $key (sort(keys(%error))) { |
|
$errorstr .= $lt{$key}.': '.$error{$key}.'<br />'; |
|
} |
|
$datatable .= '<td>'.$errorstr; |
|
} |
} else { |
} else { |
if (keys(%error) > 0) { |
if (keys(%error) > 0) { |
my $errorstr; |
my $errorstr; |
foreach my $key (sort(keys(%error))) { |
foreach my $key (sort(keys(%error))) { |
$errorstr .= $lt{$key}.': '.$error{$key}.'<br />'; |
$errorstr .= $lt{$key}.': '.$error{$key}.'<br />'; |
} |
} |
$datatable .= '<td>'.$errorstr.'</td><td>'; |
$datatable .= '<td>'.$errorstr.'</td><td> '; |
} elsif ($scantronurl) { |
} elsif ($scantronurl) { |
$datatable .= '<td><a href="'.$scantronurl.'" target="_blank">' .&mt('Custom scantron format file').'</a>' |
$datatable .= '<td><span class="LC_nobreak">'. |
.'<span class="LC_nobreak"><label>' |
'<a href="'.$scantronurl.'" target="_blank">'. |
.'<input type="checkbox" name="scantronformat_del"' |
&mt('Custom scantron format file').'</a><label>'. |
.'" value="1" />'.&mt('Delete?').'</label></td>' |
'<input type="checkbox" name="scantronformat_del"'. |
.'<td>'.&mt('Replace:').'</span><br />'; |
'" value="1" />'.&mt('Delete?').'</label></span></td>'. |
|
'<td><span class="LC_nobreak"> '. |
|
&mt('Replace:').'</span><br />'; |
} |
} |
} |
} |
if (keys(%error) == 0) { |
if (keys(%error) == 0) { |
if ($switchserver) { |
if ($switchserver) { |
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
} else { |
} else { |
$datatable .=' <input type="file" name="scantronformat" />'; |
$datatable .='<span class="LC_nobreak"> '. |
|
'<input type="file" name="scantronformat" /></span>'; |
} |
} |
} |
} |
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
Line 1957 sub legacy_scantronformat {
|
Line 2122 sub legacy_scantronformat {
|
} |
} |
|
|
sub print_coursecategories { |
sub print_coursecategories { |
my ($dom,$hdritem,$settings,$rowtotal) = @_; |
my ($position,$dom,$hdritem,$settings,$rowtotal) = @_; |
my ($datatable,$css_class); |
my $datatable; |
my $itemcount = 1; |
if ($position eq 'top') { |
if (ref($settings) eq 'HASH') { |
my $toggle_cats_crs = ' '; |
my (@cats,@trails,%allitems,%idx,@jsarray); |
my $toggle_cats_dom = ' checked="checked" '; |
&Apache::loncommon::extract_categories($settings,\@cats,\@trails, |
my $can_cat_crs = ' '; |
\%allitems,\%idx,\@jsarray); |
my $can_cat_dom = ' checked="checked" '; |
my $maxdepth = scalar(@cats); |
if (ref($settings) eq 'HASH') { |
my $colattrib = ''; |
if ($settings->{'togglecats'} eq 'crs') { |
if ($maxdepth > 2) { |
$toggle_cats_crs = $toggle_cats_dom; |
$colattrib = ' colspan="2" '; |
$toggle_cats_dom = ' '; |
} |
} |
my @path; |
if ($settings->{'categorize'} eq 'crs') { |
if (@cats > 0) { |
$can_cat_crs = $can_cat_dom; |
if (ref($cats[0]) eq 'ARRAY') { |
$can_cat_dom = ' '; |
my $numtop = @{$cats[0]}; |
} |
my $maxnum = $numtop; |
} |
if ((!grep(/^instcode$/,@{$cats[0]})) || ($settings->{'instcode::0'} eq '')) { |
my %title = &Apache::lonlocal::texthash ( |
$maxnum ++; |
togglecats => 'Show/Hide a course in the catalog', |
} |
categorize => 'Assign a category to a course', |
my $lastidx; |
); |
for (my $i=0; $i<$numtop; $i++) { |
my %level = &Apache::lonlocal::texthash ( |
my $parent = $cats[0][$i]; |
dom => 'Set in "Modify Course" (Domain)', |
|
crs => 'Set in "Modify Parameters" (Course)', |
|
); |
|
$datatable = '<tr class="LC_odd_row">'. |
|
'<td>'.$title{'togglecats'}.'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="togglecats"'. |
|
$toggle_cats_dom.' value="dom" />'.$level{'dom'}.'</label> '. |
|
'<label><input type="radio" name="togglecats"'. |
|
$toggle_cats_crs.' value="crs" />'.$level{'crs'}.'</label></span></td>'. |
|
'</tr><tr>'. |
|
'<td>'.$title{'categorize'}.'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" name="categorize"'. |
|
$can_cat_dom.' value="dom" />'.$level{'dom'}.'</label> '. |
|
'<label><input type="radio" name="categorize"'. |
|
$can_cat_crs.'value="crs" />'.$level{'crs'}.'</label></span></td>'. |
|
'</tr>'; |
|
$$rowtotal += 2; |
|
} else { |
|
my $css_class; |
|
my $itemcount = 1; |
|
my $cathash; |
|
if (ref($settings) eq 'HASH') { |
|
$cathash = $settings->{'cats'}; |
|
} |
|
if (ref($cathash) eq 'HASH') { |
|
my (@cats,@trails,%allitems,%idx,@jsarray); |
|
&Apache::loncommon::extract_categories($cathash,\@cats,\@trails, |
|
\%allitems,\%idx,\@jsarray); |
|
my $maxdepth = scalar(@cats); |
|
my $colattrib = ''; |
|
if ($maxdepth > 2) { |
|
$colattrib = ' colspan="2" '; |
|
} |
|
my @path; |
|
if (@cats > 0) { |
|
if (ref($cats[0]) eq 'ARRAY') { |
|
my $numtop = @{$cats[0]}; |
|
my $maxnum = $numtop; |
|
if ((!grep(/^instcode$/,@{$cats[0]})) || ($cathash->{'instcode::0'} eq '')) { |
|
$maxnum ++; |
|
} |
|
my $lastidx; |
|
for (my $i=0; $i<$numtop; $i++) { |
|
my $parent = $cats[0][$i]; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
my $item = &escape($parent).'::0'; |
|
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$item','$idx{$item}'".');"'; |
|
$lastidx = $idx{$item}; |
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
|
.'<select name="'.$item.'"'.$chgstr.'>'; |
|
for (my $k=0; $k<=$maxnum; $k++) { |
|
my $vpos = $k+1; |
|
my $selstr; |
|
if ($k == $i) { |
|
$selstr = ' selected="selected" '; |
|
} |
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
|
} |
|
$datatable .= '</select></td><td>'; |
|
if ($parent eq 'instcode') { |
|
$datatable .= '<span class="LC_nobreak">'.&mt('Official courses') |
|
.'</span><br /><span class="LC_nobreak">(' |
|
.&mt('with institutional codes').')</span></td>' |
|
.'<td'.$colattrib.'><span class="LC_nobreak"><label><input type="radio" name="instcode" value="1" checked="checked" />' |
|
.&mt('Display').'</label> ' |
|
.'<label><input type="radio" name="instcode" value="0" />' |
|
.&mt('Do not display').'</label></span></td>'; |
|
} else { |
|
$datatable .= $parent |
|
.' <label><input type="checkbox" name="deletecategory" ' |
|
.'value="'.$item.'" />'.&mt('Delete').'</label></span></td>'; |
|
} |
|
my $depth = 1; |
|
push(@path,$parent); |
|
$datatable .= &build_category_rows($itemcount,\@cats,$depth,$parent,\@path,\%idx); |
|
pop(@path); |
|
$datatable .= '</tr><tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr>'; |
|
$itemcount ++; |
|
} |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $item = &escape($parent).'::0'; |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','$lastidx'".');"'; |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$item','$idx{$item}'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak"><select name="addcategory_pos"'.$chgstr.'>'; |
$lastidx = $idx{$item}; |
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
|
.'<select name="'.$item.'"'.$chgstr.'>'; |
|
for (my $k=0; $k<=$maxnum; $k++) { |
for (my $k=0; $k<=$maxnum; $k++) { |
my $vpos = $k+1; |
my $vpos = $k+1; |
my $selstr; |
my $selstr; |
if ($k == $i) { |
if ($k == $numtop) { |
$selstr = ' selected="selected" '; |
$selstr = ' selected="selected" '; |
} |
} |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
$datatable .= '</select></td><td>'; |
$datatable .= '</select></span></td><td colspan="2">'.&mt('Add category:').' ' |
if ($parent eq 'instcode') { |
.'<input type="text" size="20" name="addcategory_name" value="" /></td>' |
$datatable .= '<span class="LC_nobreak">'.&mt('Official courses') |
.'</tr>'."\n"; |
.'</span><br /><span class="LC_nobreak">(' |
|
.&mt('with institutional codes').')</span></td>' |
|
.'<td'.$colattrib.'><span class="LC_nobreak"><label><input type="radio" name="instcode" value="1" checked="checked" />' |
|
.&mt('Display').'</label> ' |
|
.'<label><input type="radio" name="instcode" value="0" />' |
|
.&mt('Do not display').'</label></span></td>'; |
|
} else { |
|
$datatable .= $parent |
|
.' <label><input type="checkbox" name="deletecategory" ' |
|
.'value="'.$item.'" />'.&mt('Delete').'</label></span></td>'; |
|
} |
|
my $depth = 1; |
|
push(@path,$parent); |
|
$datatable .= &build_category_rows($itemcount,\@cats,$depth,$parent,\@path,\%idx); |
|
pop(@path); |
|
$datatable .= '</tr><tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr>'; |
|
$itemcount ++; |
$itemcount ++; |
} |
if ((!grep(/^instcode$/,@{$cats[0]})) || ($cathash->{'instcode::0'} eq '')) { |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','$lastidx'".');"'; |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','instcode_pos','$lastidx'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak"><select name="addcategory_pos"'.$chgstr.'>'; |
$datatable .= '<tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr><tr '.$css_class.'><td>'. |
for (my $k=0; $k<=$maxnum; $k++) { |
'<span class="LC_nobreak"><select name="instcode_pos"'.$chgstr.'>'; |
my $vpos = $k+1; |
for (my $k=0; $k<=$maxnum; $k++) { |
my $selstr; |
my $vpos = $k+1; |
if ($k == $numtop) { |
my $selstr; |
$selstr = ' selected="selected" '; |
if ($k == $maxnum) { |
} |
$selstr = ' selected="selected" '; |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '</select></span></td><td colspan="2">'.&mt('New:').' ' |
|
.'<input type="text" size="20" name="addcategory_name" value="" /></td>' |
|
.'</tr>'."\n"; |
|
$itemcount ++; |
|
if ((!grep(/^instcode$/,@{$cats[0]})) || ($settings->{'instcode::0'} eq '')) { |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','instcode_pos','$lastidx'".');"'; |
|
$datatable .= '<tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr><tr '.$css_class.'><td>'. |
|
'<span class="LC_nobreak"><select name="instcode_pos"'.$chgstr.'>'; |
|
for (my $k=0; $k<=$maxnum; $k++) { |
|
my $vpos = $k+1; |
|
my $selstr; |
|
if ($k == $maxnum) { |
|
$selstr = ' selected="selected" '; |
|
} |
} |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '</select></span></td><td><span class="LC_nobreak">' |
|
.&mt('Official courses').'</span>'.'<br /><span class="LC_nobreak">(' |
|
.&mt('with institutional codes').')</span></td>' |
|
.'<td><span class="LC_nobreak"><label><input type="radio" name="instcode" value="1" />' |
|
.&mt('Display').'</label> ' |
|
.'<label><input type="radio" name="instcode" value="0" checked="checked"/>' |
|
.&mt('Do not display').'</label></span></td></tr>'; |
} |
} |
$datatable .= '</select></span></td><td><span class="LC_nobreak">' |
|
.&mt('Official courses').'</span>'.'<br /><span class="LC_nobreak">(' |
|
.&mt('with institutional codes').')</span></td>' |
|
.'<td><span class="LC_nobreak"><label><input type="radio" name="instcode" value="1" />' |
|
.&mt('Display').'</label> ' |
|
.'<label><input type="radio" name="instcode" value="0" checked="checked"/>' |
|
.&mt('Do not display').'</label></span></td></tr>'; |
|
} |
} |
|
} else { |
|
$datatable .= &initialize_categories($itemcount); |
} |
} |
} else { |
} else { |
$datatable .= &initialize_categories($itemcount); |
$datatable .= '<td class="LC_right_item">'.$hdritem->{'header'}->[0]->{'col2'}.'</td>' |
|
.&initialize_categories($itemcount); |
} |
} |
} else { |
$$rowtotal += $itemcount; |
$datatable .= '<td class="LC_right_item">'.$hdritem->{'header'}->[0]->{'col2'}.'</td>' |
|
.&initialize_categories($itemcount); |
|
} |
} |
$$rowtotal += $itemcount; |
|
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub print_serverstatuses { |
|
my ($dom,$settings,$rowtotal) = @_; |
|
my $datatable; |
|
my @pages = &serverstatus_pages(); |
|
my (%namedaccess,%machineaccess); |
|
foreach my $type (@pages) { |
|
$namedaccess{$type} = ''; |
|
$machineaccess{$type}= ''; |
|
} |
|
if (ref($settings) eq 'HASH') { |
|
foreach my $type (@pages) { |
|
if (exists($settings->{$type})) { |
|
if (ref($settings->{$type}) eq 'HASH') { |
|
foreach my $key (keys(%{$settings->{$type}})) { |
|
if ($key eq 'namedusers') { |
|
$namedaccess{$type} = $settings->{$type}->{$key}; |
|
} elsif ($key eq 'machines') { |
|
$machineaccess{$type} = $settings->{$type}->{$key}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
my $titles= &LONCAPA::loncgi::serverstatus_titles(); |
|
my $rownum = 0; |
|
my $css_class; |
|
foreach my $type (@pages) { |
|
$rownum ++; |
|
$css_class = $rownum%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td><span class="LC_nobreak">'. |
|
$titles->{$type}.'</span></td>'. |
|
'<td class="LC_left_item">'. |
|
'<input type="text" name="'.$type.'_namedusers" '. |
|
'value="'.$namedaccess{$type}.'" size="30" /></td>'. |
|
'<td class="LC_right_item">'. |
|
'<span class="LC_nobreak">'. |
|
'<input type="text" name="'.$type.'_machines" '. |
|
'value="'.$machineaccess{$type}.'" size="10" />'. |
|
'</td></tr>'."\n"; |
|
} |
|
$$rowtotal += $rownum; |
|
return $datatable; |
|
} |
|
|
|
sub serverstatus_pages { |
|
return ('userstatus','lonstatus','loncron','server-status','codeversions', |
|
'clusterstatus','metadata_keywords','metadata_harvest', |
|
'takeoffline','takeonline','showenv'); |
|
} |
|
|
sub coursecategories_javascript { |
sub coursecategories_javascript { |
my ($settings) = @_; |
my ($settings) = @_; |
my ($output,$jstext); |
my ($output,$jstext,$cathash); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
|
$cathash = $settings->{'cats'}; |
|
} |
|
if (ref($cathash) eq 'HASH') { |
my (@cats,@jsarray,%idx); |
my (@cats,@jsarray,%idx); |
&Apache::loncommon::gather_categories($settings,\@cats,\%idx,\@jsarray); |
&Apache::loncommon::gather_categories($cathash,\@cats,\%idx,\@jsarray); |
if (@jsarray > 0) { |
if (@jsarray > 0) { |
$jstext = ' var categories = Array('.scalar(@jsarray).');'."\n"; |
$jstext = ' var categories = Array('.scalar(@jsarray).');'."\n"; |
for (my $i=0; $i<@jsarray; $i++) { |
for (my $i=0; $i<@jsarray; $i++) { |
Line 2165 sub initialize_categories {
|
Line 2431 sub initialize_categories {
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','0'".');"'; |
$chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','0'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
.'<select name="addcategory_pos"'.$chgstr/'><option value="0">1</option>' |
.'<select name="addcategory_pos"'.$chgstr.'><option value="0">1</option>' |
.'<option value="1" selected="selected">2</option></select> ' |
.'<option value="1" selected="selected">2</option></select> ' |
.&mt('Add category').'</td><td>'.&mt('Name:') |
.&mt('Add category').'</td><td>'.&mt('Name:') |
.' <input type="text" size="20" name="addcategory_name" value="" /></td></tr>'; |
.' <input type="text" size="20" name="addcategory_name" value="" /></td></tr>'; |
Line 2223 sub build_category_rows {
|
Line 2489 sub build_category_rows {
|
pop(@{$path}); |
pop(@{$path}); |
} |
} |
} else { |
} else { |
$text .= &mt('New:').' </span><input type="textbox" size="20" name="addcategory_name_'; |
$text .= &mt('Add subcategory:').' </span><input type="textbox" size="20" name="addcategory_name_'; |
if ($j == $numchildren) { |
if ($j == $numchildren) { |
$text .= $name; |
$text .= $name; |
} else { |
} else { |
Line 2255 sub build_category_rows {
|
Line 2521 sub build_category_rows {
|
} |
} |
|
|
sub modifiable_userdata_row { |
sub modifiable_userdata_row { |
my ($context,$role,$settings,$numinrow,$rowcount) = @_; |
my ($context,$role,$settings,$numinrow,$rowcount,$usertypes) = @_; |
my $rolename; |
my $rolename; |
if ($role eq 'cr') { |
if ($context eq 'selfcreate') { |
$rolename = &mt('Custom role'); |
if (ref($usertypes) eq 'HASH') { |
|
$rolename = $usertypes->{$role}; |
|
} else { |
|
$rolename = $role; |
|
} |
} else { |
} else { |
$rolename = &Apache::lonnet::plaintext($role); |
if ($role eq 'cr') { |
|
$rolename = &mt('Custom role'); |
|
} else { |
|
$rolename = &Apache::lonnet::plaintext($role); |
|
} |
} |
} |
my @fields = ('lastname','firstname','middlename','generation', |
my @fields = ('lastname','firstname','middlename','generation', |
'permanentemail','id'); |
'permanentemail','id'); |
Line 2470 sub modify_login {
|
Line 2744 sub modify_login {
|
'adminmail' => 'off', |
'adminmail' => 'off', |
'newuser' => 'off', |
'newuser' => 'off', |
); |
); |
foreach my $item (@toggles) { |
if (ref($domconfig{'login'}) eq 'HASH') { |
if ($defaultchecked{$item} eq 'on') { |
foreach my $item (@toggles) { |
if (($domconfig{'login'}{$item} eq '0') && |
if ($defaultchecked{$item} eq 'on') { |
($env{'form.'.$item} eq '1')) { |
if (($domconfig{'login'}{$item} eq '0') && |
$changes{$item} = 1; |
($env{'form.'.$item} eq '1')) { |
} elsif (($domconfig{'login'}{$item} eq '' || |
$changes{$item} = 1; |
$domconfig{'login'}{$item} eq '1') && |
} elsif (($domconfig{'login'}{$item} eq '' || |
($env{'form.'.$item} eq '0')) { |
$domconfig{'login'}{$item} eq '1') && |
$changes{$item} = 1; |
($env{'form.'.$item} eq '0')) { |
} |
$changes{$item} = 1; |
} elsif ($defaultchecked{$item} eq 'off') { |
} |
if (($domconfig{'login'}{$item} eq '1') && |
} elsif ($defaultchecked{$item} eq 'off') { |
($env{'form.'.$item} eq '0')) { |
if (($domconfig{'login'}{$item} eq '1') && |
$changes{$item} = 1; |
($env{'form.'.$item} eq '0')) { |
} elsif (($domconfig{'login'}{$item} eq '' || |
$changes{$item} = 1; |
$domconfig{'login'}{$item} eq '0') && |
} elsif (($domconfig{'login'}{$item} eq '' || |
($env{'form.'.$item} eq '1')) { |
$domconfig{'login'}{$item} eq '0') && |
$changes{$item} = 1; |
($env{'form.'.$item} eq '1')) { |
|
$changes{$item} = 1; |
|
} |
} |
} |
} |
} |
} |
if (($domconfig{'login'}{'loginheader'} eq 'text') && |
if (($domconfig{'login'}{'loginheader'} eq 'text') && |
($env{'form.loginheader'} eq 'image')) { |
($env{'form.loginheader'} eq 'image')) { |
$changes{'loginheader'} = 1; |
$changes{'loginheader'} = 1; |
} elsif (($domconfig{'login'}{'loginheader'} eq '' || |
} elsif (($domconfig{'login'}{'loginheader'} eq '' || |
$domconfig{'login'}{'loginheader'} eq 'image') && |
$domconfig{'login'}{'loginheader'} eq 'image') && |
($env{'form.loginheader'} eq 'text')) { |
($env{'form.loginheader'} eq 'text')) { |
$changes{'loginheader'} = 1; |
$changes{'loginheader'} = 1; |
} |
} |
} |
if (keys(%changes) > 0 || $colchgtext) { |
if (keys(%changes) > 0 || $colchgtext) { |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
Line 2530 sub color_font_choices {
|
Line 2806 sub color_font_choices {
|
img => "Header", |
img => "Header", |
bgs => "Background colors", |
bgs => "Background colors", |
links => "Link colors", |
links => "Link colors", |
|
images => "Images", |
font => "Font color", |
font => "Font color", |
pgbg => "Page", |
pgbg => "Header", |
tabbg => "Header", |
tabbg => "Header", |
sidebg => "Border", |
sidebg => "Border", |
link => "Link", |
link => "Link", |
Line 2545 sub modify_rolecolors {
|
Line 2822 sub modify_rolecolors {
|
my ($r,$dom,$confname,$roles,%domconfig) = @_; |
my ($r,$dom,$confname,$roles,%domconfig) = @_; |
my ($resulttext,%rolehash); |
my ($resulttext,%rolehash); |
$rolehash{'rolecolors'} = {}; |
$rolehash{'rolecolors'} = {}; |
|
if (ref($domconfig{'rolecolors'}) ne 'HASH') { |
|
if ($domconfig{'rolecolors'} eq '') { |
|
$domconfig{'rolecolors'} = {}; |
|
} |
|
} |
my ($errors,%changes) = &modify_colors($r,$dom,$confname,$roles, |
my ($errors,%changes) = &modify_colors($r,$dom,$confname,$roles, |
$domconfig{'rolecolors'},$rolehash{'rolecolors'}); |
$domconfig{'rolecolors'},$rolehash{'rolecolors'}); |
my $putresult = &Apache::lonnet::put_dom('configuration',\%rolehash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%rolehash, |
Line 2602 sub modify_colors {
|
Line 2884 sub modify_colors {
|
$domconfig->{$role} = {}; |
$domconfig->{$role} = {}; |
} |
} |
foreach my $img (@images) { |
foreach my $img (@images) { |
|
if (($role eq 'login') && (($img eq 'img') || ($img eq 'logo'))) { |
|
if (defined($env{'form.login_showlogo_'.$img})) { |
|
$confhash->{$role}{'showlogo'}{$img} = 1; |
|
} else { |
|
$confhash->{$role}{'showlogo'}{$img} = 0; |
|
} |
|
} |
if ( ! $env{'form.'.$role.'_'.$img.'.filename'} |
if ( ! $env{'form.'.$role.'_'.$img.'.filename'} |
&& !defined($domconfig->{$role}{$img}) |
&& !defined($domconfig->{$role}{$img}) |
&& !$env{'form.'.$role.'_del_'.$img} |
&& !$env{'form.'.$role.'_del_'.$img} |
Line 2676 sub modify_colors {
|
Line 2965 sub modify_colors {
|
$changes{$role}{'images'}{$img} = 1; |
$changes{$role}{'images'}{$img} = 1; |
} |
} |
} |
} |
} |
if (($role eq 'login') && (($img eq 'logo') || ($img eq 'img'))) { |
|
if (ref($domconfig->{'login'}{'showlogo'}) eq 'HASH') { |
|
if ($confhash->{$role}{'showlogo'}{$img} ne |
|
$domconfig->{$role}{'showlogo'}{$img}) { |
|
$changes{$role}{'showlogo'}{$img} = 1; |
|
} |
|
} else { |
|
if ($confhash->{$role}{'showlogo'}{$img} == 0) { |
|
$changes{$role}{'showlogo'}{$img} = 1; |
|
} |
|
} |
|
} |
|
} |
if ($domconfig->{$role}{'font'} ne '') { |
if ($domconfig->{$role}{'font'} ne '') { |
if ($confhash->{$role}{'font'} ne $domconfig->{$role}{'font'}) { |
if ($confhash->{$role}{'font'} ne $domconfig->{$role}{'font'}) { |
$changes{$role}{'font'} = 1; |
$changes{$role}{'font'} = 1; |
Line 2768 sub default_change_checker {
|
Line 3069 sub default_change_checker {
|
$confhash->{$role}{$img} = ''; |
$confhash->{$role}{$img} = ''; |
$changes->{$role}{'images'}{$img} = 1; |
$changes->{$role}{'images'}{$img} = 1; |
} |
} |
|
if ($role eq 'login') { |
|
if ($confhash->{$role}{'showlogo'}{$img} == 0) { |
|
$changes->{$role}{'showlogo'}{$img} = 1; |
|
} |
|
} |
} |
} |
if ($confhash->{$role}{'font'}) { |
if ($confhash->{$role}{'font'}) { |
$changes->{$role}{'font'} = 1; |
$changes->{$role}{'font'} = 1; |
Line 2799 sub display_colorchgs {
|
Line 3105 sub display_colorchgs {
|
$resulttext .= '<li>'.&mt($choices{$key}).':<ul>'; |
$resulttext .= '<li>'.&mt($choices{$key}).':<ul>'; |
} |
} |
foreach my $item (sort(keys(%{$changes->{$role}{$key}}))) { |
foreach my $item (sort(keys(%{$changes->{$role}{$key}}))) { |
if ($confhash->{$role}{$item} eq '') { |
if (($role eq 'login') && ($key eq 'showlogo')) { |
|
if ($confhash->{$role}{$key}{$item}) { |
|
$resulttext .= '<li>'.&mt("$choices{$item} set to be displayed").'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt("$choices{$item} set to not be displayed").'</li>'; |
|
} |
|
} elsif ($confhash->{$role}{$item} eq '') { |
$resulttext .= '<li>'.&mt("$choices{$item} set to default").'</li>'; |
$resulttext .= '<li>'.&mt("$choices{$item} set to default").'</li>'; |
} else { |
} else { |
my $newitem = $confhash->{$role}{$item}; |
my $newitem = $confhash->{$role}{$item}; |
Line 3140 sub modify_quotas {
|
Line 3452 sub modify_quotas {
|
} |
} |
foreach my $key (keys(%formhash)) { |
foreach my $key (keys(%formhash)) { |
if ($formhash{$key} ne '') { |
if ($formhash{$key} ne '') { |
if (!exists($domconfig{'quotas'}{$key})) { |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
|
if (!exists($domconfig{'quotas'}{$key})) { |
|
$changes{$key} = 1; |
|
} |
|
} else { |
$changes{$key} = 1; |
$changes{$key} = 1; |
} |
} |
} |
} |
Line 3971 sub modify_usermodification {
|
Line 4287 sub modify_usermodification {
|
$curr_usermodification{$key} = $domconfig{'usermodification'}{$key}; |
$curr_usermodification{$key} = $domconfig{'usermodification'}{$key}; |
} |
} |
} |
} |
my @contexts = ('author','course'); |
my @contexts = ('author','course','selfcreate'); |
my %context_title = ( |
my %context_title = ( |
author => 'In author context', |
author => 'In author context', |
course => 'In course context', |
course => 'In course context', |
|
selfcreate => 'When self creating account', |
); |
); |
my @fields = ('lastname','firstname','middlename','generation', |
my @fields = ('lastname','firstname','middlename','generation', |
'permanentemail','id'); |
'permanentemail','id'); |
Line 3982 sub modify_usermodification {
|
Line 4299 sub modify_usermodification {
|
author => ['ca','aa'], |
author => ['ca','aa'], |
course => ['st','ep','ta','in','cr'], |
course => ['st','ep','ta','in','cr'], |
); |
); |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
if (ref($types) eq 'ARRAY') { |
|
push(@{$types},'default'); |
|
$usertypes->{'default'} = $othertitle; |
|
} |
|
$roles{'selfcreate'} = $types; |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
my %modifyhash; |
my %modifyhash; |
foreach my $context (@contexts) { |
foreach my $context (@contexts) { |
Line 4029 sub modify_usermodification {
|
Line 4352 sub modify_usermodification {
|
if (ref($changes{$context}) eq 'ARRAY') { |
if (ref($changes{$context}) eq 'ARRAY') { |
foreach my $role (@{$changes{$context}}) { |
foreach my $role (@{$changes{$context}}) { |
my $rolename; |
my $rolename; |
if ($role eq 'cr') { |
if ($context eq 'selfcreate') { |
$rolename = &mt('Custom'); |
$rolename = $role; |
|
if (ref($usertypes) eq 'HASH') { |
|
if ($usertypes->{$role} ne '') { |
|
$rolename = $usertypes->{$role}; |
|
} |
|
} |
} else { |
} else { |
$rolename = &Apache::lonnet::plaintext($role); |
if ($role eq 'cr') { |
|
$rolename = &mt('Custom'); |
|
} else { |
|
$rolename = &Apache::lonnet::plaintext($role); |
|
} |
} |
} |
my @modifiable; |
my @modifiable; |
$resulttext .= '<li><span class="LC_cusr_emph">'.&mt('Target user with [_1] role',$rolename).'</span> - '.&mt('modifiable fields: '); |
if ($context eq 'selfcreate') { |
|
$resulttext .= '<li><span class="LC_cusr_emph">'.&mt('Self-creation of account by users with status: [_1] ',$rolename).'</span> - '.&mt('modifiable fields (if institutional data blank): '); |
|
} else { |
|
$resulttext .= '<li><span class="LC_cusr_emph">'.&mt('Target user with [_1] role',$rolename).'</span> - '.&mt('modifiable fields: '); |
|
} |
foreach my $field (@fields) { |
foreach my $field (@fields) { |
if ($modifyhash{$context}{$role}{$field}) { |
if ($modifyhash{$context}{$role}{$field}) { |
push(@modifiable,$fieldtitles{$field}); |
push(@modifiable,$fieldtitles{$field}); |
Line 4067 sub modify_defaults {
|
Line 4403 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'); |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def'); |
my @authtypes = ('internal','krb4','krb5','localauth'); |
my @authtypes = ('internal','krb4','krb5','localauth'); |
foreach my $item (@items) { |
foreach my $item (@items) { |
$newvalues{$item} = $env{'form.'.$item}; |
$newvalues{$item} = $env{'form.'.$item}; |
Line 4088 sub modify_defaults {
|
Line 4424 sub modify_defaults {
|
push(@errors,$item); |
push(@errors,$item); |
} |
} |
} |
} |
|
} elsif ($item eq 'timezone_def') { |
|
if ($newvalues{$item} ne '') { |
|
if (!DateTime::TimeZone->is_valid_name($newvalues{$item})) { |
|
push(@errors,$item); |
|
} |
|
} |
|
} elsif ($item eq 'datelocale_def') { |
|
if ($newvalues{$item} ne '') { |
|
my @datelocale_ids = DateTime::Locale->ids(); |
|
if (!grep(/^\Q$newvalues{$item}\E$/,@datelocale_ids)) { |
|
push(@errors,$item); |
|
} |
|
} |
} |
} |
if (grep(/^\Q$item\E$/,@errors)) { |
if (grep(/^\Q$item\E$/,@errors)) { |
$newvalues{$item} = $domdefaults{$item}; |
$newvalues{$item} = $domdefaults{$item}; |
Line 4099 sub modify_defaults {
|
Line 4448 sub modify_defaults {
|
defaults => { auth_def => $newvalues{'auth_def'}, |
defaults => { auth_def => $newvalues{'auth_def'}, |
auth_arg_def => $newvalues{'auth_arg_def'}, |
auth_arg_def => $newvalues{'auth_arg_def'}, |
lang_def => $newvalues{'lang_def'}, |
lang_def => $newvalues{'lang_def'}, |
|
timezone_def => $newvalues{'timezone_def'}, |
|
datelocale_def => $newvalues{'datelocale_def'}, |
} |
} |
); |
); |
my $title = &defaults_titles(); |
my $title = &defaults_titles(); |
Line 4131 sub modify_defaults {
|
Line 4482 sub modify_defaults {
|
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('domdefaults',$dom, |
&Apache::lonnet::do_cache_new('domdefaults',$dom, |
$defaults_hash{'defaults'},$cachetime); |
$defaults_hash{'defaults'},$cachetime); |
my $sysmail = $r->dir_config('lonSysEMail'); |
if ($changes{'auth_def'} || $changes{'auth_arg_def'} || $changes{'lang_def'} || $changes{'datelocale_def'}) { |
&Apache::lonmsg::sendemail($sysmail,"LON-CAPA Domain Settings Change - $dom",$mailmsgtext); |
my $sysmail = $r->dir_config('lonSysEMail'); |
|
&Apache::lonmsg::sendemail($sysmail,"LON-CAPA Domain Settings Change - $dom",$mailmsgtext); |
|
} |
} else { |
} else { |
$resulttext = &mt('No changes made to default authentication/language settings'); |
$resulttext = &mt('No changes made to default authentication/language/timezone settings'); |
} |
} |
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
Line 4231 sub modify_scantron {
|
Line 4584 sub modify_scantron {
|
|
|
sub modify_coursecategories { |
sub modify_coursecategories { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,%deletions,%reorderings,%needreordering,%adds,$errors); |
my ($resulttext,%deletions,%reorderings,%needreordering,%adds,%changes,$errors, |
|
$cathash); |
my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory'); |
my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory'); |
if (($domconfig{'coursecategories'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
|
push (@deletecategory,'instcode::0'); |
|
} |
|
my (@predelcats,@predeltrails,%predelallitems); |
|
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
|
$cathash = $domconfig{'coursecategories'}{'cats'}; |
|
if ($domconfig{'coursecategories'}{'togglecats'} ne $env{'form.togglecats'}) { |
|
$changes{'togglecats'} = 1; |
|
$domconfig{'coursecategories'}{'togglecats'} = $env{'form.togglecats'}; |
|
} |
|
if ($domconfig{'coursecategories'}{'categorize'} ne $env{'form.categorize'}) { |
|
$changes{'categorize'} = 1; |
|
$domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'}; |
|
} |
|
} else { |
|
$changes{'togglecats'} = 1; |
|
$changes{'categorize'} = 1; |
|
$domconfig{'coursecategories'}{'togglecats'} = $env{'form.togglecats'}; |
|
$domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'}; |
|
} |
|
if (ref($cathash) eq 'HASH') { |
|
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
|
push (@deletecategory,'instcode::0'); |
|
} |
|
} |
|
my (@predelcats,@predeltrails,%predelallitems,%sort_by_deltrail); |
|
if (ref($cathash) eq 'HASH') { |
if (@deletecategory > 0) { |
if (@deletecategory > 0) { |
#FIXME Need to remove category from all courses using a deleted category |
#FIXME Need to remove category from all courses using a deleted category |
&Apache::loncommon::extract_categories($domconfig{'coursecategories'},\@predelcats,\@predeltrails,\%predelallitems); |
&Apache::loncommon::extract_categories($cathash,\@predelcats,\@predeltrails,\%predelallitems); |
foreach my $item (@deletecategory) { |
foreach my $item (@deletecategory) { |
if ($domconfig{'coursecategories'}{$item} ne '') { |
if ($domconfig{'coursecategories'}{'cats'}{$item} ne '') { |
delete($domconfig{'coursecategories'}{$item}); |
delete($domconfig{'coursecategories'}{'cats'}{$item}); |
$deletions{$item} = 1; |
$deletions{$item} = 1; |
&recurse_cat_deletes($item,$domconfig{'coursecategories'}, |
&recurse_cat_deletes($item,$cathash,\%deletions); |
\%deletions); |
|
} |
} |
} |
} |
} |
} |
foreach my $item (keys(%{$domconfig{'coursecategories'}})) { |
foreach my $item (keys(%{$cathash})) { |
my ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$item); |
my ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$item); |
if ($domconfig{'coursecategories'}{$item} ne $env{'form.'.$item}) { |
if ($cathash->{$item} ne $env{'form.'.$item}) { |
$reorderings{$item} = 1; |
$reorderings{$item} = 1; |
$domconfig{'coursecategories'}{$item} = $env{'form.'.$item}; |
$domconfig{'coursecategories'}{'cats'}{$item} = $env{'form.'.$item}; |
} |
} |
if ($env{'form.addcategory_name_'.$item} ne '') { |
if ($env{'form.addcategory_name_'.$item} ne '') { |
my $newcat = $env{'form.addcategory_name_'.$item}; |
my $newcat = $env{'form.addcategory_name_'.$item}; |
my $newdepth = $depth+1; |
my $newdepth = $depth+1; |
my $newitem = &escape($newcat).':'.&escape($cat).':'.$newdepth; |
my $newitem = &escape($newcat).':'.&escape($cat).':'.$newdepth; |
$domconfig{'coursecategories'}{$newitem} = $env{'form.addcategory_pos_'.$item}; |
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.addcategory_pos_'.$item}; |
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
if ($env{'form.subcat_'.$item} ne '') { |
if ($env{'form.subcat_'.$item} ne '') { |
my $newcat = $env{'form.subcat_'.$item}; |
my $newcat = $env{'form.subcat_'.$item}; |
my $newdepth = $depth+1; |
my $newdepth = $depth+1; |
my $newitem = &escape($newcat).':'.&escape($cat).':'.$newdepth; |
my $newitem = &escape($newcat).':'.&escape($cat).':'.$newdepth; |
$domconfig{'coursecategories'}{$newitem} = 0; |
$domconfig{'coursecategories'}{'cats'}{$newitem} = 0; |
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
} |
} |
} |
} |
if ($env{'form.instcode'} eq '1') { |
if ($env{'form.instcode'} eq '1') { |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
if (ref($cathash) eq 'HASH') { |
my $newitem = 'instcode::0'; |
my $newitem = 'instcode::0'; |
if ($domconfig{'coursecategories'}{$newitem} eq '') { |
if ($cathash->{$newitem} eq '') { |
$domconfig{'coursecategories'}{$newitem} = $env{'form.instcode_pos'}; |
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.instcode_pos'}; |
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
} else { |
} else { |
my $newitem = 'instcode::0'; |
my $newitem = 'instcode::0'; |
$domconfig{'coursecategories'}{$newitem} = $env{'form.instcode_pos'}; |
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.instcode_pos'}; |
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
} |
} |
if ($env{'form.addcategory_name'} ne '') { |
if ($env{'form.addcategory_name'} ne '') { |
my $newitem = &escape($env{'form.addcategory_name'}).'::0'; |
my $newitem = &escape($env{'form.addcategory_name'}).'::0'; |
$domconfig{'coursecategories'}{$newitem} = $env{'form.addcategory_pos'}; |
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.addcategory_pos'}; |
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
|
my $putresult; |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
my %sort_by_deltrail; |
|
if (keys(%deletions) > 0) { |
if (keys(%deletions) > 0) { |
foreach my $key (keys(%deletions)) { |
foreach my $key (keys(%deletions)) { |
if ($predelallitems{$key} ne '') { |
if ($predelallitems{$key} ne '') { |
Line 4300 sub modify_coursecategories {
|
Line 4671 sub modify_coursecategories {
|
} |
} |
} |
} |
my (@chkcats,@chktrails,%chkallitems); |
my (@chkcats,@chktrails,%chkallitems); |
&Apache::loncommon::extract_categories($domconfig{'coursecategories'},\@chkcats,\@chktrails,\%chkallitems); |
&Apache::loncommon::extract_categories($domconfig{'coursecategories'}{'cats'},\@chkcats,\@chktrails,\%chkallitems); |
if (ref($chkcats[0]) eq 'ARRAY') { |
if (ref($chkcats[0]) eq 'ARRAY') { |
my $depth = 0; |
my $depth = 0; |
my $chg = 0; |
my $chg = 0; |
Line 4312 sub modify_coursecategories {
|
Line 4683 sub modify_coursecategories {
|
} else { |
} else { |
$item = &escape($name).'::0'; |
$item = &escape($name).'::0'; |
if ($chg) { |
if ($chg) { |
$domconfig{'coursecategories'}{$item} -= $chg; |
$domconfig{'coursecategories'}{'cats'}{$item} -= $chg; |
} |
} |
$depth ++; |
$depth ++; |
&recurse_check(\@chkcats,$domconfig{'coursecategories'},$depth,$name); |
&recurse_check(\@chkcats,$domconfig{'coursecategories'}{'cats'},$depth,$name); |
$depth --; |
$depth --; |
} |
} |
} |
} |
} |
} |
my $putresult = &Apache::lonnet::put_dom('configuration',\%domconfig,$dom); |
} |
my (@cats,@trails,%allitems); |
if ((keys(%changes) > 0) || (keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
&Apache::loncommon::extract_categories($domconfig{'coursecategories'},\@cats,\@trails,\%allitems); |
$putresult = &Apache::lonnet::put_dom('configuration',\%domconfig,$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
|
my %title = ( |
|
togglecats => 'Show/Hide a course in the catalog', |
|
categorize => 'Category assigned to course', |
|
); |
|
my %level = ( |
|
dom => 'set from "Modify Course" (Domain)', |
|
crs => 'set from "Parameters" (Course)', |
|
); |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if (keys(%deletions) > 0) { |
if ($changes{'togglecats'}) { |
$resulttext .= '<li>'.&mt('Deleted categories:').'<ul>'; |
$resulttext .= '<li>'.&mt("$title{'togglecats'} $level{$env{'form.togglecats'}}").'</li>'; |
foreach my $predeltrail (sort {$a <=> $b } (keys(%sort_by_deltrail))) { |
|
$resulttext .= '<li>'.$predeltrails[$predeltrail].'</li>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
} |
if (keys(%reorderings) > 0) { |
if ($changes{'categorize'}) { |
my %sort_by_trail; |
$resulttext .= '<li>'.&mt("$title{'categorize'} $level{$env{'form.categorize'}}").'</li>'; |
$resulttext .= '<li>'.&mt('Reordered categories:').'<ul>'; |
} |
foreach my $key (keys(%reorderings)) { |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
if ($allitems{$key} ne '') { |
my $cathash; |
$sort_by_trail{$allitems{$key}} = $trails[$allitems{$key}]; |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
|
$cathash = $domconfig{'coursecategories'}{'cats'}; |
|
} else { |
|
$cathash = {}; |
|
} |
|
my (@cats,@trails,%allitems); |
|
&Apache::loncommon::extract_categories($cathash,\@cats,\@trails,\%allitems); |
|
if (keys(%deletions) > 0) { |
|
$resulttext .= '<li>'.&mt('Deleted categories:').'<ul>'; |
|
foreach my $predeltrail (sort {$a <=> $b } (keys(%sort_by_deltrail))) { |
|
$resulttext .= '<li>'.$predeltrails[$predeltrail].'</li>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
|
if (keys(%reorderings) > 0) { |
|
my %sort_by_trail; |
|
$resulttext .= '<li>'.&mt('Reordered categories:').'<ul>'; |
|
foreach my $key (keys(%reorderings)) { |
|
if ($allitems{$key} ne '') { |
|
$sort_by_trail{$allitems{$key}} = $trails[$allitems{$key}]; |
|
} |
} |
} |
|
foreach my $trail (sort {$a <=> $b } (keys(%sort_by_trail))) { |
|
$resulttext .= '<li>'.$trails[$trail].'</li>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
} |
} |
foreach my $trail (sort {$a <=> $b } (keys(%sort_by_trail))) { |
if (keys(%adds) > 0) { |
$resulttext .= '<li>'.$trails[$trail].'</li>'; |
my %sort_by_trail; |
|
$resulttext .= '<li>'.&mt('Added categories:').'<ul>'; |
|
foreach my $key (keys(%adds)) { |
|
if ($allitems{$key} ne '') { |
|
$sort_by_trail{$allitems{$key}} = $trails[$allitems{$key}]; |
|
} |
|
} |
|
foreach my $trail (sort {$a <=> $b } (keys(%sort_by_trail))) { |
|
$resulttext .= '<li>'.$trails[$trail].'</li>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
} |
} |
$resulttext .= '</ul></li>'; |
|
} |
} |
if (keys(%adds) > 0) { |
$resulttext .= '</ul>'; |
my %sort_by_trail; |
} else { |
$resulttext .= '<li>'.&mt('Added categories:').'<ul>'; |
$resulttext = '<span class="LC_error">'. |
foreach my $key (keys(%adds)) { |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
if ($allitems{$key} ne '') { |
} |
$sort_by_trail{$allitems{$key}} = $trails[$allitems{$key}]; |
} else { |
|
$resulttext = &mt('No changes made to course categories'); |
|
} |
|
return $resulttext; |
|
} |
|
|
|
sub modify_serverstatuses { |
|
my ($dom,%domconfig) = @_; |
|
my ($resulttext,%changes,%currserverstatus,%newserverstatus); |
|
if (ref($domconfig{'serverstatuses'}) eq 'HASH') { |
|
%currserverstatus = %{$domconfig{'serverstatuses'}}; |
|
} |
|
my @pages = &serverstatus_pages(); |
|
foreach my $type (@pages) { |
|
$newserverstatus{$type}{'namedusers'} = ''; |
|
$newserverstatus{$type}{'machines'} = ''; |
|
if (defined($env{'form.'.$type.'_namedusers'})) { |
|
my @users = split(/,/,$env{'form.'.$type.'_namedusers'}); |
|
my @okusers; |
|
foreach my $user (@users) { |
|
my ($uname,$udom) = split(/:/,$user); |
|
if (($udom =~ /^$match_domain$/) && |
|
(&Apache::lonnet::domain($udom)) && |
|
($uname =~ /^$match_username$/)) { |
|
if (!grep(/^\Q$user\E/,@okusers)) { |
|
push(@okusers,$user); |
|
} |
|
} |
|
} |
|
if (@okusers > 0) { |
|
@okusers = sort(@okusers); |
|
$newserverstatus{$type}{'namedusers'} = join(',',@okusers); |
|
} |
|
} |
|
if (defined($env{'form.'.$type.'_machines'})) { |
|
my @machines = split(/,/,$env{'form.'.$type.'_machines'}); |
|
my @okmachines; |
|
foreach my $ip (@machines) { |
|
my @parts = split(/\./,$ip); |
|
next if (@parts < 4); |
|
my $badip = 0; |
|
for (my $i=0; $i<4; $i++) { |
|
if (!(($parts[$i] >= 0) && ($parts[$i] <= 255))) { |
|
$badip = 1; |
|
last; |
} |
} |
} |
} |
foreach my $trail (sort {$a <=> $b } (keys(%sort_by_trail))) { |
if (!$badip) { |
$resulttext .= '<li>'.$trails[$trail].'</li>'; |
push(@okmachines,$ip); |
|
} |
|
} |
|
@okmachines = sort(@okmachines); |
|
$newserverstatus{$type}{'machines'} = join(',',@okmachines); |
|
} |
|
} |
|
my %serverstatushash = ( |
|
serverstatuses => \%newserverstatus, |
|
); |
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%serverstatushash, |
|
$dom); |
|
my %changes; |
|
foreach my $type (@pages) { |
|
if (ref($currserverstatus{$type}) eq 'HASH') { |
|
my @currnamed = split(/,/,$currserverstatus{$type}{'namedusers'}); |
|
my @newusers = split(/,/,$newserverstatus{$type}{'namedusers'}); |
|
foreach my $item (@currnamed) { |
|
if (!grep(/^\Q$item\E$/,@newusers)) { |
|
$changes{$type}{'namedusers'} = 1; |
|
last; |
|
} |
|
} |
|
foreach my $item (@newusers) { |
|
if (!grep(/^\Q$item\E$/,@currnamed)) { |
|
$changes{$type}{'namedusers'} = 1; |
|
last; |
|
} |
|
} |
|
my @currmachines = split(/,/,$currserverstatus{$type}{'machines'}); |
|
my @newmachines = split(/,/,$newserverstatus{$type}{'machines'}); |
|
foreach my $item (@currmachines) { |
|
if (!grep(/^\Q$item\E$/,@newmachines)) { |
|
$changes{$type}{'machines'} = 1; |
|
last; |
|
} |
|
} |
|
foreach my $item (@newmachines) { |
|
if (!grep(/^\Q$item\E$/,@currmachines)) { |
|
$changes{$type}{'machines'} = 1; |
|
last; |
|
} |
|
} |
|
|
|
} |
|
} |
|
if (keys(%changes) > 0) { |
|
my $titles= &LONCAPA::loncgi::serverstatus_titles(); |
|
my $putresult = &Apache::lonnet::put_dom('configuration', |
|
\%serverstatushash,$dom); |
|
if ($putresult eq 'ok') { |
|
$resulttext .= &mt('Changes made:').'<ul>'; |
|
foreach my $type (@pages) { |
|
if (defined($changes{$type})) { |
|
$resulttext .= '<li>'.$titles->{$type}.'<ul>'; |
|
if (defined($changes{$type}{'namedusers'})) { |
|
if ($newserverstatus{$type}{'namedusers'} eq '') { |
|
$resulttext .= '<li>'.&mt("Access terminated for all specific (named) users").'</li>'."\n"; |
|
} else { |
|
$resulttext .= '<li>'.&mt("Access available for the following specified users: ").$newserverstatus{$type}{'namedusers'}.'</li>'."\n"; |
|
} |
|
} elsif (defined($changes{$type}{'machines'})) { |
|
if ($newserverstatus{$type}{'machines'} eq '') { |
|
$resulttext .= '<li>'.&mt("Access terminated for all specific IP addresses").'</li>'."\n"; |
|
} else { |
|
$resulttext .= '<li>'.&mt("Access available for the following specified IP addresses: ").$newserverstatus{$type}{'machines'}.'</li>'."\n"; |
|
} |
|
|
|
} |
|
$resulttext .= '</ul></li>'; |
} |
} |
$resulttext .= '</ul></li>'; |
|
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
&mt('An error occurred saving access settings for server status pages: [_1].',$putresult).'</span>'; |
|
|
} |
} |
} else { |
} else { |
$resulttext = &mt('No changes made to course categories'); |
$resulttext = &mt('No changes made to access to server status pages'); |
} |
} |
return $resulttext; |
return $resulttext; |
} |
} |