version 1.139, 2010/08/24 13:37:50
|
version 1.145, 2011/07/31 23:05:00
|
Line 140 autolimit
|
Line 140 autolimit
|
|
|
=over |
=over |
|
|
- course requests will be processed autoatically up to a limit of |
- course requests will be processed automatically up to a limit of |
N requests for the course type for the particular requestor. |
N requests for the course type for the particular requestor. |
If N is undefined, there is no limit to the number of course requests |
If N is undefined, there is no limit to the number of course requests |
which a course owner may submit and have processed automatically. |
which a course owner may submit and have processed automatically. |
Line 230 sub handler {
|
Line 230 sub handler {
|
}, |
}, |
|
|
'defaults' => |
'defaults' => |
{ text => 'Default authentication/language/timezone', |
{ text => 'Default authentication/language/timezone/portal', |
help => 'Domain_Configuration_LangTZAuth', |
help => 'Domain_Configuration_LangTZAuth', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value'}], |
col2 => 'Value'}], |
Line 351 sub handler {
|
Line 351 sub handler {
|
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
}, |
}, |
'usersessions' => |
'usersessions' => |
{text => 'User session hosting', |
{text => 'User session hosting/offloading', |
help => 'Domain_Configuration_User_Sessions', |
help => 'Domain_Configuration_User_Sessions', |
header => [{col1 => 'Hosting of users from other domains', |
header => [{col1 => 'Domain server', |
|
col2 => 'Servers to offload sessions to when busy'}, |
|
{col1 => 'Hosting of users from other domains', |
col2 => 'Rules'}, |
col2 => 'Rules'}, |
{col1 => "Hosting domain's own users elsewhere", |
{col1 => "Hosting domain's own users elsewhere", |
col2 => 'Rules'}], |
col2 => 'Rules'}], |
Line 488 sub print_config_box {
|
Line 490 sub print_config_box {
|
} |
} |
if ($numheaders > 1) { |
if ($numheaders > 1) { |
my $colspan = ''; |
my $colspan = ''; |
|
my $rightcolspan = ''; |
if (($action eq 'rolecolors') || ($action eq 'coursecategories') || ($action eq 'helpsettings')) { |
if (($action eq 'rolecolors') || ($action eq 'coursecategories') || ($action eq 'helpsettings')) { |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
} |
} |
|
if ($action eq 'usersessions') { |
|
$rightcolspan = ' colspan="3"'; |
|
} |
$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.'>'.&mt($item->{'header'}->[0]->{'col1'}).'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[0]->{'col1'}).'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[0]->{'col2'}).'</td> |
<td class="LC_right_item"'.$rightcolspan.'>'.&mt($item->{'header'}->[0]->{'col2'}).'</td> |
</tr>'; |
</tr>'; |
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'autoupdate') { |
if ($action eq 'autoupdate') { |
Line 583 sub print_config_box {
|
Line 589 sub print_config_box {
|
} elsif ($action eq 'helpsettings') { |
} elsif ($action eq 'helpsettings') { |
$output .= &print_helpsettings('bottom',$dom,$confname,$settings,\$rowtotal); |
$output .= &print_helpsettings('bottom',$dom,$confname,$settings,\$rowtotal); |
} elsif ($action eq 'usersessions') { |
} elsif ($action eq 'usersessions') { |
$output .= &print_usersessions('bottom',$dom,$settings,\$rowtotal); |
$output .= &print_usersessions('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_usersessions('bottom',$dom,$settings,\$rowtotal); |
|
$rowtotal ++; |
} elsif ($action eq 'coursedefaults') { |
} elsif ($action eq 'coursedefaults') { |
$output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal); |
$output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'rolecolors') { |
} elsif ($action eq 'rolecolors') { |
Line 867 sub print_login {
|
Line 884 sub print_login {
|
domlogo => 'Domain Logo', |
domlogo => 'Domain Logo', |
login => 'Login box'); |
login => 'Login box'); |
my $itemcount = 1; |
my $itemcount = 1; |
my ($css_class,$datatable); |
|
foreach my $item (@toggles) { |
foreach my $item (@toggles) { |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= |
$datatable .= |
Line 1887 sub print_autocreate {
|
Line 1903 sub print_autocreate {
|
'<input type="radio" name="autocreate_xml"'. |
'<input type="radio" name="autocreate_xml"'. |
$createon{'xml'}.' value="1" />'.&mt('Yes').'</label> '. |
$createon{'xml'}.' value="1" />'.&mt('Yes').'</label> '. |
'<label><input type="radio" name="autocreate_xml"'. |
'<label><input type="radio" name="autocreate_xml"'. |
$createoff{'xml'}.' value="0" />'.&mt('No').'</label></span>'; |
$createoff{'xml'}.' value="0" />'.&mt('No').'</label></span>'. |
|
'</td></tr><tr>'. |
|
'<td>'.&mt('Create pending requests for official courses (if validated)').'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="autocreate_req"'. |
|
$createon{'req'}.' value="1" />'.&mt('Yes').'</label> '. |
|
'<label><input type="radio" name="autocreate_req"'. |
|
$createoff{'req'}.' value="0" />'.&mt('No').'</label></span>'; |
my ($numdc,$dctable) = &active_dc_picker($dom,$curr_dc); |
my ($numdc,$dctable) = &active_dc_picker($dom,$curr_dc); |
if ($numdc > 1) { |
if ($numdc > 1) { |
$datatable .= '</td><tr><td>'. |
$datatable .= '</td></tr><tr class="LC_odd_row"><td>'. |
&mt('XML files processed as: (choose Dom. Coord.)'). |
&mt('Course creation processed as: (choose Dom. Coord.)'). |
'</td><td class="LC_left_item">'.$dctable.'</td></tr>'. |
'</td><td class="LC_left_item">'.$dctable.'</td></tr>'; |
'<tr class="LC_odd_row">'; |
|
$$rowtotal ++ ; |
$$rowtotal ++ ; |
} else { |
} else { |
$datatable .= '</td></tr><tr>'; |
$datatable .= $dctable.'</td></tr>'; |
} |
} |
$datatable .= '<td>'.&mt('Create pending requests for official courses (if validated)').'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="autocreate_req"'. |
|
$createon{'req'}.' value="1" />'.&mt('Yes').'</label> '. |
|
'<label><input type="radio" name="autocreate_req"'. |
|
$createoff{'req'}.' value="0" />'.&mt('No').'</label></span></td>'. |
|
'</tr>'; |
|
return $datatable; |
return $datatable; |
} |
} |
|
|
Line 2287 sub print_coursedefaults {
|
Line 2302 sub print_coursedefaults {
|
sub print_usersessions { |
sub print_usersessions { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($css_class,$datatable,%checked,%choices); |
my ($css_class,$datatable,%checked,%choices); |
my %lt = &usersession_titles(); |
my (%by_ip,%by_location,@intdoms); |
|
&build_location_hashes(\@intdoms,\%by_ip,\%by_location); |
|
|
|
my @alldoms = &Apache::lonnet::all_domains(); |
|
my %uniques = &Apache::lonnet::get_unique_servers(\@alldoms); |
|
my %servers = &dom_servers($dom); |
my $itemcount = 1; |
my $itemcount = 1; |
my $numinrow = 6; |
|
my $prefix; |
|
my @types; |
|
if ($position eq 'top') { |
if ($position eq 'top') { |
$prefix = 'hosted'; |
if (keys(%uniques) > 1) { |
@types = ('excludedomain','includedomain'); |
my %spareid = ¤t_offloads_to($dom,$settings,\%servers); |
|
$datatable .= &spares_row(\%servers,\%spareid,\%uniques,$rowtotal); |
|
} else { |
|
$datatable .= '<tr'.$css_class.'><td colspan="2">'. |
|
&mt('Nothing to set here, as the cluster to which this domain belongs only contains this server.'); |
|
} |
} else { |
} else { |
$prefix = 'remote'; |
if (keys(%by_location) == 0) { |
@types = ('version','excludedomain','includedomain'); |
$datatable .= '<tr'.$css_class.'><td colspan="2">'. |
} |
&mt('Nothing to set here, as the cluster to which this domain belongs only contains this institution.'); |
my (%current,%checkedon,%checkedoff); |
} else { |
my @lcversions = &Apache::lonnet::all_loncaparevs(); |
my %lt = &usersession_titles(); |
my (%by_ip,%by_location,@intdoms); |
my $numinrow = 5; |
&build_location_hashes(\@intdoms,\%by_ip,\%by_location); |
my $prefix; |
my @locations = sort(keys(%by_location)); |
my @types; |
foreach my $type (@types) { |
if ($position eq 'bottom') { |
$checkedon{$type} = ''; |
$prefix = 'remote'; |
$checkedoff{$type} = ' checked="checked"'; |
@types = ('version','excludedomain','includedomain'); |
} |
} else { |
if (ref($settings) eq 'HASH') { |
$prefix = 'hosted'; |
if (ref($settings->{$prefix}) eq 'HASH') { |
@types = ('excludedomain','includedomain'); |
foreach my $key (keys(%{$settings->{$prefix}})) { |
|
$current{$key} = $settings->{$prefix}{$key}; |
|
if ($key eq 'version') { |
|
if ($current{$key} ne '') { |
|
$checkedon{$key} = ' checked="checked"'; |
|
$checkedoff{$key} = ''; |
|
} |
|
} elsif (ref($current{$key}) eq 'ARRAY') { |
|
$checkedon{$key} = ' checked="checked"'; |
|
$checkedoff{$key} = ''; |
|
} |
|
} |
} |
} |
my (%current,%checkedon,%checkedoff); |
} |
my @lcversions = &Apache::lonnet::all_loncaparevs(); |
foreach my $type (@types) { |
my @locations = sort(keys(%by_location)); |
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
foreach my $type (@types) { |
$datatable .= '<tr'.$css_class.'> |
$checkedon{$type} = ''; |
<td><span class="LC_nobreak">'.$lt{$type}.'</span><br /> |
$checkedoff{$type} = ' checked="checked"'; |
<span class="LC_nobreak"> |
} |
<label><input type="radio" name="'.$prefix.'_'.$type.'_inuse" '.$checkedoff{$type}.' value="0" />'.&mt('Not in use').'</label> |
if (ref($settings) eq 'HASH') { |
<label><input type="radio" name="'.$prefix.'_'.$type.'_inuse" '.$checkedon{$type}.' value="1" />'.&mt('In use').'</label></span></td><td>'; |
if (ref($settings->{$prefix}) eq 'HASH') { |
if ($type eq 'version') { |
foreach my $key (keys(%{$settings->{$prefix}})) { |
my $selector = '<select name="'.$prefix.'_version">'; |
$current{$key} = $settings->{$prefix}{$key}; |
foreach my $version (@lcversions) { |
if ($key eq 'version') { |
my $selected = ''; |
if ($current{$key} ne '') { |
if ($current{'version'} eq $version) { |
$checkedon{$key} = ' checked="checked"'; |
$selected = ' selected="selected"'; |
$checkedoff{$key} = ''; |
|
} |
|
} elsif (ref($current{$key}) eq 'ARRAY') { |
|
$checkedon{$key} = ' checked="checked"'; |
|
$checkedoff{$key} = ''; |
|
} |
|
} |
} |
} |
$selector .= ' <option value="'.$version.'"'. |
|
$selected.'>'.$version.'</option>'; |
|
} |
} |
$selector .= '</select> '; |
foreach my $type (@types) { |
$datatable .= &mt('remote server must be version: [_1] or later',$selector); |
next if ($type ne 'version' && !@locations); |
} else { |
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
$datatable.= '<div><input type="button" value="'.&mt('check all').'" '. |
$datatable .= '<tr'.$css_class.'> |
'onclick="javascript:checkAll(document.display.'.$prefix.'_'.$type.')"'. |
<td><span class="LC_nobreak">'.$lt{$type}.'</span><br /> |
' />'.(' 'x2). |
<span class="LC_nobreak"> |
'<input type="button" value="'.&mt('uncheck all').'" '. |
<label><input type="radio" name="'.$prefix.'_'.$type.'_inuse" '.$checkedoff{$type}.' value="0" />'.&mt('Not in use').'</label> |
'onclick="javascript:uncheckAll(document.display.'.$prefix.'_'.$type.')" />'. |
<label><input type="radio" name="'.$prefix.'_'.$type.'_inuse" '.$checkedon{$type}.' value="1" />'.&mt('In use').'</label></span></td><td>'; |
"\n". |
if ($type eq 'version') { |
'</div><div><table>'; |
my $selector = '<select name="'.$prefix.'_version">'; |
my $rem; |
foreach my $version (@lcversions) { |
for (my $i=0; $i<@locations; $i++) { |
my $selected = ''; |
my ($showloc,$value,$checkedtype); |
if ($current{'version'} eq $version) { |
if (ref($by_location{$locations[$i]}) eq 'ARRAY') { |
$selected = ' selected="selected"'; |
my $ip = $by_location{$locations[$i]}->[0]; |
} |
if (ref($by_ip{$ip}) eq 'ARRAY') { |
$selector .= ' <option value="'.$version.'"'. |
$value = join(':',@{$by_ip{$ip}}); |
$selected.'>'.$version.'</option>'; |
$showloc = join(', ',@{$by_ip{$ip}}); |
} |
if (ref($current{$type}) eq 'ARRAY') { |
$selector .= '</select> '; |
foreach my $loc (@{$by_ip{$ip}}) { |
$datatable .= &mt('remote server must be version: [_1] or later',$selector); |
if (grep(/^\Q$loc\E$/,@{$current{$type}})) { |
} else { |
$checkedtype = ' checked="checked"'; |
$datatable.= '<div><input type="button" value="'.&mt('check all').'" '. |
last; |
'onclick="javascript:checkAll(document.display.'.$prefix.'_'.$type.')"'. |
|
' />'.(' 'x2). |
|
'<input type="button" value="'.&mt('uncheck all').'" '. |
|
'onclick="javascript:uncheckAll(document.display.'.$prefix.'_'.$type.')" />'. |
|
"\n". |
|
'</div><div><table>'; |
|
my $rem; |
|
for (my $i=0; $i<@locations; $i++) { |
|
my ($showloc,$value,$checkedtype); |
|
if (ref($by_location{$locations[$i]}) eq 'ARRAY') { |
|
my $ip = $by_location{$locations[$i]}->[0]; |
|
if (ref($by_ip{$ip}) eq 'ARRAY') { |
|
$value = join(':',@{$by_ip{$ip}}); |
|
$showloc = join(', ',@{$by_ip{$ip}}); |
|
if (ref($current{$type}) eq 'ARRAY') { |
|
foreach my $loc (@{$by_ip{$ip}}) { |
|
if (grep(/^\Q$loc\E$/,@{$current{$type}})) { |
|
$checkedtype = ' checked="checked"'; |
|
last; |
|
} |
|
} |
} |
} |
} |
} |
} |
} |
|
$rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$datatable .= '</tr>'; |
|
} |
|
$datatable .= '<tr>'; |
|
} |
|
$datatable .= '<td class="LC_left_item">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="'.$prefix.'_'.$type. |
|
'" value="'.$value.'"'.$checkedtype.' />'.$showloc. |
|
'</label></span></td>'; |
} |
} |
} |
$rem = @locations%($numinrow); |
$rem = $i%($numinrow); |
my $colsleft = $numinrow - $rem; |
if ($rem == 0) { |
if ($colsleft > 1 ) { |
if ($i > 0) { |
$datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
$datatable .= '</tr>'; |
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$datatable .= '<td class="LC_left_item"> </td>'; |
} |
} |
$datatable .= '<tr>'; |
$datatable .= '</tr></table>'; |
} |
} |
$datatable .= '<td class="LC_left_item">'. |
$datatable .= '</td></tr>'; |
'<span class="LC_nobreak"><label>'. |
$itemcount ++; |
'<input type="checkbox" name="'.$prefix.'_'.$type. |
|
'" value="'.$value.'"'.$checkedtype.' />'.$showloc. |
|
'</label></span></td>'; |
|
} |
|
$rem = @locations%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$datatable .= '<td class="LC_left_item"> </td>'; |
|
} |
} |
$datatable .= '</tr></table>'; |
|
} |
} |
$datatable .= '</td></tr>'; |
|
$itemcount ++; |
|
} |
} |
$$rowtotal += $itemcount; |
$$rowtotal += $itemcount; |
return $datatable; |
return $datatable; |
Line 2447 sub build_location_hashes {
|
Line 2482 sub build_location_hashes {
|
return; |
return; |
} |
} |
|
|
|
sub current_offloads_to { |
|
my ($dom,$settings,$servers) = @_; |
|
my (%spareid,%otherdomconfigs); |
|
if ((ref($settings) eq 'HASH') && (ref($servers) eq 'HASH')) { |
|
foreach my $lonhost (sort(keys(%{$servers}))) { |
|
my $gotspares; |
|
if (ref($settings->{'spares'}) eq 'HASH') { |
|
if (ref($settings->{'spares'}{$lonhost}) eq 'HASH') { |
|
$spareid{$lonhost}{'primary'} = $settings->{'spares'}{$lonhost}{'primary'}; |
|
$spareid{$lonhost}{'default'} = $settings->{'spares'}{$lonhost}{'default'}; |
|
$gotspares = 1; |
|
} |
|
} |
|
unless ($gotspares) { |
|
my $gotspares; |
|
my $serverhomeID = |
|
&Apache::lonnet::get_server_homeID($servers->{$lonhost}); |
|
my $serverhomedom = |
|
&Apache::lonnet::host_domain($serverhomeID); |
|
if ($serverhomedom ne $dom) { |
|
if (ref($otherdomconfigs{$serverhomedom} eq 'HASH')) { |
|
if (ref($otherdomconfigs{$serverhomedom}{'usersessions'}) eq 'HASH') { |
|
if (ref($otherdomconfigs{$serverhomedom}{'usersessions'}{'spares'}) eq 'HASH') { |
|
$spareid{$lonhost}{'primary'} = $otherdomconfigs{$serverhomedom}{'usersessions'}{'spares'}{'primary'}; |
|
$spareid{$lonhost}{'default'} = $otherdomconfigs{$serverhomedom}{'usersessions'}{'spares'}{'default'}; |
|
$gotspares = 1; |
|
} |
|
} |
|
} else { |
|
$otherdomconfigs{$serverhomedom} = |
|
&Apache::lonnet::get_dom('configuration',['usersessions'],$serverhomedom); |
|
if (ref($otherdomconfigs{$serverhomedom}) eq 'HASH') { |
|
if (ref($otherdomconfigs{$serverhomedom}{'usersessions'}) eq 'HASH') { |
|
if (ref($otherdomconfigs{$serverhomedom}{'usersessions'}{'spares'}) eq 'HASH') { |
|
if (ref($otherdomconfigs{$serverhomedom}{'usersessions'}{'spares'}{$lonhost}) eq 'HASH') { |
|
$spareid{$lonhost}{'primary'} = $otherdomconfigs{$serverhomedom}{'usersessions'}{'spares'}{'primary'}; |
|
$spareid{$lonhost}{'default'} = $otherdomconfigs{$serverhomedom}{'usersessions'}{'spares'}{'default'}; |
|
$gotspares = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
unless ($gotspares) { |
|
if ($lonhost eq $Apache::lonnet::perlvar{'lonHostID'}) { |
|
$spareid{$lonhost}{'primary'} = $Apache::lonnet::spareid{'primary'}; |
|
$spareid{$lonhost}{'default'} = $Apache::lonnet::spareid{'default'}; |
|
} else { |
|
my $server_hostname = &Apache::lonnet::hostname($lonhost); |
|
my $server_homeID = &Apache::lonnet::get_server_homeID($server_hostname); |
|
if ($server_homeID eq $Apache::lonnet::perlvar{'lonHostID'}) { |
|
$spareid{$lonhost}{'primary'} = $Apache::lonnet::spareid{'primary'}; |
|
$spareid{$lonhost}{'default'} = $Apache::lonnet::spareid{'default'}; |
|
} else { |
|
my %requested; |
|
$requested{'spareid'} = 'HASH'; |
|
my %returnhash = &Apache::lonnet::get_remote_globals($lonhost,\%requested); |
|
my $spareshash = $returnhash{'spareid'}; |
|
if (ref($spareshash) eq 'HASH') { |
|
$spareid{$lonhost}{'primary'} = $spareshash->{'primary'}; |
|
$spareid{$lonhost}{'default'} = $spareshash->{'default'}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return %spareid; |
|
} |
|
|
|
sub spares_row { |
|
my ($servers,$spareid,$uniques,$rowtotal) = @_; |
|
my $css_class; |
|
my $numinrow = 4; |
|
my $itemcount = 1; |
|
my $datatable; |
|
if ((ref($servers) eq 'HASH') && (ref($spareid) eq 'HASH')) { |
|
foreach my $server (sort(keys(%{$servers}))) { |
|
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
|
$datatable .= '<tr'.$css_class.'> |
|
<td rowspan="2"> |
|
<span class="LC_nobreak"><b>'.$server.'</b> when busy, offloads to:</span></td>'; |
|
my (%current,%canselect); |
|
if (ref($spareid->{$server}) eq 'HASH') { |
|
foreach my $type ('primary','default') { |
|
if (ref($spareid->{$server}{$type}) eq 'ARRAY') { |
|
my @spares = @{$spareid->{$server}{$type}}; |
|
if (@spares > 0) { |
|
$current{$type} .= '<table>'; |
|
for (my $i=0; $i<@spares; $i++) { |
|
my $rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$current{$type} .= '</tr>'; |
|
} |
|
$current{$type} .= '<tr>'; |
|
} |
|
$current{$type} .= '<td><label><input type="checkbox" name="spare_'.$type.'_'.$server.'" checked="checked" value="'.$spareid->{$server}{$type}[$i].'" /> '. |
|
$spareid->{$server}{$type}[$i]. |
|
'</label></td>'; |
|
} |
|
$current{$type} .= '</tr></table>'; |
|
} |
|
} |
|
if ($current{$type} eq '') { |
|
$current{$type} = &mt('None specified'); |
|
} |
|
$canselect{$type} = |
|
&newspare_select($server,$type,$spareid->{$server}{$type},$uniques); |
|
} |
|
} |
|
$datatable .= '<td><i>'.&mt('primary').'</i><td>'.$current{'primary'}.'</td>'. |
|
'<td>'.&mt('Add new [_1]primary[_2]:','<i>','</i>').' '. |
|
$canselect{'primary'}.'</td></tr>'. |
|
'<tr'.$css_class.'>'. |
|
'<td><i>'.&mt('default').'</i></td>'. |
|
'<td>'.$current{'default'}.'</td>'. |
|
'<td>'.&mt('Add new [_1]default[_2]:','<i>','</i>').' '. |
|
$canselect{'default'}.'</td></tr>'; |
|
$itemcount ++; |
|
} |
|
} |
|
$$rowtotal += $itemcount; |
|
return $datatable; |
|
} |
|
|
|
sub newspare_select { |
|
my ($server,$type,$currspares,$uniques) = @_; |
|
my $output; |
|
if (ref($uniques) eq 'HASH') { |
|
if (keys(%{$uniques}) > 1) { |
|
$output = '<select name="newspare_'.$type.'_'.$server.'">'."\n". |
|
'<option value="" selected ="selected">'.&mt('Select').'</option>'."\n"; |
|
foreach my $lonhost (sort(keys(%{$uniques}))) { |
|
next if ($lonhost eq $server); |
|
if (ref($currspares) eq 'ARRAY') { |
|
if (@{$currspares} > 0) { |
|
next if (grep(/^\Q$lonhost\E$/,@{$currspares})); |
|
} |
|
} |
|
$output .= '<option value="'.$lonhost.'">'.$lonhost.'</option>'."\n"; |
|
} |
|
$output .= '<select>'; |
|
} |
|
} |
|
return $output; |
|
} |
|
|
sub contact_titles { |
sub contact_titles { |
my %titles = &Apache::lonlocal::texthash ( |
my %titles = &Apache::lonlocal::texthash ( |
'supportemail' => 'Support E-mail address', |
'supportemail' => 'Support E-mail address', |
Line 2818 sub print_usermodification {
|
Line 3003 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'); |
'datelocale_def','portal_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($dom); |
my $rownum = 0; |
my $rownum = 0; |
my ($datatable,$css_class); |
my ($datatable,$css_class); |
foreach my $item (@items) { |
foreach my $item (@items) { |
Line 2857 sub print_defaults {
|
Line 3042 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}.'" />'; |
$domdefaults{$item}.'"'.$size.' />'; |
} |
} |
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
$rownum ++; |
$rownum ++; |
Line 2868 sub print_defaults {
|
Line 3057 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 4640 sub modify_quotas {
|
Line 4841 sub modify_quotas {
|
$changes{'notify'}{'approval'} = 1; |
$changes{'notify'}{'approval'} = 1; |
} |
} |
} else { |
} else { |
if ($domconfig{$action}{'notify'}{'approval'}) { |
if ($confhash{'notify'}{'approval'}) { |
$changes{'notify'}{'approval'} = 1; |
$changes{'notify'}{'approval'} = 1; |
} |
} |
} |
} |
} else { |
} else { |
if ($domconfig{$action}{'notify'}{'approval'}) { |
if ($confhash{'notify'}{'approval'}) { |
$changes{'notify'}{'approval'} = 1; |
$changes{'notify'}{'approval'} = 1; |
} |
} |
} |
} |
Line 4966 sub modify_autoupdate {
|
Line 5167 sub modify_autoupdate {
|
middlename => 'Middle Name', |
middlename => 'Middle Name', |
generation => 'Generation', |
generation => 'Generation', |
); |
); |
my $othertitle = &mt('All users'); |
$othertitle = &mt('All users'); |
if (keys(%{$usertypes}) > 0) { |
if (keys(%{$usertypes}) > 0) { |
$othertitle = &mt('Other users'); |
$othertitle = &mt('Other users'); |
} |
} |
Line 6010 sub modify_defaults {
|
Line 6211 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'); |
foreach my $item (@items) { |
foreach my $item (@items) { |
$newvalues{$item} = $env{'form.'.$item}; |
$newvalues{$item} = $env{'form.'.$item}; |
Line 6046 sub modify_defaults {
|
Line 6247 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 6462 sub modify_serverstatuses {
|
Line 6669 sub modify_serverstatuses {
|
my %serverstatushash = ( |
my %serverstatushash = ( |
serverstatuses => \%newserverstatus, |
serverstatuses => \%newserverstatus, |
); |
); |
my %changes; |
|
foreach my $type (@pages) { |
foreach my $type (@pages) { |
foreach my $setting ('namedusers','machines') { |
foreach my $setting ('namedusers','machines') { |
my (@current,@new); |
my (@current,@new); |
Line 6725 sub modify_coursedefaults {
|
Line 6931 sub modify_coursedefaults {
|
} |
} |
} elsif ($item eq 'anonsurvey_threshold') { |
} 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 .= '<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 { |
Line 6740 sub modify_coursedefaults {
|
Line 6946 sub modify_coursedefaults {
|
|
|
sub modify_usersessions { |
sub modify_usersessions { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my @types = ('version','excludedomain','includedomain'); |
my @hostingtypes = ('version','excludedomain','includedomain'); |
my @prefixes = ('remote','hosted'); |
my @offloadtypes = ('primary','default'); |
|
my %types = ( |
|
remote => \@hostingtypes, |
|
hosted => \@hostingtypes, |
|
spares => \@offloadtypes, |
|
); |
|
my @prefixes = ('remote','hosted','spares'); |
my @lcversions = &Apache::lonnet::all_loncaparevs(); |
my @lcversions = &Apache::lonnet::all_loncaparevs(); |
my (%by_ip,%by_location,@intdoms); |
my (%by_ip,%by_location,@intdoms); |
&build_location_hashes(\@intdoms,\%by_ip,\%by_location); |
&build_location_hashes(\@intdoms,\%by_ip,\%by_location); |
Line 6754 sub modify_usersessions {
|
Line 6966 sub modify_usersessions {
|
my $resulttext; |
my $resulttext; |
my %iphost = &Apache::lonnet::get_iphost(); |
my %iphost = &Apache::lonnet::get_iphost(); |
foreach my $prefix (@prefixes) { |
foreach my $prefix (@prefixes) { |
foreach my $type (@types) { |
next if ($prefix eq 'spares'); |
|
foreach my $type (@{$types{$prefix}}) { |
my $inuse = $env{'form.'.$prefix.'_'.$type.'_inuse'}; |
my $inuse = $env{'form.'.$prefix.'_'.$type.'_inuse'}; |
if ($type eq 'version') { |
if ($type eq 'version') { |
my $value = $env{'form.'.$prefix.'_'.$type}; |
my $value = $env{'form.'.$prefix.'_'.$type}; |
Line 6846 sub modify_usersessions {
|
Line 7059 sub modify_usersessions {
|
} |
} |
} |
} |
} |
} |
|
|
|
my @alldoms = &Apache::lonnet::all_domains(); |
|
my %uniques = &Apache::lonnet::get_unique_servers(\@alldoms); |
|
my %servers = &dom_servers($dom); |
|
my %spareid = ¤t_offloads_to($dom,$domconfig{'usersessions'},\%servers); |
|
my $savespares; |
|
|
|
foreach my $lonhost (sort(keys(%servers))) { |
|
my $serverhomeID = |
|
&Apache::lonnet::get_server_homeID($servers{$lonhost}); |
|
$defaultshash{'usersessions'}{'spares'}{$lonhost} = {}; |
|
my %spareschg; |
|
foreach my $type (@{$types{'spares'}}) { |
|
my @okspares; |
|
my @checked = &Apache::loncommon::get_env_multiple('form.spare_'.$type.'_'.$lonhost); |
|
foreach my $server (@checked) { |
|
unless (($server eq $lonhost) || ($server eq $serverhomeID)) { |
|
if ($uniques{$server}) { |
|
push(@okspares,$server); |
|
} |
|
} |
|
} |
|
my $new = $env{'form.newspare_'.$type.'_'.$lonhost}; |
|
my $newspare; |
|
if (($new ne '') && ($uniques{$new})) { |
|
unless (($new eq $lonhost) || ($new eq $serverhomeID)) { |
|
$newspare = $new; |
|
$spareschg{$type} = 1; |
|
} |
|
} |
|
if (ref($spareid{$lonhost}) eq 'HASH') { |
|
if (ref($spareid{$lonhost}{$type}) eq 'ARRAY') { |
|
my @diffs = &Apache::loncommon::compare_arrays($domconfig{'usersessions'}{'spares'}{$lonhost}{$type},\@okspares); |
|
if (@diffs > 0) { |
|
$spareschg{$type} = 1; |
|
} elsif ($new ne '') { |
|
$spareschg{$type} = 1; |
|
} |
|
} |
|
} |
|
my @spares = sort(@okspares,$newspare); |
|
$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type} = \@spares; |
|
} |
|
if (keys(%spareschg) > 0) { |
|
$changes{'spares'}{$lonhost} = \%spareschg; |
|
} |
|
} |
|
|
|
if (ref($domconfig{'usersessions'}) eq 'HASH') { |
|
if (ref($domconfig{'usersessions'}{'spares'}) eq 'HASH') { |
|
if (ref($changes{'spares'}) eq 'HASH') { |
|
if (keys(%{$changes{'spares'}}) > 0) { |
|
$savespares = 1; |
|
} |
|
} |
|
} else { |
|
$savespares = 1; |
|
} |
|
} |
|
|
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
$dom); |
$dom); |
Line 6865 sub modify_usersessions {
|
Line 7138 sub modify_usersessions {
|
foreach my $prefix (@prefixes) { |
foreach my $prefix (@prefixes) { |
if (ref($changes{$prefix}) eq 'HASH') { |
if (ref($changes{$prefix}) eq 'HASH') { |
$resulttext .= '<li>'.$lt{$prefix}.'<ul>'; |
$resulttext .= '<li>'.$lt{$prefix}.'<ul>'; |
foreach my $type (@types) { |
if ($prefix eq 'spares') { |
if (defined($changes{$prefix}{$type})) { |
if (ref($changes{$prefix}) eq 'HASH') { |
my $newvalue; |
foreach my $lonhost (sort(keys(%{$changes{$prefix}}))) { |
if (ref($defaultshash{'usersessions'}) eq 'HASH') { |
$resulttext .= '<li><b>'.$lonhost.'</b> '; |
if (ref($defaultshash{'usersessions'}{$prefix})) { |
if (ref($changes{$prefix}{$lonhost}) eq 'HASH') { |
if ($type eq 'version') { |
foreach my $type (@{$types{$prefix}}) { |
$newvalue = $defaultshash{'usersessions'}{$prefix}{$type}; |
if ($changes{$prefix}{$lonhost}{$type}) { |
} elsif (ref($defaultshash{'usersessions'}{$prefix}{$type}) eq 'ARRAY') { |
my $offloadto = &mt('None'); |
if (@{$defaultshash{'usersessions'}{$prefix}{$type}} > 0) { |
if (ref($defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}) eq 'ARRAY') { |
$newvalue = join(', ',@{$defaultshash{'usersessions'}{$prefix}{$type}}); |
if (@{$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}} > 0) { |
|
$offloadto = join(', ',@{$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}}); |
|
} |
|
} |
|
$resulttext .= &mt('[_1] set to: [_2]','<i>'.$lt{'type'}.'</i>',$offloadto).(' 'x3); |
} |
} |
} |
} |
} |
} |
|
$resulttext .= '</li>'; |
} |
} |
if ($newvalue eq '') { |
} |
if ($type eq 'version') { |
} else { |
$resulttext .= '<li>'.&mt('[_1] set to: off',$lt{$type}).'</li>'; |
foreach my $type (@{$types{$prefix}}) { |
|
if (defined($changes{$prefix}{$type})) { |
|
my $newvalue; |
|
if (ref($defaultshash{'usersessions'}) eq 'HASH') { |
|
if (ref($defaultshash{'usersessions'}{$prefix})) { |
|
if ($type eq 'version') { |
|
$newvalue = $defaultshash{'usersessions'}{$prefix}{$type}; |
|
} elsif (ref($defaultshash{'usersessions'}{$prefix}{$type}) eq 'ARRAY') { |
|
if (@{$defaultshash{'usersessions'}{$prefix}{$type}} > 0) { |
|
$newvalue = join(', ',@{$defaultshash{'usersessions'}{$prefix}{$type}}); |
|
} |
|
} |
|
} |
|
} |
|
if ($newvalue eq '') { |
|
if ($type eq 'version') { |
|
$resulttext .= '<li>'.&mt('[_1] set to: off',$lt{$type}).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('[_1] set to: none',$lt{$type}).'</li>'; |
|
} |
} else { |
} else { |
$resulttext .= '<li>'.&mt('[_1] set to: none',$lt{$type}).'</li>'; |
if ($type eq 'version') { |
|
$newvalue .= ' '.&mt('(or later)'); |
|
} |
|
$resulttext .= '<li>'.&mt('[_1] set to: [_2].',$lt{$type},$newvalue).'</li>'; |
} |
} |
} else { |
|
if ($type eq 'version') { |
|
$newvalue .= ' '.&mt('(or later)'); |
|
} |
|
$resulttext .= '<li>'.&mt('[_1] set to: [_2].',$lt{$type},$newvalue).'</li>'; |
|
} |
} |
} |
} |
} |
} |
Line 6902 sub modify_usersessions {
|
Line 7197 sub modify_usersessions {
|
&mt('An error occurred: [_1]',$putresult).'</span>'; |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
} |
} |
} else { |
} else { |
$resulttext = &mt('No changes made to settings for user session hosting.'); |
$resulttext = &mt('No changes made to settings for user session hosting/offloading.'); |
} |
} |
return $resulttext; |
return $resulttext; |
} |
} |
Line 7055 sub usersession_titles {
|
Line 7350 sub usersession_titles {
|
hosted => 'Hosting of sessions for users from other domains on servers in this domain', |
hosted => 'Hosting of sessions for users from other domains on servers in this domain', |
|
|
remote => 'Hosting of sessions for users in this domain on servers in other domains', |
remote => 'Hosting of sessions for users in this domain on servers in other domains', |
|
spares => 'Servers offloaded to, when busy', |
version => 'LON-CAPA version requirement', |
version => 'LON-CAPA version requirement', |
excludedomain => 'Allow all, but exclude specific domains', |
excludedomain => 'Allow all, but exclude specific domains', |
includedomain => 'Deny all, but include specific domains', |
includedomain => 'Deny all, but include specific domains', |
|
primary => 'Primary (checked first)', |
|
default => 'Default', |
); |
); |
} |
} |
|
|