version 1.160.6.71, 2016/09/18 19:22:48
|
version 1.263, 2015/05/11 18:11:42
|
Line 213 sub handler {
|
Line 213 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','selfenrollment','inststatus'],$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','selfenrollment','usersessions'); |
my %existing; |
my %existing; |
if (ref($domconfig{'loadbalancing'}) eq 'HASH') { |
if (ref($domconfig{'loadbalancing'}) eq 'HASH') { |
%existing = %{$domconfig{'loadbalancing'}}; |
%existing = %{$domconfig{'loadbalancing'}}; |
Line 411 sub handler {
|
Line 411 sub handler {
|
print => \&print_serverstatuses, |
print => \&print_serverstatuses, |
modify => \&modify_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' => |
'coursedefaults' => |
{text => 'Course/Community defaults', |
{text => 'Course/Community defaults', |
help => 'Domain_Configuration_Course_Defaults', |
help => 'Domain_Configuration_Course_Defaults', |
Line 433 sub handler {
|
Line 441 sub handler {
|
print => \&print_selfenrollment, |
print => \&print_selfenrollment, |
modify => \&modify_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' => |
'usersessions' => |
{text => 'User session hosting/offloading', |
{text => 'User session hosting/offloading', |
help => 'Domain_Configuration_User_Sessions', |
help => 'Domain_Configuration_User_Sessions', |
Line 619 sub process_changes {
|
Line 635 sub process_changes {
|
$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') { |
} elsif ($action eq 'selfenrollment') { |
Line 2398 ENDSCRIPT
|
Line 2416 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 2450 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 2485 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 2873 sub radiobutton_prefs {
|
Line 2884 sub radiobutton_prefs {
|
} else { |
} else { |
$datatable .= '<td class="LC_right_item">'; |
$datatable .= '<td class="LC_right_item">'; |
} |
} |
$datatable .= |
$datatable .= |
'<span class="LC_nobreak">'. |
'<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'). |
Line 2892 sub print_coursedefaults {
|
Line 2903 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)', |
uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)', |
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)', |
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)', |
postsubmit => 'Disable submit button/keypress following student submission', |
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, |
postsubmit => 60, |
mysqltables => 172800, |
|
); |
); |
if ($position eq 'top') { |
if ($position eq 'top') { |
%defaultchecked = ( |
%defaultchecked = ( |
|
'canuse_pdfforms' => 'off', |
'uselcmath' => 'on', |
'uselcmath' => 'on', |
'usejsme' => 'on', |
'usejsme' => 'on', |
'canclone' => 'none', |
|
); |
); |
@toggles = ('uselcmath','usejsme'); |
@toggles = ('canuse_pdfforms','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,%defcredits,%curruploadquota,%deftimeout); |
my $currusecredits = 0; |
my $currusecredits = 0; |
my $postsubmitclient = 1; |
my $postsubmitclient = 1; |
my @types = ('official','unofficial','community','textbook'); |
my @types = ('official','unofficial','community','textbook'); |
Line 3019 sub print_coursedefaults {
|
Line 2957 sub print_coursedefaults {
|
foreach my $type (@types) { |
foreach my $type (@types) { |
if (ref($settings->{'postsubmit'}->{'timeout'}) eq 'HASH') { |
if (ref($settings->{'postsubmit'}->{'timeout'}) eq 'HASH') { |
if ($settings->{'postsubmit'}->{'timeout'}->{$type} =~ /^\d+$/) { |
if ($settings->{'postsubmit'}->{'timeout'}->{$type} =~ /^\d+$/) { |
$deftimeout{$type} = $settings->{'postsubmit'}->{'timeout'}->{$type}; |
$deftimeout{$type} = $settings->{'postsubmit'}->{'timeout'}->{$type}; |
} else { |
} else { |
$deftimeout{$type} = $staticdefaults{'postsubmit'}; |
$deftimeout{$type} = $staticdefaults{'postsubmit'}; |
} |
} |
Line 3033 sub print_coursedefaults {
|
Line 2971 sub print_coursedefaults {
|
$deftimeout{$type} = $staticdefaults{'postsubmit'}; |
$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 { |
} else { |
foreach my $type (@types) { |
foreach my $type (@types) { |
$deftimeout{$type} = $staticdefaults{'postsubmit'}; |
$deftimeout{$type} = $staticdefaults{'postsubmit'}; |
Line 3119 sub print_coursedefaults {
|
Line 3048 sub print_coursedefaults {
|
$additional .= '</tr></table></div>'."\n"; |
$additional .= '</tr></table></div>'."\n"; |
%defaultchecked = ('postsubmit' => 'on'); |
%defaultchecked = ('postsubmit' => 'on'); |
@toggles = ('postsubmit'); |
@toggles = ('postsubmit'); |
$current = { |
my $current = { |
'postsubmit' => $postsubmitclient, |
'postsubmit' => $postsubmitclient, |
}; |
}; |
($table,$itemcount) = |
($table,$itemcount) = |
&radiobutton_prefs($current,\@toggles,\%defaultchecked, |
&radiobutton_prefs($current,\@toggles,\%defaultchecked, |
\%choices,$itemcount,$onclick,$additional,'left'); |
\%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; |
Line 3672 sub spares_row {
|
Line 3587 sub spares_row {
|
<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><br />'. |
'<span class="LC_nobreak">'."\n". |
'<span class="LC_nobreak">'."\n". |
'<label><input type="checkbox" name="offloadnow" value="'.$server.'"'.$checkednow.' />'. |
'<label><input type="checkbox" name="offloadnow" value="'.$server.'"'.$checkednow.' />'. |
' '.&mt('Switch active users on next access').'</label></span>'. |
' '.&mt('Switch active users on next access').'</label></span>'. |
"\n"; |
"\n"; |
Line 4567 sub email_as_username {
|
Line 4482 sub email_as_username {
|
|
|
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 4500 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 4533 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 5423 sub serverstatus_pages {
|
Line 5328 sub serverstatus_pages {
|
|
|
sub defaults_javascript { |
sub defaults_javascript { |
my ($settings) = @_; |
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')) { |
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { |
my $maxnum = scalar(@{$settings->{'inststatusorder'}}); |
my $maxnum = scalar(@{$settings->{'inststatusorder'}}); |
if ($maxnum eq '') { |
if ($maxnum eq '') { |
Line 5508 sub coursecategories_javascript {
|
Line 5413 sub coursecategories_javascript {
|
} |
} |
my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"'); |
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 $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.'); |
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 6165 sub modify_login {
|
Line 6067 sub modify_login {
|
$errors .= '<li><span class="LC_error">'.$puberror.'</span></li>'; |
$errors .= '<li><span class="LC_error">'.$puberror.'</span></li>'; |
if ((grep(/^\Q$lang\E$/,@currlangs)) && |
if ((grep(/^\Q$lang\E$/,@currlangs)) && |
(!grep(/^\Q$lang\E$/,@delurls))) { |
(!grep(/^\Q$lang\E$/,@delurls))) { |
|
|
$loginhash{'login'}{'helpurl'}{$lang} = $domconfig{'login'}{'helpurl'}{$lang}; |
$loginhash{'login'}{'helpurl'}{$lang} = $domconfig{'login'}{'helpurl'}{$lang}; |
} |
} |
} |
} |
Line 6189 sub modify_login {
|
Line 6090 sub modify_login {
|
if ($domservers{$lonhost}) { |
if ($domservers{$lonhost}) { |
if (ref($domconfig{'login'}{'headtag'}{$lonhost}) eq 'HASH') { |
if (ref($domconfig{'login'}{'headtag'}{$lonhost}) eq 'HASH') { |
$currheadtagurls{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'url'}; |
$currheadtagurls{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'url'}; |
$currexempt{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'exempt'} |
$currexempt{$lonhost} = $domconfig{'login'}{'headtagexempt'}{$lonhost}{'exempt'} |
} |
} |
} |
} |
} |
} |
Line 6208 sub modify_login {
|
Line 6109 sub modify_login {
|
} elsif ($currheadtagurls{$lonhost}) { |
} elsif ($currheadtagurls{$lonhost}) { |
$loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $currheadtagurls{$lonhost}; |
$loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $currheadtagurls{$lonhost}; |
if ($currexempt{$lonhost}) { |
if ($currexempt{$lonhost}) { |
if ((!exists($possexempt{$lonhost})) || ($possexempt{$lonhost} ne $currexempt{$lonhost})) { |
if ((!exists($possexempt{$lonhost})) || ($possexempt{$lonhost} ne $currexempt{$lonhost})) { |
$changes{'headtag'}{$lonhost} = 1; |
$changes{'headtag'}{$lonhost} = 1; |
} |
} |
} elsif ($possexempt{$lonhost}) { |
} elsif ($possexempt{$lonhost}) { |
Line 6259 sub modify_login {
|
Line 6160 sub modify_login {
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
$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 6415 sub modify_login {
|
Line 6315 sub modify_login {
|
$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 6334 sub modify_login {
|
return $resulttext; |
return $resulttext; |
} |
} |
|
|
|
|
sub check_exempt_addresses { |
sub check_exempt_addresses { |
my ($iplist) = @_; |
my ($iplist) = @_; |
$iplist =~ s/^\s+//; |
$iplist =~ s/^\s+//; |
Line 7350 sub modify_quotas {
|
Line 7244 sub modify_quotas {
|
my $newpos = $env{'form.'.$itemid}; |
my $newpos = $env{'form.'.$itemid}; |
$newpos =~ s/\D+//g; |
$newpos =~ s/\D+//g; |
foreach my $item ('subject','title','publisher','author') { |
foreach my $item ('subject','title','publisher','author') { |
next if ((($item eq 'author') || ($item eq 'publisher')) && |
next if ((($item eq 'author') || ($item eq 'publisher')) && |
($type eq 'templates')); |
($type eq 'templates')); |
$confhash{$type}{$key}{$item} = $env{'form.'.$type.'_'.$item.'_'.$i}; |
$confhash{$type}{$key}{$item} = $env{'form.'.$type.'_'.$item.'_'.$i}; |
if ($domconfig{$action}{$type}{$key}{$item} ne $confhash{$type}{$key}{$item}) { |
if ($domconfig{$action}{$type}{$key}{$item} ne $confhash{$type}{$key}{$item}) { |
Line 7447 sub modify_quotas {
|
Line 7341 sub modify_quotas {
|
if (@{$confhash{'validation'}{$item}} > 0) { |
if (@{$confhash{'validation'}{$item}} > 0) { |
@{$confhash{'validation'}{$item}} = sort(@{$confhash{'validation'}{$item}}); |
@{$confhash{'validation'}{$item}} = sort(@{$confhash{'validation'}{$item}}); |
} |
} |
if (ref($domconfig{'requestcourses'}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}{'validation'}{$item}) eq 'ARRAY') { |
if (ref($domconfig{'requestcourses'}{'validation'}{$item}) eq 'ARRAY') { |
@changed = &Apache::loncommon::compare_arrays($confhash{'validation'}{$item}, |
@changed = &Apache::loncommon::compare_arrays($confhash{'validation'}{$item}, |
$domconfig{'requestcourses'}{'validation'}{$item}); |
$domconfig{'requestcourses'}{'validation'}{$item}); |
|
} else { |
|
@changed = @{$confhash{'validation'}{$item}}; |
|
} |
|
} else { |
} else { |
@changed = @{$confhash{'validation'}{$item}}; |
@changed = @{$confhash{'validation'}{$item}}; |
} |
} |
Line 7475 sub modify_quotas {
|
Line 7365 sub modify_quotas {
|
$env{'form.requestcourses_validation_'.$item} =~ s/[\n\r\f]+/\s/gs; |
$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 (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
if ($domconfig{'requestcourses'}{'validation'}{$item} ne $confhash{'validation'}{$item}) { |
if ($domconfig{'requestcourses'}{'validation'}{$item} ne $confhash{'validation'}{$item}) { |
$changes{'validation'}{$item} = $confhash{'validation'}{$item}; |
$changes{'validation'}{$item} = $confhash{'validation'}{$item}; |
|
} |
|
} else { |
|
if ($confhash{'validation'}{$item} ne '') { |
|
$changes{'validation'}{$item} = $confhash{'validation'}{$item}; |
|
} |
|
} |
} |
} else { |
} else { |
if ($confhash{'validation'}{$item} ne '') { |
if ($confhash{'validation'}{$item} ne '') { |
Line 7501 sub modify_quotas {
|
Line 7385 sub modify_quotas {
|
} |
} |
} |
} |
if (ref($confhash{'validation'}) eq 'HASH') { |
if (ref($confhash{'validation'}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
if ($domconfig{'requestcourses'}{'validation'}{'dc'}) { |
if ($domconfig{'requestcourses'}{'validation'}{'dc'}) { |
unless ($confhash{'validation'}{'dc'} eq $domconfig{'requestcourses'}{'validation'}{'dc'}) { |
unless ($confhash{'validation'}{'dc'} eq $domconfig{'requestcourses'}{'validation'}{'dc'}) { |
if ($confhash{'validation'}{'dc'} eq '') { |
if ($confhash{'validation'}{'dc'} eq '') { |
$changes{'validation'}{'dc'} = &mt('None'); |
$changes{'validation'}{'dc'} = &mt('None'); |
} else { |
} else { |
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
|
} |
|
} |
} |
} elsif ($confhash{'validation'}{'dc'} ne '') { |
|
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
|
} |
} |
} elsif ($confhash{'validation'}{'dc'} ne '') { |
} elsif ($confhash{'validation'}{'dc'} ne '') { |
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
Line 7520 sub modify_quotas {
|
Line 7400 sub modify_quotas {
|
} elsif ($confhash{'validation'}{'dc'} ne '') { |
} elsif ($confhash{'validation'}{'dc'} ne '') { |
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
$changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'}; |
} |
} |
} else { |
} elsif (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}) eq 'HASH') { |
if ($domconfig{'requestcourses'}{'validation'}{'dc'}) { |
if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') { |
$changes{'validation'}{'dc'} = &mt('None'); |
if ($domconfig{'requestcourses'}{'validation'}{'dc'}) { |
|
$changes{'validation'}{'dc'} = &mt('None'); |
|
} |
|
} |
|
} |
} |
} |
} |
} |
} |
Line 7934 sub modify_autoenroll {
|
Line 7810 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 7820 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 7851 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 7871 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 8498 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 8722 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')) { |
($item eq 'selfcreateprocessing') || ($item eq 'shibenv')) { |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
Line 9198 sub modify_selfcreation {
|
Line 9051 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'}; |
Line 9360 sub modify_selfcreation {
|
Line 9212 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') { |
Line 9484 sub process_captcha {
|
Line 9332 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'}; |
Line 9494 sub process_captcha {
|
Line 9342 sub process_captcha {
|
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 9353 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 10420 sub modify_coursedefaults {
|
Line 10245 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', |
'uselcmath' => 'on', |
'usejsme' => 'on' |
'usejsme' => 'on' |
); |
); |
my @toggles = ('uselcmath','usejsme'); |
my @toggles = ('canuse_pdfforms','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, |
postsubmit => 60, |
mysqltables => 172800, |
|
); |
); |
|
|
$defaultshash{'coursedefaults'} = {}; |
$defaultshash{'coursedefaults'} = {}; |
Line 10473 sub modify_coursedefaults {
|
Line 10297 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 10310 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 @currclonecode; |
|
if (ref($currclone) eq 'HASH') { |
|
if (ref($currclone->{'instcode'}) eq 'ARRAY') { |
|
@currclonecode = @{$currclone->{'instcode'}}; |
|
} |
|
} |
|
my $newclone; |
|
if ($env{'form.canclone'} =~ /^(none|domain|instcode)$/) { |
|
$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; |
my %credits; |
foreach my $type (@types) { |
foreach my $type (@types) { |
unless ($type eq 'community') { |
unless ($type eq 'community') { |
Line 10544 sub modify_coursedefaults {
|
Line 10332 sub modify_coursedefaults {
|
$defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type}; |
$defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type}; |
} |
} |
} else { |
} else { |
if ($env{'form.coursecredits'} eq '1') { |
if ($env{'form.coursecredits'} eq '1') { |
foreach my $type (@types) { |
foreach my $type (@types) { |
unless ($type eq 'community') { |
unless ($type eq 'community') { |
if ($domconfig{'coursedefaults'}{'coursecredits'}{$type} ne $credits{$type}) { |
if ($domconfig{'coursedefaults'}{'coursecredits'}{$type} ne $credits{$type}) { |
$changes{'coursecredits'} = 1; |
$changes{'coursecredits'} = 1; |
} |
} |
$defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type}; |
$defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type}; |
Line 10590 sub modify_coursedefaults {
|
Line 10378 sub modify_coursedefaults {
|
} |
} |
if (exists($currtimeout{$type})) { |
if (exists($currtimeout{$type})) { |
if ($timeout ne $currtimeout{$type}) { |
if ($timeout ne $currtimeout{$type}) { |
$changes{'postsubmit'} = 1; |
$changes{'postsubmit'} = 1; |
} |
} |
} elsif ($timeout ne '') { |
} elsif ($timeout ne '') { |
$changes{'postsubmit'} = 1; |
$changes{'postsubmit'} = 1; |
Line 10612 sub modify_coursedefaults {
|
Line 10400 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{'uploadquota'}) || ($changes{'postsubmit'}) || |
($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) || |
($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'})) { |
($changes{'canclone'}) || ($changes{'mysqltables'})) { |
foreach my $item ('canuse_pdfforms','uselcmath','usejsme') { |
foreach my $item ('uselcmath','usejsme') { |
|
if ($changes{$item}) { |
if ($changes{$item}) { |
$domdefaults{$item}=$defaultshash{'coursedefaults'}{$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'}})) { |
foreach my $type (keys(%{$defaultshash{'coursedefaults'}{'coursecredits'}})) { |
Line 10646 sub modify_coursedefaults {
|
Line 10433 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 10441 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("Course/Community users can create/upload PDF forms set to 'on'").'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "off"').'</li>'; |
|
} |
|
} elsif ($item eq 'uselcmath') { |
if ($env{'form.'.$item} eq '1') { |
if ($env{'form.'.$item} eq '1') { |
$resulttext .= '<li>'.&mt('Math preview uses LON-CAPA previewer (javascript), if supported by browser.').'</li>'; |
$resulttext .= '<li>'.&mt('Math preview uses LON-CAPA previewer (javascript), if supported by browser.').'</li>'; |
} else { |
} else { |
Line 10676 sub modify_coursedefaults {
|
Line 10457 sub modify_coursedefaults {
|
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('Molecule editor uses JSME (HTML5), if supported by browser.').'</li>'; |
} else { |
} else { |
$resulttext .= '<li>'.&mt('Molecule editor uses JME (Java), if supported by client OS.').'</li>'; |
$resulttext .= '<li>'.&mt('Molecule editor uses JME (Java), if supported by client OS.').'</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 10474 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') { |
} elsif ($item eq 'postsubmit') { |
if ($domdefaults{'postsubmit'} eq 'off') { |
if ($domdefaults{'postsubmit'} eq 'off') { |
$resulttext .= '<li>'.&mt('Submit button(s) remain enabled on page after student makes submission.'); |
$resulttext .= '<li>'.&mt('Submit button(s) remain enabled on page after student makes submission.'); |
} else { |
} else { |
$resulttext .= '<li>'.&mt('Submit button(s) disabled on page after student makes submission').'; '; |
$resulttext .= '<li>'.&mt('Submit button(s) disabled on page after student makes submission').'; '; |
if (ref($defaultshash{'coursedefaults'}{'postsubmit'}) eq 'HASH') { |
if (ref($defaultshash{'coursedefaults'}{'postsubmit'}) eq 'HASH') { |
$resulttext .= &mt('durations:').'<ul>'; |
$resulttext .= &mt('durations:').'<ul>'; |
foreach my $type (@types) { |
foreach my $type (@types) { |
$resulttext .= '<li>'; |
$resulttext .= '<li>'; |
Line 10739 sub modify_coursedefaults {
|
Line 10508 sub modify_coursedefaults {
|
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} |
} |
$resulttext .= '</li>'; |
$resulttext .= '</li>'; |
} |
} |
} elsif ($item eq 'coursecredits') { |
} elsif ($item eq 'coursecredits') { |
if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { |
if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { |
Line 10758 sub modify_coursedefaults {
|
Line 10527 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 11222 sub modify_usersessions {
|
Line 10980 sub modify_usersessions {
|
} |
} |
} |
} |
unless ($changes{'offloadnow'}) { |
unless ($changes{'offloadnow'}) { |
foreach my $lonhost (keys(%{$defaultshash{'usersessions'}{'offloadnow'}})) { |
foreach my $lonhost (keys(%{$defaultshash{'usersessions'}{'offloadnow'}})) { |
unless ($domconfig{'usersessions'}{'offloadnow'}{$lonhost}) { |
unless ($domconfig{'usersessions'}{'offloadnow'}{$lonhost}) { |
$changes{'offloadnow'} = 1; |
$changes{'offloadnow'} = 1; |
last; |
last; |
Line 11447 sub modify_loadbalancing {
|
Line 11205 sub modify_loadbalancing {
|
} |
} |
if ($rule eq 'specific') { |
if ($rule eq 'specific') { |
my $specifiedhost = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type}; |
my $specifiedhost = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type}; |
if (exists($servers{$specifiedhost})) { |
if (exists($servers{$specifiedhost})) { |
$rule = $specifiedhost; |
$rule = $specifiedhost; |
} |
} |
} |
} |
Line 11523 sub modify_loadbalancing {
|
Line 11281 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')) { |
($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { |
if (($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { |
if (($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { |
foreach my $sparetype (@sparestypes) { |
foreach my $sparetype (@sparestypes) { |
if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') { |
if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') { |
Line 12223 function updateCaptcha(caller,context) {
|
Line 11981 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 12001 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 12009 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 12295 function toggleDisplay(domForm,caller) {
|
Line 12036 function toggleDisplay(domForm,caller) {
|
if (document.getElementById(caller)) { |
if (document.getElementById(caller)) { |
var divitem = document.getElementById(caller); |
var divitem = document.getElementById(caller); |
var optionsElement = domForm.coursecredits; |
var optionsElement = domForm.coursecredits; |
var checkval = 1; |
|
var dispval = 'block'; |
|
if (caller == 'emailoptions') { |
if (caller == 'emailoptions') { |
optionsElement = domForm.cancreate_email; |
optionsElement = domForm.cancreate_email; |
} |
} |
if (caller == 'studentsubmission') { |
if (caller == 'studentsubmission') { |
optionsElement = domForm.postsubmit; |
optionsElement = domForm.postsubmit; |
} |
} |
if (caller == 'cloneinstcode') { |
|
optionsElement = domForm.canclone; |
|
checkval = 'instcode'; |
|
} |
|
if (optionsElement.length) { |
if (optionsElement.length) { |
var currval; |
var currval; |
for (var i=0; i<optionsElement.length; i++) { |
for (var i=0; i<optionsElement.length; i++) { |
Line 12314 function toggleDisplay(domForm,caller) {
|
Line 12049 function toggleDisplay(domForm,caller) {
|
currval = optionsElement[i].value; |
currval = optionsElement[i].value; |
} |
} |
} |
} |
if (currval == checkval) { |
if (currval == 1) { |
divitem.style.display = dispval; |
divitem.style.display = 'block'; |
} else { |
} else { |
divitem.style.display = 'none'; |
divitem.style.display = 'none'; |
} |
} |
Line 12338 sub captcha_phrases {
|
Line 12073 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)', |
|
); |
); |
} |
} |
|
|