version 1.160.6.71, 2016/09/18 19:22:48
|
version 1.228, 2014/03/03 17:11:42
|
Line 164 use Apache::lonhtmlcommon();
|
Line 164 use Apache::lonhtmlcommon();
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonmsg(); |
use Apache::lonmsg(); |
use Apache::lonconfigsettings; |
use Apache::lonconfigsettings; |
use Apache::lonuserutils(); |
|
use Apache::loncoursequeueadmin(); |
|
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA::Enrollment; |
use LONCAPA::Enrollment; |
use LONCAPA::lonauthcgi(); |
use LONCAPA::lonauthcgi(); |
Line 213 sub handler {
|
Line 211 sub handler {
|
'quotas','autoenroll','autoupdate','autocreate', |
'quotas','autoenroll','autoupdate','autocreate', |
'directorysrch','usercreation','usermodification', |
'directorysrch','usercreation','usermodification', |
'contacts','defaults','scantron','coursecategories', |
'contacts','defaults','scantron','coursecategories', |
'serverstatuses','requestcourses','coursedefaults', |
'serverstatuses','requestcourses','helpsettings', |
'usersessions','loadbalancing','requestauthor', |
'coursedefaults','usersessions','loadbalancing', |
'selfenrollment','inststatus'],$dom); |
'requestauthor'],$dom); |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
'autoupdate','autocreate','directorysrch','contacts', |
'autoupdate','autocreate','directorysrch','contacts', |
'usercreation','selfcreation','usermodification','scantron', |
'usercreation','selfcreation','usermodification','scantron', |
'requestcourses','requestauthor','coursecategories', |
'requestcourses','requestauthor','coursecategories', |
'serverstatuses','coursedefaults','selfenrollment', |
'serverstatuses','helpsettings', |
'usersessions'); |
'coursedefaults','usersessions'); |
my %existing; |
my %existing; |
if (ref($domconfig{'loadbalancing'}) eq 'HASH') { |
if (ref($domconfig{'loadbalancing'}) eq 'HASH') { |
%existing = %{$domconfig{'loadbalancing'}}; |
%existing = %{$domconfig{'loadbalancing'}}; |
Line 241 sub handler {
|
Line 239 sub handler {
|
col2 => '',}, |
col2 => '',}, |
{col1 => 'Administrator Settings', |
{col1 => 'Administrator Settings', |
col2 => '',}], |
col2 => '',}], |
print => \&print_rolecolors, |
|
modify => \&modify_rolecolors, |
|
}, |
}, |
'login' => |
'login' => |
{ text => 'Log-in page options', |
{ text => 'Log-in page options', |
Line 250 sub handler {
|
Line 246 sub handler {
|
header => [{col1 => 'Log-in Page Items', |
header => [{col1 => 'Log-in Page Items', |
col2 => '',}, |
col2 => '',}, |
{col1 => 'Log-in Help', |
{col1 => 'Log-in Help', |
col2 => 'Value'}, |
|
{col1 => 'Custom HTML in document head', |
|
col2 => 'Value'}], |
col2 => 'Value'}], |
print => \&print_login, |
|
modify => \&modify_login, |
|
}, |
}, |
'defaults' => |
'defaults' => |
{ text => 'Default authentication/language/timezone/portal/types', |
{ text => 'Default authentication/language/timezone/portal', |
help => 'Domain_Configuration_LangTZAuth', |
help => 'Domain_Configuration_LangTZAuth', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value'}, |
col2 => 'Value'}], |
{col1 => 'Institutional user types', |
|
col2 => 'Assignable to e-mail usernames'}], |
|
print => \&print_defaults, |
|
modify => \&modify_defaults, |
|
}, |
}, |
'quotas' => |
'quotas' => |
{ text => 'Blogs, personal web pages, webDAV/quotas, portfolios', |
{ text => 'Blogs, personal web pages, webDAV/quotas, portfolios', |
Line 272 sub handler {
|
Line 260 sub handler {
|
header => [{col1 => 'User affiliation', |
header => [{col1 => 'User affiliation', |
col2 => 'Available tools', |
col2 => 'Available tools', |
col3 => 'Quotas, MB; (Authoring requires role)',}], |
col3 => 'Quotas, MB; (Authoring requires role)',}], |
print => \&print_quotas, |
|
modify => \&modify_quotas, |
|
}, |
}, |
'autoenroll' => |
'autoenroll' => |
{ text => 'Auto-enrollment settings', |
{ text => 'Auto-enrollment settings', |
help => 'Domain_Configuration_Auto_Enrollment', |
help => 'Domain_Configuration_Auto_Enrollment', |
header => [{col1 => 'Configuration setting', |
header => [{col1 => 'Configuration setting', |
col2 => 'Value(s)'}], |
col2 => 'Value(s)'}], |
print => \&print_autoenroll, |
|
modify => \&modify_autoenroll, |
|
}, |
}, |
'autoupdate' => |
'autoupdate' => |
{ text => 'Auto-update settings', |
{ text => 'Auto-update settings', |
Line 292 sub handler {
|
Line 276 sub handler {
|
col2 => 'Affiliation'}, |
col2 => 'Affiliation'}, |
{col1 => 'User population', |
{col1 => 'User population', |
col2 => 'Updatable user data'}], |
col2 => 'Updatable user data'}], |
print => \&print_autoupdate, |
|
modify => \&modify_autoupdate, |
|
}, |
}, |
'autocreate' => |
'autocreate' => |
{ text => 'Auto-course creation settings', |
{ text => 'Auto-course creation settings', |
help => 'Domain_Configuration_Auto_Creation', |
help => 'Domain_Configuration_Auto_Creation', |
header => [{col1 => 'Configuration Setting', |
header => [{col1 => 'Configuration Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
print => \&print_autocreate, |
|
modify => \&modify_autocreate, |
|
}, |
}, |
'directorysrch' => |
'directorysrch' => |
{ text => 'Institutional directory searches', |
{ text => 'Institutional directory searches', |
help => 'Domain_Configuration_InstDirectory_Search', |
help => 'Domain_Configuration_InstDirectory_Search', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
print => \&print_directorysrch, |
|
modify => \&modify_directorysrch, |
|
}, |
}, |
'contacts' => |
'contacts' => |
{ text => 'Contact Information', |
{ text => 'Contact Information', |
help => 'Domain_Configuration_Contact_Info', |
help => 'Domain_Configuration_Contact_Info', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
print => \&print_contacts, |
|
modify => \&modify_contacts, |
|
}, |
}, |
'usercreation' => |
'usercreation' => |
{ text => 'User creation', |
{ text => 'User creation', |
Line 328 sub handler {
|
Line 304 sub handler {
|
col2 => 'Usernames which may be created',}, |
col2 => 'Usernames which may be created',}, |
{col1 => 'Context', |
{col1 => 'Context', |
col2 => 'Assignable authentication types'}], |
col2 => 'Assignable authentication types'}], |
print => \&print_usercreation, |
|
modify => \&modify_usercreation, |
|
}, |
}, |
'selfcreation' => |
'selfcreation' => |
{ text => 'Users self-creating accounts', |
{ text => 'Users self-creating accounts', |
Line 340 sub handler {
|
Line 314 sub handler {
|
col2 => 'Information user can enter'}, |
col2 => 'Information user can enter'}, |
{col1 => 'Self-creation with e-mail as username', |
{col1 => 'Self-creation with e-mail as username', |
col2 => 'Settings'}], |
col2 => 'Settings'}], |
print => \&print_selfcreation, |
|
modify => \&modify_selfcreation, |
|
}, |
}, |
'usermodification' => |
'usermodification' => |
{ text => 'User modification', |
{ text => 'User modification', |
Line 350 sub handler {
|
Line 322 sub handler {
|
col2 => 'User information updatable in author context'}, |
col2 => 'User information updatable in author context'}, |
{col1 => 'Target user has role', |
{col1 => 'Target user has role', |
col2 => 'User information updatable in course context'}], |
col2 => 'User information updatable in course context'}], |
print => \&print_usermodification, |
|
modify => \&modify_usermodification, |
|
}, |
}, |
'scantron' => |
'scantron' => |
{ text => 'Bubblesheet format file', |
{ text => 'Bubblesheet format file', |
Line 359 sub handler {
|
Line 329 sub handler {
|
header => [ {col1 => 'Item', |
header => [ {col1 => 'Item', |
col2 => '', |
col2 => '', |
}], |
}], |
print => \&print_scantron, |
|
modify => \&modify_scantron, |
|
}, |
}, |
'requestcourses' => |
'requestcourses' => |
{text => 'Request creation of courses', |
{text => 'Request creation of courses', |
Line 370 sub handler {
|
Line 338 sub handler {
|
{col1 => 'Setting', |
{col1 => 'Setting', |
col2 => 'Value'}, |
col2 => 'Value'}, |
{col1 => 'Available textbooks', |
{col1 => 'Available textbooks', |
col2 => ''}, |
col2 => ''}], |
{col1 => 'Available templates', |
|
col2 => ''}, |
|
{col1 => 'Validation (not official courses)', |
|
col2 => 'Value'},], |
|
print => \&print_quotas, |
|
modify => \&modify_quotas, |
|
}, |
}, |
'requestauthor' => |
'requestauthor' => |
{text => 'Request Authoring Space', |
{text => 'Request Authoring Space', |
Line 385 sub handler {
|
Line 347 sub handler {
|
col2 => 'Availability/Processing of requests',}, |
col2 => 'Availability/Processing of requests',}, |
{col1 => 'Setting', |
{col1 => 'Setting', |
col2 => 'Value'}], |
col2 => 'Value'}], |
print => \&print_quotas, |
|
modify => \&modify_quotas, |
|
}, |
}, |
'coursecategories' => |
'coursecategories' => |
{ text => 'Cataloging of courses/communities', |
{ text => 'Cataloging of courses/communities', |
help => 'Domain_Configuration_Cataloging_Courses', |
help => 'Domain_Configuration_Cataloging_Courses', |
header => [{col1 => 'Catalog type/availability', |
header => [{col1 => 'Category settings', |
col2 => '',}, |
|
{col1 => 'Category settings for standard catalog', |
|
col2 => '',}, |
col2 => '',}, |
{col1 => 'Categories', |
{col1 => 'Categories', |
col2 => '', |
col2 => '', |
}], |
}], |
print => \&print_coursecategories, |
|
modify => \&modify_coursecategories, |
|
}, |
}, |
'serverstatuses' => |
'serverstatuses' => |
{text => 'Access to server status pages', |
{text => 'Access to server status pages', |
Line 408 sub handler {
|
Line 364 sub handler {
|
col2 => 'Other named users', |
col2 => 'Other named users', |
col3 => 'Specific IPs', |
col3 => 'Specific IPs', |
}], |
}], |
print => \&print_serverstatuses, |
}, |
modify => \&modify_serverstatuses, |
'helpsettings' => |
|
{text => 'Help page settings', |
|
help => 'Domain_Configuration_Help_Settings', |
|
header => [{col1 => 'Help Settings (logged-in users)', |
|
col2 => 'Value'}], |
}, |
}, |
'coursedefaults' => |
'coursedefaults' => |
{text => 'Course/Community defaults', |
{text => 'Course/Community defaults', |
Line 418 sub handler {
|
Line 378 sub handler {
|
col2 => 'Value',}, |
col2 => 'Value',}, |
{col1 => 'Defaults which can be overridden for each course by a DC', |
{col1 => 'Defaults which can be overridden for each course by a DC', |
col2 => 'Value',},], |
col2 => 'Value',},], |
print => \&print_coursedefaults, |
|
modify => \&modify_coursedefaults, |
|
}, |
}, |
'selfenrollment' => |
'privacy' => |
{text => 'Self-enrollment in Course/Community', |
{text => 'User Privacy', |
help => 'Domain_Configuration_Selfenrollment', |
help => 'Domain_Configuration_User_Privacy', |
header => [{col1 => 'Configuration Rights', |
header => [{col1 => 'Setting', |
col2 => 'Configured by Course Personnel or Domain Coordinator?'}, |
col2 => 'Value',}], |
{col1 => 'Defaults', |
|
col2 => 'Value'}, |
|
{col1 => 'Self-enrollment validation (optional)', |
|
col2 => 'Value'},], |
|
print => \&print_selfenrollment, |
|
modify => \&modify_selfenrollment, |
|
}, |
}, |
'usersessions' => |
'usersessions' => |
{text => 'User session hosting/offloading', |
{text => 'User session hosting/offloading', |
Line 442 sub handler {
|
Line 394 sub handler {
|
col2 => 'Rules'}, |
col2 => 'Rules'}, |
{col1 => "Hosting domain's own users elsewhere", |
{col1 => "Hosting domain's own users elsewhere", |
col2 => 'Rules'}], |
col2 => 'Rules'}], |
print => \&print_usersessions, |
|
modify => \&modify_usersessions, |
|
}, |
}, |
'loadbalancing' => |
'loadbalancing' => |
{text => 'Dedicated Load Balancer(s)', |
{text => 'Dedicated Load Balancer(s)', |
Line 453 sub handler {
|
Line 403 sub handler {
|
col3 => 'User affiliation', |
col3 => 'User affiliation', |
col4 => 'Overrides'}, |
col4 => 'Overrides'}, |
], |
], |
print => \&print_loadbalancing, |
|
modify => \&modify_loadbalancing, |
|
}, |
}, |
); |
); |
if (keys(%servers) > 1) { |
if (keys(%servers) > 1) { |
Line 465 sub handler {
|
Line 413 sub handler {
|
{col1 => 'Log-in Page Items', |
{col1 => 'Log-in Page Items', |
col2 => ''}, |
col2 => ''}, |
{col1 => 'Log-in Help', |
{col1 => 'Log-in Help', |
col2 => 'Value'}, |
|
{col1 => 'Custom HTML in document head', |
|
col2 => 'Value'}], |
col2 => 'Value'}], |
print => \&print_login, |
|
modify => \&modify_login, |
|
}; |
}; |
} |
} |
|
|
Line 489 sub handler {
|
Line 433 sub handler {
|
} |
} |
} elsif ($phase eq 'display') { |
} elsif ($phase eq 'display') { |
my $js = &recaptcha_js(). |
my $js = &recaptcha_js(). |
&toggle_display_js(); |
&credits_js(); |
if ((keys(%servers) > 1) || (keys(%existing) > 0)) { |
if ((keys(%servers) > 1) || (keys(%existing) > 0)) { |
my ($othertitle,$usertypes,$types) = |
my ($othertitle,$usertypes,$types) = |
&Apache::loncommon::sorted_inst_types($dom); |
&Apache::loncommon::sorted_inst_types($dom); |
Line 612 sub process_changes {
|
Line 556 sub process_changes {
|
} elsif ($action eq 'scantron') { |
} elsif ($action eq 'scantron') { |
$output = &modify_scantron($r,$dom,$confname,$lastactref,%domconfig); |
$output = &modify_scantron($r,$dom,$confname,$lastactref,%domconfig); |
} elsif ($action eq 'coursecategories') { |
} elsif ($action eq 'coursecategories') { |
$output = &modify_coursecategories($dom,$lastactref,%domconfig); |
$output = &modify_coursecategories($dom,%domconfig); |
} elsif ($action eq 'serverstatuses') { |
} elsif ($action eq 'serverstatuses') { |
$output = &modify_serverstatuses($dom,%domconfig); |
$output = &modify_serverstatuses($dom,%domconfig); |
} elsif ($action eq 'requestcourses') { |
} elsif ($action eq 'requestcourses') { |
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); |
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); |
} elsif ($action eq 'requestauthor') { |
} elsif ($action eq 'requestauthor') { |
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); |
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); |
|
} elsif ($action eq 'helpsettings') { |
|
$output = &modify_helpsettings($r,$dom,$confname,%domconfig); |
} elsif ($action eq 'coursedefaults') { |
} elsif ($action eq 'coursedefaults') { |
$output = &modify_coursedefaults($dom,$lastactref,%domconfig); |
$output = &modify_coursedefaults($dom,$lastactref,%domconfig); |
} elsif ($action eq 'selfenrollment') { |
|
$output = &modify_selfenrollment($dom,$lastactref,%domconfig) |
|
} elsif ($action eq 'usersessions') { |
} elsif ($action eq 'usersessions') { |
$output = &modify_usersessions($dom,$lastactref,%domconfig); |
$output = &modify_usersessions($dom,$lastactref,%domconfig); |
} elsif ($action eq 'loadbalancing') { |
} elsif ($action eq 'loadbalancing') { |
Line 637 sub print_config_box {
|
Line 581 sub print_config_box {
|
my $output; |
my $output; |
if ($action eq 'coursecategories') { |
if ($action eq 'coursecategories') { |
$output = &coursecategories_javascript($settings); |
$output = &coursecategories_javascript($settings); |
} elsif ($action eq 'defaults') { |
|
$output = &defaults_javascript($settings); |
|
} |
} |
$output .= |
$output .= |
'<table class="LC_nested_outer"> |
'<table class="LC_nested_outer"> |
<tr> |
<tr> |
<th align="left" valign="middle"><span class="LC_nobreak">'. |
<th align="left" valign="middle"><span class="LC_nobreak">'. |
Line 655 sub print_config_box {
|
Line 597 sub print_config_box {
|
if ($numheaders > 1) { |
if ($numheaders > 1) { |
my $colspan = ''; |
my $colspan = ''; |
my $rightcolspan = ''; |
my $rightcolspan = ''; |
if (($action eq 'rolecolors') || ($action eq 'defaults') || |
if (($action eq 'rolecolors') || ($action eq 'coursecategories') || |
(($action eq 'login') && ($numheaders < 4))) { |
(($action eq 'login') && ($numheaders < 3))) { |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
} |
} |
if ($action eq 'usersessions') { |
if ($action eq 'usersessions') { |
Line 671 sub print_config_box {
|
Line 613 sub print_config_box {
|
<td class="LC_right_item"'.$rightcolspan.'>'.&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') || ($action eq 'usercreation') || ($action eq 'selfcreation') || |
if ($action eq 'autoupdate') { |
($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') || |
$output .= &print_autoupdate('top',$dom,$settings,\$rowtotal); |
($action eq 'selfenrollment') || ($action eq 'usersessions')) { |
} elsif ($action eq 'usercreation') { |
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); |
$output .= &print_usercreation('top',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'selfcreation') { |
|
$output .= &print_selfcreation('top',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'usermodification') { |
|
$output .= &print_usermodification('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'coursecategories') { |
} elsif ($action eq 'coursecategories') { |
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal); |
$output .= &print_coursecategories('top',$dom,$item,$settings,\$rowtotal); |
} elsif ($action eq 'login') { |
} elsif ($action eq 'login') { |
if ($numheaders == 4) { |
if ($numheaders == 3) { |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
$output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal); |
$output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal); |
} else { |
} else { |
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal); |
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal); |
} |
} |
} elsif (($action eq 'requestcourses') || ($action eq 'requestauthor')) { |
} elsif ($action eq 'requestcourses') { |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
|
} elsif ($action eq 'requestauthor') { |
|
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
|
} elsif ($action eq 'usersessions') { |
|
$output .= &print_usersessions('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'rolecolors') { |
} elsif ($action eq 'rolecolors') { |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
|
} elsif ($action eq 'coursedefaults') { |
|
$output .= &print_coursedefaults('top',$dom,$settings,\$rowtotal); |
} |
} |
$output .= ' |
$output .= ' |
</table> |
</table> |
Line 697 sub print_config_box {
|
Line 649 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.'>'.&mt($item->{'header'}->[1]->{'col1'}).'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[1]->{'col1'}).'</td>'; |
|
$output .= ' |
<td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[1]->{'col2'}).'</td> |
<td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[1]->{'col2'}).'</td> |
</tr>'; |
</tr>'; |
$rowtotal ++; |
$rowtotal ++; |
if (($action eq 'autoupdate') || ($action eq 'usercreation') || |
if ($action eq 'autoupdate') { |
($action eq 'selfcreation') || ($action eq 'selfenrollment') || |
$output .= &print_autoupdate('middle',$dom,$settings,\$rowtotal).' |
($action eq 'usersessions') || ($action eq 'coursecategories')) { |
</table> |
if ($action eq 'coursecategories') { |
</td> |
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); |
</tr> |
$colspan = ' colspan="2"'; |
<tr> |
} else { |
<td> |
$output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal); |
<table class="LC_nested"> |
} |
<tr class="LC_info_row"> |
$output .= ' |
<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_autoupdate('bottom',$dom,$settings,\$rowtotal); |
|
$rowtotal ++; |
|
} elsif ($action eq 'usercreation') { |
|
$output .= &print_usercreation('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_usercreation('bottom',$dom,$settings,\$rowtotal); |
|
$rowtotal ++; |
|
} elsif ($action eq 'selfcreation') { |
|
$output .= &print_selfcreation('middle',$dom,$settings,\$rowtotal).' |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
Line 720 sub print_config_box {
|
Line 691 sub print_config_box {
|
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> |
</tr>'."\n"; |
</tr>'. |
if ($action eq 'coursecategories') { |
&print_selfcreation('bottom',$dom,$settings,\$rowtotal); |
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
|
} else { |
|
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); |
|
} |
|
$rowtotal ++; |
$rowtotal ++; |
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') || |
} elsif ($action eq 'usermodification') { |
($action eq 'defaults')) { |
$output .= &print_usermodification('middle',$dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'coursecategories') { |
|
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
} elsif ($action eq 'login') { |
} elsif ($action eq 'login') { |
if ($numheaders == 4) { |
if ($numheaders == 3) { |
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).' |
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).' |
</table> |
</table> |
</td> |
</td> |
Line 747 sub print_config_box {
|
Line 715 sub print_config_box {
|
} else { |
} else { |
$output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal); |
$output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal); |
} |
} |
$output .= ' |
} elsif ($action eq 'requestcourses') { |
|
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal). |
|
&print_studentcode($settings,\$rowtotal).' |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row">'; |
<tr class="LC_info_row"> |
if ($numheaders == 4) { |
|
$output .= ' |
|
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td> |
|
<td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</td> |
|
</tr>'; |
|
} else { |
|
$output .= ' |
|
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
<td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col2'}).'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'. |
</tr>'; |
&print_textbookcourses($dom,$settings,\$rowtotal); |
} |
} elsif ($action eq 'requestauthor') { |
$rowtotal ++; |
|
$output .= &print_login('headtag',$dom,$confname,$phase,$settings,\$rowtotal); |
|
} elsif ($action eq 'requestcourses') { |
|
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal); |
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal); |
$rowtotal ++; |
} elsif ($action eq 'usersessions') { |
$output .= &print_studentcode($settings,\$rowtotal).' |
$output .= &print_usersessions('middle',$dom,$settings,\$rowtotal).' |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
Line 780 sub print_config_box {
|
Line 740 sub print_config_box {
|
<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'}->[2]->{'col1'}).'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'. |
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'. |
&textbookcourses_javascript($settings). |
&print_usersessions('bottom',$dom,$settings,\$rowtotal); |
&print_textbookcourses($dom,'textbooks',$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'}->[3]->{'col1'}).'</td> |
|
<td class="LC_right_item">'.&mt($item->{'header'}->[3]->{'col2'}).'</td> </tr>'. |
|
&print_textbookcourses($dom,'templates',$settings,\$rowtotal).' |
|
</table> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td> |
|
<table class="LC_nested"> |
|
<tr class="LC_info_row"> |
|
<td class="LC_left_item"'.$colspan.' valign="top">'.&mt($item->{'header'}->[4]->{'col1'}).'</td> |
|
<td class="LC_right_item" valign="top">'.&mt($item->{'header'}->[4]->{'col2'}).'</td> |
|
</tr>'. |
|
&print_validation_rows('requestcourses',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'requestauthor') { |
|
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal); |
|
$rowtotal ++; |
$rowtotal ++; |
|
} elsif ($action eq 'coursedefaults') { |
|
$output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'rolecolors') { |
} elsif ($action eq 'rolecolors') { |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
</table> |
</table> |
Line 885 sub print_config_box {
|
Line 823 sub print_config_box {
|
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'quotas') { |
if ($action eq 'quotas') { |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
} elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || ($action eq 'directorysrch') || |
} elsif ($action eq 'autoenroll') { |
($action eq 'contacts') || ($action eq 'serverstatuses') || ($action eq 'loadbalancing')) { |
$output .= &print_autoenroll($dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->($dom,$settings,\$rowtotal); |
} elsif ($action eq 'autocreate') { |
|
$output .= &print_autocreate($dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'directorysrch') { |
|
$output .= &print_directorysrch($dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'contacts') { |
|
$output .= &print_contacts($dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'defaults') { |
|
$output .= &print_defaults($dom,$settings,\$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 'serverstatuses') { |
|
$output .= &print_serverstatuses($dom,$settings,\$rowtotal); |
} elsif ($action eq 'helpsettings') { |
} elsif ($action eq 'helpsettings') { |
$output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal); |
$output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal); |
|
} elsif ($action eq 'loadbalancing') { |
|
$output .= &print_loadbalancing($dom,$settings,\$rowtotal); |
} |
} |
} |
} |
$output .= ' |
$output .= ' |
Line 1188 sub print_login {
|
Line 1137 sub print_login {
|
$itemcount ++; |
$itemcount ++; |
} |
} |
$datatable .= &captcha_choice('login',$settings,$itemcount); |
$datatable .= &captcha_choice('login',$settings,$itemcount); |
} elsif ($caller eq 'headtag') { |
|
my %domservers = &Apache::lonnet::get_servers($dom); |
|
my $choice = $choices{'headtag'}; |
|
$css_class = ' class="LC_odd_row"'; |
|
$datatable .= '<tr'.$css_class.'><td colspan="2">'.$choice.'</td>'. |
|
'<td align="left"><table><tr><th>'.$choices{'hostid'}.'</th>'. |
|
'<th>'.$choices{'current'}.'</th>'. |
|
'<th>'.$choices{'action'}.'</th>'. |
|
'<th>'.$choices{'exempt'}.'</th></tr>'."\n"; |
|
my (%currurls,%currexempt); |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{'headtag'}) eq 'HASH') { |
|
foreach my $lonhost (keys(%{$settings->{'headtag'}})) { |
|
if (ref($settings->{'headtag'}{$lonhost}) eq 'HASH') { |
|
$currurls{$lonhost} = $settings->{'headtag'}{$lonhost}{'url'}; |
|
$currexempt{$lonhost} = $settings->{'headtag'}{$lonhost}{'exempt'}; |
|
} |
|
} |
|
} |
|
} |
|
my %lt = &Apache::lonlocal::texthash( |
|
del => 'Delete?', |
|
rep => 'Replace:', |
|
upl => 'Upload:', |
|
curr => 'View contents', |
|
none => 'None', |
|
); |
|
my $switchserver = &check_switchserver($dom,$confname); |
|
foreach my $lonhost (sort(keys(%domservers))) { |
|
my $exempt = &check_exempt_addresses($currexempt{$lonhost}); |
|
$datatable .= '<tr><td>'.$domservers{$lonhost}.'</td>'; |
|
if ($currurls{$lonhost}) { |
|
$datatable .= '<td class="LC_right_item"><a href="'. |
|
"javascript:void(open('$currurls{$lonhost}?inhibitmenu=yes','Custom_HeadTag', |
|
'menubar=0,toolbar=1,scrollbars=1,width=600,height=500,resizable=yes'))". |
|
'">'.$lt{'curr'}.'</a></td>'. |
|
'<td><span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="loginheadtag_del" value="'.$lonhost.'" />'. |
|
$lt{'del'}.'</label> '.$lt{'rep'}.'</span>'; |
|
} else { |
|
$datatable .= '<td class="LC_right_item">'.$lt{'none'}.'</td><td>'.$lt{'upl'}; |
|
} |
|
$datatable .='<br />'; |
|
if ($switchserver) { |
|
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= '<input type="file" name="loginheadtag_'.$lonhost.'" />'; |
|
} |
|
$datatable .= '</td><td><input type="textbox" name="loginheadtagexempt_'.$lonhost.'" value="'.$exempt.'" /></td></tr>'; |
|
} |
|
$datatable .= '</table></td></tr>'; |
|
} |
} |
return $datatable; |
return $datatable; |
} |
} |
Line 1272 sub login_choices {
|
Line 1170 sub login_choices {
|
link => "Link", |
link => "Link", |
alink => "Active link", |
alink => "Active link", |
vlink => "Visited link", |
vlink => "Visited link", |
headtag => "Custom markup", |
|
action => "Action", |
|
current => "Current", |
|
); |
); |
return %choices; |
return %choices; |
} |
} |
Line 1576 sub display_color_options {
|
Line 1471 sub display_color_options {
|
$datatable .= '<td class="LC_right_item">'. |
$datatable .= '<td class="LC_right_item">'. |
'<table border="0"><tr>'; |
'<table border="0"><tr>'; |
foreach my $item (@{$links}) { |
foreach my $item (@{$links}) { |
my $color = $designs->{'links'}{$item} ? $designs->{'links'}{$item} : $defaults->{'links'}{$item}; |
my $color = $designs->{'link'}{$item} ? $designs->{'link'}{$item} : $defaults->{'links'}{$item}; |
$datatable .= '<td align="center">'.$choices->{$item}."\n"; |
$datatable .= '<td align="center">'.$choices->{$item}."\n"; |
if ($designs->{'links'}{$item}) { |
if ($designs->{'links'}{$item}) { |
$datatable.=' '; |
$datatable.=' '; |
Line 2137 sub print_requestmail {
|
Line 2032 sub print_requestmail {
|
$datatable .= &mt('There are no active Domain Coordinators'); |
$datatable .= &mt('There are no active Domain Coordinators'); |
} |
} |
$datatable .='</td></tr>'; |
$datatable .='</td></tr>'; |
|
$$rowtotal += $rows; |
return $datatable; |
return $datatable; |
} |
} |
|
|
Line 2145 sub print_studentcode {
|
Line 2041 sub print_studentcode {
|
my $rownum = 0; |
my $rownum = 0; |
my ($output,%current); |
my ($output,%current); |
my @crstypes = ('official','unofficial','community','textbook'); |
my @crstypes = ('official','unofficial','community','textbook'); |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'uniquecode'}) eq 'HASH') { |
if (ref($settings->{'uniquecode'}) eq 'HASH') { |
foreach my $type (@crstypes) { |
foreach my $type (@crstypes) { |
$current{$type} = $settings->{'uniquecode'}{$type}; |
$current{$type} = $settings->{'uniquecode'}{$type}; |
|
} |
|
} |
} |
} |
} |
$output .= '<tr>'. |
$output .= '<tr>'. |
Line 2170 sub print_studentcode {
|
Line 2064 sub print_studentcode {
|
} |
} |
|
|
sub print_textbookcourses { |
sub print_textbookcourses { |
my ($dom,$type,$settings,$rowtotal) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my $rownum = 0; |
my $rownum = 0; |
my $css_class; |
my $css_class; |
my $itemcount = 1; |
my $itemcount = 1; |
my $maxnum = 0; |
my $maxnum = 0; |
my $bookshash; |
my $bookshash; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
$bookshash = $settings->{$type}; |
$bookshash = $settings->{'textbooks'}; |
} |
} |
my %ordered; |
my %ordered; |
if (ref($bookshash) eq 'HASH') { |
if (ref($bookshash) eq 'HASH') { |
Line 2191 sub print_textbookcourses {
|
Line 2085 sub print_textbookcourses {
|
my $confname = $dom.'-domainconfig'; |
my $confname = $dom.'-domainconfig'; |
my $switchserver = &check_switchserver($dom,$confname); |
my $switchserver = &check_switchserver($dom,$confname); |
my $maxnum = scalar(keys(%ordered)); |
my $maxnum = scalar(keys(%ordered)); |
my $datatable; |
my $datatable = &textbookcourses_javascript(\%ordered); |
if (keys(%ordered)) { |
if (keys(%ordered)) { |
my @items = sort { $a <=> $b } keys(%ordered); |
my @items = sort { $a <=> $b } keys(%ordered); |
for (my $i=0; $i<@items; $i++) { |
for (my $i=0; $i<@items; $i++) { |
Line 2199 sub print_textbookcourses {
|
Line 2093 sub print_textbookcourses {
|
my $key = $ordered{$items[$i]}; |
my $key = $ordered{$items[$i]}; |
my %coursehash=&Apache::lonnet::coursedescription($key); |
my %coursehash=&Apache::lonnet::coursedescription($key); |
my $coursetitle = $coursehash{'description'}; |
my $coursetitle = $coursehash{'description'}; |
my ($subject,$title,$author,$publisher,$image,$imgsrc,$cdom,$cnum); |
my ($subject,$title,$author,$image,$imgsrc,$cdom,$cnum); |
if (ref($bookshash->{$key}) eq 'HASH') { |
if (ref($bookshash->{$key}) eq 'HASH') { |
$subject = $bookshash->{$key}->{'subject'}; |
$subject = $bookshash->{$key}->{'subject'}; |
$title = $bookshash->{$key}->{'title'}; |
$title = $bookshash->{$key}->{'title'}; |
if ($type eq 'textbooks') { |
$author = $bookshash->{$key}->{'author'}; |
$publisher = $bookshash->{$key}->{'publisher'}; |
$image = $bookshash->{$key}->{'image'}; |
$author = $bookshash->{$key}->{'author'}; |
if ($image ne '') { |
$image = $bookshash->{$key}->{'image'}; |
my ($path,$imagefile) = ($image =~ m{^(.+)/([^/]+)$}); |
if ($image ne '') { |
my $imagethumb = "$path/tn-".$imagefile; |
my ($path,$imagefile) = ($image =~ m{^(.+)/([^/]+)$}); |
$imgsrc = '<img src="'.$imagethumb.'" alt="'.&mt('Textbook image').'" />'; |
my $imagethumb = "$path/tn-".$imagefile; |
|
$imgsrc = '<img src="'.$imagethumb.'" alt="'.&mt('Textbook image').'" />'; |
|
} |
|
} |
} |
} |
} |
my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'$type".'_'."$key','$type'".');"'; |
my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'$key'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
.'<select name="'.$type.'_'.$key.'"'.$chgstr.'>'; |
.'<select name="'.$key.'"'.$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; |
Line 2226 sub print_textbookcourses {
|
Line 2117 sub print_textbookcourses {
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
$datatable .= '</select>'.(' 'x2). |
$datatable .= '</select>'.(' 'x2). |
'<label><input type="checkbox" name="'.$type.'_del" value="'.$key.'" />'. |
'<label><input type="checkbox" name="book_del" value="'.$key.'" />'. |
&mt('Delete?').'</label></span></td>'. |
&mt('Delete?').'</label></span></td>'. |
'<td colspan="2">'. |
'<td colspan="2">'. |
'<span class="LC_nobreak">'.&mt('Subject:').'<input type="text" size="15" name="'.$type.'_subject_'.$i.'" value="'.$subject.'" /></span> '. |
'<span class="LC_nobreak">'.&mt('Subject:').'<input type="text" size="15" name="book_subject_'.$i.'" value="'.$subject.'" /></span> '. |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.&mt('Title:').'<input type="text" size="30" name="'.$type.'_title_'.$i.'" value="'.$title.'" /></span> '; |
'<span class="LC_nobreak">'.&mt('Title:').'<input type="text" size="30" name="book_title_'.$i.'" value="'.$title.'" /></span> '. |
if ($type eq 'textbooks') { |
(' 'x2). |
$datatable .= (' 'x2). |
'<span class="LC_nobreak">'.&mt('Author(s):').'<input type="text" size="25" name="book_author_'.$i.'" value="'.$author.'" /></span> '. |
'<span class="LC_nobreak">'.&mt('Publisher:').'<input type="text" size="10" name="'.$type.'_publisher_'.$i.'" value="'.$publisher.'" /></span> '. |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.&mt('Thumbnail:'); |
'<span class="LC_nobreak">'.&mt('Author(s):').'<input type="text" size="25" name="'.$type.'_author_'.$i.'" value="'.$author.'" /></span> '. |
if ($image) { |
(' 'x2). |
$datatable .= '<span class="LC_nobreak">'. |
'<span class="LC_nobreak">'.&mt('Thumbnail:'); |
$imgsrc. |
if ($image) { |
'<label><input type="checkbox" name="book_image_del"'. |
$datatable .= '<span class="LC_nobreak">'. |
' value="'.$key.'" />'.&mt('Delete?').'</label></span> '. |
$imgsrc. |
'<span class="LC_nobreak"> '.&mt('Replace:').' '; |
'<label><input type="checkbox" name="'.$type.'_image_del"'. |
|
' value="'.$key.'" />'.&mt('Delete?').'</label></span> '. |
|
'<span class="LC_nobreak"> '.&mt('Replace:').' '; |
|
} |
|
if ($switchserver) { |
|
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= '<input type="file" name="'.$type.'_image_'.$i.'" value="" />'; |
|
} |
|
} |
} |
$datatable .= '<input type="hidden" name="'.$type.'_id_'.$i.'" value="'.$type.'_'.$key.'" /></span> '. |
if ($switchserver) { |
|
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= '<input type="file" name="book_image_'.$i.'" value="" />'; |
|
} |
|
$datatable .= '<input type="hidden" name="book_id_'.$i.'" value="'.$key.'" /></span> '. |
'<span class="LC_nobreak">'.&mt('LON-CAPA course:').' '. |
'<span class="LC_nobreak">'.&mt('LON-CAPA course:').' '. |
$coursetitle.'</span></td></tr>'."\n"; |
$coursetitle.'</span></td></tr>'."\n"; |
$itemcount ++; |
$itemcount ++; |
} |
} |
} |
} |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'$type"."_addbook_pos','$type'".');"'; |
my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'addbook_pos'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
'<input type="hidden" name="'.$type.'_maxnum" value="'.$maxnum.'" />'."\n". |
'<input type="hidden" name="book_maxnum" value="'.$maxnum.'" />'."\n". |
'<select name="'.$type.'_addbook_pos"'.$chgstr.'>'; |
'<select name="addbook_pos"'.$chgstr.'>'; |
for (my $k=0; $k<$maxnum+1; $k++) { |
for (my $k=0; $k<$maxnum+1; $k++) { |
my $vpos = $k+1; |
my $vpos = $k+1; |
my $selstr; |
my $selstr; |
Line 2272 sub print_textbookcourses {
|
Line 2159 sub print_textbookcourses {
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
$datatable .= '</select> '."\n". |
$datatable .= '</select> '."\n". |
'<input type="checkbox" name="'.$type.'_addbook" value="1" />'.&mt('Add').'</td>'."\n". |
'<input type="checkbox" name="addbook" value="1" />'.&mt('Add').'</td>'."\n". |
'<td colspan="2">'. |
'<td colspan="2">'. |
'<span class="LC_nobreak">'.&mt('Subject:').'<input type="text" size="15" name="'.$type.'_addbook_subject" value="" /></span> '."\n". |
'<span class="LC_nobreak">'.&mt('Subject:').'<input type="text" size="15" name="addbook_subject" value="" /></span> '."\n". |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.&mt('Title:').'<input type="text" size="30" name="'.$type.'_addbook_title" value="" /></span> '."\n". |
'<span class="LC_nobreak">'.&mt('Title:').'<input type="text" size="30" name="addbook_title" value="" /></span> '."\n". |
(' 'x2); |
(' 'x2). |
if ($type eq 'textbooks') { |
'<span class="LC_nobreak">'.&mt('Author(s):').'<input type="text" size="25" name="addbook_author" value="" /></span> '."\n". |
$datatable .= '<span class="LC_nobreak">'.&mt('Publisher:').'<input type="text" size="10" name="'.$type.'_addbook_publisher" value="" /></span> '."\n". |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.&mt('Image:').' '; |
'<span class="LC_nobreak">'.&mt('Author(s):').'<input type="text" size="25" name="'.$type.'_addbook_author" value="" /></span> '."\n". |
if ($switchserver) { |
(' 'x2). |
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
'<span class="LC_nobreak">'.&mt('Image:').' '; |
} else { |
if ($switchserver) { |
$datatable .= '<input type="file" name="addbook_image" value="" />'; |
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= '<input type="file" name="'.$type.'_addbook_image" value="" />'; |
|
} |
|
} |
} |
$datatable .= '</span>'."\n". |
$datatable .= '</span>'."\n". |
'<span class="LC_nobreak">'.&mt('LON-CAPA course:').' '. |
'<span class="LC_nobreak">'.&mt('LON-CAPA course:').' '. |
&Apache::loncommon::select_dom_form($env{'request.role.domain'},$type.'_addbook_cdom'). |
&Apache::loncommon::select_dom_form($env{'request.role.domain'},'addbook_cdom'). |
'<input type="text" size="25" name="'.$type.'_addbook_cnum" value="" />'. |
'<input type="text" size="25" name="addbook_cnum" value="" />'. |
&Apache::loncommon::selectcourse_link |
&Apache::loncommon::selectcourse_link |
('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course'); |
('display','addbook_cnum','addbook_cdom',undef,undef,undef,'Course'); |
'</span></td>'."\n". |
'</span></td>'."\n". |
'</tr>'."\n"; |
'</tr>'."\n"; |
$itemcount ++; |
$itemcount ++; |
Line 2303 sub print_textbookcourses {
|
Line 2186 sub print_textbookcourses {
|
} |
} |
|
|
sub textbookcourses_javascript { |
sub textbookcourses_javascript { |
my ($settings) = @_; |
my ($textbooks) = @_; |
return unless(ref($settings) eq 'HASH'); |
return unless(ref($textbooks) eq 'HASH'); |
my (%ordered,%total,%jstext); |
my $num = scalar(keys(%{$textbooks})); |
foreach my $type ('textbooks','templates') { |
my @jsarray; |
$total{$type} = 0; |
foreach my $item (sort {$a <=> $b } (keys(%{$textbooks}))) { |
if (ref($settings->{$type}) eq 'HASH') { |
push(@jsarray,$textbooks->{$item}); |
foreach my $item (keys(%{$settings->{$type}})) { |
|
if (ref($settings->{$type}->{$item}) eq 'HASH') { |
|
my $num = $settings->{$type}->{$item}{'order'}; |
|
$ordered{$type}{$num} = $item; |
|
} |
|
} |
|
$total{$type} = scalar(keys(%{$settings->{$type}})); |
|
} |
|
my @jsarray = (); |
|
foreach my $item (sort {$a <=> $b } (keys(%{$ordered{$type}}))) { |
|
push(@jsarray,$ordered{$type}{$item}); |
|
} |
|
$jstext{$type} = ' var '.$type.' = Array('."'".join("','",@jsarray)."'".');'."\n"; |
|
} |
} |
|
my $jstext = ' var textbooks = Array('."'".join("','",@jsarray)."'".');'."\n"; |
return <<"ENDSCRIPT"; |
return <<"ENDSCRIPT"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
function reorderBooks(form,item,caller) { |
function reorderBooks(form,item) { |
var changedVal; |
var changedVal; |
$jstext{'textbooks'}; |
$jstext |
$jstext{'templates'}; |
var newpos = 'addbook_pos'; |
var newpos; |
var current = new Array; |
var maxh; |
var maxh = 1 + $num; |
if (caller == 'textbooks') { |
|
newpos = 'textbooks_addbook_pos'; |
|
maxh = 1 + $total{'textbooks'}; |
|
} else { |
|
newpos = 'templates_addbook_pos'; |
|
maxh = 1 + $total{'templates'}; |
|
} |
|
var current = new Array; |
var current = new Array; |
var newitemVal = form.elements[newpos].options[form.elements[newpos].selectedIndex].value; |
var newitemVal = form.elements[newpos].options[form.elements[newpos].selectedIndex].value; |
if (item == newpos) { |
if (item == newpos) { |
Line 2347 $jstext{'templates'};
|
Line 2211 $jstext{'templates'};
|
changedVal = form.elements[item].options[form.elements[item].selectedIndex].value; |
changedVal = form.elements[item].options[form.elements[item].selectedIndex].value; |
current[newitemVal] = newpos; |
current[newitemVal] = newpos; |
} |
} |
if (caller == 'textbooks') { |
for (var i=0; i<textbooks.length; i++) { |
for (var i=0; i<textbooks.length; i++) { |
var elementName = textbooks[i]; |
var elementName = 'textbooks_'+textbooks[i]; |
if (elementName != item) { |
if (elementName != item) { |
if (form.elements[elementName]) { |
if (form.elements[elementName]) { |
var currVal = form.elements[elementName].options[form.elements[elementName].selectedIndex].value; |
var currVal = form.elements[elementName].options[form.elements[elementName].selectedIndex].value; |
current[currVal] = elementName; |
current[currVal] = elementName; |
|
} |
|
} |
|
} |
|
} |
|
if (caller == 'templates') { |
|
for (var i=0; i<templates.length; i++) { |
|
var elementName = 'templates_'+templates[i]; |
|
if (elementName != item) { |
|
if (form.elements[elementName]) { |
|
var currVal = form.elements[elementName].options[form.elements[elementName].selectedIndex].value; |
|
current[currVal] = elementName; |
|
} |
|
} |
} |
} |
} |
} |
} |
Line 2398 ENDSCRIPT
|
Line 2249 ENDSCRIPT
|
sub print_autoenroll { |
sub print_autoenroll { |
my ($dom,$settings,$rowtotal) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
my ($defdom,$runon,$runoff,$coownerson,$coownersoff,$failsafe); |
my ($defdom,$runon,$runoff,$coownerson,$coownersoff); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (exists($settings->{'run'})) { |
if (exists($settings->{'run'})) { |
if ($settings->{'run'} eq '0') { |
if ($settings->{'run'} eq '0') { |
Line 2432 sub print_autoenroll {
|
Line 2283 sub print_autoenroll {
|
if (exists($settings->{'sender_domain'})) { |
if (exists($settings->{'sender_domain'})) { |
$defdom = $settings->{'sender_domain'}; |
$defdom = $settings->{'sender_domain'}; |
} |
} |
if (exists($settings->{'autofailsafe'})) { |
|
$failsafe = $settings->{'autofailsafe'}; |
|
} |
|
} else { |
} else { |
if ($autorun) { |
if ($autorun) { |
$runon = ' checked="checked" '; |
$runon = ' checked="checked" '; |
Line 2470 sub print_autoenroll {
|
Line 2318 sub print_autoenroll {
|
$coownerson.' value="1" />'.&mt('Yes').'</label> '. |
$coownerson.' value="1" />'.&mt('Yes').'</label> '. |
'<label><input type="radio" name="autoassign_coowners"'. |
'<label><input type="radio" name="autoassign_coowners"'. |
$coownersoff.' value="0" />'.&mt('No').'</label></span></td>'. |
$coownersoff.' value="0" />'.&mt('No').'</label></span></td>'. |
'</tr><tr>'. |
'</tr>'; |
'<td>'.&mt('Failsafe for no drops when institutional data missing').'</td>'. |
$$rowtotal += 3; |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="autoenroll_failsafe"'. |
|
' value="'.$failsafe.'" size="4" /></td></tr>'; |
|
$$rowtotal += 4; |
|
return $datatable; |
return $datatable; |
} |
} |
|
|
Line 2590 sub print_autocreate {
|
Line 2434 sub print_autocreate {
|
$createoff{'req'}.' value="0" />'.&mt('No').'</label></span>'; |
$createoff{'req'}.' value="0" />'.&mt('No').'</label></span>'; |
my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio', |
my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio', |
'autocreate_xmldc',%currhash); |
'autocreate_xmldc',%currhash); |
$datatable .= '</td></tr><tr class="LC_odd_row"><td>'; |
|
if ($numdc > 1) { |
if ($numdc > 1) { |
$datatable .= &mt('Course creation processed as: (choose Dom. Coord.)'). |
$datatable .= '</td></tr><tr class="LC_odd_row"><td>'. |
'</td><td class="LC_left_item">'; |
&mt('Course creation processed as: (choose Dom. Coord.)'). |
|
'</td><td class="LC_left_item">'.$dctable.'</td></tr>'; |
} else { |
} else { |
$datatable .= &mt('Course creation processed as:'). |
$datatable .= $dctable.'</td></tr>'; |
'</td><td class="LC_right_item">'; |
|
} |
} |
$datatable .= $dctable.'</td></tr>'; |
|
$$rowtotal += $rows; |
$$rowtotal += $rows; |
return $datatable; |
return $datatable; |
} |
} |
Line 2833 sub print_helpsettings {
|
Line 2675 sub print_helpsettings {
|
|
|
sub radiobutton_prefs { |
sub radiobutton_prefs { |
my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick, |
my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick, |
$additional,$align) = @_; |
$additional) = @_; |
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && |
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && |
(ref($choices) eq 'HASH')); |
(ref($choices) eq 'HASH')); |
|
|
Line 2867 sub radiobutton_prefs {
|
Line 2709 sub radiobutton_prefs {
|
$datatable .= |
$datatable .= |
'<tr'.$css_class.'><td valign="top">'. |
'<tr'.$css_class.'><td valign="top">'. |
'<span class="LC_nobreak">'.$choices->{$item}. |
'<span class="LC_nobreak">'.$choices->{$item}. |
'</span></td>'; |
'</span></td>'. |
if ($align eq 'left') { |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
$datatable .= '<td class="LC_left_item">'; |
|
} else { |
|
$datatable .= '<td class="LC_right_item">'; |
|
} |
|
$datatable .= |
|
'<span class="LC_nobreak">'. |
|
'<label><input type="radio" name="'. |
'<label><input type="radio" name="'. |
$item.'" '.$checkedon{$item}.' value="1"'.$onclick.' />'.&mt('Yes'). |
$item.'" '.$checkedon{$item}.' value="1"'.$onclick.' />'.&mt('Yes'). |
'</label> <label><input type="radio" name="'.$item.'" '. |
'</label> <label><input type="radio" name="'.$item.'" '. |
Line 2892 sub print_coursedefaults {
|
Line 2728 sub print_coursedefaults {
|
my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles); |
my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles); |
my $itemcount = 1; |
my $itemcount = 1; |
my %choices = &Apache::lonlocal::texthash ( |
my %choices = &Apache::lonlocal::texthash ( |
|
canuse_pdfforms => 'Course/Community users can create/upload PDF forms', |
uploadquota => 'Default quota for files uploaded directly to course/community using Course Editor (MB)', |
uploadquota => 'Default quota for files uploaded directly to course/community using Course Editor (MB)', |
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys', |
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys', |
coursecredits => 'Credits can be specified for courses', |
coursecredits => 'Credits can be specified for courses', |
uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)', |
|
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)', |
|
postsubmit => 'Disable submit button/keypress following student submission', |
|
canclone => "People who may clone a course (besides course's owner and coordinators)", |
|
mysqltables => 'Lifetime (s) of "Temporary" MySQL tables (student performance data) on homeserver', |
|
); |
); |
my %staticdefaults = ( |
my %staticdefaults = ( |
anonsurvey_threshold => 10, |
anonsurvey_threshold => 10, |
uploadquota => 500, |
uploadquota => 500, |
postsubmit => 60, |
|
mysqltables => 172800, |
|
); |
); |
if ($position eq 'top') { |
if ($position eq 'top') { |
%defaultchecked = ( |
%defaultchecked = ('canuse_pdfforms' => 'off'); |
'uselcmath' => 'on', |
@toggles = ('canuse_pdfforms'); |
'usejsme' => 'on', |
|
'canclone' => 'none', |
|
); |
|
@toggles = ('uselcmath','usejsme'); |
|
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
\%choices,$itemcount); |
\%choices,$itemcount); |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= |
|
'<tr'.$css_class.'><td valign="top">'. |
|
'<span class="LC_nobreak">'.$choices{'canclone'}. |
|
'</span></td><td class="LC_left_item">'; |
|
my $currcanclone = 'none'; |
|
my $onclick; |
|
my @cloneoptions = ('none','domain'); |
|
my %clonetitles = ( |
|
none => 'No additional course requesters', |
|
domain => "Any course requester in course's domain", |
|
instcode => 'Course requests for official courses ...', |
|
); |
|
my (%codedefaults,@code_order,@posscodes); |
|
if (&Apache::lonnet::auto_instcode_defaults($dom,\%codedefaults, |
|
\@code_order) eq 'ok') { |
|
if (@code_order > 0) { |
|
push(@cloneoptions,'instcode'); |
|
$onclick = ' onclick="toggleDisplay(this.form,'."'cloneinstcode'".');"'; |
|
} |
|
} |
|
if (ref($settings) eq 'HASH') { |
|
if ($settings->{'canclone'}) { |
|
if (ref($settings->{'canclone'}) eq 'HASH') { |
|
if (ref($settings->{'canclone'}{'instcode'}) eq 'ARRAY') { |
|
if (@code_order > 0) { |
|
$currcanclone = 'instcode'; |
|
@posscodes = @{$settings->{'canclone'}{'instcode'}}; |
|
} |
|
} |
|
} elsif ($settings->{'canclone'} eq 'domain') { |
|
$currcanclone = $settings->{'canclone'}; |
|
} |
|
} |
|
} |
|
foreach my $option (@cloneoptions) { |
|
my ($checked,$additional); |
|
if ($currcanclone eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
if ($option eq 'instcode') { |
|
if (@code_order) { |
|
my $show = 'none'; |
|
if ($checked) { |
|
$show = 'block'; |
|
} |
|
$additional = '<div id="cloneinstcode" style="display:'.$show.'" />'. |
|
&mt('Institutional codes for new and cloned course have identical:'). |
|
'<br />'; |
|
foreach my $item (@code_order) { |
|
my $codechk; |
|
if ($checked) { |
|
if (grep(/^\Q$item\E$/,@posscodes)) { |
|
$codechk = ' checked="checked"'; |
|
} |
|
} |
|
$additional .= '<label>'. |
|
'<input type="checkbox" name="clonecode" value="'.$item.'"'.$codechk.' />'. |
|
$item.'</label>'; |
|
} |
|
$additional .= (' 'x2).'('.&mt('check as many as needed').')</div>'; |
|
} |
|
} |
|
$datatable .= |
|
'<span class="LC_nobreak"><label><input type="radio" name="canclone"'.$checked. |
|
' value="'.$option.'"'.$onclick.' />'.$clonetitles{$option}. |
|
'</label> '.$additional.'</span><br />'; |
|
} |
|
$datatable .= '</td>'. |
|
'</tr>'; |
|
$itemcount ++; |
|
} else { |
} else { |
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout,%currmysql); |
my ($currdefresponder,$def_official_credits,$def_unofficial_credits,$def_textbook_credits, |
|
%curruploadquota); |
my $currusecredits = 0; |
my $currusecredits = 0; |
my $postsubmitclient = 1; |
|
my @types = ('official','unofficial','community','textbook'); |
my @types = ('official','unofficial','community','textbook'); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
$currdefresponder = $settings->{'anonsurvey_threshold'}; |
$currdefresponder = $settings->{'anonsurvey_threshold'}; |
Line 3001 sub print_coursedefaults {
|
Line 2756 sub print_coursedefaults {
|
} |
} |
} |
} |
if (ref($settings->{'coursecredits'}) eq 'HASH') { |
if (ref($settings->{'coursecredits'}) eq 'HASH') { |
foreach my $type (@types) { |
$def_official_credits = $settings->{'coursecredits'}->{'official'}; |
next if ($type eq 'community'); |
$def_unofficial_credits = $settings->{'coursecredits'}->{'unofficial'}; |
$defcredits{$type} = $settings->{'coursecredits'}->{$type}; |
$def_textbook_credits = $settings->{'coursecredits'}->{'textbook'}; |
if ($defcredits{$type} ne '') { |
if (($def_official_credits ne '') || ($def_unofficial_credits ne '') || |
$currusecredits = 1; |
($def_textbook_credits ne '')) { |
} |
$currusecredits = 1; |
} |
|
} |
|
if (ref($settings->{'postsubmit'}) eq 'HASH') { |
|
if ($settings->{'postsubmit'}->{'client'} eq 'off') { |
|
$postsubmitclient = 0; |
|
foreach my $type (@types) { |
|
$deftimeout{$type} = $staticdefaults{'postsubmit'}; |
|
} |
|
} else { |
|
foreach my $type (@types) { |
|
if (ref($settings->{'postsubmit'}->{'timeout'}) eq 'HASH') { |
|
if ($settings->{'postsubmit'}->{'timeout'}->{$type} =~ /^\d+$/) { |
|
$deftimeout{$type} = $settings->{'postsubmit'}->{'timeout'}->{$type}; |
|
} else { |
|
$deftimeout{$type} = $staticdefaults{'postsubmit'}; |
|
} |
|
} else { |
|
$deftimeout{$type} = $staticdefaults{'postsubmit'}; |
|
} |
|
} |
|
} |
|
} else { |
|
foreach my $type (@types) { |
|
$deftimeout{$type} = $staticdefaults{'postsubmit'}; |
|
} |
} |
} |
} |
if (ref($settings->{'mysqltables'}) eq 'HASH') { |
|
foreach my $type (keys(%{$settings->{'mysqltables'}})) { |
|
$currmysql{$type} = $settings->{'mysqltables'}{$type}; |
|
} |
|
} else { |
|
foreach my $type (@types) { |
|
$currmysql{$type} = $staticdefaults{'mysqltables'}; |
|
} |
|
} |
|
} else { |
|
foreach my $type (@types) { |
|
$deftimeout{$type} = $staticdefaults{'postsubmit'}; |
|
} |
|
} |
} |
if (!$currdefresponder) { |
if (!$currdefresponder) { |
$currdefresponder = $staticdefaults{'anonsurvey_threshold'}; |
$currdefresponder = $staticdefaults{'anonsurvey_threshold'}; |
Line 3064 sub print_coursedefaults {
|
Line 2782 sub print_coursedefaults {
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<input type="text" name="anonsurvey_threshold"'. |
'<input type="text" name="anonsurvey_threshold"'. |
' value="'.$currdefresponder.'" size="5" /></span>'. |
' value="'.$currdefresponder.'" size="5" /></span>'. |
'</td></tr>'."\n"; |
'</td></tr>'."\n". |
$itemcount ++; |
'<tr><td><span class="LC_nobreak">'. |
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
$choices{'uploadquota'}. |
$datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'. |
'</span></td>'. |
$choices{'uploadquota'}. |
'<td align="right" class="LC_right_item">'. |
'</span></td>'. |
'<table><tr>'; |
'<td align="right" class="LC_right_item">'. |
|
'<table><tr>'; |
|
foreach my $type (@types) { |
foreach my $type (@types) { |
$datatable .= '<td align="center">'.&mt($type).'<br />'. |
$datatable .= '<td align="center">'.&mt($type).'<br />'. |
'<input type="text" name="uploadquota_'.$type.'"'. |
'<input type="text" name="uploadquota_'.$type.'"'. |
' value="'.$curruploadquota{$type}.'" size="5" /></td>'; |
' value="'.$curruploadquota{$type}.'" size="5" /></td>'; |
} |
} |
$datatable .= '</tr></table></td></tr>'."\n"; |
$datatable .= '</tr></table></td></tr>'."\n"; |
$itemcount ++; |
$itemcount += 2; |
my $onclick = "toggleDisplay(this.form,'credits');"; |
my $onclick = 'toggleCredits(this.form);'; |
my $display = 'none'; |
my $display = 'none'; |
if ($currusecredits) { |
if ($currusecredits) { |
$display = 'block'; |
$display = 'block'; |
} |
} |
my $additional = '<div id="credits" style="display: '.$display.'">'. |
my $additional = '<div id="credits" style="display: '.$display.'">'. |
'<i>'.&mt('Default credits').'</i><br /><table><tr>'; |
'<span class="LC_nobreak">'. |
foreach my $type (@types) { |
&mt('Default credits for official courses [_1]', |
next if ($type eq 'community'); |
'<input type="text" name="official_credits" value="'. |
$additional .= '<td align="center">'.&mt($type).'<br />'. |
$def_official_credits.'" size="3" />'). |
'<input type="text" name="'.$type.'_credits"'. |
'</span><br />'. |
' value="'.$defcredits{$type}.'" size="3" /></td>'; |
'<span class="LC_nobreak">'. |
} |
&mt('Default credits for unofficial courses [_1]', |
$additional .= '</tr></table></div>'."\n"; |
'<input type="text" name="unofficial_credits" value="'. |
|
$def_unofficial_credits.'" size="3" />'). |
|
'</span><br />'. |
|
'<span class="LC_nobreak">'. |
|
&mt('Default credits for textbook courses [_1]', |
|
'<input type="text" name="textbook_credits" value="'. |
|
$def_textbook_credits.'" size="3" />'). |
|
'</span></div>'."\n"; |
%defaultchecked = ('coursecredits' => 'off'); |
%defaultchecked = ('coursecredits' => 'off'); |
@toggles = ('coursecredits'); |
@toggles = ('coursecredits'); |
my $current = { |
my $current = { |
Line 3100 sub print_coursedefaults {
|
Line 2823 sub print_coursedefaults {
|
}; |
}; |
(my $table,$itemcount) = |
(my $table,$itemcount) = |
&radiobutton_prefs($current,\@toggles,\%defaultchecked, |
&radiobutton_prefs($current,\@toggles,\%defaultchecked, |
\%choices,$itemcount,$onclick,$additional,'left'); |
\%choices,$itemcount,$onclick,$additional); |
$datatable .= $table; |
|
$onclick = "toggleDisplay(this.form,'studentsubmission');"; |
|
my $display = 'none'; |
|
if ($postsubmitclient) { |
|
$display = 'block'; |
|
} |
|
$additional = '<div id="studentsubmission" style="display: '.$display.'">'. |
|
&mt('Number of seconds submit is disabled').'<br />'. |
|
'<i>'.&mt('Enter 0 to remain disabled until page reload.').'</i><br />'. |
|
'<table><tr>'; |
|
foreach my $type (@types) { |
|
$additional .= '<td align="center">'.&mt($type).'<br />'. |
|
'<input type="text" name="'.$type.'_timeout" value="'. |
|
$deftimeout{$type}.'" size="5" /></td>'; |
|
} |
|
$additional .= '</tr></table></div>'."\n"; |
|
%defaultchecked = ('postsubmit' => 'on'); |
|
@toggles = ('postsubmit'); |
|
$current = { |
|
'postsubmit' => $postsubmitclient, |
|
}; |
|
($table,$itemcount) = |
|
&radiobutton_prefs($current,\@toggles,\%defaultchecked, |
|
\%choices,$itemcount,$onclick,$additional,'left'); |
|
$datatable .= $table; |
$datatable .= $table; |
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
|
$datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'. |
|
$choices{'mysqltables'}. |
|
'</span></td>'. |
|
'<td align="right" class="LC_right_item">'. |
|
'<table><tr>'; |
|
foreach my $type (@types) { |
|
$datatable .= '<td align="center">'.&mt($type).'<br />'. |
|
'<input type="text" name="mysqltables_'.$type.'"'. |
|
' value="'.$currmysql{$type}.'" size="5" /></td>'; |
|
} |
|
$datatable .= '</tr></table></td></tr>'."\n"; |
|
$itemcount ++; |
|
|
|
} |
} |
$$rowtotal += $itemcount; |
$$rowtotal += $itemcount; |
return $datatable; |
return $datatable; |
} |
} |
|
|
sub print_selfenrollment { |
|
my ($position,$dom,$settings,$rowtotal) = @_; |
|
my ($css_class,$datatable); |
|
my $itemcount = 1; |
|
my @types = ('official','unofficial','community','textbook'); |
|
if (($position eq 'top') || ($position eq 'middle')) { |
|
my ($rowsref,$titlesref) = &Apache::lonuserutils::get_selfenroll_titles(); |
|
my %descs = &Apache::lonuserutils::selfenroll_default_descs(); |
|
my @rows; |
|
my $key; |
|
if ($position eq 'top') { |
|
$key = 'admin'; |
|
if (ref($rowsref) eq 'ARRAY') { |
|
@rows = @{$rowsref}; |
|
} |
|
} elsif ($position eq 'middle') { |
|
$key = 'default'; |
|
@rows = ('types','registered','approval','limit'); |
|
} |
|
foreach my $row (@rows) { |
|
if (defined($titlesref->{$row})) { |
|
$itemcount ++; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td>'.$titlesref->{$row}.'</td>'. |
|
'<td class="LC_left_item">'. |
|
'<table><tr>'; |
|
my (%current,%currentcap); |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{$key}) eq 'HASH') { |
|
foreach my $type (@types) { |
|
if (ref($settings->{$key}->{$type}) eq 'HASH') { |
|
$current{$type} = $settings->{$key}->{$type}->{$row}; |
|
} |
|
if (($row eq 'limit') && ($key eq 'default')) { |
|
if (ref($settings->{$key}->{$type}) eq 'HASH') { |
|
$currentcap{$type} = $settings->{$key}->{$type}->{'cap'}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
my %roles = ( |
|
'0' => &Apache::lonnet::plaintext('dc'), |
|
); |
|
|
|
foreach my $type (@types) { |
|
unless (($row eq 'registered') && ($key eq 'default')) { |
|
$datatable .= '<th>'.&mt($type).'</th>'; |
|
} |
|
} |
|
unless (($row eq 'registered') && ($key eq 'default')) { |
|
$datatable .= '</tr><tr>'; |
|
} |
|
foreach my $type (@types) { |
|
if ($type eq 'community') { |
|
$roles{'1'} = &mt('Community personnel'); |
|
} else { |
|
$roles{'1'} = &mt('Course personnel'); |
|
} |
|
$datatable .= '<td style="vertical-align: top">'; |
|
if ($position eq 'top') { |
|
my %checked; |
|
if ($current{$type} eq '0') { |
|
$checked{'0'} = ' checked="checked"'; |
|
} else { |
|
$checked{'1'} = ' checked="checked"'; |
|
} |
|
foreach my $role ('1','0') { |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="selfenrolladmin_'.$row.'_'.$type.'" '. |
|
'value="'.$role.'"'.$checked{$role}.' />'. |
|
$roles{$role}.'</label></span> '; |
|
} |
|
} else { |
|
if ($row eq 'types') { |
|
my %checked; |
|
if ($current{$type} =~ /^(all|dom)$/) { |
|
$checked{$1} = ' checked="checked"'; |
|
} else { |
|
$checked{''} = ' checked="checked"'; |
|
} |
|
foreach my $val ('','dom','all') { |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type ="radio" name="selfenrolldefault_'.$row.'_'.$type.'" '. |
|
'value="'.$val.'"'.$checked{$val}.' />'.$descs{$row}{$val}.'</label></span> '; |
|
} |
|
} elsif ($row eq 'registered') { |
|
my %checked; |
|
if ($current{$type} eq '1') { |
|
$checked{'1'} = ' checked="checked"'; |
|
} else { |
|
$checked{'0'} = ' checked="checked"'; |
|
} |
|
foreach my $val ('0','1') { |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type ="radio" name="selfenrolldefault_'.$row.'_'.$type.'" '. |
|
'value="'.$val.'"'.$checked{$val}.' />'.$descs{$row}{$val}.'</label></span> '; |
|
} |
|
} elsif ($row eq 'approval') { |
|
my %checked; |
|
if ($current{$type} =~ /^([12])$/) { |
|
$checked{$1} = ' checked="checked"'; |
|
} else { |
|
$checked{'0'} = ' checked="checked"'; |
|
} |
|
for my $val (0..2) { |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="selfenrolldefault_'.$row.'_'.$type.'" '. |
|
'value="'.$val.'"'.$checked{$val}.' />'.$descs{$row}{$val}.'</label></span> '; |
|
} |
|
} elsif ($row eq 'limit') { |
|
my %checked; |
|
if ($current{$type} =~ /^(allstudents|selfenrolled)$/) { |
|
$checked{$1} = ' checked="checked"'; |
|
} else { |
|
$checked{'none'} = ' checked="checked"'; |
|
} |
|
my $cap; |
|
if ($currentcap{$type} =~ /^\d+$/) { |
|
$cap = $currentcap{$type}; |
|
} |
|
foreach my $val ('none','allstudents','selfenrolled') { |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="selfenrolldefault_'.$row.'_'.$type.'" '. |
|
'value="'.$val.'"'.$checked{$val}.' />'.$descs{$row}{$val}.'</label></span> '; |
|
} |
|
$datatable .= '<br />'. |
|
'<span class="LC_nobreak">'.&mt('Maximum allowed: '). |
|
'<input type="text" name="selfenrolldefault_cap_'.$type.'" size = "5" value="'.$cap.'" />'. |
|
'</span>'; |
|
} |
|
} |
|
$datatable .= '</td>'; |
|
} |
|
$datatable .= '</tr>'; |
|
} |
|
$datatable .= '</table></td></tr>'; |
|
} |
|
} elsif ($position eq 'bottom') { |
|
$datatable .= &print_validation_rows('selfenroll',$dom,$settings,\$itemcount); |
|
} |
|
$$rowtotal += $itemcount; |
|
return $datatable; |
|
} |
|
|
|
sub print_validation_rows { |
|
my ($caller,$dom,$settings,$rowtotal) = @_; |
|
my ($itemsref,$namesref,$fieldsref); |
|
if ($caller eq 'selfenroll') { |
|
($itemsref,$namesref,$fieldsref) = &Apache::lonuserutils::selfenroll_validation_types(); |
|
} elsif ($caller eq 'requestcourses') { |
|
($itemsref,$namesref,$fieldsref) = &Apache::loncoursequeueadmin::requestcourses_validation_types(); |
|
} |
|
my %currvalidation; |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{'validation'}) eq 'HASH') { |
|
%currvalidation = %{$settings->{'validation'}}; |
|
} |
|
} |
|
my $datatable; |
|
my $itemcount = 0; |
|
foreach my $item (@{$itemsref}) { |
|
my $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
|
$datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'. |
|
$namesref->{$item}. |
|
'</span></td>'. |
|
'<td class="LC_left_item">'; |
|
if (($item eq 'url') || ($item eq 'button')) { |
|
$datatable .= '<span class="LC_nobreak">'. |
|
'<input type="text" name="'.$caller.'_validation_'.$item.'"'. |
|
' value="'.$currvalidation{$item}.'" size="50" /></span>'; |
|
} elsif ($item eq 'fields') { |
|
my @currfields; |
|
if (ref($currvalidation{$item}) eq 'ARRAY') { |
|
@currfields = @{$currvalidation{$item}}; |
|
} |
|
foreach my $field (@{$fieldsref}) { |
|
my $check = ''; |
|
if (grep(/^\Q$field\E$/,@currfields)) { |
|
$check = ' checked="checked"'; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="'.$caller.'_validation_fields"'. |
|
' value="'.$field.'"'.$check.' />'.$field. |
|
'</label></span> '; |
|
} |
|
} elsif ($item eq 'markup') { |
|
$datatable .= '<textarea name="'.$caller.'_validation_markup" cols="50" rows="5" wrap="soft">'. |
|
$currvalidation{$item}. |
|
'</textarea>'; |
|
} |
|
$datatable .= '</td></tr>'."\n"; |
|
if (ref($rowtotal)) { |
|
$itemcount ++; |
|
} |
|
} |
|
if ($caller eq 'requestcourses') { |
|
my %currhash; |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{'validation'}) eq 'HASH') { |
|
if ($settings->{'validation'}{'dc'} ne '') { |
|
$currhash{$settings->{'validation'}{'dc'}} = 1; |
|
} |
|
} |
|
} |
|
my $numinrow = 2; |
|
my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio', |
|
'validationdc',%currhash); |
|
my $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
|
$datatable .= '</td></tr><tr'.$css_class.'><td>'; |
|
if ($numdc > 1) { |
|
$datatable .= &mt('Course creation processed as: (choose Dom. Coord.)'); |
|
} else { |
|
$datatable .= &mt('Course creation processed as: '); |
|
} |
|
$datatable .= '</td><td class="LC_left_item">'.$dctable.'</td></tr>'; |
|
$itemcount ++; |
|
} |
|
if (ref($rowtotal)) { |
|
$$rowtotal += $itemcount; |
|
} |
|
return $datatable; |
|
} |
|
|
|
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); |
Line 3384 sub print_usersessions {
|
Line 2844 sub print_usersessions {
|
if ($position eq 'top') { |
if ($position eq 'top') { |
if (keys(%serverhomes) > 1) { |
if (keys(%serverhomes) > 1) { |
my %spareid = ¤t_offloads_to($dom,$settings,\%servers); |
my %spareid = ¤t_offloads_to($dom,$settings,\%servers); |
my $curroffloadnow; |
$datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids,$rowtotal); |
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{'offloadnow'}) eq 'HASH') { |
|
$curroffloadnow = $settings->{'offloadnow'}; |
|
} |
|
} |
|
$datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids,$curroffloadnow,$rowtotal); |
|
} else { |
} else { |
$datatable .= '<tr'.$css_class.'><td colspan="2">'. |
$datatable .= '<tr'.$css_class.'><td colspan="2">'. |
&mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.'); |
&mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.'); |
Line 3640 sub current_offloads_to {
|
Line 3094 sub current_offloads_to {
|
} |
} |
|
|
sub spares_row { |
sub spares_row { |
my ($dom,$servers,$spareid,$serverhomes,$altids,$curroffloadnow,$rowtotal) = @_; |
my ($dom,$servers,$spareid,$serverhomes,$altids,$rowtotal) = @_; |
my $css_class; |
my $css_class; |
my $numinrow = 4; |
my $numinrow = 4; |
my $itemcount = 1; |
my $itemcount = 1; |
Line 3660 sub spares_row {
|
Line 3114 sub spares_row {
|
} |
} |
} |
} |
next unless (ref($spareid->{$server}) eq 'HASH'); |
next unless (ref($spareid->{$server}) eq 'HASH'); |
my $checkednow; |
|
if (ref($curroffloadnow) eq 'HASH') { |
|
if ($curroffloadnow->{$server}) { |
|
$checkednow = ' checked="checked"'; |
|
} |
|
} |
|
$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 rowspan="2"> |
<td rowspan="2"> |
<span class="LC_nobreak">'. |
<span class="LC_nobreak">'. |
&mt('[_1] when busy, offloads to:' |
&mt('[_1] when busy, offloads to:' |
,'<b>'.$server.'</b>').'</span><br />'. |
,'<b>'.$server.'</b>'). |
'<span class="LC_nobreak">'."\n". |
|
'<label><input type="checkbox" name="offloadnow" value="'.$server.'"'.$checkednow.' />'. |
|
' '.&mt('Switch active users on next access').'</label></span>'. |
|
"\n"; |
"\n"; |
my (%current,%canselect); |
my (%current,%canselect); |
my @choices = |
my @choices = |
Line 3898 sub print_loadbalancing {
|
Line 3343 sub print_loadbalancing {
|
$disabled = ' disabled="disabled"'; |
$disabled = ' disabled="disabled"'; |
} |
} |
$targettable .= |
$targettable .= |
'<td><span class="LC_nobreak"><label>'. |
'<td><label><input type="checkbox" name="loadbalancing_target_'.$balnum.'_'.$sparetype.'"'. |
'<input type="checkbox" name="loadbalancing_target_'.$balnum.'_'.$sparetype.'"'. |
|
$checked.$disabled.' value="'.$chkboxval.'" id="loadbalancing_target_'.$balnum.'_'.$sparetype.'_'.$i.'" onclick="checkOffloads('."this,'$balnum','$sparetype'".');" /><span id="loadbalancing_targettxt_'.$balnum.'_'.$sparetype.'_'.$i.'"> '.$chkboxval. |
$checked.$disabled.' value="'.$chkboxval.'" id="loadbalancing_target_'.$balnum.'_'.$sparetype.'_'.$i.'" onclick="checkOffloads('."this,'$balnum','$sparetype'".');" /><span id="loadbalancing_targettxt_'.$balnum.'_'.$sparetype.'_'.$i.'"> '.$chkboxval. |
'</span></label></span></td>'; |
'</span></label></td>'; |
my $rem = $i%($numinrow); |
my $rem = $i%($numinrow); |
if ($rem == 0) { |
if ($rem == 0) { |
if (($i > 0) && ($i < $numspares-1)) { |
if (($i > 0) && ($i < $numspares-1)) { |
Line 3991 sub loadbalancing_rules {
|
Line 3435 sub loadbalancing_rules {
|
if (ref($currrules) eq 'HASH') { |
if (ref($currrules) eq 'HASH') { |
$current = $currrules->{$type}; |
$current = $currrules->{$type}; |
} |
} |
if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) { |
if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) { |
if ($dom ne &Apache::lonnet::host_domain($lonhost)) { |
if ($dom ne &Apache::lonnet::host_domain($lonhost)) { |
$current = ''; |
$current = ''; |
} |
} |
Line 4043 sub loadbalance_rule_row {
|
Line 3487 sub loadbalance_rule_row {
|
my @rulenames; |
my @rulenames; |
my %ruletitles = &offloadtype_text(); |
my %ruletitles = &offloadtype_text(); |
if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) { |
if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) { |
@rulenames = ('balancer','offloadedto','specific'); |
@rulenames = ('balancer','offloadedto'); |
} else { |
} else { |
@rulenames = ('default','homeserver'); |
@rulenames = ('default','homeserver'); |
if ($type eq '_LC_external') { |
if ($type eq '_LC_external') { |
Line 4054 sub loadbalance_rule_row {
|
Line 3498 sub loadbalance_rule_row {
|
push(@rulenames,'none'); |
push(@rulenames,'none'); |
} |
} |
my $style = $targets_div_style; |
my $style = $targets_div_style; |
if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) { |
if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) { |
$style = $homedom_div_style; |
$style = $homedom_div_style; |
} |
} |
my $space; |
my $space; |
Line 4105 sub loadbalance_rule_row {
|
Line 3549 sub loadbalance_rule_row {
|
'<input type="radio" name="loadbalancing_rules_'.$balnum.'_'.$type. |
'<input type="radio" name="loadbalancing_rules_'.$balnum.'_'.$type. |
'" id="loadbalancing_rules_'.$balnum.'_'.$type.'_'.$i.'" value="'. |
'" id="loadbalancing_rules_'.$balnum.'_'.$type.'_'.$i.'" value="'. |
$rule.'" onclick="balanceruleChange('."this.form,'$balnum','$type'". |
$rule.'" onclick="balanceruleChange('."this.form,'$balnum','$type'". |
')"'.$checked.' /> '; |
')"'.$checked.' /> '.$ruletitles{$rulenames[$i]}. |
if (($rulenames[$i] eq 'specific') && ($type =~ /^_LC_ipchange/)) { |
'</label>'.$extra.'</span><br />'."\n"; |
$output .= $ruletitles{'particular'}; |
|
} else { |
|
$output .= $ruletitles{$rulenames[$i]}; |
|
} |
|
$output .= '</label>'.$extra.'</span><br />'."\n"; |
|
} |
} |
$output .= '</div></td></tr>'."\n"; |
$output .= '</div></td></tr>'."\n"; |
return $output; |
return $output; |
Line 4126 sub offloadtype_text {
|
Line 3565 sub offloadtype_text {
|
'none' => 'No offload', |
'none' => 'No offload', |
'balancer' => 'Session hosted on Load Balancer, after re-authentication', |
'balancer' => 'Session hosted on Load Balancer, after re-authentication', |
'offloadedto' => 'Session hosted on offload server, after re-authentication', |
'offloadedto' => 'Session hosted on offload server, after re-authentication', |
'particular' => 'Session hosted (after re-auth) on server:', |
|
); |
); |
return %ruletitles; |
return %ruletitles; |
} |
} |
Line 4342 sub print_usercreation {
|
Line 3780 sub print_usercreation {
|
|
|
sub print_selfcreation { |
sub print_selfcreation { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my (@selfcreate,$createsettings,$processing,$datatable); |
my (@selfcreate,$createsettings,$datatable); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'cancreate'}) eq 'HASH') { |
if (ref($settings->{'cancreate'}) eq 'HASH') { |
$createsettings = $settings->{'cancreate'}; |
$createsettings = $settings->{'cancreate'}; |
if (ref($createsettings) eq 'HASH') { |
if (ref($settings->{'cancreate'}{'selfcreate'}) eq 'ARRAY') { |
if (ref($createsettings->{'selfcreate'}) eq 'ARRAY') { |
@selfcreate = @{$settings->{'cancreate'}{'selfcreate'}}; |
@selfcreate = @{$createsettings->{'selfcreate'}}; |
} elsif ($settings->{'cancreate'}{'selfcreate'} ne '') { |
} elsif ($createsettings->{'selfcreate'} ne '') { |
if ($settings->{'cancreate'}{'selfcreate'} eq 'any') { |
if ($settings->{'cancreate'}{'selfcreate'} eq 'any') { |
@selfcreate = ('email','login','sso'); |
@selfcreate = ('email','login','sso'); |
} elsif ($settings->{'cancreate'}{'selfcreate'} ne 'none') { |
} elsif ($createsettings->{'selfcreate'} ne 'none') { |
@selfcreate = ($settings->{'cancreate'}{'selfcreate'}); |
@selfcreate = ($createsettings->{'selfcreate'}); |
|
} |
|
} |
|
if (ref($createsettings->{'selfcreateprocessing'}) eq 'HASH') { |
|
$processing = $createsettings->{'selfcreateprocessing'}; |
|
} |
} |
} |
} |
} |
} |
Line 4390 sub print_selfcreation {
|
Line 3823 sub print_selfcreation {
|
$$rowtotal ++; |
$$rowtotal ++; |
} |
} |
} |
} |
my @fields = ('lastname','firstname','middlename','permanentemail','id','inststatus'); |
|
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
|
$fieldtitles{'inststatus'} = &mt('Institutional status'); |
|
my $rem; |
|
my $numperrow = 2; |
|
my $css_class = $$rowtotal%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td class="LC_left_item">'.&mt('Mapping of Shibboleth environment variable names to user data fields (SSO auth)').'</td>'. |
|
'<td class="LC_left_item">'."\n". |
|
'<table><tr><td>'."\n"; |
|
for (my $i=0; $i<@fields; $i++) { |
|
$rem = $i%($numperrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$datatable .= '</tr>'; |
|
} |
|
$datatable .= '<tr>'; |
|
} |
|
my $currval; |
|
if (ref($createsettings) eq 'HASH') { |
|
if (ref($createsettings->{'shibenv'}) eq 'HASH') { |
|
$currval = $createsettings->{'shibenv'}{$fields[$i]}; |
|
} |
|
} |
|
$datatable .= '<td class="LC_left_item">'. |
|
'<span class="LC_nobreak">'. |
|
'<input type="text" name="shibenv_'.$fields[$i].'" '. |
|
'value="'.$currval.'" size="10" /> '. |
|
$fieldtitles{$fields[$i]}.'</span></td>'; |
|
} |
|
my $colsleft = $numperrow - $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></td></tr>'; |
|
$$rowtotal ++; |
|
} elsif ($position eq 'middle') { |
} elsif ($position eq 'middle') { |
my %domconf = &Apache::lonnet::get_dom('configuration',['usermodification'],$dom); |
my %domconf = &Apache::lonnet::get_dom('configuration',['usermodification'],$dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
Line 4443 sub print_selfcreation {
|
Line 3837 sub print_selfcreation {
|
} |
} |
} |
} |
} else { |
} else { |
my %choices = &Apache::lonlocal::texthash ( |
my $css_class = $$rowtotal%2?' class="LC_odd_row"':''; |
cancreate_email => 'E-mail address as username', |
my %choices = |
); |
&Apache::lonlocal::texthash( |
my @toggles = sort(keys(%choices)); |
email => 'Approved automatically', |
my %defaultchecked = ( |
emailapproval => 'Queued for approval by DC', |
'cancreate_email' => 'off', |
off => 'Not enabled', |
); |
); |
my $itemcount = 0; |
$datatable .= '<tr'.$css_class.'>'. |
my $display = 'none'; |
'<td>'.&mt('E-mail address as username'). |
if (grep(/^\Qemail\E$/,@selfcreate)) { |
'</td><td class="LC_left_item">'. |
$display = 'block'; |
'<span class="LC_nobreak">'; |
} |
foreach my $option ('email','emailapproval','off') { |
my $onclick = "toggleDisplay(this.form,'emailoptions');"; |
my $checked; |
my $additional = '<div id="emailoptions" style="display: '.$display.'">'; |
if ($option eq 'email') { |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
if ($radiohash{'cancreate_email'}) { |
my $usertypes = {}; |
$checked = 'checked="checked"'; |
my $order = []; |
} |
if ((ref($domdefaults{'inststatustypes'}) eq 'HASH') && (ref($domdefaults{'inststatusguest'}) eq 'ARRAY')) { |
} elsif ($option eq 'emailapproval') { |
$usertypes = $domdefaults{'inststatustypes'}; |
if ($radiohash{'cancreate_emailapproval'}) { |
$order = $domdefaults{'inststatusguest'}; |
$checked = 'checked="checked"'; |
} |
|
if (ref($order) eq 'ARRAY') { |
|
push(@{$order},'default'); |
|
if (@{$order} > 1) { |
|
$usertypes->{'default'} = &mt('Other users'); |
|
$additional .= '<table><tr>'; |
|
foreach my $status (@{$order}) { |
|
$additional .= '<th>'.$usertypes->{$status}.'</th>'; |
|
} |
|
$additional .= '</tr><tr>'; |
|
foreach my $status (@{$order}) { |
|
$additional .= '<td>'.&email_as_username($rowtotal,$processing,$status).'</td>'; |
|
} |
} |
$additional .= '</tr></table>'; |
|
} else { |
} else { |
$usertypes->{'default'} = &mt('All users'); |
if ((!$radiohash{'cancreate_email'}) && (!$radiohash{'cancreate_emailapproval'})) { |
$additional .= &email_as_username($rowtotal,$processing); |
$checked = 'checked="checked"'; |
|
} |
} |
} |
|
$datatable .= '<label>'. |
|
'<input type="radio" name="cancreate_email" '. |
|
$checked.' value="'.$option.'" />'. |
|
$choices{$option}.'</label> '; |
} |
} |
$additional .= '</div>'."\n"; |
|
|
|
($datatable,$itemcount) = &radiobutton_prefs(\%radiohash,\@toggles,\%defaultchecked, |
|
\%choices,$$rowtotal,$onclick,$additional); |
|
$$rowtotal ++; |
$$rowtotal ++; |
$datatable .= &print_requestmail($dom,'selfcreation',$createsettings,$rowtotal); |
$datatable .= '</span></td></tr>'. |
|
&print_requestmail($dom,'selfcreation',$createsettings,$rowtotal); |
$$rowtotal ++; |
$$rowtotal ++; |
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info(); |
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info(); |
$numinrow = 1; |
$numinrow = 1; |
if (ref($order) eq 'ARRAY') { |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
foreach my $status (@{$order}) { |
$usertypes->{'default'} = $othertitle; |
|
if (ref($types) eq 'ARRAY') { |
|
push(@{$types},'default'); |
|
$usertypes->{'default'} = $othertitle; |
|
foreach my $status (@{$types}) { |
$datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings, |
$datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings, |
$numinrow,$$rowtotal,$usertypes,$infofields,$infotitles); |
$numinrow,$$rowtotal,$usertypes,$infofields,$infotitles); |
$$rowtotal ++; |
$$rowtotal ++; |
Line 4512 sub print_selfcreation {
|
Line 3899 sub print_selfcreation {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
sub email_as_username { |
|
my ($rowtotal,$processing,$type) = @_; |
|
my %choices = |
|
&Apache::lonlocal::texthash ( |
|
automatic => 'Automatic approval', |
|
approval => 'Queued for approval', |
|
); |
|
my $output; |
|
foreach my $option ('automatic','approval') { |
|
my $checked; |
|
if (ref($processing) eq 'HASH') { |
|
if ($type eq '') { |
|
if (!exists($processing->{'default'})) { |
|
if ($option eq 'automatic') { |
|
$checked = ' checked="checked"'; |
|
} |
|
} else { |
|
if ($processing->{'default'} eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
} |
|
} else { |
|
if (!exists($processing->{$type})) { |
|
if ($option eq 'automatic') { |
|
$checked = ' checked="checked"'; |
|
} |
|
} else { |
|
if ($processing->{$type} eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
} |
|
} |
|
} elsif ($option eq 'automatic') { |
|
$checked = ' checked="checked"'; |
|
} |
|
my $name = 'cancreate_emailprocess'; |
|
if (($type ne '') && ($type ne 'default')) { |
|
$name .= '_'.$type; |
|
} |
|
$output .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="'.$name.'"'. |
|
$checked.' value="'.$option.'" />'. |
|
$choices{$option}.'</label></span>'; |
|
if ($type eq '') { |
|
$output .= ' '; |
|
} else { |
|
$output .= '<br />'; |
|
} |
|
} |
|
$$rowtotal ++; |
|
return $output; |
|
} |
|
|
|
sub captcha_choice { |
sub captcha_choice { |
my ($context,$settings,$itemcount) = @_; |
my ($context,$settings,$itemcount) = @_; |
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext, |
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext); |
$vertext,$currver); |
|
my %lt = &captcha_phrases(); |
my %lt = &captcha_phrases(); |
$keyentry = 'hidden'; |
$keyentry = 'hidden'; |
if ($context eq 'cancreate') { |
if ($context eq 'cancreate') { |
Line 4586 sub captcha_choice {
|
Line 3919 sub captcha_choice {
|
$pubtext = $lt{'pub'}; |
$pubtext = $lt{'pub'}; |
$privtext = $lt{'priv'}; |
$privtext = $lt{'priv'}; |
$keyentry = 'text'; |
$keyentry = 'text'; |
$vertext = $lt{'ver'}; |
|
$currver = $settings->{'recaptchaversion'}; |
|
if ($currver ne '2') { |
|
$currver = 1; |
|
} |
|
} |
} |
if (ref($settings->{'recaptchakeys'}) eq 'HASH') { |
if (ref($settings->{'recaptchakeys'}) eq 'HASH') { |
$currpub = $settings->{'recaptchakeys'}{'public'}; |
$currpub = $settings->{'recaptchakeys'}{'public'}; |
Line 4624 sub captcha_choice {
|
Line 3952 sub captcha_choice {
|
$currpub.'" size="40" /></span><br />'."\n". |
$currpub.'" size="40" /></span><br />'."\n". |
'<span class="LC_nobreak"><span id="'.$context.'_recaptchaprivtxt">'.$privtext.'</span> '."\n". |
'<span class="LC_nobreak"><span id="'.$context.'_recaptchaprivtxt">'.$privtext.'</span> '."\n". |
'<input type="'.$keyentry.'" id="'.$context.'_recaptchapriv" name="'.$context.'_recaptchapriv" value="'. |
'<input type="'.$keyentry.'" id="'.$context.'_recaptchapriv" name="'.$context.'_recaptchapriv" value="'. |
$currpriv.'" size="40" /></span><br />'. |
$currpriv.'" size="40" /></span></td></tr></table>'."\n". |
'<span class="LC_nobreak"><span id="'.$context.'_recaptchavertxt">'.$vertext.'</span> '."\n". |
|
'<input type="'.$keyentry.'" id="'.$context.'_recaptchaversion" name="'.$context.'_recaptchaversion" value="'. |
|
$currver.'" size="3" /></span><br />'. |
|
'</td></tr></table>'."\n". |
|
'</td></tr>'; |
'</td></tr>'; |
return $output; |
return $output; |
} |
} |
Line 4747 sub print_usermodification {
|
Line 4071 sub print_usermodification {
|
$$rowtotal ++; |
$$rowtotal ++; |
$rowcount ++; |
$rowcount ++; |
} |
} |
} elsif ($position eq 'bottom') { |
} 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 4761 sub print_usermodification {
|
Line 4085 sub print_usermodification {
|
} |
} |
|
|
sub print_defaults { |
sub print_defaults { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
|
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def', |
|
'datelocale_def','portal_def'); |
|
my %defaults; |
|
if (ref($settings) eq 'HASH') { |
|
%defaults = %{$settings}; |
|
} else { |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
|
foreach my $item (@items) { |
|
$defaults{$item} = $domdefaults{$item}; |
|
} |
|
} |
|
my $titles = &defaults_titles($dom); |
my $rownum = 0; |
my $rownum = 0; |
my ($datatable,$css_class); |
my ($datatable,$css_class); |
if ($position eq 'top') { |
foreach my $item (@items) { |
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def', |
if ($rownum%2) { |
'datelocale_def','portal_def'); |
$css_class = ''; |
my %defaults; |
|
if (ref($settings) eq 'HASH') { |
|
%defaults = %{$settings}; |
|
} else { |
} else { |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
$css_class = ' class="LC_odd_row" '; |
foreach my $item (@items) { |
|
$defaults{$item} = $domdefaults{$item}; |
|
} |
|
} |
} |
my $titles = &defaults_titles($dom); |
$datatable .= '<tr'.$css_class.'>'. |
foreach my $item (@items) { |
'<td><span class="LC_nobreak">'.$titles->{$item}. |
if ($rownum%2) { |
'</span></td><td class="LC_right_item">'; |
$css_class = ''; |
if ($item eq 'auth_def') { |
} else { |
my @authtypes = ('internal','krb4','krb5','localauth'); |
$css_class = ' class="LC_odd_row" '; |
my %shortauth = ( |
} |
internal => 'int', |
$datatable .= '<tr'.$css_class.'>'. |
krb4 => 'krb4', |
'<td><span class="LC_nobreak">'.$titles->{$item}. |
krb5 => 'krb5', |
'</span></td><td class="LC_right_item" colspan="3">'; |
localauth => 'loc' |
if ($item eq 'auth_def') { |
); |
my @authtypes = ('internal','krb4','krb5','localauth'); |
my %authnames = &authtype_names(); |
my %shortauth = ( |
foreach my $auth (@authtypes) { |
internal => 'int', |
my $checked = ' '; |
krb4 => 'krb4', |
if ($defaults{$item} eq $auth) { |
krb5 => 'krb5', |
$checked = ' checked="checked" '; |
localauth => 'loc' |
} |
); |
$datatable .= '<label><input type="radio" name="'.$item. |
my %authnames = &authtype_names(); |
'" value="'.$auth.'"'.$checked.'/>'. |
foreach my $auth (@authtypes) { |
$authnames{$shortauth{$auth}}.'</label> '; |
my $checked = ' '; |
|
if ($defaults{$item} eq $auth) { |
|
$checked = ' checked="checked" '; |
|
} |
|
$datatable .= '<label><input type="radio" name="'.$item. |
|
'" value="'.$auth.'"'.$checked.'/>'. |
|
$authnames{$shortauth{$auth}}.'</label> '; |
|
} |
|
} elsif ($item eq 'timezone_def') { |
|
my $includeempty = 1; |
|
$datatable .= &Apache::loncommon::select_timezone($item,$defaults{$item},undef,$includeempty); |
|
} elsif ($item eq 'datelocale_def') { |
|
my $includeempty = 1; |
|
$datatable .= &Apache::loncommon::select_datelocale($item,$defaults{$item},undef,$includeempty); |
|
} elsif ($item eq 'lang_def') { |
|
my $includeempty = 1; |
|
$datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty); |
|
} else { |
|
my $size; |
|
if ($item eq 'portal_def') { |
|
$size = ' size="25"'; |
|
} |
|
$datatable .= '<input type="text" name="'.$item.'" value="'. |
|
$defaults{$item}.'"'.$size.' />'; |
|
} |
} |
$datatable .= '</td></tr>'; |
} elsif ($item eq 'timezone_def') { |
$rownum ++; |
my $includeempty = 1; |
} |
$datatable .= &Apache::loncommon::select_timezone($item,$defaults{$item},undef,$includeempty); |
} else { |
} elsif ($item eq 'datelocale_def') { |
my (%defaults); |
my $includeempty = 1; |
if (ref($settings) eq 'HASH') { |
$datatable .= &Apache::loncommon::select_datelocale($item,$defaults{$item},undef,$includeempty); |
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH') && |
} elsif ($item eq 'lang_def') { |
(ref($settings->{'inststatusguest'}) eq 'ARRAY')) { |
my %langchoices = &get_languages_hash(); |
my $maxnum = @{$settings->{'inststatusorder'}}; |
$langchoices{''} = 'No language preference'; |
for (my $i=0; $i<$maxnum; $i++) { |
%langchoices = &Apache::lonlocal::texthash(%langchoices); |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
$datatable .= &Apache::loncommon::select_form($defaults{$item},$item, |
my $item = $settings->{'inststatusorder'}->[$i]; |
\%langchoices); |
my $title = $settings->{'inststatustypes'}->{$item}; |
} else { |
my $guestok; |
my $size; |
if (grep(/^\Q$item\E$/,@{$settings->{'inststatusguest'}})) { |
if ($item eq 'portal_def') { |
$guestok = 1; |
$size = ' size="25"'; |
} |
|
my $chgstr = ' onchange="javascript:reorderTypes(this.form,'."'$item'".');"'; |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td><span class="LC_nobreak">'. |
|
'<select name="inststatus_pos_'.$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>'; |
|
} |
|
my ($checkedon,$checkedoff); |
|
$checkedoff = ' checked="checked"'; |
|
if ($guestok) { |
|
$checkedon = $checkedoff; |
|
$checkedoff = ''; |
|
} |
|
$datatable .= '</select> '.&mt('Internal ID:').' <b>'.$item.'</b> '. |
|
'<input type="checkbox" name="inststatus_delete" value="'.$item.'" />'. |
|
&mt('delete').'</span></td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak">'.&mt('Name displayed:'). |
|
'<input type="text" size="20" name="inststatus_title_'.$item.'" value="'.$title.'" />'. |
|
'</span></td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" value="1" name="inststatus_guest_'.$item.'"'.$checkedon.' />'. |
|
&mt('Yes').'</label>'.(' 'x2). |
|
'<label><input type="radio" value="0" name="inststatus_guest_'.$item.'"'.$checkedoff.' />'. |
|
&mt('No').'</label></span></td></tr>'; |
|
} |
|
$css_class = $rownum%2?' class="LC_odd_row"':''; |
|
my $chgstr = ' onchange="javascript:reorderTypes(this.form,'."'addinststatus_pos'".');"'; |
|
$datatable .= '<tr '.$css_class.'>'. |
|
'<td><span class="LC_nobreak"><select name="addinststatus_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> '.&mt('Internal ID:'). |
|
'<input type="text" size="10" name="addinststatus" value="" />'. |
|
' '.&mt('(new)'). |
|
'</span></td><td class="LC_left_item"><span class="LC_nobreak">'. |
|
&mt('Name displayed:'). |
|
'<input type="text" size="20" name="addinststatus_title" value="" /></span></td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" value="1" name="addinststatus_guest" />'. |
|
&mt('Yes').'</label>'.(' 'x2). |
|
'<label><input type="radio" value="0" name="addinststatus_guest" />'. |
|
&mt('No').'</label></span></td></tr>'; |
|
'</tr>'."\n"; |
|
$rownum ++; |
|
} |
} |
|
$datatable .= '<input type="text" name="'.$item.'" value="'. |
|
$defaults{$item}.'"'.$size.' />'; |
} |
} |
|
$datatable .= '</td></tr>'; |
|
$rownum ++; |
} |
} |
$$rowtotal += $rownum; |
$$rowtotal += $rownum; |
return $datatable; |
return $datatable; |
Line 5111 sub print_coursecategories {
|
Line 4365 sub print_coursecategories {
|
my ($position,$dom,$hdritem,$settings,$rowtotal) = @_; |
my ($position,$dom,$hdritem,$settings,$rowtotal) = @_; |
my $datatable; |
my $datatable; |
if ($position eq 'top') { |
if ($position eq 'top') { |
my (%checked); |
|
my @catitems = ('unauth','auth'); |
|
my @cattypes = ('std','domonly','codesrch','none'); |
|
$checked{'unauth'} = 'std'; |
|
$checked{'auth'} = 'std'; |
|
if (ref($settings) eq 'HASH') { |
|
foreach my $type (@cattypes) { |
|
if ($type eq $settings->{'unauth'}) { |
|
$checked{'unauth'} = $type; |
|
} |
|
if ($type eq $settings->{'auth'}) { |
|
$checked{'auth'} = $type; |
|
} |
|
} |
|
} |
|
my %lt = &Apache::lonlocal::texthash ( |
|
unauth => 'Catalog type for unauthenticated users', |
|
auth => 'Catalog type for authenticated users', |
|
none => 'No catalog', |
|
std => 'Standard catalog', |
|
domonly => 'Domain-only catalog', |
|
codesrch => "Code search form", |
|
); |
|
my $itemcount = 0; |
|
foreach my $item (@catitems) { |
|
my $css_class = $itemcount%2? ' class="LC_odd_row"':''; |
|
$datatable .= '<tr '.$css_class.'>'. |
|
'<td>'.$lt{$item}.'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak">'; |
|
foreach my $type (@cattypes) { |
|
my $ischecked; |
|
if ($checked{$item} eq $type) { |
|
$ischecked=' checked="checked"'; |
|
} |
|
$datatable .= '<label>'. |
|
'<input type="radio" name="coursecat_'.$item.'" value="'.$type.'"'.$ischecked. |
|
' />'.$lt{$type}.'</label> '; |
|
} |
|
$datatable .= '</td></tr>'; |
|
$itemcount ++; |
|
} |
|
$$rowtotal += $itemcount; |
|
} elsif ($position eq 'middle') { |
|
my $toggle_cats_crs = ' '; |
my $toggle_cats_crs = ' '; |
my $toggle_cats_dom = ' checked="checked" '; |
my $toggle_cats_dom = ' checked="checked" '; |
my $can_cat_crs = ' '; |
my $can_cat_crs = ' '; |
Line 5360 sub print_coursecategories {
|
Line 4571 sub print_coursecategories {
|
$datatable .= &initialize_categories($itemcount); |
$datatable .= &initialize_categories($itemcount); |
} |
} |
} else { |
} else { |
$datatable .= '<td class="LC_right_item">'.$hdritem->{'header'}->[1]->{'col2'}.'</td>' |
$datatable .= '<td class="LC_right_item">'.$hdritem->{'header'}->[0]->{'col2'}.'</td>' |
.&initialize_categories($itemcount); |
.&initialize_categories($itemcount); |
} |
} |
$$rowtotal += $itemcount; |
$$rowtotal += $itemcount; |
Line 5418 sub serverstatus_pages {
|
Line 4629 sub serverstatus_pages {
|
return ('userstatus','lonstatus','loncron','server-status','codeversions', |
return ('userstatus','lonstatus','loncron','server-status','codeversions', |
'checksums','clusterstatus','metadata_keywords','metadata_harvest', |
'checksums','clusterstatus','metadata_keywords','metadata_harvest', |
'takeoffline','takeonline','showenv','toggledebug','ping','domconf', |
'takeoffline','takeonline','showenv','toggledebug','ping','domconf', |
'uniquecodes','diskusage','coursecatalog'); |
'uniquecodes'); |
} |
|
|
|
sub defaults_javascript { |
|
my ($settings) = @_; |
|
return unless (ref($settings) eq 'HASH'); |
|
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { |
|
my $maxnum = scalar(@{$settings->{'inststatusorder'}}); |
|
if ($maxnum eq '') { |
|
$maxnum = 0; |
|
} |
|
$maxnum ++; |
|
my $jstext = ' var inststatuses = Array('."'".join("','",@{$settings->{'inststatusorder'}})."'".');'; |
|
return <<"ENDSCRIPT"; |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
function reorderTypes(form,caller) { |
|
var changedVal; |
|
$jstext |
|
var newpos = 'addinststatus_pos'; |
|
var current = new Array; |
|
var maxh = $maxnum; |
|
var newitemVal = form.elements[newpos].options[form.elements[newpos].selectedIndex].value; |
|
var oldVal; |
|
if (caller == newpos) { |
|
changedVal = newitemVal; |
|
} else { |
|
var curritem = 'inststatus_pos_'+caller; |
|
changedVal = form.elements[curritem].options[form.elements[curritem].selectedIndex].value; |
|
current[newitemVal] = newpos; |
|
} |
|
for (var i=0; i<inststatuses.length; i++) { |
|
if (inststatuses[i] != caller) { |
|
var elementName = 'inststatus_pos_'+inststatuses[i]; |
|
if (form.elements[elementName]) { |
|
var currVal = form.elements[elementName].options[form.elements[elementName].selectedIndex].value; |
|
current[currVal] = elementName; |
|
} |
|
} |
|
} |
|
for (var j=0; j<maxh; j++) { |
|
if (current[j] == undefined) { |
|
oldVal = j; |
|
} |
|
} |
|
if (oldVal < changedVal) { |
|
for (var k=oldVal+1; k<=changedVal ; k++) { |
|
var elementName = current[k]; |
|
form.elements[elementName].selectedIndex = form.elements[elementName].selectedIndex - 1; |
|
} |
|
} else { |
|
for (var k=changedVal; k<oldVal; k++) { |
|
var elementName = current[k]; |
|
form.elements[elementName].selectedIndex = form.elements[elementName].selectedIndex + 1; |
|
} |
|
} |
|
return; |
|
} |
|
|
|
// ]]> |
|
</script> |
|
|
|
ENDSCRIPT |
|
} |
|
} |
} |
|
|
sub coursecategories_javascript { |
sub coursecategories_javascript { |
Line 5506 sub coursecategories_javascript {
|
Line 4654 sub coursecategories_javascript {
|
$jstext = ' var categories = Array(1);'."\n". |
$jstext = ' var categories = Array(1);'."\n". |
' categories[0] = Array("instcode_pos");'."\n"; |
' categories[0] = Array("instcode_pos");'."\n"; |
} |
} |
my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"'); |
my $instcode_reserved = &mt('The name: "instcode" is a reserved category'); |
my $communities_reserved = &mt('The name: [_1] is a reserved category.','"communities"'); |
my $communities_reserved = &mt('The name: "communities" is a reserved category'); |
my $choose_again = "\n".&mt('Please use a different name for the new top level category.'); |
my $choose_again = '\\n'.&mt('Please use a different name for the new top level category'); |
&js_escape(\$instcode_reserved); |
|
&js_escape(\$communities_reserved); |
|
&js_escape(\$choose_again); |
|
$output = <<"ENDSCRIPT"; |
$output = <<"ENDSCRIPT"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 5519 function reorderCats(form,parent,item,id
|
Line 4664 function reorderCats(form,parent,item,id
|
var changedVal; |
var changedVal; |
$jstext |
$jstext |
var newpos = 'addcategory_pos'; |
var newpos = 'addcategory_pos'; |
|
var current = new Array; |
if (parent == '') { |
if (parent == '') { |
var has_instcode = 0; |
var has_instcode = 0; |
var maxtop = categories[idx].length; |
var maxtop = categories[idx].length; |
Line 6026 sub modify_login {
|
Line 5172 sub modify_login {
|
} |
} |
|
|
my %servers = &Apache::lonnet::internet_dom_servers($dom); |
my %servers = &Apache::lonnet::internet_dom_servers($dom); |
my %domservers = &Apache::lonnet::get_servers($dom); |
|
my @loginvia_attribs = ('serverpath','custompath','exempt'); |
my @loginvia_attribs = ('serverpath','custompath','exempt'); |
if (keys(%servers) > 1) { |
if (keys(%servers) > 1) { |
foreach my $lonhost (keys(%servers)) { |
foreach my $lonhost (keys(%servers)) { |
Line 6069 sub modify_login {
|
Line 5214 sub modify_login {
|
$changes{'loginvia'}{$lonhost} = 1; |
$changes{'loginvia'}{$lonhost} = 1; |
} |
} |
if ($item eq 'exempt') { |
if ($item eq 'exempt') { |
$new = &check_exempt_addresses($new); |
$new =~ s/^\s+//; |
|
$new =~ s/\s+$//; |
|
my @poss_ips = split(/\s*[,:]\s*/,$new); |
|
my @okips; |
|
foreach my $ip (@poss_ips) { |
|
if ($ip =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { |
|
if (($1 <= 255) && ($2 <= 255) && ($3 <= 255) && ($4 <= 255)) { |
|
push(@okips,$ip); |
|
} |
|
} |
|
} |
|
if (@okips > 0) { |
|
$new = join(',',@okips); |
|
} else { |
|
$new = ''; |
|
} |
} |
} |
$loginhash{login}{loginvia}{$lonhost}{$item} = $new; |
$loginhash{login}{loginvia}{$lonhost}{$item} = $new; |
} |
} |
Line 6181 sub modify_login {
|
Line 5341 sub modify_login {
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
} |
} |
} |
} |
|
|
my (%currheadtagurls,%currexempt,@newhosts,%newheadtagurls,%possexempt); |
|
if (ref($domconfig{'login'}) eq 'HASH') { |
|
if (ref($domconfig{'login'}{'headtag'}) eq 'HASH') { |
|
foreach my $lonhost (keys(%{$domconfig{'login'}{'headtag'}})) { |
|
if ($domservers{$lonhost}) { |
|
if (ref($domconfig{'login'}{'headtag'}{$lonhost}) eq 'HASH') { |
|
$currheadtagurls{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'url'}; |
|
$currexempt{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'exempt'} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
my @delheadtagurls = &Apache::loncommon::get_env_multiple('form.loginheadtag_del'); |
|
foreach my $lonhost (sort(keys(%domservers))) { |
|
if (grep(/^\Q$lonhost\E$/,@delheadtagurls)) { |
|
$changes{'headtag'}{$lonhost} = 1; |
|
} else { |
|
if ($env{'form.loginheadtagexempt_'.$lonhost}) { |
|
$possexempt{$lonhost} = &check_exempt_addresses($env{'form.loginheadtagexempt_'.$lonhost}); |
|
} |
|
if ($env{'form.loginheadtag_'.$lonhost.'.filename'}) { |
|
push(@newhosts,$lonhost); |
|
} elsif ($currheadtagurls{$lonhost}) { |
|
$loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $currheadtagurls{$lonhost}; |
|
if ($currexempt{$lonhost}) { |
|
if ((!exists($possexempt{$lonhost})) || ($possexempt{$lonhost} ne $currexempt{$lonhost})) { |
|
$changes{'headtag'}{$lonhost} = 1; |
|
} |
|
} elsif ($possexempt{$lonhost}) { |
|
$changes{'headtag'}{$lonhost} = 1; |
|
} |
|
if ($possexempt{$lonhost}) { |
|
$loginhash{'login'}{'headtag'}{$lonhost}{'exempt'} = $possexempt{$lonhost}; |
|
} |
|
} |
|
} |
|
} |
|
if (@newhosts) { |
|
my $error; |
|
my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); |
|
if ($configuserok eq 'ok') { |
|
if ($switchserver) { |
|
$error = &mt("Upload of custom markup is not permitted to this server: [_1]",$switchserver); |
|
} elsif ($author_ok eq 'ok') { |
|
foreach my $lonhost (@newhosts) { |
|
my $formelem = 'loginheadtag_'.$lonhost; |
|
(my $result,$newheadtagurls{$lonhost}) = &publishlogo($r,'upload',$formelem,$dom,$confname, |
|
"login/headtag/$lonhost",'','', |
|
$env{'form.loginheadtag_'.$lonhost.'.filename'}); |
|
if ($result eq 'ok') { |
|
$loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $newheadtagurls{$lonhost}; |
|
$changes{'headtag'}{$lonhost} = 1; |
|
if ($possexempt{$lonhost}) { |
|
$loginhash{'login'}{'headtag'}{$lonhost}{'exempt'} = $possexempt{$lonhost}; |
|
} |
|
} else { |
|
my $puberror = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].", |
|
$newheadtagurls{$lonhost},$result); |
|
$errors .= '<li><span class="LC_error">'.$puberror.'</span></li>'; |
|
if ((grep(/^\Q$lonhost\E$/,keys(%currheadtagurls))) && |
|
(!grep(/^\Q$lonhost\E$/,@delheadtagurls))) { |
|
$loginhash{'login'}{'headtag'}{$lonhost} = $currheadtagurls{$lonhost}; |
|
} |
|
} |
|
} |
|
} else { |
|
$error = &mt("Upload of custom markup file(s) failed because an author role could not be assigned to a Domain Configuration user ([_1]) in domain: [_2]. Error was: [_3].",$confname,$dom,$author_ok); |
|
} |
|
} else { |
|
$error = &mt("Upload of custom markup file(s) failed because a Domain Configuration user ([_1]) could not be created in domain: [_2]. Error was: [_3].",$confname,$dom,$configuserok); |
|
} |
|
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} |
|
|
|
&process_captcha('login',\%changes,$loginhash{'login'},$domconfig{'login'}); |
&process_captcha('login',\%changes,$loginhash{'login'},$domconfig{'login'}); |
|
|
my $defaulthelpfile = '/adm/loginproblems.html'; |
my $defaulthelpfile = '/adm/loginproblems.html'; |
Line 6360 sub modify_login {
|
Line 5441 sub modify_login {
|
} |
} |
} |
} |
} |
} |
} elsif ($item eq 'headtag') { |
|
if (ref($changes{$item}) eq 'HASH') { |
|
foreach my $lonhost (sort(keys(%{$changes{$item}}))) { |
|
if (grep(/^\Q$lonhost\E$/,@delheadtagurls)) { |
|
$resulttext .= '<li>'.&mt('custom markup file removed for [_1]',$domservers{$lonhost}).'</li>'; |
|
} elsif (ref($loginhash{'login'}{'headtag'}{$lonhost}) eq 'HASH') { |
|
$resulttext .= '<li><a href="'. |
|
"javascript:void(open('$loginhash{'login'}{'headtag'}{$lonhost}{'url'}?inhibitmenu=yes','Custom_HeadTag', |
|
'menubar=0,toolbar=1,scrollbars=1,width=600,height=500,resizable=yes'))". |
|
'">'.&mt('custom markup').'</a> '.&mt('(for [_1])',$servers{$lonhost}).' '; |
|
if ($possexempt{$lonhost}) { |
|
$resulttext .= &mt('not included for client IP(s): [_1]',$possexempt{$lonhost}); |
|
} else { |
|
$resulttext .= &mt('included for any client IP'); |
|
} |
|
$resulttext .= '</li>'; |
|
} |
|
} |
|
} |
|
} elsif ($item eq 'captcha') { |
} elsif ($item eq 'captcha') { |
if (ref($loginhash{'login'}) eq 'HASH') { |
if (ref($loginhash{'login'}) eq 'HASH') { |
my $chgtxt; |
my $chgtxt; |
Line 6410 sub modify_login {
|
Line 5472 sub modify_login {
|
if (!$privkey) { |
if (!$privkey) { |
$chgtxt .= '<li>'.&mt('Private key deleted').'</li>'; |
$chgtxt .= '<li>'.&mt('Private key deleted').'</li>'; |
} else { |
} else { |
$chgtxt .= '<li>'.&mt('Private key set to [_1]',$privkey).'</li>'; |
$chgtxt .= '<li>'.&mt('Private key set to [_1]',$pubkey).'</li>'; |
} |
} |
$chgtxt .= '</ul>'; |
$chgtxt .= '</ul>'; |
$resulttext .= '<li>'.$chgtxt.'</li>'; |
$resulttext .= '<li>'.$chgtxt.'</li>'; |
} |
} |
} elsif ($item eq 'recaptchaversion') { |
|
if (ref($loginhash{'login'}) eq 'HASH') { |
|
if ($loginhash{'login'}{'captcha'} eq 'recaptcha') { |
|
$resulttext .= '<li>'.&mt('ReCAPTCHA for helpdesk form set to version [_1]',$loginhash{'login'}{'recaptchaversion'}). |
|
'</li>'; |
|
} |
|
} |
|
} else { |
} else { |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
} |
} |
Line 6441 sub modify_login {
|
Line 5496 sub modify_login {
|
return $resulttext; |
return $resulttext; |
} |
} |
|
|
sub check_exempt_addresses { |
|
my ($iplist) = @_; |
|
$iplist =~ s/^\s+//; |
|
$iplist =~ s/\s+$//; |
|
my @poss_ips = split(/\s*[,:]\s*/,$iplist); |
|
my (@okips,$new); |
|
foreach my $ip (@poss_ips) { |
|
if ($ip =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { |
|
if (($1 <= 255) && ($2 <= 255) && ($3 <= 255) && ($4 <= 255)) { |
|
push(@okips,$ip); |
|
} |
|
} |
|
} |
|
if (@okips > 0) { |
|
$new = join(',',@okips); |
|
} else { |
|
$new = ''; |
|
} |
|
return $new; |
|
} |
|
|
|
sub color_font_choices { |
sub color_font_choices { |
my %choices = |
my %choices = |
&Apache::lonlocal::texthash ( |
&Apache::lonlocal::texthash ( |
Line 6546 sub modify_colors {
|
Line 5580 sub modify_colors {
|
} |
} |
if ($role eq 'login') { |
if ($role eq 'login') { |
foreach my $item (@logintext) { |
foreach my $item (@logintext) { |
$env{'form.'.$role.'_'.$item} = lc($env{'form.'.$role.'_'.$item}); |
unless ($env{'form.'.$role.'_'.$item} eq $defaults{'logintext'}{$item}) { |
if ($env{'form.'.$role.'_'.$item} =~ /^\w+/) { |
|
$env{'form.'.$role.'_'.$item} = '#'.$env{'form.'.$role.'_'.$item}; |
|
} |
|
unless ($env{'form.'.$role.'_'.$item} eq lc($defaults{'logintext'}{$item})) { |
|
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; |
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; |
} |
} |
} |
} |
} else { |
} else { |
$env{'form.'.$role.'_fontmenu'} = lc($env{'form.'.$role.'_fontmenu'}); |
unless($env{'form.'.$role.'_fontmenu'} eq $defaults{'fontmenu'}) { |
if ($env{'form.'.$role.'_fontmenu'} =~ /^\w+/) { |
|
$env{'form.'.$role.'_fontmenu'} = '#'.$env{'form.'.$role.'_fontmenu'}; |
|
} |
|
unless($env{'form.'.$role.'_fontmenu'} eq lc($defaults{'fontmenu'})) { |
|
$confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'}; |
$confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'}; |
} |
} |
} |
} |
foreach my $item (@bgs) { |
foreach my $item (@bgs) { |
$env{'form.'.$role.'_'.$item} = lc($env{'form.'.$role.'_'.$item}); |
unless ($env{'form.'.$role.'_'.$item} eq $defaults{'bgs'}{$item} ) { |
if ($env{'form.'.$role.'_'.$item} =~ /^\w+/) { |
|
$env{'form.'.$role.'_'.$item} = '#'.$env{'form.'.$role.'_'.$item}; |
|
} |
|
unless ($env{'form.'.$role.'_'.$item} eq lc($defaults{'bgs'}{$item})) { |
|
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; |
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; |
} |
} |
} |
} |
foreach my $item (@links) { |
foreach my $item (@links) { |
$env{'form.'.$role.'_'.$item} = lc($env{'form.'.$role.'_'.$item}); |
unless ($env{'form.'.$role.'_'.$item} eq $defaults{'links'}{$item}) { |
if ($env{'form.'.$role.'_'.$item} =~ /^\w+/) { |
|
$env{'form.'.$role.'_'.$item} = '#'.$env{'form.'.$role.'_'.$item}; |
|
} |
|
unless ($env{'form.'.$role.'_'.$item} eq lc($defaults{'links'}{$item})) { |
|
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; |
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; |
} |
} |
} |
} |
Line 7199 sub modify_quotas {
|
Line 6217 sub modify_quotas {
|
my ($r,$dom,$action,$lastactref,%domconfig) = @_; |
my ($r,$dom,$action,$lastactref,%domconfig) = @_; |
my ($context,@usertools,@options,%validations,%titles,%confhash,%toolshash, |
my ($context,@usertools,@options,%validations,%titles,%confhash,%toolshash, |
%limithash,$toolregexp,%conditions,$resulttext,%changes,$confname,$configuserok, |
%limithash,$toolregexp,%conditions,$resulttext,%changes,$confname,$configuserok, |
$author_ok,$switchserver,$errors,$validationitemsref,$validationnamesref, |
$author_ok,$switchserver,$errors); |
$validationfieldsref); |
|
if ($action eq 'quotas') { |
if ($action eq 'quotas') { |
$context = 'tools'; |
$context = 'tools'; |
} else { |
} else { |
Line 7216 sub modify_quotas {
|
Line 6233 sub modify_quotas {
|
$confname = $dom.'-domainconfig'; |
$confname = $dom.'-domainconfig'; |
my $servadm = $r->dir_config('lonAdmEMail'); |
my $servadm = $r->dir_config('lonAdmEMail'); |
($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); |
($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); |
($validationitemsref,$validationnamesref,$validationfieldsref) = |
|
&Apache::loncoursequeueadmin::requestcourses_validation_types(); |
|
} elsif ($context eq 'requestauthor') { |
} elsif ($context eq 'requestauthor') { |
@usertools = ('author'); |
@usertools = ('author'); |
%titles = &authorrequest_titles(); |
%titles = &authorrequest_titles(); |
Line 7263 sub modify_quotas {
|
Line 6278 sub modify_quotas {
|
$confhash{'uniquecode'}{$type} = 1; |
$confhash{'uniquecode'}{$type} = 1; |
} |
} |
} |
} |
my (%newbook,%allpos); |
my ($newbook,@allpos); |
if ($context eq 'requestcourses') { |
if ($context eq 'requestcourses') { |
foreach my $type ('textbooks','templates') { |
if ($env{'form.addbook'}) { |
@{$allpos{$type}} = (); |
if (($env{'form.addbook_cnum'} =~ /^$match_courseid$/) && |
my $invalid; |
($env{'form.addbook_cdom'} =~ /^$match_domain$/)) { |
if ($type eq 'textbooks') { |
if (&Apache::lonnet::homeserver($env{'form.addbook_cnum'}, |
$invalid = &mt('Invalid LON-CAPA course for textbook'); |
$env{'form.addbook_cdom'}) eq 'no_host') { |
} else { |
$errors .= '<li><span class="LC_error">'.&mt('Invalid LON-CAPA course for textbook'). |
$invalid = &mt('Invalid LON-CAPA course for template'); |
'</span></li>'; |
} |
} else { |
if ($env{'form.'.$type.'_addbook'}) { |
$newbook = $env{'form.addbook_cdom'}.'_'.$env{'form.addbook_cnum'}; |
if (($env{'form.'.$type.'_addbook_cnum'} =~ /^$match_courseid$/) && |
my $position = $env{'form.addbook_pos'}; |
($env{'form.'.$type.'_addbook_cdom'} =~ /^$match_domain$/)) { |
$position =~ s/\D+//g; |
if (&Apache::lonnet::homeserver($env{'form.'.$type.'_addbook_cnum'}, |
if ($position ne '') { |
$env{'form.'.$type.'_addbook_cdom'}) eq 'no_host') { |
$allpos[$position] = $newbook; |
$errors .= '<li><span class="LC_error">'.$invalid.'</span></li>'; |
|
} else { |
|
$newbook{$type} = $env{'form.'.$type.'_addbook_cdom'}.'_'.$env{'form.'.$type.'_addbook_cnum'}; |
|
my $position = $env{'form.'.$type.'_addbook_pos'}; |
|
$position =~ s/\D+//g; |
|
if ($position ne '') { |
|
$allpos{$type}[$position] = $newbook{$type}; |
|
} |
|
} |
} |
} else { |
|
$errors .= '<li><span class="LC_error">'.$invalid.'</span></li>'; |
|
} |
} |
|
} else { |
|
$errors .= '<li><span class="LC_error">'.&mt('Invalid LON-CAPA course for textbook'). |
|
'</span></li>'; |
} |
} |
} |
} |
} |
} |
if (ref($domconfig{$action}) eq 'HASH') { |
if (ref($domconfig{$action}) eq 'HASH') { |
if (ref($domconfig{$action}{'notify'}) eq 'HASH') { |
if (ref($domconfig{$action}{'notify'}) eq 'HASH') { |
Line 7324 sub modify_quotas {
|
Line 6332 sub modify_quotas {
|
$changes{'uniquecode'} = 1; |
$changes{'uniquecode'} = 1; |
} |
} |
if ($context eq 'requestcourses') { |
if ($context eq 'requestcourses') { |
foreach my $type ('textbooks','templates') { |
if (ref($domconfig{$action}{'textbooks'}) eq 'HASH') { |
if (ref($domconfig{$action}{$type}) eq 'HASH') { |
my %deletions; |
my %deletions; |
my @todelete = &Apache::loncommon::get_env_multiple('form.book_del'); |
my @todelete = &Apache::loncommon::get_env_multiple('form.'.$type.'_del'); |
if (@todelete) { |
if (@todelete) { |
map { $deletions{$_} = 1; } @todelete; |
map { $deletions{$_} = 1; } @todelete; |
} |
} |
my %imgdeletions; |
my %imgdeletions; |
my @todeleteimages = &Apache::loncommon::get_env_multiple('form.book_image_del'); |
my @todeleteimages = &Apache::loncommon::get_env_multiple('form.'.$type.'_image_del'); |
if (@todeleteimages) { |
if (@todeleteimages) { |
map { $imgdeletions{$_} = 1; } @todeleteimages; |
map { $imgdeletions{$_} = 1; } @todeleteimages; |
} |
} |
my $maxnum = $env{'form.book_maxnum'}; |
my $maxnum = $env{'form.'.$type.'_maxnum'}; |
for (my $i=0; $i<=$maxnum; $i++) { |
for (my $i=0; $i<=$maxnum; $i++) { |
my $key = $env{'form.book_id_'.$i}; |
my $itemid = $env{'form.'.$type.'_id_'.$i}; |
if (ref($domconfig{$action}{'textbooks'}{$key}) eq 'HASH') { |
my ($key) = ($itemid =~ /^\Q$type\E_(\w+)$/); |
if ($deletions{$key}) { |
if (ref($domconfig{$action}{$type}{$key}) eq 'HASH') { |
if ($domconfig{$action}{'textbooks'}{$key}{'image'}) { |
if ($deletions{$key}) { |
|
if ($domconfig{$action}{$type}{$key}{'image'}) { |
|
#FIXME need to obsolete item in RES space |
|
} |
|
next; |
|
} else { |
|
my $newpos = $env{'form.'.$itemid}; |
|
$newpos =~ s/\D+//g; |
|
foreach my $item ('subject','title','publisher','author') { |
|
next if ((($item eq 'author') || ($item eq 'publisher')) && |
|
($type eq 'templates')); |
|
$confhash{$type}{$key}{$item} = $env{'form.'.$type.'_'.$item.'_'.$i}; |
|
if ($domconfig{$action}{$type}{$key}{$item} ne $confhash{$type}{$key}{$item}) { |
|
$changes{$type}{$key} = 1; |
|
} |
|
} |
|
$allpos{$type}[$newpos] = $key; |
|
} |
|
if ($imgdeletions{$key}) { |
|
$changes{$type}{$key} = 1; |
|
#FIXME need to obsolete item in RES space |
#FIXME need to obsolete item in RES space |
} elsif ($env{'form.'.$type.'_image_'.$i.'.filename'}) { |
} |
my ($cdom,$cnum) = split(/_/,$key); |
next; |
my ($imgurl,$error) = &process_textbook_image($r,$dom,$confname,$type.'_image_'.$i, |
} else { |
$cdom,$cnum,$type,$configuserok, |
my $newpos = $env{'form.'.$key}; |
$switchserver,$author_ok); |
$newpos =~ s/\D+//g; |
if ($imgurl) { |
foreach my $item ('subject','title','author') { |
$confhash{$type}{$key}{'image'} = $imgurl; |
$confhash{'textbooks'}{$key}{$item} = $env{'form.book_'.$item.'_'.$i}; |
$changes{$type}{$key} = 1; |
if ($domconfig{$action}{'textbooks'}{$key}{$item} ne $confhash{'textbooks'}{$key}{$item}) { |
|
$changes{'textbooks'}{$key} = 1; |
} |
} |
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} elsif ($domconfig{$action}{$type}{$key}{'image'}) { |
|
$confhash{$type}{$key}{'image'} = |
|
$domconfig{$action}{$type}{$key}{'image'}; |
|
} |
} |
|
$allpos[$newpos] = $key; |
|
} |
|
if ($imgdeletions{$key}) { |
|
$changes{'textbooks'}{$key} = 1; |
|
#FIXME need to obsolete item in RES space |
|
} elsif ($env{'form.book_image_'.$i.'.filename'}) { |
|
my ($cdom,$cnum) = split(/_/,$key); |
|
my ($imgurl,$error) = &process_textbook_image($r,$dom,$confname,'book_image_'.$i, |
|
$cdom,$cnum,$configuserok, |
|
$switchserver,$author_ok); |
|
if ($imgurl) { |
|
$confhash{'textbooks'}{$key}{'image'} = $imgurl; |
|
$changes{'textbooks'}{$key} = 1; |
|
} |
|
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} elsif ($domconfig{$action}{'textbooks'}{$key}{'image'}) { |
|
$confhash{'textbooks'}{$key}{'image'} = |
|
$domconfig{$action}{'textbooks'}{$key}{'image'}; |
} |
} |
} |
} |
} |
} |
Line 7393 sub modify_quotas {
|
Line 6396 sub modify_quotas {
|
} |
} |
} |
} |
if ($context eq 'requestcourses') { |
if ($context eq 'requestcourses') { |
foreach my $type ('textbooks','templates') { |
if ($newbook) { |
if ($newbook{$type}) { |
$changes{'textbooks'}{$newbook} = 1; |
$changes{$type}{$newbook{$type}} = 1; |
foreach my $item ('subject','title','author') { |
foreach my $item ('subject','title','publisher','author') { |
$env{'form.addbook_'.$item} =~ s/(`)/'/g; |
next if ((($item eq 'author') || ($item eq 'publisher')) && |
if ($env{'form.addbook_'.$item}) { |
($type eq 'template')); |
$confhash{'textbooks'}{$newbook}{$item} = $env{'form.addbook_'.$item}; |
$env{'form.'.$type.'_addbook_'.$item} =~ s/(`)/'/g; |
} |
if ($env{'form.'.$type.'_addbook_'.$item}) { |
} |
$confhash{$type}{$newbook{$type}}{$item} = $env{'form.'.$type.'_addbook_'.$item}; |
if ($env{'form.addbook_image.filename'} ne '') { |
} |
my ($cdom,$cnum) = split(/_/,$newbook); |
} |
my ($imageurl,$error) = |
if ($type eq 'textbooks') { |
&process_textbook_image($r,$dom,$confname,'addbook_image',$cdom,$cnum,$configuserok, |
if ($env{'form.'.$type.'_addbook_image.filename'} ne '') { |
$switchserver,$author_ok); |
my ($cdom,$cnum) = split(/_/,$newbook{$type}); |
if ($imageurl) { |
my ($imageurl,$error) = |
$confhash{'textbooks'}{$newbook}{'image'} = $imageurl; |
&process_textbook_image($r,$dom,$confname,$type.'_addbook_image',$cdom,$cnum,$type, |
} |
$configuserok,$switchserver,$author_ok); |
if ($error) { |
if ($imageurl) { |
&Apache::lonnet::logthis($error); |
$confhash{$type}{$newbook{$type}}{'image'} = $imageurl; |
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
} |
|
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} |
|
} |
|
} |
|
if (@{$allpos{$type}} > 0) { |
|
my $idx = 0; |
|
foreach my $item (@{$allpos{$type}}) { |
|
if ($item ne '') { |
|
$confhash{$type}{$item}{'order'} = $idx; |
|
if (ref($domconfig{$action}) eq 'HASH') { |
|
if (ref($domconfig{$action}{$type}) eq 'HASH') { |
|
if (ref($domconfig{$action}{$type}{$item}) eq 'HASH') { |
|
if ($domconfig{$action}{$type}{$item}{'order'} ne $idx) { |
|
$changes{$type}{$item} = 1; |
|
} |
|
} |
|
} |
|
} |
|
$idx ++; |
|
} |
|
} |
} |
} |
} |
} |
} |
if (ref($validationitemsref) eq 'ARRAY') { |
if (@allpos > 0) { |
foreach my $item (@{$validationitemsref}) { |
my $idx = 0; |
if ($item eq 'fields') { |
foreach my $item (@allpos) { |
my @changed; |
if ($item ne '') { |
@{$confhash{'validation'}{$item}} = &Apache::loncommon::get_env_multiple('form.requestcourses_validation_'.$item); |
$confhash{'textbooks'}{$item}{'order'} = $idx; |
if (@{$confhash{'validation'}{$item}} > 0) { |
if (ref($domconfig{$action}) eq 'HASH') { |
@{$confhash{'validation'}{$item}} = sort(@{$confhash{'validation'}{$item}}); |
if (ref($domconfig{$action}{'textbooks'}) eq 'HASH') { |
} |
if (ref($domconfig{$action}{'textbooks'}{$item}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}) eq 'HASH') { |
if ($domconfig{$action}{'textbooks'}{$item}{'order'} ne $idx) { |
if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
$changes{'textbooks'}{$item} = 1; |
if (ref($domconfig{'requestcourses'}{'validation'}{$item}) eq 'ARRAY') { |
} |
@changed = &Apache::loncommon::compare_arrays($confhash{'validation'}{$item}, |
|
$domconfig{'requestcourses'}{'validation'}{$item}); |
|
} else { |
|
@changed = @{$confhash{'validation'}{$item}}; |
|
} |
|
} else { |
|
@changed = @{$confhash{'validation'}{$item}}; |
|
} |
|
} else { |
|
@changed = @{$confhash{'validation'}{$item}}; |
|
} |
|
if (@changed) { |
|
if ($confhash{'validation'}{$item}) { |
|
$changes{'validation'}{$item} = join(', ',@{$confhash{'validation'}{$item}}); |
|
} else { |
|
$changes{'validation'}{$item} = &mt('None'); |
|
} |
|
} |
|
} else { |
|
$confhash{'validation'}{$item} = $env{'form.requestcourses_validation_'.$item}; |
|
if ($item eq 'markup') { |
|
if ($env{'form.requestcourses_validation_'.$item}) { |
|
$env{'form.requestcourses_validation_'.$item} =~ s/[\n\r\f]+/\s/gs; |
|
} |
|
} |
|
if (ref($domconfig{'requestcourses'}) eq 'HASH') { |
|
if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
|
if ($domconfig{'requestcourses'}{'validation'}{$item} ne $confhash{'validation'}{$item}) { |
|
$changes{'validation'}{$item} = $confhash{'validation'}{$item}; |
|
} |
|
} else { |
|
if ($confhash{'validation'}{$item} ne '') { |
|
$changes{'validation'}{$item} = $confhash{'validation'}{$item}; |
|
} |
|
} |
|
} else { |
|
if ($confhash{'validation'}{$item} ne '') { |
|
$changes{'validation'}{$item} = $confhash{'validation'}{$item}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($env{'form.validationdc'}) { |
|
my $newval = $env{'form.validationdc'}; |
|
my %domcoords = &get_active_dcs($dom); |
|
if (exists($domcoords{$newval})) { |
|
$confhash{'validation'}{'dc'} = $newval; |
|
} |
|
} |
|
if (ref($confhash{'validation'}) eq 'HASH') { |
|
if (ref($domconfig{'requestcourses'}) eq 'HASH') { |
|
if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
|
if ($domconfig{'requestcourses'}{'validation'}{'dc'}) { |
|
unless ($confhash{'validation'}{'dc'} eq $domconfig{'requestcourses'}{'validation'}{'dc'}) { |
|
if ($confhash{'validation'}{'dc'} eq '') { |
|
$changes{'validation'}{'dc'} = &mt('None'); |
|
} else { |
|
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
|
} |
} |
} |
} |
} elsif ($confhash{'validation'}{'dc'} ne '') { |
|
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
|
} |
|
} elsif ($confhash{'validation'}{'dc'} ne '') { |
|
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
|
} |
|
} elsif ($confhash{'validation'}{'dc'} ne '') { |
|
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
|
} |
|
} else { |
|
if (ref($domconfig{'requestcourses'}) eq 'HASH') { |
|
if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
|
if ($domconfig{'requestcourses'}{'validation'}{'dc'}) { |
|
$changes{'validation'}{'dc'} = &mt('None'); |
|
} |
} |
|
$idx ++; |
} |
} |
} |
} |
} |
} |
Line 7670 sub modify_quotas {
|
Line 6577 sub modify_quotas {
|
$domdefaults{'requestauthor'} = \%confhash; |
$domdefaults{'requestauthor'} = \%confhash; |
} else { |
} else { |
foreach my $key (keys(%confhash)) { |
foreach my $key (keys(%confhash)) { |
unless (($context eq 'requestcourses') && (($key eq 'textbooks') || ($key eq 'templates'))) { |
unless (($context eq 'requestcourses') && ($key eq 'textbooks')) { |
$domdefaults{$key} = $confhash{$key}; |
$domdefaults{$key} = $confhash{$key}; |
} |
} |
} |
} |
Line 7822 sub modify_quotas {
|
Line 6729 sub modify_quotas {
|
'</li>'; |
'</li>'; |
} |
} |
} |
} |
foreach my $type ('textbooks','templates') { |
if (ref($changes{'textbooks'}) eq 'HASH') { |
if (ref($changes{$type}) eq 'HASH') { |
$resulttext .= '<li>'.&mt('Available textbooks updated').'<ul>'; |
$resulttext .= '<li>'.&mt("Available $type updated").'<ul>'; |
foreach my $key (sort(keys(%{$changes{'textbooks'}}))) { |
foreach my $key (sort(keys(%{$changes{$type}}))) { |
my %coursehash = &Apache::lonnet::coursedescription($key); |
my %coursehash = &Apache::lonnet::coursedescription($key); |
my $coursetitle = $coursehash{'description'}; |
my $coursetitle = $coursehash{'description'}; |
my $position = $confhash{'textbooks'}{$key}{'order'} + 1; |
my $position = $confhash{$type}{$key}{'order'} + 1; |
$resulttext .= '<li>'; |
$resulttext .= '<li>'; |
foreach my $item ('subject','title','author') { |
foreach my $item ('subject','title','publisher','author') { |
my $name = $item.':'; |
next if ((($item eq 'author') || ($item eq 'publisher')) && |
$name =~ s/^(\w)/\U$1/; |
($type eq 'templates')); |
$resulttext .= &mt($name).' '.$confhash{'textbooks'}{$key}{$item}.'<br />'; |
my $name = $item.':'; |
} |
$name =~ s/^(\w)/\U$1/; |
$resulttext .= ' '.&mt('Order: [_1]',$position).'<br />'; |
$resulttext .= &mt($name).' '.$confhash{$type}{$key}{$item}.'<br />'; |
if ($confhash{'textbooks'}{$key}{'image'}) { |
} |
$resulttext .= ' '.&mt('Image: [_1]', |
$resulttext .= ' '.&mt('Order: [_1]',$position).'<br />'; |
'<img src="'.$confhash{'textbooks'}{$key}{'image'}.'"'. |
if ($type eq 'textbooks') { |
' alt="Textbook cover" />').'<br />'; |
if ($confhash{$type}{$key}{'image'}) { |
|
$resulttext .= ' '.&mt('Image: [_1]', |
|
'<img src="'.$confhash{$type}{$key}{'image'}.'"'. |
|
' alt="Textbook cover" />').'<br />'; |
|
} |
|
} |
|
$resulttext .= ' '.&mt('LON-CAPA Course: [_1]',$coursetitle).'</li>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
|
} |
|
if (ref($changes{'validation'}) eq 'HASH') { |
|
if ((ref($validationitemsref) eq 'ARRAY') && (ref($validationnamesref) eq 'HASH')) { |
|
$resulttext .= '<li>'.&mt('Validation of courses/communities updated').'<ul>'; |
|
foreach my $item (@{$validationitemsref}) { |
|
if (exists($changes{'validation'}{$item})) { |
|
if ($item eq 'markup') { |
|
$resulttext .= '<li>'.&mt('[_1] set to: [_2]',$validationnamesref->{$item}, |
|
'<br /><pre>'.$changes{'validation'}{$item}.'</pre>').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('[_1] set to: [_2]',$validationnamesref->{$item}, |
|
'<b>'.$changes{'validation'}{$item}.'</b>').'</li>'; |
|
} |
|
} |
|
} |
|
if (exists($changes{'validation'}{'dc'})) { |
|
$resulttext .= '<li>'.&mt('Validated course requests identified as processed by: [_1]', |
|
'<b>'.$changes{'validation'}{'dc'}.'</b>').'</li>'; |
|
} |
} |
|
$resulttext .= ' '.&mt('LON-CAPA Course: [_1]',$coursetitle).'</li>'; |
} |
} |
|
$resulttext .= '</ul></li>'; |
} |
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
Line 7896 sub modify_quotas {
|
Line 6777 sub modify_quotas {
|
} |
} |
|
|
sub process_textbook_image { |
sub process_textbook_image { |
my ($r,$dom,$confname,$caller,$cdom,$cnum,$type,$configuserok,$switchserver,$author_ok) = @_; |
my ($r,$dom,$confname,$caller,$cdom,$cnum,$configuserok,$switchserver,$author_ok) = @_; |
my $filename = $env{'form.'.$caller.'.filename'}; |
my $filename = $env{'form.'.$caller.'.filename'}; |
my ($error,$url); |
my ($error,$url); |
my ($width,$height) = (50,50); |
my ($width,$height) = (50,50); |
Line 7907 sub process_textbook_image {
|
Line 6788 sub process_textbook_image {
|
} elsif ($author_ok eq 'ok') { |
} elsif ($author_ok eq 'ok') { |
my ($result,$imageurl) = |
my ($result,$imageurl) = |
&publishlogo($r,'upload',$caller,$dom,$confname, |
&publishlogo($r,'upload',$caller,$dom,$confname, |
"$type/$dom/$cnum/cover",$width,$height); |
"textbooks/$dom/$cnum/cover",$width,$height); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
$url = $imageurl; |
$url = $imageurl; |
} else { |
} else { |
Line 7934 sub modify_autoenroll {
|
Line 6815 sub modify_autoenroll {
|
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
my %title = ( run => 'Auto-enrollment active', |
my %title = ( run => 'Auto-enrollment active', |
sender => 'Sender for notification messages', |
sender => 'Sender for notification messages', |
coowners => 'Automatic assignment of co-ownership to instructors of record (institutional data)', |
coowners => 'Automatic assignment of co-ownership to instructors of record (institutional data)'); |
failsafe => 'Failsafe for no drops if institutional data missing for a section'); |
|
my @offon = ('off','on'); |
my @offon = ('off','on'); |
my $sender_uname = $env{'form.sender_uname'}; |
my $sender_uname = $env{'form.sender_uname'}; |
my $sender_domain = $env{'form.sender_domain'}; |
my $sender_domain = $env{'form.sender_domain'}; |
Line 7945 sub modify_autoenroll {
|
Line 6825 sub modify_autoenroll {
|
$sender_domain = ''; |
$sender_domain = ''; |
} |
} |
my $coowners = $env{'form.autoassign_coowners'}; |
my $coowners = $env{'form.autoassign_coowners'}; |
my $failsafe = $env{'form.autoenroll_failsafe'}; |
|
$failsafe =~ s{^\s+|\s+$}{}g; |
|
if ($failsafe =~ /\D/) { |
|
undef($failsafe); |
|
} |
|
my %autoenrollhash = ( |
my %autoenrollhash = ( |
autoenroll => { 'run' => $env{'form.autoenroll_run'}, |
autoenroll => { 'run' => $env{'form.autoenroll_run'}, |
'sender_uname' => $sender_uname, |
'sender_uname' => $sender_uname, |
'sender_domain' => $sender_domain, |
'sender_domain' => $sender_domain, |
'co-owners' => $coowners, |
'co-owners' => $coowners, |
'autofailsafe' => $failsafe, |
|
} |
} |
); |
); |
my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash, |
Line 7982 sub modify_autoenroll {
|
Line 6856 sub modify_autoenroll {
|
} |
} |
} elsif ($coowners) { |
} elsif ($coowners) { |
$changes{'coowners'} = 1; |
$changes{'coowners'} = 1; |
} |
} |
if ($currautoenroll{'autofailsafe'} ne $failsafe) { |
|
$changes{'autofailsafe'} = 1; |
|
} |
|
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if ($changes{'run'}) { |
if ($changes{'run'}) { |
Line 8005 sub modify_autoenroll {
|
Line 6876 sub modify_autoenroll {
|
$lastactref->{'domainconfig'} = 1; |
$lastactref->{'domainconfig'} = 1; |
} |
} |
} |
} |
if ($changes{'autofailsafe'}) { |
|
if ($failsafe ne '') { |
|
$resulttext .= '<li>'.&mt("$title{'failsafe'} set to [_1]",$failsafe).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt("$title{'failsafe'} deleted"); |
|
} |
|
&Apache::lonnet::get_domain_defaults($dom,1); |
|
if (ref($lastactref) eq 'HASH') { |
|
$lastactref->{'domdefaults'} = 1; |
|
} |
|
} |
|
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
$resulttext = &mt('No changes made to auto-enrollment settings'); |
$resulttext = &mt('No changes made to auto-enrollment settings'); |
Line 8643 sub modify_usercreation {
|
Line 7503 sub modify_usercreation {
|
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
($item eq 'captcha') || ($item eq 'recaptchakeys') || |
($item eq 'captcha') || ($item eq 'recaptchakeys')) { |
($item eq 'recaptchaversion')) { |
|
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
} else { |
} else { |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
Line 8868 sub modify_selfcreation {
|
Line 7727 sub modify_selfcreation {
|
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
($item eq 'captcha') || ($item eq 'recaptchakeys') || |
($item eq 'captcha') || ($item eq 'recaptchakeys') || |
($item eq 'recaptchaversion') || |
($item eq 'emailusername') || ($item eq 'notify')) { |
($item eq 'emailusername') || ($item eq 'notify') || |
|
($item eq 'selfcreateprocessing') || ($item eq 'shibenv')) { |
|
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
} else { |
} else { |
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
Line 8901 sub modify_selfcreation {
|
Line 7758 sub modify_selfcreation {
|
@{$cancreate{'selfcreate'}} = (); |
@{$cancreate{'selfcreate'}} = (); |
%{$cancreate{'emailusername'}} = (); |
%{$cancreate{'emailusername'}} = (); |
@{$cancreate{'statustocreate'}} = (); |
@{$cancreate{'statustocreate'}} = (); |
%{$cancreate{'selfcreateprocessing'}} = (); |
|
%{$cancreate{'shibenv'}} = (); |
|
my %selfcreatetypes = ( |
my %selfcreatetypes = ( |
sso => 'users authenticated by institutional single sign on', |
sso => 'users authenticated by institutional single sign on', |
login => 'users authenticated by institutional log-in', |
login => 'users authenticated by institutional log-in', |
email => 'users who provide a valid e-mail address for use as username', |
email => 'users who provide a valid e-mail address for use as username (automatic creation)', |
|
emailapproval => 'users who provide a valid e-mail address for use as username (queued for Domain Coordinator review)', |
); |
); |
# |
# |
# Populate $cancreate{'selfcreate'} array reference with types of user, for which self-creation of user accounts |
# Populate $cancreate{'selfcreate'} array reference with types of user, for which self-creation of user accounts |
# is permitted. |
# is permitted. |
# |
# |
|
|
my @statuses; |
|
if (ref($domconfig{'inststatus'}) eq 'HASH') { |
|
if (ref($domconfig{'inststatus'}{'inststatusguest'}) eq 'ARRAY') { |
|
@statuses = @{$domconfig{'inststatus'}{'inststatusguest'}}; |
|
} |
|
} |
|
push(@statuses,'default'); |
|
|
|
foreach my $item ('login','sso','email') { |
foreach my $item ('login','sso','email') { |
if ($item eq 'email') { |
if ($item eq 'email') { |
if ($env{'form.cancreate_email'}) { |
if ($env{'form.cancreate_email'} eq 'email') { |
push(@{$cancreate{'selfcreate'}},'email'); |
push(@{$cancreate{'selfcreate'}},'email'); |
push(@contexts,'selfcreateprocessing'); |
} elsif ($env{'form.cancreate_email'} eq 'emailapproval') { |
foreach my $type (@statuses) { |
push(@{$cancreate{'selfcreate'}},'emailapproval'); |
if ($type eq 'default') { |
|
$cancreate{'selfcreateprocessing'}{$type} = $env{'form.cancreate_emailprocess'}; |
|
} else { |
|
$cancreate{'selfcreateprocessing'}{$type} = $env{'form.cancreate_emailprocess_'.$type}; |
|
} |
|
} |
|
} |
} |
} else { |
} else { |
if ($env{'form.cancreate_'.$item}) { |
if ($env{'form.cancreate_'.$item}) { |
Line 8946 sub modify_selfcreation {
|
Line 7787 sub modify_selfcreation {
|
# Populate $cancreate{'emailusername'}{$type} hash ref with information fields (if new user will provide data |
# Populate $cancreate{'emailusername'}{$type} hash ref with information fields (if new user will provide data |
# value set to one), if self-creation with e-mail address permitted, where $type is user type: faculty, staff, student etc. |
# value set to one), if self-creation with e-mail address permitted, where $type is user type: faculty, staff, student etc. |
# |
# |
|
if (($env{'form.cancreate_email'} eq 'email') || ($env{'form.cancreate_email'} eq 'emailapproval')) { |
if ($env{'form.cancreate_email'}) { |
|
push(@contexts,'emailusername'); |
push(@contexts,'emailusername'); |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
foreach my $type (@{$types}) { |
foreach my $type (@{$types}) { |
Line 9007 sub modify_selfcreation {
|
Line 7847 sub modify_selfcreation {
|
} |
} |
} |
} |
# |
# |
# Check if domain default is set appropriately, if self-creation of accounts is to be available for |
# Check if domain default is set appropriately, if selef-creation of accounts is to be available for |
# institutional log-in. |
# institutional log-in. |
# |
# |
if (grep(/^login$/,@{$cancreate{'selfcreate'}})) { |
if (grep(/^login$/,@{$cancreate{'selfcreate'}})) { |
Line 9020 sub modify_selfcreation {
|
Line 7860 sub modify_selfcreation {
|
} |
} |
my @fields = ('lastname','firstname','middlename','generation', |
my @fields = ('lastname','firstname','middlename','generation', |
'permanentemail','id'); |
'permanentemail','id'); |
my @shibfields = (@fields,'inststatus'); |
|
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
# |
# |
# Where usernames may created for institutional log-in and/or institutional single sign on: |
# Where usernames may created for institutional log-in and/or institutional single sign on: |
Line 9065 sub modify_selfcreation {
|
Line 7904 sub modify_selfcreation {
|
} |
} |
} |
} |
} |
} |
foreach my $field (@shibfields) { |
|
if ($env{'form.shibenv_'.$field} ne '') { |
|
$cancreate{'shibenv'}{$field} = $env{'form.shibenv_'.$field}; |
|
} |
|
} |
|
if (ref($curr_usercreation{'cancreate'}) eq 'HASH') { |
|
if (ref($curr_usercreation{'cancreate'}{'shibenv'}) eq 'HASH') { |
|
foreach my $field (@shibfields) { |
|
if ($env{'form.shibenv_'.$field} ne $curr_usercreation{'cancreate'}{'shibenv'}{$field}) { |
|
push(@{$changes{'cancreate'}},'shibenv'); |
|
} |
|
} |
|
} else { |
|
foreach my $field (@shibfields) { |
|
if ($env{'form.shibenv_'.$field}) { |
|
push(@{$changes{'cancreate'}},'shibenv'); |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} |
} |
foreach my $item (@contexts) { |
foreach my $item (@contexts) { |
if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') { |
if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') { |
Line 9118 sub modify_selfcreation {
|
Line 7936 sub modify_selfcreation {
|
} |
} |
} |
} |
} |
} |
} elsif ($item eq 'selfcreateprocessing') { |
|
if ($cancreate{$item}{$curr} ne $curr_usercreation{'cancreate'}{$item}{$curr}) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} else { |
} else { |
if (!$cancreate{$item}{$curr}) { |
if (!$cancreate{$item}{$curr}) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
Line 9147 sub modify_selfcreation {
|
Line 7959 sub modify_selfcreation {
|
} |
} |
} |
} |
} |
} |
} elsif ($item eq 'selfcreateprocessing') { |
|
if ($cancreate{$item}{$field} ne $curr_usercreation{'cancreate'}{$item}{$field}) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} else { |
} else { |
if (!$curr_usercreation{'cancreate'}{$item}{$field}) { |
if (!$curr_usercreation{'cancreate'}{$item}{$field}) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
Line 9198 sub modify_selfcreation {
|
Line 8004 sub modify_selfcreation {
|
# |
# |
$save_usercreate{'cancreate'}{'captcha'} = $savecaptcha{'captcha'}; |
$save_usercreate{'cancreate'}{'captcha'} = $savecaptcha{'captcha'}; |
$save_usercreate{'cancreate'}{'recaptchakeys'} = $savecaptcha{'recaptchakeys'}; |
$save_usercreate{'cancreate'}{'recaptchakeys'} = $savecaptcha{'recaptchakeys'}; |
$save_usercreate{'cancreate'}{'recaptchaversion'} = $savecaptcha{'recaptchaversion'}; |
|
$save_usercreate{'cancreate'}{'selfcreate'} = $cancreate{'selfcreate'}; |
$save_usercreate{'cancreate'}{'selfcreate'} = $cancreate{'selfcreate'}; |
if (ref($cancreate{'notify'}) eq 'HASH') { |
if (ref($cancreate{'notify'}) eq 'HASH') { |
$save_usercreate{'cancreate'}{'notify'} = $cancreate{'notify'}; |
$save_usercreate{'cancreate'}{'notify'} = $cancreate{'notify'}; |
} |
} |
if (ref($cancreate{'selfcreateprocessing'}) eq 'HASH') { |
|
$save_usercreate{'cancreate'}{'selfcreateprocessing'} = $cancreate{'selfcreateprocessing'}; |
|
} |
|
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
$save_usercreate{'cancreate'}{'statustocreate'} = $cancreate{'statustocreate'}; |
$save_usercreate{'cancreate'}{'statustocreate'} = $cancreate{'statustocreate'}; |
} |
} |
if (ref($cancreate{'shibenv'}) eq 'HASH') { |
|
$save_usercreate{'cancreate'}{'shibenv'} = $cancreate{'shibenv'}; |
|
} |
|
$save_usercreate{'cancreate'}{'emailusername'} = $cancreate{'emailusername'}; |
$save_usercreate{'cancreate'}{'emailusername'} = $cancreate{'emailusername'}; |
$save_usercreate{'emailrule'} = \@email_rule; |
$save_usercreate{'emailrule'} = \@email_rule; |
|
|
Line 9254 sub modify_selfcreation {
|
Line 8053 sub modify_selfcreation {
|
} |
} |
} |
} |
} |
} |
} elsif ($type eq 'shibenv') { |
|
if (keys(%{$cancreate{$type}}) == 0) { |
|
$chgtext .= &mt('Shibboleth-autheticated user does not use environment variables to set user information'); |
|
} else { |
|
$chgtext .= &mt('Shibboleth-autheticated user information set from environment variables, as follows:'). |
|
'<ul>'; |
|
foreach my $field (@shibfields) { |
|
next if ($cancreate{$type}{$field} eq ''); |
|
if ($field eq 'inststatus') { |
|
$chgtext .= '<li>'.&mt('Institutional status').' -- '.$cancreate{$type}{$field}.'</li>'; |
|
} else { |
|
$chgtext .= '<li>'.$fieldtitles{$field}.' -- '.$cancreate{$type}{$field}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
} |
|
} elsif ($type eq 'statustocreate') { |
} elsif ($type eq 'statustocreate') { |
if ((ref($cancreate{'selfcreate'}) eq 'ARRAY') && |
if ((ref($cancreate{'selfcreate'}) eq 'ARRAY') && |
(ref($cancreate{'statustocreate'}) eq 'ARRAY')) { |
(ref($cancreate{'statustocreate'}) eq 'ARRAY')) { |
Line 9311 sub modify_selfcreation {
|
Line 8094 sub modify_selfcreation {
|
} |
} |
} |
} |
} |
} |
} elsif ($type eq 'selfcreateprocessing') { |
|
my %choices = &Apache::lonlocal::texthash ( |
|
automatic => 'Automatic approval', |
|
approval => 'Queued for approval', |
|
); |
|
if (@statuses > 1) { |
|
$chgtext .= &mt('Processing of requests to create account with e-mail address as username set as follows:'). |
|
'<ul>'; |
|
foreach my $type (@statuses) { |
|
if ($type eq 'default') { |
|
$chgtext .= '<li>'.$othertitle.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$type}}.'</li>'; |
|
} else { |
|
$chgtext .= '<li>'.$usertypes->{$type}.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$type}}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
} else { |
|
$chgtext .= &mt('Processing of requests to create account with e-mail address as username set to: "[_1]"', |
|
$choices{$cancreate{'selfcreateprocessing'}{'default'}}); |
|
} |
|
} elsif ($type eq 'captcha') { |
} elsif ($type eq 'captcha') { |
if ($savecaptcha{$type} eq 'notused') { |
if ($savecaptcha{$type} eq 'notused') { |
$chgtext .= &mt('No CAPTCHA validation in use for self-creation screen.'); |
$chgtext .= &mt('No CAPTCHA validation in use for self-creation screen.'); |
Line 9360 sub modify_selfcreation {
|
Line 8123 sub modify_selfcreation {
|
$chgtext .= '<li>'.&mt('Private key set to [_1]',$pubkey).'</li>'; |
$chgtext .= '<li>'.&mt('Private key set to [_1]',$pubkey).'</li>'; |
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
} elsif ($type eq 'recaptchaversion') { |
|
if ($savecaptcha{'captcha'} eq 'recaptcha') { |
|
$chgtext .= &mt('ReCAPTCHA set to version [_1]',$savecaptcha{$type}); |
|
} |
|
} elsif ($type eq 'emailusername') { |
} elsif ($type eq 'emailusername') { |
if (ref($cancreate{'emailusername'}) eq 'HASH') { |
if (ref($cancreate{'emailusername'}) eq 'HASH') { |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
foreach my $type (@{$types}) { |
foreach my $type (@{$types}) { |
if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') { |
if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') { |
if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) { |
if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) { |
$chgtext .= &mt('When self-creating account with e-mail as username, the following information will be provided by [_1]:',"'$usertypes->{$type}'"). |
$chgtext .= &mt('When self-creating account with e-mail as username, the following information will be provided by [_1]:',$usertypes->{$type}). |
'<ul>'; |
'<ul>'; |
foreach my $field (@{$infofields}) { |
foreach my $field (@{$infofields}) { |
if ($cancreate{'emailusername'}{$type}{$field}) { |
if ($cancreate{'emailusername'}{$type}{$field}) { |
$chgtext .= '<li>'.$infotitles->{$field}.'</li>'; |
$chgtext .= '<li>'.$infotitles->{$field}.'</li>'; |
} |
} |
} |
} |
$chgtext .= '</ul>'; |
|
} else { |
|
$chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'<br />'; |
|
} |
} |
|
$chgtext .= '</ul>'; |
} else { |
} else { |
$chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'<br />'; |
$chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',$usertypes->{$type}).'<br />'; |
} |
} |
} |
} |
} |
} |
Line 9484 sub process_captcha {
|
Line 8241 sub process_captcha {
|
$changes->{'captcha'} = 1; |
$changes->{'captcha'} = 1; |
} |
} |
} |
} |
my ($newpub,$newpriv,$currpub,$currpriv,$newversion,$currversion); |
my ($newpub,$newpriv,$currpub,$currpriv); |
if ($newsettings->{'captcha'} eq 'recaptcha') { |
if ($newsettings->{'captcha'} eq 'recaptcha') { |
$newpub = $env{'form.'.$container.'_recaptchapub'}; |
$newpub = $env{'form.'.$container.'_recaptchapub'}; |
$newpriv = $env{'form.'.$container.'_recaptchapriv'}; |
$newpriv = $env{'form.'.$container.'_recaptchapriv'}; |
$newpub =~ s/[^\w\-]//g; |
$newpub =~ s/\W//g; |
$newpriv =~ s/[^\w\-]//g; |
$newpriv =~ s/\W//g; |
$newsettings->{'recaptchakeys'} = { |
$newsettings->{'recaptchakeys'} = { |
public => $newpub, |
public => $newpub, |
private => $newpriv, |
private => $newpriv, |
}; |
}; |
$newversion = $env{'form.'.$container.'_recaptchaversion'}; |
|
$newversion =~ s/\D//g; |
|
if ($newversion ne '2') { |
|
$newversion = 1; |
|
} |
|
$newsettings->{'recaptchaversion'} = $newversion; |
|
} |
} |
if (ref($current->{'recaptchakeys'}) eq 'HASH') { |
if (ref($current->{'recaptchakeys'}) eq 'HASH') { |
$currpub = $current->{'recaptchakeys'}{'public'}; |
$currpub = $current->{'recaptchakeys'}{'public'}; |
Line 9511 sub process_captcha {
|
Line 8262 sub process_captcha {
|
} |
} |
} |
} |
} |
} |
if ($current->{'captcha'} eq 'recaptcha') { |
|
$currversion = $current->{'recaptchaversion'}; |
|
if ($currversion ne '2') { |
|
$currversion = 1; |
|
} |
|
} |
|
if ($currversion ne $newversion) { |
|
if ($container eq 'cancreate') { |
|
if (ref($changes->{'cancreate'}) eq 'ARRAY') { |
|
push(@{$changes->{'cancreate'}},'recaptchaversion'); |
|
} elsif (!defined($changes->{'cancreate'})) { |
|
$changes->{'cancreate'} = ['recaptchaversion']; |
|
} |
|
} else { |
|
$changes->{'recaptchaversion'} = 1; |
|
} |
|
} |
|
if (($newpub ne $currpub) || ($newpriv ne $currpriv)) { |
if (($newpub ne $currpub) || ($newpriv ne $currpriv)) { |
if ($container eq 'cancreate') { |
if ($container eq 'cancreate') { |
if (ref($changes->{'cancreate'}) eq 'ARRAY') { |
if (ref($changes->{'cancreate'}) eq 'ARRAY') { |
Line 9703 sub modify_defaults {
|
Line 8437 sub modify_defaults {
|
defaults => \%newvalues, |
defaults => \%newvalues, |
); |
); |
my $title = &defaults_titles(); |
my $title = &defaults_titles(); |
|
|
my $currinststatus; |
|
if (ref($domconfig{'inststatus'}) eq 'HASH') { |
|
$currinststatus = $domconfig{'inststatus'}; |
|
} else { |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
$currinststatus = { |
|
inststatustypes => $usertypes, |
|
inststatusorder => $types, |
|
inststatusguest => [], |
|
}; |
|
} |
|
my @todelete = &Apache::loncommon::get_env_multiple('form.inststatus_delete'); |
|
my @allpos; |
|
my %guests; |
|
my %alltypes; |
|
my ($currtitles,$currguests,$currorder); |
|
if (ref($currinststatus) eq 'HASH') { |
|
if (ref($currinststatus->{'inststatusorder'}) eq 'ARRAY') { |
|
foreach my $type (@{$currinststatus->{'inststatusorder'}}) { |
|
if (ref($currinststatus->{inststatustypes}) eq 'HASH') { |
|
if ($currinststatus->{inststatustypes}->{$type} ne '') { |
|
$currtitles .= $currinststatus->{inststatustypes}->{$type}.','; |
|
} |
|
} |
|
unless (grep(/^\Q$type\E$/,@todelete)) { |
|
my $position = $env{'form.inststatus_pos_'.$type}; |
|
$position =~ s/\D+//g; |
|
$allpos[$position] = $type; |
|
$alltypes{$type} = $env{'form.inststatus_title_'.$type}; |
|
$alltypes{$type} =~ s/`//g; |
|
if ($env{'form.inststatus_guest_'.$type}) { |
|
$guests{$type} = 1; |
|
} |
|
} |
|
} |
|
if (ref($currinststatus->{'inststatusguest'}) eq 'ARRAY') { |
|
$currguests = join(',',@{$currinststatus->{'inststatusguest'}}); |
|
} |
|
$currorder = join(',',@{$currinststatus->{'inststatusorder'}}); |
|
$currtitles =~ s/,$//; |
|
} |
|
} |
|
if ($env{'form.addinststatus'}) { |
|
my $newtype = $env{'form.addinststatus'}; |
|
$newtype =~ s/\W//g; |
|
unless (exists($alltypes{$newtype})) { |
|
if ($env{'form.addinststatus_guest'}) { |
|
$guests{$newtype} = 1; |
|
} |
|
$alltypes{$newtype} = $env{'form.addinststatus_title'}; |
|
$alltypes{$newtype} =~ s/`//g; |
|
my $position = $env{'form.addinststatus_pos'}; |
|
$position =~ s/\D+//g; |
|
if ($position ne '') { |
|
$allpos[$position] = $newtype; |
|
} |
|
} |
|
} |
|
my (@orderedstatus,@orderedguests); |
|
foreach my $type (@allpos) { |
|
unless (($type eq '') || (grep(/^\Q$type\E$/,@orderedstatus))) { |
|
push(@orderedstatus,$type); |
|
if ($guests{$type}) { |
|
push(@orderedguests,$type); |
|
} |
|
} |
|
} |
|
foreach my $type (keys(%alltypes)) { |
|
unless (grep(/^\Q$type\E$/,@orderedstatus)) { |
|
delete($alltypes{$type}); |
|
} |
|
} |
|
$defaults_hash{'inststatus'} = { |
|
inststatustypes => \%alltypes, |
|
inststatusorder => \@orderedstatus, |
|
inststatusguest => \@orderedguests, |
|
}; |
|
if (ref($defaults_hash{'inststatus'}) eq 'HASH') { |
|
foreach my $item ('inststatustypes','inststatusorder','inststatusguest') { |
|
$domdefaults{$item} = $defaults_hash{'inststatus'}{$item}; |
|
} |
|
} |
|
if ($currorder ne join(',',@orderedstatus)) { |
|
$changes{'inststatus'}{'inststatusorder'} = 1; |
|
} |
|
if ($currguests ne join(',',@orderedguests)) { |
|
$changes{'inststatus'}{'inststatusguest'} = 1; |
|
} |
|
my $newtitles; |
|
foreach my $item (@orderedstatus) { |
|
$newtitles .= $alltypes{$item}.','; |
|
} |
|
$newtitles =~ s/,$//; |
|
if ($currtitles ne $newtitles) { |
|
$changes{'inststatus'}{'inststatustypes'} = 1; |
|
} |
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaults_hash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaults_hash, |
$dom); |
$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
Line 9808 sub modify_defaults {
|
Line 8445 sub modify_defaults {
|
my $version = &Apache::lonnet::get_server_loncaparev($dom); |
my $version = &Apache::lonnet::get_server_loncaparev($dom); |
my $mailmsgtext = "Changes made to domain settings in a LON-CAPA installation - domain: $dom (running version: $version) - dns_domain.tab needs to be updated with the following changes, to support legacy 2.4, 2.5 and 2.6 versions of LON-CAPA.\n\n"; |
my $mailmsgtext = "Changes made to domain settings in a LON-CAPA installation - domain: $dom (running version: $version) - dns_domain.tab needs to be updated with the following changes, to support legacy 2.4, 2.5 and 2.6 versions of LON-CAPA.\n\n"; |
foreach my $item (sort(keys(%changes))) { |
foreach my $item (sort(keys(%changes))) { |
if ($item eq 'inststatus') { |
my $value = $env{'form.'.$item}; |
if (ref($changes{'inststatus'}) eq 'HASH') { |
if ($value eq '') { |
if (($changes{'inststatus'}{'inststatustypes'}) || $changes{'inststatus'}{'inststatusorder'}) { |
$value = &mt('none'); |
$resulttext .= '<li>'.&mt('Institutional user status types set to:').' '; |
} elsif ($item eq 'auth_def') { |
foreach my $type (@orderedstatus) { |
my %authnames = &authtype_names(); |
$resulttext .= $alltypes{$type}.', '; |
my %shortauth = ( |
} |
internal => 'int', |
$resulttext =~ s/, $//; |
krb4 => 'krb4', |
$resulttext .= '</li>'; |
krb5 => 'krb5', |
} |
localauth => 'loc', |
if ($changes{'inststatus'}{'inststatusguest'}) { |
); |
$resulttext .= '<li>'; |
$value = $authnames{$shortauth{$value}}; |
if (@orderedguests) { |
|
$resulttext .= &mt('Types assignable to "non-institutional" usernames set to:').' '; |
|
foreach my $type (@orderedguests) { |
|
$resulttext .= $alltypes{$type}.', '; |
|
} |
|
$resulttext =~ s/, $//; |
|
} else { |
|
$resulttext .= &mt('Types assignable to "non-institutional" usernames set to none.'); |
|
} |
|
$resulttext .= '</li>'; |
|
} |
|
} |
|
} else { |
|
my $value = $env{'form.'.$item}; |
|
if ($value eq '') { |
|
$value = &mt('none'); |
|
} elsif ($item eq 'auth_def') { |
|
my %authnames = &authtype_names(); |
|
my %shortauth = ( |
|
internal => 'int', |
|
krb4 => 'krb4', |
|
krb5 => 'krb5', |
|
localauth => 'loc', |
|
); |
|
$value = $authnames{$shortauth{$value}}; |
|
} |
|
$resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$title->{$item},$value).'</li>'; |
|
$mailmsgtext .= "$title->{$item} set to $value\n"; |
|
} |
} |
|
$resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$title->{$item},$value).'</li>'; |
|
$mailmsgtext .= "$title->{$item} set to $value\n"; |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
$mailmsgtext .= "\n"; |
$mailmsgtext .= "\n"; |
Line 9970 sub modify_scantron {
|
Line 8581 sub modify_scantron {
|
} |
} |
|
|
sub modify_coursecategories { |
sub modify_coursecategories { |
my ($dom,$lastactref,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,%deletions,%reorderings,%needreordering,%adds,%changes,$errors, |
my ($resulttext,%deletions,%reorderings,%needreordering,%adds,%changes,$errors, |
$cathash); |
$cathash); |
my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory'); |
my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory'); |
my @catitems = ('unauth','auth'); |
|
my @cattypes = ('std','domonly','codesrch','none'); |
|
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
$cathash = $domconfig{'coursecategories'}{'cats'}; |
$cathash = $domconfig{'coursecategories'}{'cats'}; |
if ($domconfig{'coursecategories'}{'togglecats'} ne $env{'form.togglecats'}) { |
if ($domconfig{'coursecategories'}{'togglecats'} ne $env{'form.togglecats'}) { |
Line 9994 sub modify_coursecategories {
|
Line 8603 sub modify_coursecategories {
|
$changes{'categorizecomm'} = 1; |
$changes{'categorizecomm'} = 1; |
$domconfig{'coursecategories'}{'categorizecomm'} = $env{'form.categorizecomm'}; |
$domconfig{'coursecategories'}{'categorizecomm'} = $env{'form.categorizecomm'}; |
} |
} |
foreach my $item (@catitems) { |
|
if (grep(/^\Q$env{'form.coursecat_'.$item}\E$/,@cattypes)) { |
|
if ($domconfig{'coursecategories'}{$item} ne $env{'form.coursecat_'.$item}) { |
|
$changes{$item} = 1; |
|
$domconfig{'coursecategories'}{$item} = $env{'form.coursecat_'.$item}; |
|
} |
|
} |
|
} |
|
} else { |
} else { |
$changes{'togglecats'} = 1; |
$changes{'togglecats'} = 1; |
$changes{'categorize'} = 1; |
$changes{'categorize'} = 1; |
Line 10013 sub modify_coursecategories {
|
Line 8614 sub modify_coursecategories {
|
togglecatscomm => $env{'form.togglecatscomm'}, |
togglecatscomm => $env{'form.togglecatscomm'}, |
categorizecomm => $env{'form.categorizecomm'}, |
categorizecomm => $env{'form.categorizecomm'}, |
}; |
}; |
foreach my $item (@catitems) { |
|
if ($env{'form.coursecat_'.$item} ne 'std') { |
|
$changes{$item} = 1; |
|
} |
|
if (grep(/^\Q$env{'form.coursecat_'.$item}\E$/,@cattypes)) { |
|
$domconfig{'coursecategories'}{$item} = $env{'form.coursecat_'.$item}; |
|
} |
|
} |
|
} |
} |
if (ref($cathash) eq 'HASH') { |
if (ref($cathash) eq 'HASH') { |
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
Line 10143 sub modify_coursecategories {
|
Line 8736 sub modify_coursecategories {
|
dom => 'set in Domain ("Modify Course/Community")', |
dom => 'set in Domain ("Modify Course/Community")', |
crs => 'set in Course ("Course Configuration")', |
crs => 'set in Course ("Course Configuration")', |
comm => 'set in Community ("Community Configuration")', |
comm => 'set in Community ("Community Configuration")', |
none => 'No catalog', |
|
std => 'Standard catalog', |
|
domonly => 'Domain-only catalog', |
|
codesrch => 'Code search form', |
|
); |
); |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if ($changes{'togglecats'}) { |
if ($changes{'togglecats'}) { |
Line 10161 sub modify_coursecategories {
|
Line 8750 sub modify_coursecategories {
|
if ($changes{'categorizecomm'}) { |
if ($changes{'categorizecomm'}) { |
$resulttext .= '<li>'.&mt("$title{'categorizecomm'} $level{$env{'form.categorizecomm'}}").'</li>'; |
$resulttext .= '<li>'.&mt("$title{'categorizecomm'} $level{$env{'form.categorizecomm'}}").'</li>'; |
} |
} |
if ($changes{'unauth'}) { |
|
$resulttext .= '<li>'.&mt('Catalog type for unauthenticated users set to "'.$level{$env{'form.coursecat_unauth'}}.'"').'</li>'; |
|
} |
|
if ($changes{'auth'}) { |
|
$resulttext .= '<li>'.&mt('Catalog type for authenticated users set to "'.$level{$env{'form.coursecat_auth'}}.'"').'</li>'; |
|
} |
|
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
my $cathash; |
my $cathash; |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
Line 10211 sub modify_coursecategories {
|
Line 8794 sub modify_coursecategories {
|
} |
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
if ($changes{'unauth'} || $changes{'auth'}) { |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
|
if ($changes{'auth'}) { |
|
$domdefaults{'catauth'} = $domconfig{'coursecategories'}{'auth'}; |
|
} |
|
if ($changes{'unauth'}) { |
|
$domdefaults{'catunauth'} = $domconfig{'coursecategories'}{'unauth'}; |
|
} |
|
my $cachetime = 24*60*60; |
|
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
|
if (ref($lastactref) eq 'HASH') { |
|
$lastactref->{'domdefaults'} = 1; |
|
} |
|
} |
|
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
Line 10419 sub modify_helpsettings {
|
Line 8988 sub modify_helpsettings {
|
sub modify_coursedefaults { |
sub modify_coursedefaults { |
my ($dom,$lastactref,%domconfig) = @_; |
my ($dom,$lastactref,%domconfig) = @_; |
my ($resulttext,$errors,%changes,%defaultshash); |
my ($resulttext,$errors,%changes,%defaultshash); |
my %defaultchecked = ( |
my %defaultchecked = ('canuse_pdfforms' => 'off'); |
'uselcmath' => 'on', |
my @toggles = ('canuse_pdfforms'); |
'usejsme' => 'on' |
|
); |
|
my @toggles = ('uselcmath','usejsme'); |
|
my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial', |
my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial', |
'uploadquota_community','uploadquota_textbook','mysqltables_official', |
'uploadquota_community','uploadquota_textbook'); |
'mysqltables_unofficial','mysqltables_community','mysqltables_textbook'); |
|
my @types = ('official','unofficial','community','textbook'); |
my @types = ('official','unofficial','community','textbook'); |
my %staticdefaults = ( |
my %staticdefaults = ( |
anonsurvey_threshold => 10, |
anonsurvey_threshold => 10, |
uploadquota => 500, |
uploadquota => 500, |
postsubmit => 60, |
|
mysqltables => 172800, |
|
); |
); |
|
|
$defaultshash{'coursedefaults'} = {}; |
$defaultshash{'coursedefaults'} = {}; |
Line 10473 sub modify_coursedefaults {
|
Line 9036 sub modify_coursedefaults {
|
} |
} |
$defaultshash{'coursedefaults'}{$item} = $newdef; |
$defaultshash{'coursedefaults'}{$item} = $newdef; |
} else { |
} else { |
my ($setting,$type) = ($item =~ /^(uploadquota|mysqltables)_(\w+)$/); |
my ($type) = ($item =~ /^\Quploadquota_\E(\w+)$/); |
if (ref($domconfig{'coursedefaults'}{$setting}) eq 'HASH') { |
if (ref($domconfig{'coursedefaults'}{'uploadquota'}) eq 'HASH') { |
$currdef = $domconfig{'coursedefaults'}{$setting}{$type}; |
$currdef = $domconfig{'coursedefaults'}{'uploadquota'}{$type}; |
} |
} |
$newdef =~ s/[^\w.\-]//g; |
$newdef =~ s/[^\w.\-]//g; |
$defaultshash{'coursedefaults'}{$setting}{$type} = $newdef; |
$defaultshash{'coursedefaults'}{'uploadquota'}{$type} = $newdef; |
} |
} |
if ($currdef ne $newdef) { |
if ($currdef ne $newdef) { |
my $staticdef; |
my $staticdef; |
Line 10486 sub modify_coursedefaults {
|
Line 9049 sub modify_coursedefaults {
|
unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) { |
unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) { |
$changes{$item} = 1; |
$changes{$item} = 1; |
} |
} |
} elsif ($item =~ /^(uploadquota|mysqltables)_/) { |
} else { |
my $setting = $1; |
unless (($currdef eq '') && ($newdef == $staticdefaults{'uploadquota'})) { |
unless (($currdef eq '') && ($newdef == $staticdefaults{$setting})) { |
$changes{'uploadquota'} = 1; |
$changes{$setting} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
} |
my $currclone = $domconfig{'coursedefaults'}{'canclone'}; |
my $officialcreds = $env{'form.official_credits'}; |
my @currclonecode; |
$officialcreds =~ s/[^\d.]+//g; |
if (ref($currclone) eq 'HASH') { |
my $unofficialcreds = $env{'form.unofficial_credits'}; |
if (ref($currclone->{'instcode'}) eq 'ARRAY') { |
$unofficialcreds =~ s/[^\d.]+//g; |
@currclonecode = @{$currclone->{'instcode'}}; |
my $textbookcreds = $env{'form.textbook_credits'}; |
} |
$textbookcreds =~ s/[^\d.]+//g; |
} |
if (ref($domconfig{'coursedefaults'}{'coursecredits'} ne 'HASH') && |
my $newclone; |
($env{'form.coursecredits'} eq '1')) { |
if ($env{'form.canclone'} =~ /^(none|domain|instcode)$/) { |
$changes{'coursecredits'} = 1; |
$newclone = $env{'form.canclone'}; |
|
} |
|
if ($newclone eq 'instcode') { |
|
my @newcodes = &Apache::loncommon::get_env_multiple('form.clonecode'); |
|
my (%codedefaults,@code_order,@clonecode); |
|
&Apache::lonnet::auto_instcode_defaults($dom,\%codedefaults, |
|
\@code_order); |
|
foreach my $item (@code_order) { |
|
if (grep(/^\Q$item\E$/,@newcodes)) { |
|
push(@clonecode,$item); |
|
} |
|
} |
|
if (@clonecode) { |
|
$defaultshash{'coursedefaults'}{'canclone'} = { $newclone => \@clonecode }; |
|
my @diffs = &Apache::loncommon::compare_arrays(\@currclonecode,\@clonecode); |
|
if (@diffs) { |
|
$changes{'canclone'} = 1; |
|
} |
|
} else { |
|
$newclone eq ''; |
|
} |
|
} elsif ($newclone ne '') { |
|
$defaultshash{'coursedefaults'}{'canclone'} = $newclone; |
|
} |
|
if ($newclone ne $currclone) { |
|
$changes{'canclone'} = 1; |
|
} |
|
my %credits; |
|
foreach my $type (@types) { |
|
unless ($type eq 'community') { |
|
$credits{$type} = $env{'form.'.$type.'_credits'}; |
|
$credits{$type} =~ s/[^\d.]+//g; |
|
} |
|
} |
|
if ((ref($domconfig{'coursedefaults'}{'coursecredits'}) ne 'HASH') && |
|
($env{'form.coursecredits'} eq '1')) { |
|
$changes{'coursecredits'} = 1; |
|
foreach my $type (keys(%credits)) { |
|
$defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type}; |
|
} |
|
} else { |
} else { |
if ($env{'form.coursecredits'} eq '1') { |
if (($domconfig{'coursedefaults'}{'coursecredits'}{'official'} ne $officialcreds) || |
foreach my $type (@types) { |
($domconfig{'coursedefaults'}{'coursecredits'}{'unofficial'} ne $unofficialcreds) || |
unless ($type eq 'community') { |
($domconfig{'coursedefaults'}{'coursecredits'}{'textbook'} ne $textbookcreds)) { |
if ($domconfig{'coursedefaults'}{'coursecredits'}{$type} ne $credits{$type}) { |
$changes{'coursecredits'} = 1; |
$changes{'coursecredits'} = 1; |
|
} |
|
$defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type}; |
|
} |
|
} |
|
} elsif (ref($domconfig{'coursedefaults'}{'coursecredits'}) eq 'HASH') { |
|
foreach my $type (@types) { |
|
unless ($type eq 'community') { |
|
if ($domconfig{'coursedefaults'}{'coursecredits'}{$type}) { |
|
$changes{'coursecredits'} = 1; |
|
last; |
|
} |
|
} |
|
} |
|
} |
} |
} |
} |
if ($env{'form.postsubmit'} eq '1') { |
$defaultshash{'coursedefaults'}{'coursecredits'} = { |
$defaultshash{'coursedefaults'}{'postsubmit'}{'client'} = 'on'; |
official => $officialcreds, |
my %currtimeout; |
unofficial => $unofficialcreds, |
if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') { |
textbook => $textbookcreds, |
if ($domconfig{'coursedefaults'}{'postsubmit'}{'client'} eq 'off') { |
|
$changes{'postsubmit'} = 1; |
|
} |
|
if (ref($domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') { |
|
%currtimeout = %{$domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}}; |
|
} |
|
} else { |
|
$changes{'postsubmit'} = 1; |
|
} |
|
foreach my $type (@types) { |
|
my $timeout = $env{'form.'.$type.'_timeout'}; |
|
$timeout =~ s/\D//g; |
|
if ($timeout == $staticdefaults{'postsubmit'}) { |
|
$timeout = ''; |
|
} elsif (($timeout eq '') || ($timeout =~ /^0+$/)) { |
|
$timeout = '0'; |
|
} |
|
unless ($timeout eq '') { |
|
$defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type} = $timeout; |
|
} |
|
if (exists($currtimeout{$type})) { |
|
if ($timeout ne $currtimeout{$type}) { |
|
$changes{'postsubmit'} = 1; |
|
} |
|
} elsif ($timeout ne '') { |
|
$changes{'postsubmit'} = 1; |
|
} |
|
} |
|
} else { |
|
$defaultshash{'coursedefaults'}{'postsubmit'}{'client'} = 'off'; |
|
if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') { |
|
if ($domconfig{'coursedefaults'}{'postsubmit'}{'client'} eq 'on') { |
|
$changes{'postsubmit'} = 1; |
|
} |
|
} else { |
|
$changes{'postsubmit'} = 1; |
|
} |
|
} |
} |
} |
} |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
Line 10612 sub modify_coursedefaults {
|
Line 9083 sub modify_coursedefaults {
|
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
if (($changes{'uploadquota'}) || ($changes{'postsubmit'}) || |
if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'}) || ($changes{'uploadquota'})) { |
($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) || |
if ($changes{'canuse_pdfforms'}) { |
($changes{'canclone'}) || ($changes{'mysqltables'})) { |
$domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'}; |
foreach my $item ('uselcmath','usejsme') { |
|
if ($changes{$item}) { |
|
$domdefaults{$item}=$defaultshash{'coursedefaults'}{$item}; |
|
} |
|
} |
} |
if ($changes{'coursecredits'}) { |
if ($changes{'coursecredits'}) { |
if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { |
if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { |
foreach my $type (keys(%{$defaultshash{'coursedefaults'}{'coursecredits'}})) { |
$domdefaults{'officialcredits'} = |
$domdefaults{$type.'credits'} = |
$defaultshash{'coursedefaults'}{'coursecredits'}{'official'}; |
$defaultshash{'coursedefaults'}{'coursecredits'}{$type}; |
$domdefaults{'unofficialcredits'} = |
} |
$defaultshash{'coursedefaults'}{'coursecredits'}{'unofficial'}; |
} |
$domdefaults{'textbookcredits'} = |
} |
$domdefaults{'coursedefaults'}{'coursecredits'}{'textbook'}; |
if ($changes{'postsubmit'}) { |
|
if (ref($defaultshash{'coursedefaults'}{'postsubmit'}) eq 'HASH') { |
|
$domdefaults{'postsubmit'} = $defaultshash{'coursedefaults'}{'postsubmit'}{'client'}; |
|
if (ref($defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') { |
|
foreach my $type (keys(%{$defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}})) { |
|
$domdefaults{$type.'postsubtimeout'} = |
|
$defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type}; |
|
} |
|
} |
|
} |
} |
} |
} |
if ($changes{'uploadquota'}) { |
if ($changes{'uploadquota'}) { |
Line 10646 sub modify_coursedefaults {
|
Line 9104 sub modify_coursedefaults {
|
} |
} |
} |
} |
} |
} |
if ($changes{'canclone'}) { |
|
if (ref($defaultshash{'coursedefaults'}{'canclone'}) eq 'HASH') { |
|
if (ref($defaultshash{'coursedefaults'}{'canclone'}{'instcode'}) eq 'ARRAY') { |
|
my @clonecodes = @{$defaultshash{'coursedefaults'}{'canclone'}{'instcode'}}; |
|
if (@clonecodes) { |
|
$domdefaults{'canclone'} = join('+',@clonecodes); |
|
} |
|
} |
|
} else { |
|
$domdefaults{'canclone'}=$defaultshash{'coursedefaults'}{'canclone'}; |
|
} |
|
} |
|
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
if (ref($lastactref) eq 'HASH') { |
if (ref($lastactref) eq 'HASH') { |
Line 10666 sub modify_coursedefaults {
|
Line 9112 sub modify_coursedefaults {
|
} |
} |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
foreach my $item (sort(keys(%changes))) { |
foreach my $item (sort(keys(%changes))) { |
if ($item eq 'uselcmath') { |
if ($item eq 'canuse_pdfforms') { |
if ($env{'form.'.$item} eq '1') { |
|
$resulttext .= '<li>'.&mt('Math preview uses LON-CAPA previewer (javascript), if supported by browser.').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Math preview uses DragMath (Java), if supported by client OS.').'</li>'; |
|
} |
|
} elsif ($item eq 'usejsme') { |
|
if ($env{'form.'.$item} eq '1') { |
if ($env{'form.'.$item} eq '1') { |
$resulttext .= '<li>'.&mt('Molecule editor uses JSME (HTML5), if supported by browser.').'</li>'; |
$resulttext .= '<li>'.&mt("Course/Community users can create/upload PDF forms set to 'on'").'</li>'; |
} else { |
} else { |
$resulttext .= '<li>'.&mt('Molecule editor uses JME (Java), if supported by client OS.').'</li>'; |
$resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "off"').'</li>'; |
} |
} |
} 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>'; |
Line 10693 sub modify_coursedefaults {
|
Line 9133 sub modify_coursedefaults {
|
} else { |
} else { |
$resulttext .= '<li>'.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).'</li>'; |
$resulttext .= '<li>'.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).'</li>'; |
} |
} |
} elsif ($item eq 'mysqltables') { |
|
if (ref($defaultshash{'coursedefaults'}{'mysqltables'}) eq 'HASH') { |
|
$resulttext .= '<li>'.&mt('Lifetime of "Temporary" MySQL tables (student performance data) on homeserver').'<ul>'. |
|
'<li>'.&mt('Official courses: [_1] s','<b>'.$defaultshash{'coursedefaults'}{'mysqltables'}{'official'}.'</b>').'</li>'. |
|
'<li>'.&mt('Unofficial courses: [_1] s','<b>'.$defaultshash{'coursedefaults'}{'mysqltables'}{'unofficial'}.'</b>').'</li>'. |
|
'<li>'.&mt('Textbook courses: [_1] s','<b>'.$defaultshash{'coursedefaults'}{'mysqltables'}{'textbook'}.'</b>').'</li>'. |
|
'<li>'.&mt('Communities: [_1] s','<b>'.$defaultshash{'coursedefaults'}{'mysqltables'}{'community'}.'</b>').'</li>'. |
|
'</ul>'. |
|
'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Lifetime of "Temporary" MySQL tables (student performance data) on homeserver remains default: [_1] s',$staticdefaults{'uploadquota'}).'</li>'; |
|
} |
|
} elsif ($item eq 'postsubmit') { |
|
if ($domdefaults{'postsubmit'} eq 'off') { |
|
$resulttext .= '<li>'.&mt('Submit button(s) remain enabled on page after student makes submission.'); |
|
} else { |
|
$resulttext .= '<li>'.&mt('Submit button(s) disabled on page after student makes submission').'; '; |
|
if (ref($defaultshash{'coursedefaults'}{'postsubmit'}) eq 'HASH') { |
|
$resulttext .= &mt('durations:').'<ul>'; |
|
foreach my $type (@types) { |
|
$resulttext .= '<li>'; |
|
my $timeout; |
|
if (ref($defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') { |
|
$timeout = $defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type}; |
|
} |
|
my $display; |
|
if ($timeout eq '0') { |
|
$display = &mt('unlimited'); |
|
} elsif ($timeout eq '') { |
|
$display = &mt('[quant,_1,second] (default)',$staticdefaults{'postsubmit'}); |
|
} else { |
|
$display = &mt('[quant,_1,second]',$timeout); |
|
} |
|
if ($type eq 'community') { |
|
$resulttext .= &mt('Communities'); |
|
} elsif ($type eq 'official') { |
|
$resulttext .= &mt('Official courses'); |
|
} elsif ($type eq 'unofficial') { |
|
$resulttext .= &mt('Unofficial courses'); |
|
} elsif ($type eq 'textbook') { |
|
$resulttext .= &mt('Textbook courses'); |
|
} |
|
$resulttext .= ' -- '.$display.'</li>'; |
|
} |
|
$resulttext .= '</ul>'; |
|
} |
|
$resulttext .= '</li>'; |
|
} |
|
} elsif ($item eq 'coursecredits') { |
} elsif ($item eq 'coursecredits') { |
if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { |
if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { |
if (($domdefaults{'officialcredits'} eq '') && |
if (($domdefaults{'officialcredits'} eq '') && |
Line 10758 sub modify_coursedefaults {
|
Line 9150 sub modify_coursedefaults {
|
} else { |
} else { |
$resulttext .= '<li>'.&mt('Student credits not in use for courses in this domain').'</li>'; |
$resulttext .= '<li>'.&mt('Student credits not in use for courses in this domain').'</li>'; |
} |
} |
} elsif ($item eq 'canclone') { |
|
if (ref($defaultshash{'coursedefaults'}{'canclone'}) eq 'HASH') { |
|
if (ref($defaultshash{'coursedefaults'}{'canclone'}{'instcode'}) eq 'ARRAY') { |
|
my $clonecodes = join(' '.&mt('and').' ',@{$defaultshash{'coursedefaults'}{'canclone'}{'instcode'}}); |
|
$resulttext .= '<li>'.&mt('By default, official courses can be cloned from existing courses with the same: [_1]','<b>'.$clonecodes.'</b>').'</li>'; |
|
} |
|
} elsif ($defaultshash{'coursedefaults'}{'canclone'} eq 'domain') { |
|
$resulttext .= '<li>'.&mt('By default, a course requester can clone any course from his/her domain.').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('By default, only course owner and coordinators may clone a course.').'</li>'; |
|
} |
|
} |
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
Line 10782 sub modify_coursedefaults {
|
Line 9163 sub modify_coursedefaults {
|
return $resulttext; |
return $resulttext; |
} |
} |
|
|
sub modify_selfenrollment { |
|
my ($dom,$lastactref,%domconfig) = @_; |
|
my ($resulttext,$errors,%changes,%selfenrollhash,%ordered); |
|
my @types = ('official','unofficial','community','textbook'); |
|
my %titles = &tool_titles(); |
|
my %descs = &Apache::lonuserutils::selfenroll_default_descs(); |
|
($ordered{'admin'},my $titlesref) = &Apache::lonuserutils::get_selfenroll_titles(); |
|
$ordered{'default'} = ['types','registered','approval','limit']; |
|
|
|
my (%roles,%shown,%toplevel); |
|
$roles{'0'} = &Apache::lonnet::plaintext('dc'); |
|
|
|
if (ref($domconfig{'selfenrollment'}) ne 'HASH') { |
|
if ($domconfig{'selfenrollment'} eq '') { |
|
$domconfig{'selfenrollment'} = {}; |
|
} |
|
} |
|
%toplevel = ( |
|
admin => 'Configuration Rights', |
|
default => 'Default settings', |
|
validation => 'Validation of self-enrollment requests', |
|
); |
|
my ($itemsref,$namesref,$fieldsref) = &Apache::lonuserutils::selfenroll_validation_types(); |
|
|
|
if (ref($ordered{'admin'}) eq 'ARRAY') { |
|
foreach my $item (@{$ordered{'admin'}}) { |
|
foreach my $type (@types) { |
|
if ($env{'form.selfenrolladmin_'.$item.'_'.$type}) { |
|
$selfenrollhash{'admin'}{$type}{$item} = 1; |
|
} else { |
|
$selfenrollhash{'admin'}{$type}{$item} = 0; |
|
} |
|
if (ref($domconfig{'selfenrollment'}{'admin'}) eq 'HASH') { |
|
if (ref($domconfig{'selfenrollment'}{'admin'}{$type}) eq 'HASH') { |
|
if ($selfenrollhash{'admin'}{$type}{$item} ne |
|
$domconfig{'selfenrollment'}{'admin'}{$type}{$item}) { |
|
push(@{$changes{'admin'}{$type}},$item); |
|
} |
|
} else { |
|
if (!$selfenrollhash{'admin'}{$type}{$item}) { |
|
push(@{$changes{'admin'}{$type}},$item); |
|
} |
|
} |
|
} elsif (!$selfenrollhash{'admin'}{$type}{$item}) { |
|
push(@{$changes{'admin'}{$type}},$item); |
|
} |
|
} |
|
} |
|
} |
|
|
|
foreach my $item (@{$ordered{'default'}}) { |
|
foreach my $type (@types) { |
|
my $value = $env{'form.selfenrolldefault_'.$item.'_'.$type}; |
|
if ($item eq 'types') { |
|
unless (($value eq 'all') || ($value eq 'dom')) { |
|
$value = ''; |
|
} |
|
} elsif ($item eq 'registered') { |
|
unless ($value eq '1') { |
|
$value = 0; |
|
} |
|
} elsif ($item eq 'approval') { |
|
unless ($value =~ /^[012]$/) { |
|
$value = 0; |
|
} |
|
} else { |
|
unless (($value eq 'allstudents') || ($value eq 'selfenrolled')) { |
|
$value = 'none'; |
|
} |
|
} |
|
$selfenrollhash{'default'}{$type}{$item} = $value; |
|
if (ref($domconfig{'selfenrollment'}{'default'}) eq 'HASH') { |
|
if (ref($domconfig{'selfenrollment'}{'default'}{$type}) eq 'HASH') { |
|
if ($selfenrollhash{'default'}{$type}{$item} ne |
|
$domconfig{'selfenrollment'}{'default'}{$type}{$item}) { |
|
push(@{$changes{'default'}{$type}},$item); |
|
} |
|
} else { |
|
push(@{$changes{'default'}{$type}},$item); |
|
} |
|
} else { |
|
push(@{$changes{'default'}{$type}},$item); |
|
} |
|
if ($item eq 'limit') { |
|
if (($value eq 'allstudents') || ($value eq 'selfenrolled')) { |
|
$env{'form.selfenrolldefault_cap_'.$type} =~ s/\D//g; |
|
if ($env{'form.selfenrolldefault_cap_'.$type} ne '') { |
|
$selfenrollhash{'default'}{$type}{'cap'} = $env{'form.selfenrolldefault_cap_'.$type}; |
|
} |
|
} else { |
|
$selfenrollhash{'default'}{$type}{'cap'} = ''; |
|
} |
|
if (ref($domconfig{'selfenrollment'}{'default'}{$type}) eq 'HASH') { |
|
if ($selfenrollhash{'default'}{$type}{'cap'} ne |
|
$domconfig{'selfenrollment'}{'admin'}{$type}{'cap'}) { |
|
push(@{$changes{'default'}{$type}},'cap'); |
|
} |
|
} elsif ($selfenrollhash{'default'}{$type}{'cap'} ne '') { |
|
push(@{$changes{'default'}{$type}},'cap'); |
|
} |
|
} |
|
} |
|
} |
|
|
|
foreach my $item (@{$itemsref}) { |
|
if ($item eq 'fields') { |
|
my @changed; |
|
@{$selfenrollhash{'validation'}{$item}} = &Apache::loncommon::get_env_multiple('form.selfenroll_validation_'.$item); |
|
if (@{$selfenrollhash{'validation'}{$item}} > 0) { |
|
@{$selfenrollhash{'validation'}{$item}} = sort(@{$selfenrollhash{'validation'}{$item}}); |
|
} |
|
if (ref($domconfig{'selfenrollment'}{'validation'}) eq 'HASH') { |
|
if (ref($domconfig{'selfenrollment'}{'validation'}{$item}) eq 'ARRAY') { |
|
@changed = &Apache::loncommon::compare_arrays($selfenrollhash{'validation'}{$item}, |
|
$domconfig{'selfenrollment'}{'validation'}{$item}); |
|
} else { |
|
@changed = @{$selfenrollhash{'validation'}{$item}}; |
|
} |
|
} else { |
|
@changed = @{$selfenrollhash{'validation'}{$item}}; |
|
} |
|
if (@changed) { |
|
if ($selfenrollhash{'validation'}{$item}) { |
|
$changes{'validation'}{$item} = join(', ',@{$selfenrollhash{'validation'}{$item}}); |
|
} else { |
|
$changes{'validation'}{$item} = &mt('None'); |
|
} |
|
} |
|
} else { |
|
$selfenrollhash{'validation'}{$item} = $env{'form.selfenroll_validation_'.$item}; |
|
if ($item eq 'markup') { |
|
if ($env{'form.selfenroll_validation_'.$item}) { |
|
$env{'form.selfenroll_validation_'.$item} =~ s/[\n\r\f]+/\s/gs; |
|
} |
|
} |
|
if (ref($domconfig{'selfenrollment'}{'validation'}) eq 'HASH') { |
|
if ($domconfig{'selfenrollment'}{'validation'}{$item} ne $selfenrollhash{'validation'}{$item}) { |
|
$changes{'validation'}{$item} = $selfenrollhash{'validation'}{$item}; |
|
} |
|
} |
|
} |
|
} |
|
|
|
my $putresult = &Apache::lonnet::put_dom('configuration',{'selfenrollment' => \%selfenrollhash}, |
|
$dom); |
|
if ($putresult eq 'ok') { |
|
if (keys(%changes) > 0) { |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
|
$resulttext = &mt('Changes made:').'<ul>'; |
|
foreach my $key ('admin','default','validation') { |
|
if (ref($changes{$key}) eq 'HASH') { |
|
$resulttext .= '<li>'.$toplevel{$key}.'<ul>'; |
|
if ($key eq 'validation') { |
|
foreach my $item (@{$itemsref}) { |
|
if (exists($changes{$key}{$item})) { |
|
if ($item eq 'markup') { |
|
$resulttext .= '<li>'.&mt('[_1] set to: [_2]',$namesref->{$item}, |
|
'<br /><pre>'.$changes{$key}{$item}.'</pre>').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('[_1] set to: [_2]',$namesref->{$item}, |
|
'<b>'.$changes{$key}{$item}.'</b>').'</li>'; |
|
} |
|
} |
|
} |
|
} else { |
|
foreach my $type (@types) { |
|
if ($type eq 'community') { |
|
$roles{'1'} = &mt('Community personnel'); |
|
} else { |
|
$roles{'1'} = &mt('Course personnel'); |
|
} |
|
if (ref($changes{$key}{$type}) eq 'ARRAY') { |
|
if (ref($selfenrollhash{$key}{$type}) eq 'HASH') { |
|
if ($key eq 'admin') { |
|
my @mgrdc = (); |
|
if (ref($ordered{$key}) eq 'ARRAY') { |
|
foreach my $item (@{$ordered{'admin'}}) { |
|
if (ref($selfenrollhash{$key}{$type}) eq 'HASH') { |
|
if ($selfenrollhash{$key}{$type}{$item} eq '0') { |
|
push(@mgrdc,$item); |
|
} |
|
} |
|
} |
|
if (@mgrdc) { |
|
$domdefaults{$type.'selfenrolladmdc'} = join(',',@mgrdc); |
|
} else { |
|
delete($domdefaults{$type.'selfenrolladmdc'}); |
|
} |
|
} |
|
} else { |
|
if (ref($ordered{$key}) eq 'ARRAY') { |
|
foreach my $item (@{$ordered{$key}}) { |
|
if (grep(/^\Q$item\E$/,@{$changes{$key}{$type}})) { |
|
$domdefaults{$type.'selfenroll'.$item} = |
|
$selfenrollhash{$key}{$type}{$item}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
$resulttext .= '<li>'.$titles{$type}.'<ul>'; |
|
foreach my $item (@{$ordered{$key}}) { |
|
if (grep(/^\Q$item\E$/,@{$changes{$key}{$type}})) { |
|
$resulttext .= '<li>'; |
|
if ($key eq 'admin') { |
|
$resulttext .= &mt('[_1] -- management by: [_2]',$titlesref->{$item}, |
|
'<b>'.$roles{$selfenrollhash{'admin'}{$type}{$item}}.'</b>'); |
|
} else { |
|
$resulttext .= &mt('[_1] set to: [_2]',$titlesref->{$item}, |
|
'<b>'.$descs{$item}{$selfenrollhash{'default'}{$type}{$item}}.'</b>'); |
|
} |
|
$resulttext .= '</li>'; |
|
} |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
|
} |
|
if ((exists($changes{'admin'})) || (exists($changes{'default'}))) { |
|
my $cachetime = 24*60*60; |
|
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
|
if (ref($lastactref) eq 'HASH') { |
|
$lastactref->{'domdefaults'} = 1; |
|
} |
|
} |
|
} |
|
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = &mt('No changes made to self-enrollment settings'); |
|
} |
|
} else { |
|
$resulttext = '<span class="LC_error">'. |
|
&mt('An error occurred: [_1]',$putresult).'</span>'; |
|
} |
|
return $resulttext; |
|
} |
|
|
|
sub modify_usersessions { |
sub modify_usersessions { |
my ($dom,$lastactref,%domconfig) = @_; |
my ($dom,$lastactref,%domconfig) = @_; |
my @hostingtypes = ('version','excludedomain','includedomain'); |
my @hostingtypes = ('version','excludedomain','includedomain'); |
Line 11187 sub modify_usersessions {
|
Line 9329 sub modify_usersessions {
|
$changes{'spares'}{$lonhost} = \%spareschg; |
$changes{'spares'}{$lonhost} = \%spareschg; |
} |
} |
} |
} |
$defaultshash{'usersessions'}{'offloadnow'} = {}; |
|
my @offloadnow = &Apache::loncommon::get_env_multiple('form.offloadnow'); |
|
my @okoffload; |
|
if (@offloadnow) { |
|
foreach my $server (@offloadnow) { |
|
if (&Apache::lonnet::hostname($server) ne '') { |
|
unless (grep(/^\Q$server\E$/,@okoffload)) { |
|
push(@okoffload,$server); |
|
} |
|
} |
|
} |
|
if (@okoffload) { |
|
foreach my $lonhost (@okoffload) { |
|
$defaultshash{'usersessions'}{'offloadnow'}{$lonhost} = 1; |
|
} |
|
} |
|
} |
|
if (ref($domconfig{'usersessions'}) eq 'HASH') { |
if (ref($domconfig{'usersessions'}) eq 'HASH') { |
if (ref($domconfig{'usersessions'}{'spares'}) eq 'HASH') { |
if (ref($domconfig{'usersessions'}{'spares'}) eq 'HASH') { |
if (ref($changes{'spares'}) eq 'HASH') { |
if (ref($changes{'spares'}) eq 'HASH') { |
Line 11214 sub modify_usersessions {
|
Line 9340 sub modify_usersessions {
|
} else { |
} else { |
$savespares = 1; |
$savespares = 1; |
} |
} |
if (ref($domconfig{'usersessions'}{'offloadnow'}) eq 'HASH') { |
|
foreach my $lonhost (keys(%{$domconfig{'usersessions'}{'offloadnow'}})) { |
|
unless ($defaultshash{'usersessions'}{'offloadnow'}{$lonhost}) { |
|
$changes{'offloadnow'} = 1; |
|
last; |
|
} |
|
} |
|
unless ($changes{'offloadnow'}) { |
|
foreach my $lonhost (keys(%{$defaultshash{'usersessions'}{'offloadnow'}})) { |
|
unless ($domconfig{'usersessions'}{'offloadnow'}{$lonhost}) { |
|
$changes{'offloadnow'} = 1; |
|
last; |
|
} |
|
} |
|
} |
|
} elsif (@okoffload) { |
|
$changes{'offloadnow'} = 1; |
|
} |
|
} elsif (@okoffload) { |
|
$changes{'offloadnow'} = 1; |
|
} |
} |
|
|
my $nochgmsg = &mt('No changes made to settings for user session hosting/offloading.'); |
my $nochgmsg = &mt('No changes made to settings for user session hosting/offloading.'); |
if ((keys(%changes) > 0) || ($savespares)) { |
if ((keys(%changes) > 0) || ($savespares)) { |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
Line 11247 sub modify_usersessions {
|
Line 9354 sub modify_usersessions {
|
if (ref($defaultshash{'usersessions'}{'hosted'}) eq 'HASH') { |
if (ref($defaultshash{'usersessions'}{'hosted'}) eq 'HASH') { |
$domdefaults{'hostedsessions'} = $defaultshash{'usersessions'}{'hosted'}; |
$domdefaults{'hostedsessions'} = $defaultshash{'usersessions'}{'hosted'}; |
} |
} |
if (ref($defaultshash{'usersessions'}{'offloadnow'}) eq 'HASH') { |
|
$domdefaults{'offloadnow'} = $defaultshash{'usersessions'}{'offloadnow'}; |
|
} |
|
} |
} |
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
Line 11318 sub modify_usersessions {
|
Line 9422 sub modify_usersessions {
|
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} |
} |
} |
} |
if ($changes{'offloadnow'}) { |
|
if (ref($defaultshash{'usersessions'}{'offloadnow'}) eq 'HASH') { |
|
if (keys(%{$defaultshash{'usersessions'}{'offloadnow'}}) > 0) { |
|
$resulttext .= '<li>'.&mt('Switch active users on next access, for server(s):').'<ul>'; |
|
foreach my $lonhost (sort(keys(%{$defaultshash{'usersessions'}{'offloadnow'}}))) { |
|
$resulttext .= '<li>'.$lonhost.'</li>'; |
|
} |
|
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('No servers now set to switch active users on next access.'); |
|
} |
|
} else { |
|
$resulttext .= '<li>'.&mt('No servers now set to switch active users on next access.').'</li>'; |
|
} |
|
} |
|
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
$resulttext = $nochgmsg; |
$resulttext = $nochgmsg; |
Line 11354 sub modify_loadbalancing {
|
Line 9443 sub modify_loadbalancing {
|
my ($othertitle,$usertypes,$types) = |
my ($othertitle,$usertypes,$types) = |
&Apache::loncommon::sorted_inst_types($dom); |
&Apache::loncommon::sorted_inst_types($dom); |
my %servers = &Apache::lonnet::internet_dom_servers($dom); |
my %servers = &Apache::lonnet::internet_dom_servers($dom); |
my %libraryservers = &Apache::lonnet::get_servers($dom,'library'); |
|
my @sparestypes = ('primary','default'); |
my @sparestypes = ('primary','default'); |
my %typetitles = &sparestype_titles(); |
my %typetitles = &sparestype_titles(); |
my $resulttext; |
my $resulttext; |
Line 11446 sub modify_loadbalancing {
|
Line 9534 sub modify_loadbalancing {
|
$rule = $env{'form.loadbalancing_rules_'.$i.'_'.$type}; |
$rule = $env{'form.loadbalancing_rules_'.$i.'_'.$type}; |
} |
} |
if ($rule eq 'specific') { |
if ($rule eq 'specific') { |
my $specifiedhost = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type}; |
$rule = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type}; |
if (exists($servers{$specifiedhost})) { |
|
$rule = $specifiedhost; |
|
} |
|
} |
} |
$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type} = $rule; |
$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type} = $rule; |
if (ref($currrules{$balancer}) eq 'HASH') { |
if (ref($currrules{$balancer}) eq 'HASH') { |
Line 11471 sub modify_loadbalancing {
|
Line 9556 sub modify_loadbalancing {
|
\%defaultshash,$dom); |
\%defaultshash,$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
my %toupdate; |
|
if (ref($changes{'delete'}) eq 'ARRAY') { |
if (ref($changes{'delete'}) eq 'ARRAY') { |
foreach my $balancer (sort(@{$changes{'delete'}})) { |
foreach my $balancer (sort(@{$changes{'delete'}})) { |
$resulttext .= '<li>'.&mt('Load Balancing discontinued for: [_1]',$balancer).'</li>'; |
$resulttext .= '<li>'.&mt('Load Balancing discontinued for: [_1]',$balancer).'</li>'; |
$toupdate{$balancer} = 1; |
my $cachekey = &escape('loadbalancing').':'.&escape($dom); |
|
&Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]); |
} |
} |
} |
} |
if (ref($changes{'add'}) eq 'ARRAY') { |
if (ref($changes{'add'}) eq 'ARRAY') { |
foreach my $balancer (sort(@{$changes{'add'}})) { |
foreach my $balancer (sort(@{$changes{'add'}})) { |
$resulttext .= '<li>'.&mt('Load Balancing enabled for: [_1]',$balancer); |
$resulttext .= '<li>'.&mt('Load Balancing enabled for: [_1]',$balancer); |
$toupdate{$balancer} = 1; |
|
} |
} |
} |
} |
if (ref($changes{'curr'}) eq 'HASH') { |
if (ref($changes{'curr'}) eq 'HASH') { |
foreach my $balancer (sort(keys(%{$changes{'curr'}}))) { |
foreach my $balancer (sort(keys(%{$changes{'curr'}}))) { |
$toupdate{$balancer} = 1; |
|
if (ref($changes{'curr'}{$balancer}) eq 'HASH') { |
if (ref($changes{'curr'}{$balancer}) eq 'HASH') { |
if ($changes{'curr'}{$balancer}{'targets'}) { |
if ($changes{'curr'}{$balancer}{'targets'}) { |
my %offloadstr; |
my %offloadstr; |
Line 11523 sub modify_loadbalancing {
|
Line 9606 sub modify_loadbalancing {
|
if ($rule eq '') { |
if ($rule eq '') { |
$balancetext = $ruletitles{'default'}; |
$balancetext = $ruletitles{'default'}; |
} elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') || |
} elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') || |
($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { |
($rule eq 'balancer') || ($rule eq 'offloadedto')) { |
if (($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { |
$balancetext = $ruletitles{$rule}; |
foreach my $sparetype (@sparestypes) { |
|
if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') { |
|
map { $toupdate{$_} = 1; } (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}}); |
|
} |
|
} |
|
foreach my $item (@{$alltypes}) { |
|
next if ($item =~ /^_LC_ipchange/); |
|
my $hasrule = $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$item}; |
|
if ($hasrule eq 'homeserver') { |
|
map { $toupdate{$_} = 1; } (keys(%libraryservers)); |
|
} else { |
|
unless (($hasrule eq 'default') || ($hasrule eq 'none') || ($hasrule eq 'externalbalancer')) { |
|
if ($servers{$hasrule}) { |
|
$toupdate{$hasrule} = 1; |
|
} |
|
} |
|
} |
|
} |
|
if (($rule eq 'balancer') || ($rule eq 'offloadedto')) { |
|
$balancetext = $ruletitles{$rule}; |
|
} else { |
|
my $receiver = $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type}; |
|
$balancetext = $ruletitles{'particular'}.' '.$receiver; |
|
if ($receiver) { |
|
$toupdate{$receiver}; |
|
} |
|
} |
|
} else { |
|
$balancetext = $ruletitles{$rule}; |
|
} |
|
} else { |
} else { |
$balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type}); |
$balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type}); |
} |
} |
Line 11563 sub modify_loadbalancing {
|
Line 9616 sub modify_loadbalancing {
|
} |
} |
} |
} |
} |
} |
if (keys(%toupdate)) { |
my $cachekey = &escape('loadbalancing').':'.&escape($dom); |
my %thismachine; |
&Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]); |
my $updatedhere; |
|
my $cachetime = 60*60*24; |
|
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
|
foreach my $lonhost (keys(%toupdate)) { |
|
if ($thismachine{$lonhost}) { |
|
unless ($updatedhere) { |
|
&Apache::lonnet::do_cache_new('loadbalancing',$dom, |
|
$defaultshash{'loadbalancing'}, |
|
$cachetime); |
|
$updatedhere = 1; |
|
} |
|
} else { |
|
my $cachekey = &escape('loadbalancing').':'.&escape($dom); |
|
&Apache::lonnet::remote_devalidate_cache($lonhost,[$cachekey]); |
|
} |
|
} |
|
} |
|
} |
} |
} |
} |
if ($resulttext ne '') { |
if ($resulttext ne '') { |
Line 11659 sub get_active_dcs {
|
Line 9695 sub get_active_dcs {
|
|
|
sub active_dc_picker { |
sub active_dc_picker { |
my ($dom,$numinrow,$inputtype,$name,%currhash) = @_; |
my ($dom,$numinrow,$inputtype,$name,%currhash) = @_; |
my %domcoords = &get_active_dcs($dom); |
my %domcoords = &get_active_dcs($dom); |
my @domcoord = keys(%domcoords); |
my @domcoord = keys(%domcoords); |
if (keys(%currhash)) { |
if (keys(%currhash)) { |
foreach my $dc (keys(%currhash)) { |
foreach my $dc (keys(%currhash)) { |
Line 11722 sub active_dc_picker {
|
Line 9758 sub active_dc_picker {
|
my ($dcname,$dcdom) = split(':',$domcoord[0]); |
my ($dcname,$dcdom) = split(':',$domcoord[0]); |
my $user = &Apache::loncommon::plainname($dcname,$dcdom); |
my $user = &Apache::loncommon::plainname($dcname,$dcdom); |
if ($inputtype eq 'radio') { |
if ($inputtype eq 'radio') { |
$table = '<input type="hidden" name="'.$name.'" value="'.$domcoord[0].'" />'.$user; |
$table .= '<input type="hidden" name="'.$name.'" value="'.$domcoord[0].'" />'.$user; |
if ($user ne $dcname.':'.$dcdom) { |
if ($user ne $dcname.':'.$dcdom) { |
$table .= ' ('.$dcname.':'.$dcdom.')'; |
$table .= ' ('.$dcname.':'.$dcdom.')'; |
} |
} |
Line 11731 sub active_dc_picker {
|
Line 9767 sub active_dc_picker {
|
if (exists($currhash{$domcoord[0]})) { |
if (exists($currhash{$domcoord[0]})) { |
$check = ' checked="checked"'; |
$check = ' checked="checked"'; |
} |
} |
$table = '<span class="LC_nobreak"><label>'. |
$table .= '<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="'.$name.'" '. |
'<input type="checkbox" name="'.$name.'" '. |
'value="'.$domcoord[0].'"'.$check.' />'.$user; |
'value="'.$domcoord[0].'"'.$check.' />'.$user; |
if ($user ne $dcname.':'.$dcdom) { |
if ($user ne $dcname.':'.$dcdom) { |
$table .= ' ('.$dcname.':'.$dcdom.')'; |
$table .= ' ('.$dcname.':'.$dcdom.')'; |
} |
} |
Line 12223 function updateCaptcha(caller,context) {
|
Line 10259 function updateCaptcha(caller,context) {
|
var pubitem; |
var pubitem; |
var privtext; |
var privtext; |
var pubtext; |
var pubtext; |
var versionitem; |
|
var versiontext; |
|
if (document.getElementById(context+'_recaptchapub')) { |
if (document.getElementById(context+'_recaptchapub')) { |
pubitem = document.getElementById(context+'_recaptchapub'); |
pubitem = document.getElementById(context+'_recaptchapub'); |
} else { |
} else { |
Line 12245 function updateCaptcha(caller,context) {
|
Line 10279 function updateCaptcha(caller,context) {
|
} else { |
} else { |
return; |
return; |
} |
} |
if (document.getElementById(context+'_recaptchaversion')) { |
|
versionitem = document.getElementById(context+'_recaptchaversion'); |
|
} else { |
|
return; |
|
} |
|
if (document.getElementById(context+'_recaptchavertxt')) { |
|
versiontext = document.getElementById(context+'_recaptchavertxt'); |
|
} else { |
|
return; |
|
} |
|
if (caller.checked) { |
if (caller.checked) { |
if (caller.value == 'recaptcha') { |
if (caller.value == 'recaptcha') { |
pubitem.type = 'text'; |
pubitem.type = 'text'; |
Line 12263 function updateCaptcha(caller,context) {
|
Line 10287 function updateCaptcha(caller,context) {
|
privitem.size = '40'; |
privitem.size = '40'; |
pubtext.innerHTML = "$lt{'pub'}"; |
pubtext.innerHTML = "$lt{'pub'}"; |
privtext.innerHTML = "$lt{'priv'}"; |
privtext.innerHTML = "$lt{'priv'}"; |
versionitem.type = 'text'; |
|
versionitem.size = '3'; |
|
versiontext.innerHTML = "$lt{'ver'}"; |
|
} else { |
} else { |
pubitem.type = 'hidden'; |
pubitem.type = 'hidden'; |
privitem.type = 'hidden'; |
privitem.type = 'hidden'; |
versionitem.type = 'hidden'; |
|
pubtext.innerHTML = ''; |
pubtext.innerHTML = ''; |
privtext.innerHTML = ''; |
privtext.innerHTML = ''; |
versiontext.innerHTML = ''; |
|
} |
} |
} |
} |
return; |
return; |
Line 12285 END
|
Line 10304 END
|
|
|
} |
} |
|
|
sub toggle_display_js { |
sub credits_js { |
return <<"END"; |
return <<"END"; |
|
|
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
|
|
function toggleDisplay(domForm,caller) { |
function toggleCredits(domForm) { |
if (document.getElementById(caller)) { |
if (document.getElementById('credits')) { |
var divitem = document.getElementById(caller); |
creditsitem = document.getElementById('credits'); |
var optionsElement = domForm.coursecredits; |
var creditsLength = domForm.coursecredits.length; |
var checkval = 1; |
if (creditsLength) { |
var dispval = 'block'; |
|
if (caller == 'emailoptions') { |
|
optionsElement = domForm.cancreate_email; |
|
} |
|
if (caller == 'studentsubmission') { |
|
optionsElement = domForm.postsubmit; |
|
} |
|
if (caller == 'cloneinstcode') { |
|
optionsElement = domForm.canclone; |
|
checkval = 'instcode'; |
|
} |
|
if (optionsElement.length) { |
|
var currval; |
var currval; |
for (var i=0; i<optionsElement.length; i++) { |
for (var i=0; i<creditsLength; i++) { |
if (optionsElement[i].checked) { |
if (domForm.coursecredits[i].checked) { |
currval = optionsElement[i].value; |
currval = domForm.coursecredits[i].value; |
} |
} |
} |
} |
if (currval == checkval) { |
if (currval == 1) { |
divitem.style.display = dispval; |
creditsitem.style.display = 'block'; |
} else { |
} else { |
divitem.style.display = 'none'; |
creditsitem.style.display = 'none'; |
} |
} |
} |
} |
} |
} |
Line 12338 sub captcha_phrases {
|
Line 10345 sub captcha_phrases {
|
original => 'original (CAPTCHA)', |
original => 'original (CAPTCHA)', |
recaptcha => 'successor (ReCAPTCHA)', |
recaptcha => 'successor (ReCAPTCHA)', |
notused => 'unused', |
notused => 'unused', |
ver => 'ReCAPTCHA version (1 or 2)', |
|
); |
); |
} |
} |
|
|
Line 12349 sub devalidate_remote_domconfs {
|
Line 10355 sub devalidate_remote_domconfs {
|
my %thismachine; |
my %thismachine; |
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
my @posscached = ('domainconfig','domdefaults'); |
my @posscached = ('domainconfig','domdefaults'); |
if (keys(%servers)) { |
if (keys(%servers) > 1) { |
foreach my $server (keys(%servers)) { |
foreach my $server (keys(%servers)) { |
next if ($thismachine{$server}); |
next if ($thismachine{$server}); |
my @cached; |
my @cached; |