--- loncom/interface/domainprefs.pm 2016/09/18 19:22:48 1.160.6.71
+++ loncom/interface/domainprefs.pm 2014/07/15 21:51:47 1.249
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.71 2016/09/18 19:22:48 raeburn Exp $
+# $Id: domainprefs.pm,v 1.249 2014/07/15 21:51:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -213,15 +213,15 @@ sub handler {
'quotas','autoenroll','autoupdate','autocreate',
'directorysrch','usercreation','usermodification',
'contacts','defaults','scantron','coursecategories',
- 'serverstatuses','requestcourses','coursedefaults',
- 'usersessions','loadbalancing','requestauthor',
- 'selfenrollment','inststatus'],$dom);
+ 'serverstatuses','requestcourses','helpsettings',
+ 'coursedefaults','usersessions','loadbalancing',
+ 'requestauthor','selfenrollment','inststatus'],$dom);
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
'autoupdate','autocreate','directorysrch','contacts',
'usercreation','selfcreation','usermodification','scantron',
'requestcourses','requestauthor','coursecategories',
- 'serverstatuses','coursedefaults','selfenrollment',
- 'usersessions');
+ 'serverstatuses','helpsettings',
+ 'coursedefaults','selfenrollment','usersessions');
my %existing;
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
@@ -250,8 +250,6 @@ sub handler {
header => [{col1 => 'Log-in Page Items',
col2 => '',},
{col1 => 'Log-in Help',
- col2 => 'Value'},
- {col1 => 'Custom HTML in document head',
col2 => 'Value'}],
print => \&print_login,
modify => \&modify_login,
@@ -411,6 +409,14 @@ sub handler {
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'}],
+ print => \&print_helpsettings,
+ modify => \&modify_helpsettings,
+ },
'coursedefaults' =>
{text => 'Course/Community defaults',
help => 'Domain_Configuration_Course_Defaults',
@@ -433,6 +439,14 @@ sub handler {
print => \&print_selfenrollment,
modify => \&modify_selfenrollment,
},
+ 'privacy' =>
+ {text => 'User Privacy',
+ help => 'Domain_Configuration_User_Privacy',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ print => \&print_privacy,
+ modify => \&modify_privacy,
+ },
'usersessions' =>
{text => 'User session hosting/offloading',
help => 'Domain_Configuration_User_Sessions',
@@ -465,8 +479,6 @@ sub handler {
{col1 => 'Log-in Page Items',
col2 => ''},
{col1 => 'Log-in Help',
- col2 => 'Value'},
- {col1 => 'Custom HTML in document head',
col2 => 'Value'}],
print => \&print_login,
modify => \&modify_login,
@@ -619,6 +631,8 @@ sub process_changes {
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);
} elsif ($action eq 'requestauthor') {
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);
+ } elsif ($action eq 'helpsettings') {
+ $output = &modify_helpsettings($r,$dom,$confname,%domconfig);
} elsif ($action eq 'coursedefaults') {
$output = &modify_coursedefaults($dom,$lastactref,%domconfig);
} elsif ($action eq 'selfenrollment') {
@@ -656,7 +670,7 @@ sub print_config_box {
my $colspan = '';
my $rightcolspan = '';
if (($action eq 'rolecolors') || ($action eq 'defaults') ||
- (($action eq 'login') && ($numheaders < 4))) {
+ (($action eq 'login') && ($numheaders < 3))) {
$colspan = ' colspan="2"';
}
if ($action eq 'usersessions') {
@@ -678,7 +692,7 @@ sub print_config_box {
} elsif ($action eq 'coursecategories') {
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);
} elsif ($action eq 'login') {
- if ($numheaders == 4) {
+ if ($numheaders == 3) {
$colspan = ' colspan="2"';
$output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal);
} else {
@@ -731,7 +745,7 @@ sub print_config_box {
($action eq 'defaults')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'login') {
- if ($numheaders == 4) {
+ if ($numheaders == 3) {
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
@@ -747,27 +761,6 @@ sub print_config_box {
} else {
$output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal);
}
- $output .= '
-
-
-
-
-
-
- ';
- if ($numheaders == 4) {
- $output .= '
- '.&mt($item->{'header'}->[3]->{'col1'}).'
- '.&mt($item->{'header'}->[3]->{'col2'}).'
- ';
- } else {
- $output .= '
- '.&mt($item->{'header'}->[2]->{'col1'}).'
- '.&mt($item->{'header'}->[2]->{'col2'}).'
- ';
- }
- $rowtotal ++;
- $output .= &print_login('headtag',$dom,$confname,$phase,$settings,\$rowtotal);
} elsif ($action eq 'requestcourses') {
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal);
$rowtotal ++;
@@ -1188,57 +1181,6 @@ sub print_login {
$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 .= ''.$choice.' '.
- ' ';
}
return $datatable;
}
@@ -1272,9 +1214,6 @@ sub login_choices {
link => "Link",
alink => "Active link",
vlink => "Visited link",
- headtag => "Custom markup",
- action => "Action",
- current => "Current",
);
return %choices;
}
@@ -2398,7 +2337,7 @@ ENDSCRIPT
sub print_autoenroll {
my ($dom,$settings,$rowtotal) = @_;
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 (exists($settings->{'run'})) {
if ($settings->{'run'} eq '0') {
@@ -2432,9 +2371,6 @@ sub print_autoenroll {
if (exists($settings->{'sender_domain'})) {
$defdom = $settings->{'sender_domain'};
}
- if (exists($settings->{'autofailsafe'})) {
- $failsafe = $settings->{'autofailsafe'};
- }
} else {
if ($autorun) {
$runon = ' checked="checked" ';
@@ -2470,12 +2406,8 @@ sub print_autoenroll {
$coownerson.' value="1" />'.&mt('Yes').' '.
' '.&mt('No').' '.
- ''.
- ''.&mt('Failsafe for no drops when institutional data missing').' '.
- ''.
- ' ';
- $$rowtotal += 4;
+ '';
+ $$rowtotal += 3;
return $datatable;
}
@@ -2833,7 +2765,7 @@ sub print_helpsettings {
sub radiobutton_prefs {
my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick,
- $additional,$align) = @_;
+ $additional) = @_;
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&
(ref($choices) eq 'HASH'));
@@ -2867,14 +2799,8 @@ sub radiobutton_prefs {
$datatable .=
''.
''.$choices->{$item}.
- ' ';
- if ($align eq 'left') {
- $datatable .= '';
- } else {
- $datatable .= ' ';
- }
- $datatable .=
- ''.
+ ' '.
+ ''.
' '.&mt('Yes').
' 'Course/Community users can create/upload PDF forms',
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',
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 = (
anonsurvey_threshold => 10,
uploadquota => 500,
- postsubmit => 60,
- mysqltables => 172800,
);
if ($position eq 'top') {
- %defaultchecked = (
- 'uselcmath' => 'on',
- 'usejsme' => 'on',
- 'canclone' => 'none',
- );
- @toggles = ('uselcmath','usejsme');
+ %defaultchecked = ('canuse_pdfforms' => 'off');
+ @toggles = ('canuse_pdfforms');
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
- \%choices,$itemcount);
- $css_class = $itemcount%2?' class="LC_odd_row"':'';
- $datatable .=
- ''.
- ''.$choices{'canclone'}.
- ' ';
- 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 = '
'.
- &mt('Institutional codes for new and cloned course have identical:').
- ' ';
- foreach my $item (@code_order) {
- my $codechk;
- if ($checked) {
- if (grep(/^\Q$item\E$/,@posscodes)) {
- $codechk = ' checked="checked"';
- }
- }
- $additional .= ''.
- ' '.
- $item.' ';
- }
- $additional .= (' 'x2).'('.&mt('check as many as needed').')';
- }
- }
- $datatable .=
- ' '.$clonetitles{$option}.
- ' '.$additional.' ';
- }
- $datatable .= ' '.
- ' ';
- $itemcount ++;
+ \%choices,$itemcount);
} else {
$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 $postsubmitclient = 1;
my @types = ('official','unofficial','community','textbook');
if (ref($settings) eq 'HASH') {
$currdefresponder = $settings->{'anonsurvey_threshold'};
@@ -3001,51 +2846,14 @@ sub print_coursedefaults {
}
}
if (ref($settings->{'coursecredits'}) eq 'HASH') {
- foreach my $type (@types) {
- next if ($type eq 'community');
- $defcredits{$type} = $settings->{'coursecredits'}->{$type};
- if ($defcredits{$type} 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'};
+ $def_official_credits = $settings->{'coursecredits'}->{'official'};
+ $def_unofficial_credits = $settings->{'coursecredits'}->{'unofficial'};
+ $def_textbook_credits = $settings->{'coursecredits'}->{'textbook'};
+ if (($def_official_credits ne '') || ($def_unofficial_credits ne '') ||
+ ($def_textbook_credits ne '')) {
+ $currusecredits = 1;
}
}
- 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) {
$currdefresponder = $staticdefaults{'anonsurvey_threshold'};
@@ -3085,14 +2893,21 @@ sub print_coursedefaults {
$display = 'block';
}
my $additional = ''.
- '
'.&mt('Default credits').' '."\n";
+ ''.
+ &mt('Default credits for official courses [_1]',
+ ' ').
+ ' '.
+ ''.
+ &mt('Default credits for unofficial courses [_1]',
+ ' ').
+ ' '.
+ ''.
+ &mt('Default credits for textbook courses [_1]',
+ ' ').
+ ' '."\n";
%defaultchecked = ('coursecredits' => 'off');
@toggles = ('coursecredits');
my $current = {
@@ -3100,46 +2915,9 @@ sub print_coursedefaults {
};
(my $table,$itemcount) =
&radiobutton_prefs($current,\@toggles,\%defaultchecked,
- \%choices,$itemcount,$onclick,$additional,'left');
- $datatable .= $table;
- $onclick = "toggleDisplay(this.form,'studentsubmission');";
- my $display = 'none';
- if ($postsubmitclient) {
- $display = 'block';
- }
- $additional = ''.
- &mt('Number of seconds submit is disabled').'
'.
- '
'.&mt('Enter 0 to remain disabled until page reload.').' '.
- '
'."\n";
- %defaultchecked = ('postsubmit' => 'on');
- @toggles = ('postsubmit');
- $current = {
- 'postsubmit' => $postsubmitclient,
- };
- ($table,$itemcount) =
- &radiobutton_prefs($current,\@toggles,\%defaultchecked,
- \%choices,$itemcount,$onclick,$additional,'left');
+ \%choices,$itemcount,$onclick,$additional);
$datatable .= $table;
- $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- $datatable .= ''.
- $choices{'mysqltables'}.
- ' '.
- ''.
- ' '."\n";
$itemcount ++;
-
}
$$rowtotal += $itemcount;
return $datatable;
@@ -3384,13 +3162,7 @@ sub print_usersessions {
if ($position eq 'top') {
if (keys(%serverhomes) > 1) {
my %spareid = ¤t_offloads_to($dom,$settings,\%servers);
- my $curroffloadnow;
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{'offloadnow'}) eq 'HASH') {
- $curroffloadnow = $settings->{'offloadnow'};
- }
- }
- $datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids,$curroffloadnow,$rowtotal);
+ $datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids,$rowtotal);
} else {
$datatable .= ''.
&mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.');
@@ -3640,7 +3412,7 @@ sub current_offloads_to {
}
sub spares_row {
- my ($dom,$servers,$spareid,$serverhomes,$altids,$curroffloadnow,$rowtotal) = @_;
+ my ($dom,$servers,$spareid,$serverhomes,$altids,$rowtotal) = @_;
my $css_class;
my $numinrow = 4;
my $itemcount = 1;
@@ -3660,21 +3432,12 @@ sub spares_row {
}
}
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"' : '';
$datatable .= '
'.
&mt('[_1] when busy, offloads to:'
- ,''.$server.' ').' '.
- ''."\n".
- ' '.
- ' '.&mt('Switch active users on next access').' '.
+ ,''.$server.' ').
"\n";
my (%current,%canselect);
my @choices =
@@ -3898,10 +3661,9 @@ sub print_loadbalancing {
$disabled = ' disabled="disabled"';
}
$targettable .=
- ' '.
- ' '.$chkboxval.
- ' ';
+ '';
my $rem = $i%($numinrow);
if ($rem == 0) {
if (($i > 0) && ($i < $numspares-1)) {
@@ -3991,7 +3753,7 @@ sub loadbalancing_rules {
if (ref($currrules) eq 'HASH') {
$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)) {
$current = '';
}
@@ -4043,7 +3805,7 @@ sub loadbalance_rule_row {
my @rulenames;
my %ruletitles = &offloadtype_text();
if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) {
- @rulenames = ('balancer','offloadedto','specific');
+ @rulenames = ('balancer','offloadedto');
} else {
@rulenames = ('default','homeserver');
if ($type eq '_LC_external') {
@@ -4054,7 +3816,7 @@ sub loadbalance_rule_row {
push(@rulenames,'none');
}
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;
}
my $space;
@@ -4105,13 +3867,8 @@ sub loadbalance_rule_row {
' ';
- if (($rulenames[$i] eq 'specific') && ($type =~ /^_LC_ipchange/)) {
- $output .= $ruletitles{'particular'};
- } else {
- $output .= $ruletitles{$rulenames[$i]};
- }
- $output .= ''.$extra.' '."\n";
+ ')"'.$checked.' /> '.$ruletitles{$rulenames[$i]}.
+ ''.$extra.' '."\n";
}
$output .= ' '."\n";
return $output;
@@ -4126,7 +3883,6 @@ sub offloadtype_text {
'none' => 'No offload',
'balancer' => 'Session hosted on Load Balancer, after re-authentication',
'offloadedto' => 'Session hosted on offload server, after re-authentication',
- 'particular' => 'Session hosted (after re-auth) on server:',
);
return %ruletitles;
}
@@ -4567,8 +4323,7 @@ sub email_as_username {
sub captcha_choice {
my ($context,$settings,$itemcount) = @_;
- my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext,
- $vertext,$currver);
+ my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext);
my %lt = &captcha_phrases();
$keyentry = 'hidden';
if ($context eq 'cancreate') {
@@ -4586,11 +4341,6 @@ sub captcha_choice {
$pubtext = $lt{'pub'};
$privtext = $lt{'priv'};
$keyentry = 'text';
- $vertext = $lt{'ver'};
- $currver = $settings->{'recaptchaversion'};
- if ($currver ne '2') {
- $currver = 1;
- }
}
if (ref($settings->{'recaptchakeys'}) eq 'HASH') {
$currpub = $settings->{'recaptchakeys'}{'public'};
@@ -4624,11 +4374,7 @@ sub captcha_choice {
$currpub.'" size="40" /> '."\n".
''.$privtext.' '."\n".
' '.
- ''.$vertext.' '."\n".
- ' '.
- '
'."\n".
+ $currpriv.'" size="40" /> '."\n".
'';
return $output;
}
@@ -4811,8 +4557,11 @@ sub print_defaults {
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);
+ my %langchoices = &get_languages_hash();
+ $langchoices{''} = 'No language preference';
+ %langchoices = &Apache::lonlocal::texthash(%langchoices);
+ $datatable .= &Apache::loncommon::select_form($defaults{$item},$item,
+ \%langchoices);
} else {
my $size;
if ($item eq 'portal_def') {
@@ -4881,7 +4630,7 @@ sub print_defaults {
$datatable .= ''.$vpos.' ';
}
$datatable .= ' '.&mt('Internal ID:').
- ' '.
+ ' '.
' '.&mt('(new)').
''.
&mt('Name displayed:').
@@ -5418,12 +5167,12 @@ sub serverstatus_pages {
return ('userstatus','lonstatus','loncron','server-status','codeversions',
'checksums','clusterstatus','metadata_keywords','metadata_harvest',
'takeoffline','takeonline','showenv','toggledebug','ping','domconf',
- 'uniquecodes','diskusage','coursecatalog');
+ 'uniquecodes','diskusage');
}
sub defaults_javascript {
my ($settings) = @_;
- return unless (ref($settings) eq 'HASH');
+ 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 '') {
@@ -5508,10 +5257,7 @@ sub coursecategories_javascript {
}
my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"');
my $communities_reserved = &mt('The name: [_1] is a reserved category.','"communities"');
- 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);
+ my $choose_again = '\\n'.&mt('Please use a different name for the new top level category.');
$output = <<"ENDSCRIPT";