--- loncom/interface/domainprefs.pm 2016/09/18 19:22:48 1.160.6.71
+++ loncom/interface/domainprefs.pm 2015/03/13 13:30:19 1.258
@@ -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.258 2015/03/13 13:30:19 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'}};
@@ -411,6 +411,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 +441,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',
@@ -619,6 +635,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') {
@@ -2398,7 +2416,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 +2450,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 +2485,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;
}
@@ -2873,7 +2884,7 @@ sub radiobutton_prefs {
} else {
$datatable .= '';
}
- $datatable .=
+ $datatable .=
''.
' '.&mt('Yes').
@@ -2892,104 +2903,31 @@ sub print_coursedefaults {
my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles);
my $itemcount = 1;
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)',
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 = (
+ 'canuse_pdfforms' => 'off',
'uselcmath' => 'on',
'usejsme' => 'on',
- 'canclone' => 'none',
);
- @toggles = ('uselcmath','usejsme');
+ @toggles = ('canuse_pdfforms','uselcmath','usejsme');
($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 ++;
} else {
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout,%currmysql);
+ my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout);
my $currusecredits = 0;
my $postsubmitclient = 1;
my @types = ('official','unofficial','community','textbook');
@@ -3019,7 +2957,7 @@ sub print_coursedefaults {
foreach my $type (@types) {
if (ref($settings->{'postsubmit'}->{'timeout'}) eq 'HASH') {
if ($settings->{'postsubmit'}->{'timeout'}->{$type} =~ /^\d+$/) {
- $deftimeout{$type} = $settings->{'postsubmit'}->{'timeout'}->{$type};
+ $deftimeout{$type} = $settings->{'postsubmit'}->{'timeout'}->{$type};
} else {
$deftimeout{$type} = $staticdefaults{'postsubmit'};
}
@@ -3033,15 +2971,6 @@ sub print_coursedefaults {
$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'};
@@ -3108,9 +3037,7 @@ sub print_coursedefaults {
$display = 'block';
}
$additional = ''.
- &mt('Number of seconds submit is disabled').'
'.
- '
'.&mt('Enter 0 to remain disabled until page reload.').' '.
- '
';
+ ''.&mt('Number of seconds submit is disabled').' ';
foreach my $type (@types) {
$additional .= ''.&mt($type).' '.
' 'on');
@toggles = ('postsubmit');
- $current = {
- 'postsubmit' => $postsubmitclient,
- };
+ my $current = {
+ 'postsubmit' => $postsubmitclient,
+ };
($table,$itemcount) =
&radiobutton_prefs($current,\@toggles,\%defaultchecked,
\%choices,$itemcount,$onclick,$additional,'left');
$datatable .= $table;
- $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- $datatable .= ' '.
- $choices{'mysqltables'}.
- ' '.
- ''.
- ' '."\n";
- $itemcount ++;
-
}
$$rowtotal += $itemcount;
return $datatable;
@@ -3384,13 +3297,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 +3547,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 +3567,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 =
@@ -4567,8 +4465,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 +4483,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 +4516,7 @@ sub captcha_choice {
$currpub.'" size="40" /> '."\n".
''.$privtext.' '."\n".
' '.
- ''.$vertext.' '."\n".
- ' '.
- '
'."\n".
+ $currpriv.'" size="40" />
'."\n".
'
';
return $output;
}
@@ -4811,8 +4699,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 +4772,7 @@ sub print_defaults {
$datatable .= ''.$vpos.' ';
}
$datatable .= ' '.&mt('Internal ID:').
- ' '.
+ ' '.
' '.&mt('(new)').
''.
&mt('Name displayed:').
@@ -5418,12 +5309,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 +5399,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";