version 1.524, 2012/08/23 14:17:12
|
version 1.550, 2015/04/28 13:34:12
|
Line 46 This module sets coursewide and assessme
|
Line 46 This module sets coursewide and assessme
|
|
|
=over |
=over |
|
|
=pod |
|
|
|
=item parmval() |
=item parmval() |
|
|
Figure out a cascading parameter. |
Figure out a cascading parameter. |
Line 139 javascript function 'pjump'.
|
Line 137 javascript function 'pjump'.
|
|
|
extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes. |
extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes. |
|
|
Input: See list below: |
Input: See list below |
|
|
|
=over 4 |
|
|
=item * B<env{'user.name'}> : Current username |
=item * B<env{'user.name'}> : Current username |
|
|
=item * B<env{'user.domain'}> : Domain of current user. |
=item * B<env{'user.domain'}> : Domain of current user. |
|
|
=item * b<env{"request.course.fn"} : Course |
=item * B<env{"request.course.fn"}> : Course |
|
|
|
=back |
|
|
Outputs: See list below: |
Outputs: See list below: |
|
|
|
=over 4 |
|
|
=item * B<ids> (out) : An array that will contain all of the ids in the course. |
=item * B<ids> (out) : An array that will contain all of the ids in the course. |
|
|
=item * B<typep>(out) : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>. |
=item * B<typep>(out) : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>. |
Line 173 Outputs: See list below:
|
Line 177 Outputs: See list below:
|
|
|
=item * B<defkeytype> |
=item * B<defkeytype> |
|
|
|
=back |
|
|
=item isdateparm() |
=item isdateparm() |
|
|
=item parmmenu() |
=item parmmenu() |
Line 210 Returns: nothing
|
Line 216 Returns: nothing
|
|
|
Variables used (guessed by Jeremy): |
Variables used (guessed by Jeremy): |
|
|
|
=over |
|
|
=item * B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type. |
=item * B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type. |
|
|
=item * B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? |
=item * B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? |
Line 222 Variables used (guessed by Jeremy):
|
Line 230 Variables used (guessed by Jeremy):
|
When storing information, store as part 0 |
When storing information, store as part 0 |
When requesting information, request from full part |
When requesting information, request from full part |
|
|
|
=back |
|
|
=item tablestart() |
=item tablestart() |
|
|
=item tableend() |
=item tableend() |
Line 288 Set portfolio metadata
|
Line 298 Set portfolio metadata
|
|
|
Main handler. Calls &assessparms subroutine. |
Main handler. Calls &assessparms subroutine. |
|
|
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 315 use LONCAPA qw(:DEFAULT :match);
|
Line 324 use LONCAPA qw(:DEFAULT :match);
|
|
|
|
|
sub startSettingsScreen { |
sub startSettingsScreen { |
my ($r,$mode)=@_; |
my ($r,$mode,$crstype)=@_; |
|
|
|
my $tabtext = &mt('Course Settings'); |
|
if ($crstype eq 'Community') { |
|
$tabtext = &mt('Community Settings'); |
|
} |
$r->print("\n".'<ul class="LC_TabContentBigger" id="main">'); |
$r->print("\n".'<ul class="LC_TabContentBigger" id="main">'); |
$r->print("\n".'<li'.($mode eq 'coursepref'?' class="active"':'').'><a href="/adm/courseprefs"><b> '. |
$r->print("\n".'<li'.($mode eq 'coursepref'?' class="active"':'').'><a href="/adm/courseprefs"><b> '. |
&mt('Course Settings'). |
$tabtext. |
' </b></a></li>'); |
' </b></a></li>'); |
|
|
$r->print("\n".'<li'.($mode eq 'parmset'?' class="active"':'').' id="tabbededitor"><a href="/adm/parmset"><b>'. |
$r->print("\n".'<li'.($mode eq 'parmset'?' class="active"':'').' id="tabbededitor"><a href="/adm/parmset"><b>'. |
Line 661 sub storeparm_by_symb {
|
Line 674 sub storeparm_by_symb {
|
} |
} |
|
|
sub log_parmset { |
sub log_parmset { |
return &Apache::lonnet::write_log('parameterlog',@_); |
return &Apache::lonnet::write_log('course','parameterlog',@_); |
} |
} |
|
|
sub storeparm_by_symb_inner { |
sub storeparm_by_symb_inner { |
Line 768 sub valout {
|
Line 781 sub valout {
|
my $result = ''; |
my $result = ''; |
# Values of zero are valid. |
# Values of zero are valid. |
if (! $value && $value ne '0') { |
if (! $value && $value ne '0') { |
if ($editable) { |
if ($editable) { |
$result = '<span class="LC_clickhere">*</span>'; |
$result = |
} else { |
'<img src="/res/adm/pages/editmap.png"' |
$result=' '; |
.' alt="'.&mt('Change').'"' |
} |
.' title="'.&mt('Change').'" style="border:0;" />'; |
|
} else { |
|
$result=' '; |
|
} |
} else { |
} else { |
if ($type eq 'date_interval') { |
if ($type eq 'date_interval') { |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
Line 916 function showHide_courseContent() {
|
Line 932 function showHide_courseContent() {
|
COURSECONTENTSCRIPT |
COURSECONTENTSCRIPT |
} |
} |
|
|
|
sub toggleparmtextbox_js { |
|
return <<"ENDSCRIPT"; |
|
|
|
if (!document.getElementsByClassName) { |
|
function getElementsByClassName(node, classname) { |
|
var a = []; |
|
var re = new RegExp('(^| )'+classname+'( |$)'); |
|
var els = node.getElementsByTagName("*"); |
|
for(var i=0,j=els.length; i<j; i++) |
|
if(re.test(els[i].className))a.push(els[i]); |
|
return a; |
|
} |
|
} |
|
|
|
function showHideLenient() { |
|
var lenients; |
|
var setRegExp = /^set_/; |
|
if (document.getElementsByClassName) { |
|
lenients = document.getElementsByClassName('LC_lenient_radio'); |
|
} else { |
|
lenients = getElementsByClassName(document.body,'LC_lenient_radio'); |
|
} |
|
if (lenients != 'undefined') { |
|
for (var i=0; i<lenients.length; i++) { |
|
if (lenients[i].checked) { |
|
if (lenients[i].value == 'weighted') { |
|
if (setRegExp.test(lenients[i].name)) { |
|
var identifier = lenients[i].name.replace(setRegExp,''); |
|
toggleParmTextbox(document.parmform,identifier); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function toggleParmTextbox(form,key) { |
|
var divfortext = document.getElementById('LC_parmtext_'+key); |
|
if (divfortext) { |
|
var caller = form.elements['set_'+key]; |
|
if (caller.length) { |
|
for (i=0; i<caller.length; i++) { |
|
if (caller[i].checked) { |
|
if (caller[i].value == 'weighted') { |
|
divfortext.style.display = 'inline'; |
|
} else { |
|
divfortext.style.display = 'none'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
ENDSCRIPT |
|
} |
|
|
|
sub validateparms_js { |
|
return <<'ENDSCRIPT'; |
|
|
|
function validateParms() { |
|
var textRegExp = /^settext_/; |
|
var tailLenient = /\.lenient$/; |
|
var patternRelWeight = /^\-?[\d.]+$/; |
|
var patternLenientStd = /^(yes|no|default)$/; |
|
var ipallowRegExp = /^setipallow_/; |
|
var ipdenyRegExp = /^setipdeny_/; |
|
var patternIP = /[\[\]\*\.a-zA-Z\d\-]+/; |
|
if ((document.parmform.elements.length != 'undefined') && (document.parmform.elements.length) != 'null') { |
|
if (document.parmform.elements.length) { |
|
for (i=0; i<document.parmform.elements.length; i++) { |
|
var name=document.parmform.elements[i].name; |
|
if (textRegExp.test(name)) { |
|
var identifier = name.replace(textRegExp,''); |
|
if (tailLenient.test(identifier)) { |
|
if (document.parmform.elements['set_'+identifier].length) { |
|
for (var j=0; j<document.parmform.elements['set_'+identifier].length; j++) { |
|
if (document.parmform.elements['set_'+identifier][j].checked) { |
|
if (!(patternLenientStd.test(document.parmform.elements['set_'+identifier][j].value))) { |
|
var relweight = document.parmform.elements[i].value; |
|
relweight = relweight.replace(/^\s+|\s+$/g,''); |
|
if (!patternRelWeight.test(relweight)) { |
|
relweight = '0.0'; |
|
} |
|
if (document.parmform.elements['set_'+identifier][j].value == 'weighted') { |
|
document.parmform.elements['set_'+identifier][j].value = relweight; |
|
} else { |
|
document.parmform.elements['set_'+identifier][j].value += ','+relweight; |
|
} |
|
} |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
if (ipallowRegExp.test(name)) { |
|
var identifier = name.replace(ipallowRegExp,''); |
|
var possallow = document.parmform.elements[i].value; |
|
possallow = possallow.replace(/^\s+|\s+$/g,''); |
|
if (patternIP.test(possallow)) { |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
possallow = ','+possallow; |
|
} |
|
document.parmform.elements['set_'+identifier].value += possallow; |
|
} |
|
} else { |
|
if (ipdenyRegExp.test(name)) { |
|
var identifier = name.replace(ipdenyRegExp,''); |
|
var possdeny = document.parmform.elements[i].value; |
|
possdeny = possdeny.replace(/^\s+|\s+$/g,''); |
|
if (patternIP.test(possdeny)) { |
|
possdeny = '!'+possdeny; |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
possdeny = ','+possdeny; |
|
} |
|
document.parmform.elements['set_'+identifier].value += possdeny; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return true; |
|
} |
|
|
|
ENDSCRIPT |
|
} |
|
|
|
sub ipacc_boxes_js { |
|
my $remove = &mt('Remove'); |
|
return <<"END"; |
|
\$(document).ready(function() { |
|
var wrapper = \$(".LC_string_ipacc_wrap"); |
|
var add_button = \$(".LC_add_ipacc_button"); |
|
var ipaccRegExp = /^LC_string_ipacc_/; |
|
|
|
\$(add_button).click(function(e){ |
|
e.preventDefault(); |
|
var identifier = \$(this).closest("div").attr("id"); |
|
identifier = identifier.replace(ipaccRegExp,''); |
|
\$(this).closest('div').find('.LC_string_ipacc_inner').append('<div><input type="text" name="setip'+identifier+'"/><a href="#" class="LC_remove_ipacc">$remove</a></div>'); |
|
}); |
|
|
|
\$(wrapper).delegate(".LC_remove_ipacc","click", function(e){ |
|
e.preventDefault(); \$(this).closest("div").remove(); |
|
}) |
|
}); |
|
|
|
|
|
END |
|
} |
|
|
sub startpage { |
sub startpage { |
my ($r,$psymb) = @_; |
my ($r,$psymb,$crstype) = @_; |
|
|
my %loaditems = ( |
my %loaditems = ( |
'onload' => "group_or_section('cgroup')", |
'onload' => "group_or_section('cgroup')", |
Line 951 sub startpage {
|
Line 1123 sub startpage {
|
my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'}); |
my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'}); |
my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'}); |
my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'}); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset'); |
&startSettingsScreen($r,'parmset',$crstype); |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<input type="hidden" value="" name="pres_value" /> |
<input type="hidden" value="" name="pres_value" /> |
Line 1009 sub print_row {
|
Line 1181 sub print_row {
|
my ($othergrp,$grp_parm,$controlgrp); |
my ($othergrp,$grp_parm,$controlgrp); |
|
|
if ($parmlev eq 'general') { |
if ($parmlev eq 'general') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} else { |
} else { |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} |
} |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} else { |
} else { |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} |
} |
} else { |
} else { |
if ($uname) { |
if ($uname) { |
Line 1048 sub print_row {
|
Line 1219 sub print_row {
|
} |
} |
} |
} |
|
|
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
|
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
|
if ($csec) { |
if ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
|
|
|
if ($cgroup) { |
if ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} |
} |
|
|
if ($uname) { |
if ($uname) { |
if ($othergrp) { |
if ($othergrp) { |
$r->print($othergrp); |
$r->print($othergrp); |
} |
} |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); |
} |
} |
|
|
} # end of $parmlev if/else |
} # end of $parmlev if/else |
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.'</td>'); |
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.'</td>'); |
Line 1103 sub print_td {
|
Line 1273 sub print_td {
|
if ($which > 3) { |
if ($which > 3) { |
$nolink = 1; |
$nolink = 1; |
} |
} |
|
} elsif ($mprefix =~ /examcode\&$/) { |
|
unless ($which == 2) { |
|
$nolink = 1; |
|
} |
} |
} |
if ($nolink) { |
if ($nolink) { |
$r->print(&valout($$outpar[$which],$$typeoutpar[$which])); |
$r->print(&valout($$outpar[$which],$$typeoutpar[$which])); |
Line 1256 sub extractResourceInformation {
|
Line 1430 sub extractResourceInformation {
|
$$mapp{$mapid}=$$mapp{$id}; |
$$mapp{$mapid}=$$mapp{$id}; |
$$allmaps{$mapid}=$$mapp{$id}; |
$$allmaps{$mapid}=$$mapp{$id}; |
if ($mapid eq '1') { |
if ($mapid eq '1') { |
$$maptitles{$mapid}=&mt('Main Course Documents'); |
$$maptitles{$mapid}=&mt('Main Content'); |
} else { |
} else { |
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id}); |
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id}); |
} |
} |
Line 1390 sub lookUpTableParameter {
|
Line 1564 sub lookUpTableParameter {
|
'contentopen' => 'time_settings', |
'contentopen' => 'time_settings', |
'contentclose' => 'time_settings', |
'contentclose' => 'time_settings', |
'discussend' => 'time_settings', |
'discussend' => 'time_settings', |
'printopendate' => 'time_settings', |
'printstartdate' => 'time_settings', |
'printclosedate' => 'time_settings', |
'printenddate' => 'time_settings', |
'weight' => 'grading', |
'weight' => 'grading', |
'handgrade' => 'grading', |
'handgrade' => 'grading', |
'maxtries' => 'tries', |
'maxtries' => 'tries', |
Line 1426 sub lookUpTableParameter {
|
Line 1600 sub lookUpTableParameter {
|
'lenient' => 'grading', |
'lenient' => 'grading', |
'retrypartial' => 'tries', |
'retrypartial' => 'tries', |
'discussvote' => 'misc', |
'discussvote' => 'misc', |
|
'examcode' => 'high_level_randomization', |
); |
); |
} |
} |
|
|
Line 1478 sub category_order {
|
Line 1652 sub category_order {
|
|
|
sub parmboxes { |
sub parmboxes { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my $tempkey; |
my %categories = &categories(); |
my $tempparameter; |
|
my %categories = &categories; |
|
my %category_order = &category_order(); |
my %category_order = &category_order(); |
my %categoryList = ( |
my %categoryList = ( |
'time_settings' => [], |
'time_settings' => [], |
Line 1495 sub parmboxes {
|
Line 1667 sub parmboxes {
|
'misc' => [], |
'misc' => [], |
); |
); |
|
|
foreach $tempparameter (keys %$allparms) { |
foreach my $tempparameter (keys(%$allparms)) { |
&whatIsMyCategory($tempparameter, \%categoryList); |
&whatIsMyCategory($tempparameter, \%categoryList); |
} |
} |
#part to print the parm-list |
#part to print the parm-list |
$r->print('<div class="LC_columnSection">'."\n"); |
foreach my $key (sort { $category_order{$a} <=> $category_order{$b} } keys(%categoryList)) { |
|
next if (@{$categoryList{$key}} == 0); |
#Print parameters |
next if ($key eq ''); |
for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) { |
$r->print('<div class="LC_Box LC_400Box">' |
if(@{$categoryList{$key}} == 0) { |
.'<h4 class="LC_hcell">'.&mt($categories{$key}).'</h4>'."\n"); |
next; |
foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
} else { |
$r->print('<span class="LC_nobreak">' |
$r->print('<div class="LC_Box LC_400Box">' |
.'<label><input type="checkbox" name="pscat" ' |
.'<h4 class="LC_hcell">' |
.'value="'.$tempkey.'" '); |
.&mt($categories{$key}) |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
.'</h4>'."\n"); |
$r->print( ' checked="checked"'); |
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
|
$r->print('<span class="LC_nobreak">' |
|
.'<label><input type="checkbox" name="pscat" '); |
|
$r->print('value="'.$tempkey.'" '); |
|
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
|
: $tempkey) |
|
.'</label></span><br />'."\n"); |
|
} |
} |
$r->print("</div>\n"); |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
|
: $tempkey) |
|
.'</label></span><br />'."\n"); |
} |
} |
|
$r->print('</div>'); |
} |
} |
|
$r->print("\n"); |
$r->print("</div>\n"); |
|
} |
} |
# |
# |
# This function offers some links on the parameter section to get with one click a group a parameters |
# This function offers some links on the parameter section to get with one click a group a parameters |
Line 1610 sub usermenu {
|
Line 1774 sub usermenu {
|
$sections .= qq| onchange="group_or_section('csec')" |; |
$sections .= qq| onchange="group_or_section('csec')" |; |
} |
} |
$sections .= '>'; |
$sections .= '>'; |
foreach my $section ('',sort keys %sectionhash) { |
foreach my $section ('',sort(keys(%sectionhash))) { |
$sections.='<option value="'.$section.'" '. |
$sections.='<option value="'.$section.'" '. |
($section eq $csec?'selected="selected"':'').'>'.$section. |
($section eq $csec?'selected="selected"':'').'>'.$section. |
'</option>'; |
'</option>'; |
Line 1655 function group_or_section(caller) {
|
Line 1819 function group_or_section(caller) {
|
$groups .= qq| onchange="group_or_section('cgroup')" |; |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
} |
} |
$groups .= '>'; |
$groups .= '>'; |
foreach my $grp ('',sort keys %grouphash) { |
foreach my $grp ('',sort(keys(%grouphash))) { |
$groups.='<option value="'.$grp.'" '; |
$groups.='<option value="'.$grp.'" '; |
if ($grp eq $cgroup) { |
if ($grp eq $cgroup) { |
unless ((defined($uname)) && ($grp eq '')) { |
unless ((defined($uname)) && ($grp eq '')) { |
Line 1690 function group_or_section(caller) {
|
Line 1854 function group_or_section(caller) {
|
# This function shows on table Mode the available Parameters for the selected Resources |
# This function shows on table Mode the available Parameters for the selected Resources |
# |
# |
sub displaymenu { |
sub displaymenu { |
my ($r,$allparms,$pscat,$psprt,$keyorder)=@_; |
my ($r,$allparms,$pscat,$psprt,$keyorder,$divid)=@_; |
|
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
|
|
&parmmenu($r,$allparms,$pscat,$keyorder); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::loncommon::start_scrollbox()); |
$r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid)); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::loncommon::end_scrollbox()); |
$r->print(&Apache::loncommon::end_scrollbox()); |
|
|
Line 1770 sub mapmenu {
|
Line 1934 sub mapmenu {
|
.'</div>' |
.'</div>' |
); |
); |
|
|
$r->print(&Apache::loncommon::start_scrollbox(undef,undef,undef,'mapmenuscroll')); |
$r->print(&Apache::loncommon::start_scrollbox('700px','680px','400px','mapmenuscroll')); |
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner')); |
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner')); |
|
|
# Display row: "All Maps or Folders" |
# Display row: "All Maps or Folders" |
Line 1789 sub mapmenu {
|
Line 1953 sub mapmenu {
|
.&Apache::loncommon::end_data_table_row() |
.&Apache::loncommon::end_data_table_row() |
); |
); |
|
|
# Display row: "Main Course Documents" |
# Display row: "Main Content" |
if (exists($$allmaps{1})) { |
if (exists($$allmaps{1})) { |
$r->print( |
$r->print( |
&Apache::loncommon::start_data_table_row() |
&Apache::loncommon::start_data_table_row() |
Line 1861 sub mapmenu {
|
Line 2025 sub mapmenu {
|
sub levelmenu { |
sub levelmenu { |
my ($r,$alllevs,$parmlev)=@_; |
my ($r,$alllevs,$parmlev)=@_; |
|
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameter Level').&Apache::loncommon::help_open_topic('Course_Parameter_Levels'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameter Level'). |
|
&Apache::loncommon::help_open_topic('Course_Parameter_Levels'))); |
$r->print('<select id="parmlev" name="parmlev" onchange="showHide_courseContent()">'); |
$r->print('<select id="parmlev" name="parmlev" onchange="showHide_courseContent()">'); |
foreach (reverse sort keys %{$alllevs}) { |
foreach my $lev (reverse(sort(keys(%{$alllevs})))) { |
$r->print('<option value="'.$$alllevs{$_}.'"'); |
$r->print('<option value="'.$$alllevs{$lev}.'"'); |
if ($parmlev eq $$alllevs{$_}) { |
if ($parmlev eq $$alllevs{$lev}) { |
$r->print(' selected="selected"'); |
$r->print(' selected="selected"'); |
} |
} |
$r->print('>'.&mt($_).'</option>'); |
$r->print('>'.&mt($lev).'</option>'); |
} |
} |
$r->print("</select>"); |
$r->print("</select>"); |
} |
} |
Line 1880 sub sectionmenu {
|
Line 2045 sub sectionmenu {
|
return if (!%sectionhash); |
return if (!%sectionhash); |
|
|
$r->print('<select name="Section" multiple="multiple" size="8">'); |
$r->print('<select name="Section" multiple="multiple" size="8">'); |
foreach my $s ('all',sort keys %sectionhash) { |
foreach my $s ('all',sort(keys(%sectionhash))) { |
$r->print(' <option value="'.$s.'"'); |
$r->print(' <option value="'.$s.'"'); |
foreach (@{$selectedsections}) { |
foreach my $sec (@{$selectedsections}) { |
if ($s eq $_) { |
if ($s eq $sec) { |
$r->print(' selected="selected"'); |
$r->print(' selected="selected"'); |
last; |
last; |
|
} |
} |
} |
} |
$r->print('>'.$s."</option>\n"); |
$r->print('>'.$s."</option>\n"); |
|
} |
} |
$r->print("</select>\n"); |
$r->print("</select>\n"); |
} |
} |
Line 1900 sub groupmenu {
|
Line 2065 sub groupmenu {
|
|
|
$r->print('<select name="Group" multiple="multiple" size="8">'); |
$r->print('<select name="Group" multiple="multiple" size="8">'); |
foreach my $group (sort(keys(%grouphash))) { |
foreach my $group (sort(keys(%grouphash))) { |
$r->print(' <option value="'.$group.'"'); |
$r->print(' <option value="'.$group.'"'); |
foreach (@{$selectedgroups}) { |
foreach my $grp (@{$selectedgroups}) { |
if ($group eq $_) { |
if ($group eq $grp) { |
$r->print(' selected="selected"'); |
$r->print(' selected="selected"'); |
last; |
last; |
|
} |
} |
} |
} |
$r->print('>'.$group."</option>\n"); |
$r->print('>'.$group."</option>\n"); |
|
} |
} |
$r->print("</select>\n"); |
$r->print("</select>\n"); |
} |
} |
Line 1922 sub keysinorder {
|
Line 2087 sub keysinorder {
|
my ($name,$keyorder)=@_; |
my ($name,$keyorder)=@_; |
return sort { |
return sort { |
$$keyorder{$a} <=> $$keyorder{$b}; |
$$keyorder{$a} <=> $$keyorder{$b}; |
} (keys %{$name}); |
} (keys(%{$name})); |
} |
} |
|
|
sub keysinorder_bytype { |
sub keysinorder_bytype { |
Line 1934 sub keysinorder_bytype {
|
Line 2099 sub keysinorder_bytype {
|
return ($a cmp $b); |
return ($a cmp $b); |
} |
} |
$$keyorder{'parameter_0_'.$ta} <=> $$keyorder{'parameter_0_'.$tb}; |
$$keyorder{'parameter_0_'.$ta} <=> $$keyorder{'parameter_0_'.$tb}; |
} (keys %{$name}); |
} (keys(%{$name})); |
} |
} |
|
|
sub keysindisplayorder { |
sub keysindisplayorder { |
my ($name,$keyorder)=@_; |
my ($name,$keyorder)=@_; |
return sort { |
return sort { |
$$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; |
$$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; |
} (keys %{$name}); |
} (keys(%{$name})); |
} |
} |
|
|
sub sortmenu { |
sub sortmenu { |
Line 1981 sub standardkeyorder {
|
Line 2146 sub standardkeyorder {
|
'parameter_0_discussend' => 19, |
'parameter_0_discussend' => 19, |
'parameter_0_discusshide' => 20, |
'parameter_0_discusshide' => 20, |
'parameter_0_discussvote' => 21, |
'parameter_0_discussvote' => 21, |
'parameter_0_printopendate' => 22, |
'parameter_0_printstartdate' => 22, |
'parameter_0_printclosedate' => 23); |
'parameter_0_printenddate' => 23); |
} |
} |
|
|
|
|
Line 2085 sub assessparms {
|
Line 2250 sub assessparms {
|
$id=''; |
$id=''; |
} else { |
} else { |
$message= |
$message= |
'<span class="LC_error">'.&mt("Unknown ID")." '$id' ". |
'<p class="LC_warning">'. |
&mt('at domain')." '$udom'</span>"; |
&mt('Unknown ID [_1] at domain [_2]', |
|
"'".$id."'","'".$udom."'"). |
|
'</p>'; |
} |
} |
} else { |
} else { |
$uname=$env{'form.uname'}; |
$uname=$env{'form.uname'}; |
Line 2097 sub assessparms {
|
Line 2264 sub assessparms {
|
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
if ($uhome eq 'no_host') { |
if ($uhome eq 'no_host') { |
$message= |
$message= |
'<span class="LC_error">'.&mt("Unknown user")." '$uname' ". |
'<p class="LC_warning">'. |
&mt("at domain")." '$udom'</span>"; |
&mt('Unknown user [_1] at domain [_2]', |
|
"'".$uname."'","'".$udom."'"). |
|
'</p>'; |
$uname=''; |
$uname=''; |
} else { |
} else { |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
if ($csec eq '-1') { |
if ($csec eq '-1') { |
$message='<span class="LC_error">'. |
$message= |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
'<p class="LC_warning">'. |
&mt("not in this course")."</span>"; |
&mt('User [_1] at domain [_2] not in this course', |
|
"'".$uname."'","'".$udom."'"). |
|
'</p>'; |
$uname=''; |
$uname=''; |
$csec=$env{'form.csec'}; |
$csec=$env{'form.csec'}; |
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
Line 2149 sub assessparms {
|
Line 2320 sub assessparms {
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my $totalstored = 0; |
my $totalstored = 0; |
|
my $now = time; |
|
|
for (my $i=0;$i<=$#markers;$i++) { |
for (my $i=0;$i<=$#markers;$i++) { |
my ($needsrelease,$needsnewer,$name); |
my ($needsrelease,$needsnewer,$name); |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
Line 2183 sub assessparms {
|
Line 2353 sub assessparms {
|
} |
} |
} |
} |
} |
} |
} elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote)\&\d+$/) { |
} elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode|printstartdate|printenddate|acc)\&\d+$/) { |
$name = $1; |
$name = $1; |
|
my $val = $values[$i]; |
|
my $valmatch = ''; |
|
if ($name eq 'examcode') { |
|
if (&Apache::lonnet::validCODE($values[$i])) { |
|
$val = 'valid'; |
|
} |
|
} elsif ($name eq 'printstartdate') { |
|
if ($val =~ /^\d+$/) { |
|
if ($val > $now) { |
|
$val = 'future'; |
|
} |
|
} |
|
} elsif ($name eq 'printenddate') { |
|
if ($val =~ /^\d+$/) { |
|
if ($val < $now) { |
|
$val = 'past'; |
|
} |
|
} |
|
} elsif (($name eq 'lenient') || ($name eq 'acc')) { |
|
my $stringtype = &get_stringtype($name); |
|
my $stringmatch = &standard_string_matches($stringtype); |
|
if (ref($stringmatch) eq 'ARRAY') { |
|
foreach my $item (@{$stringmatch}) { |
|
if (ref($item) eq 'ARRAY') { |
|
my ($regexpname,$pattern) = @{$item}; |
|
if ($pattern ne '') { |
|
if ($val =~ /$pattern/) { |
|
$valmatch = $regexpname; |
|
$val = ''; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
$needsrelease = |
$needsrelease = |
$Apache::lonnet::needsrelease{"parameter:$name:$values[$i]"}; |
$Apache::lonnet::needsrelease{"parameter:$name:$val:$valmatch"}; |
if ($needsrelease) { |
if ($needsrelease) { |
unless ($got_chostname) { |
unless ($got_chostname) { |
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
$got_chostname = 1; |
$got_chostname = 1; |
} |
} |
$needsnewer = ¶meter_releasecheck($name,$values[$i], |
$needsnewer = ¶meter_releasecheck($name,$val,$valmatch, |
$needsrelease, |
$needsrelease, |
$chostname, |
|
$cmajor,$cminor); |
$cmajor,$cminor); |
} |
} |
} |
} |
Line 2218 sub assessparms {
|
Line 2423 sub assessparms {
|
} |
} |
} |
} |
#----------------------------------------------- if all selected, fill in array |
#----------------------------------------------- if all selected, fill in array |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if ($pscat[0] eq "all") {@pscat = (keys(%allparms));} |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries','type','problemstatus') }; |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries','type','problemstatus') }; |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys(%allparts));} |
# ------------------------------------------------------------------ Start page |
# ------------------------------------------------------------------ Start page |
|
|
&startpage($r,$pssymb); |
my $crstype = &Apache::loncommon::course_type(); |
|
&startpage($r,$pssymb,$crstype); |
|
|
foreach ('tolerance','date_default','date_start','date_end', |
foreach my $item ('tolerance','date_default','date_start','date_end', |
'date_interval','int','float','string') { |
'date_interval','int','float','string') { |
$r->print('<input type="hidden" value="'. |
$r->print('<input type="hidden" value="'. |
&HTML::Entities::encode($env{'form.recent_'.$_},'"&<>'). |
&HTML::Entities::encode($env{'form.recent_'.$item},'"&<>'). |
'" name="recent_'.$_.'" />'); |
'" name="recent_'.$item.'" />'); |
} |
} |
|
|
# ----- Start Parameter Selection |
# ----- Start Parameter Selection |
Line 2275 ENDPARMSELSCRIPT
|
Line 2481 ENDPARMSELSCRIPT
|
|
|
# Step 2 |
# Step 2 |
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2')); |
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2')); |
&displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder); |
&displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder,'parmmenuscroll'); |
|
|
# Step 3 |
# Step 3 |
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3')); |
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3')); |
Line 2303 ENDPARMSELSCRIPT
|
Line 2509 ENDPARMSELSCRIPT
|
.'</a>' |
.'</a>' |
.'</p>'); |
.'</p>'); |
} else { |
} else { |
$r->print(); |
|
# parameter screen for a single resource. |
# parameter screen for a single resource. |
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my $title = &Apache::lonnet::gettitle($pssymb); |
my $title = &Apache::lonnet::gettitle($pssymb); |
Line 2337 ENDPARMSELSCRIPT
|
Line 2542 ENDPARMSELSCRIPT
|
|
|
@pscat = @temp_pscat; |
@pscat = @temp_pscat; |
|
|
|
|
if (($env{'form.prevvisit'}) || ($pschp) || ($pssymb)) { |
if (($env{'form.prevvisit'}) || ($pschp) || ($pssymb)) { |
# ----------------------------------------------------------------- Start Table |
# ----------------------------------------------------------------- Start Table |
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
Line 2364 ENDPARMSELSCRIPT
|
Line 2570 ENDPARMSELSCRIPT
|
$userspan ++; |
$userspan ++; |
} |
} |
$r->print('<th colspan="'.$userspan.'" rowspan="2">'); |
$r->print('<th colspan="'.$userspan.'" rowspan="2">'); |
$r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>"); |
$r->print(&mt('User [_1] at Domain [_2]',"'".$uname."'","'".$udom."'").'</th>'); |
} |
} |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'pie' => "Parameter in Effect", |
'pie' => "Parameter in Effect", |
Line 2427 ENDTABLEHEADFOUR
|
Line 2633 ENDTABLEHEADFOUR
|
my $defbgtwo=''; |
my $defbgtwo=''; |
my $defbgthree = ''; |
my $defbgthree = ''; |
|
|
foreach (@ids) { |
foreach my $rid (@ids) { |
|
|
my $rid=$_; |
|
my ($inmapid)=($rid=~/\.(\d+)$/); |
my ($inmapid)=($rid=~/\.(\d+)$/); |
|
|
if ((!$pssymb && |
if ((!$pssymb && |
Line 2463 ENDTABLEHEADFOUR
|
Line 2668 ENDTABLEHEADFOUR
|
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
|
my $filter=$env{'form.filter'}; |
my $filter=$env{'form.filter'}; |
foreach (&keysplit($keyp{$rid})) { |
foreach my $tempkeyp (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
|
if (grep $_ eq $tempkeyp, @catmarker) { |
if (grep $_ eq $tempkeyp, @catmarker) { |
my $parmname=&Apache::lonnet::metadata($uri,$_.'.name'); |
my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name'); |
# We may only want certain parameters listed |
# We may only want certain parameters listed |
if ($filter) { |
if ($filter) { |
unless ($filter=~/\Q$parmname\E/) { next; } |
unless ($filter=~/\Q$parmname\E/) { next; } |
} |
} |
$name{$_}=$parmname; |
$name{$tempkeyp}=$parmname; |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part'); |
|
|
my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display'); |
if ($allparms{$name{$_}} ne '') { |
if ($allparms{$name{$tempkeyp}} ne '') { |
my $identifier; |
my $identifier; |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
if ($parmdis =~ /(\s*\[Part.*)$/) { |
$identifier = $1; |
$identifier = $1; |
} |
} |
$display{$_} = $allparms{$name{$_}}.$identifier; |
$display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; |
} else { |
} else { |
$display{$_} = $parmdis; |
$display{$tempkeyp} = $parmdis; |
} |
} |
unless ($display{$_}) { $display{$_}=''; } |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$display{$_}.=' ('.$name{$_}.')'; |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$default{$_}=&Apache::lonnet::metadata($uri,$_); |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp); |
$type{$_}=&Apache::lonnet::metadata($uri,$_.'.type'); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type'); |
$thistitle=&Apache::lonnet::metadata($uri,$_.'.title'); |
$thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title'); |
} |
} |
} |
} |
my $totalparms=scalar keys %name; |
my $totalparms=scalar(keys(%name)); |
if ($totalparms>0) { |
if ($totalparms>0) { |
my $firstrow=1; |
my $firstrow=1; |
my $title=&Apache::lonnet::gettitle($symbp{$rid}); |
my $title=&Apache::lonnet::gettitle($symbp{$rid}); |
Line 2517 ENDTABLEHEADFOUR
|
Line 2721 ENDTABLEHEADFOUR
|
$r->print('<td style="background-color:'.$defbgone.';"'. |
$r->print('<td style="background-color:'.$defbgone.';"'. |
' rowspan='.$totalparms. |
' rowspan='.$totalparms. |
'>'.$maptitles{$mapp{$rid}}.'</td>'); |
'>'.$maptitles{$mapp{$rid}}.'</td>'); |
foreach (&keysinorder_bytype(\%name,\%keyorder)) { |
foreach my $item (&keysinorder_bytype(\%name,\%keyorder)) { |
|
|
unless ($firstrow) { |
unless ($firstrow) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
} else { |
} else { |
undef $firstrow; |
undef $firstrow; |
} |
} |
&print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default, |
&print_row($r,$item,\%part,\%name,\%symbp,$rid,\%default, |
\%type,\%display,$defbgone,$defbgtwo, |
\%type,\%display,$defbgone,$defbgtwo, |
$defbgthree,$parmlev,$uname,$udom,$csec, |
$defbgthree,$parmlev,$uname,$udom,$csec, |
$cgroup,\@usersgroups); |
$cgroup,\@usersgroups); |
Line 2551 ENDTABLEHEADFOUR
|
Line 2754 ENDTABLEHEADFOUR
|
|
|
#-------------------------------------------- for each map, gather information |
#-------------------------------------------- for each map, gather information |
my $mapid; |
my $mapid; |
foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) { |
foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys(%maplist)) { |
my $maptitle = $maplist{$mapid}; |
my $maptitle = $maplist{$mapid}; |
|
|
#----------------------- loop through ids and get all parameter types for map |
#----------------------- loop through ids and get all parameter types for map |
Line 2565 ENDTABLEHEADFOUR
|
Line 2768 ENDTABLEHEADFOUR
|
|
|
# $r->print("Catmarker: @catmarker<br />\n"); |
# $r->print("Catmarker: @catmarker<br />\n"); |
|
|
foreach (@ids) { |
foreach my $id (@ids) { |
($map)=(/([\d]*?)\./); |
($map)=($id =~ /([\d]*?)\./); |
my $rid = $_; |
my $rid = $id; |
|
|
# $r->print("$mapid:$map: $rid <br /> \n"); |
# $r->print("$mapid:$map: $rid <br /> \n"); |
|
|
Line 2582 ENDTABLEHEADFOUR
|
Line 2785 ENDTABLEHEADFOUR
|
# When storing information, store as part 0 |
# When storing information, store as part 0 |
# When requesting information, request from full part |
# When requesting information, request from full part |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
foreach (&keysplit($keyp{$rid})) { |
foreach my $fullkeyp (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $fullkeyp; |
my $fullkeyp = $tempkeyp; |
$tempkeyp =~ s/_\w+_/_0_/; |
$tempkeyp =~ s/_\w+_/_0_/; |
|
|
|
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
$part{$tempkeyp}="0"; |
$part{$tempkeyp}="0"; |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
Line 2646 ENDTABLEHEADFOUR
|
Line 2848 ENDTABLEHEADFOUR
|
.&Apache::loncommon::end_data_table_header_row() |
.&Apache::loncommon::end_data_table_header_row() |
); |
); |
|
|
foreach (&keysinorder(\%name,\%keyorder)) { |
foreach my $item (&keysinorder(\%name,\%keyorder)) { |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
$parmlev,$uname,$udom,$csec,$cgroup); |
$parmlev,$uname,$udom,$csec,$cgroup); |
} |
} |
Line 2673 ENDTABLEHEADFOUR
|
Line 2875 ENDTABLEHEADFOUR
|
my %type = (); |
my %type = (); |
my %default = (); |
my %default = (); |
|
|
foreach (@ids) { |
foreach $id (@ids) { |
my $rid = $_; |
my $rid = $id; |
|
|
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
|
Line 2685 ENDTABLEHEADFOUR
|
Line 2887 ENDTABLEHEADFOUR
|
# When storing information, store as part 0 |
# When storing information, store as part 0 |
# When requesting information, request from full part |
# When requesting information, request from full part |
#------------------------------------------------------------------- |
#------------------------------------------------------------------- |
foreach (&keysplit($keyp{$rid})) { |
foreach my $fullkeyp (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $fullkeyp; |
my $fullkeyp = $tempkeyp; |
$tempkeyp =~ s/_\w+_/_0_/; |
$tempkeyp =~ s/_\w+_/_0_/; |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
|
$part{$tempkeyp}="0"; |
$part{$tempkeyp}="0"; |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
Line 2737 ENDMAPONE
|
Line 2938 ENDMAPONE
|
.&Apache::loncommon::end_data_table_header_row() |
.&Apache::loncommon::end_data_table_header_row() |
); |
); |
|
|
foreach (&keysinorder(\%name,\%keyorder)) { |
foreach my $item (&keysinorder(\%name,\%keyorder)) { |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
$parmlev,$uname,$udom,$csec,$cgroup); |
$parmlev,$uname,$udom,$csec,$cgroup); |
} |
} |
Line 2785 sub readdata {
|
Line 2986 sub readdata {
|
# Read userdata |
# Read userdata |
|
|
my $classlist=&Apache::loncoursedata::get_classlist(); |
my $classlist=&Apache::loncoursedata::get_classlist(); |
foreach (keys %$classlist) { |
foreach my $user (keys(%$classlist)) { |
if ($_=~/^($match_username)\:($match_domain)$/) { |
if ($user=~/^($match_username)\:($match_domain)$/) { |
my ($tuname,$tudom)=($1,$2); |
my ($tuname,$tudom)=($1,$2); |
my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom); |
my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom); |
foreach my $userkey (keys %{$useropt}) { |
foreach my $userkey (keys(%{$useropt})) { |
if ($userkey=~/^$env{'request.course.id'}/) { |
if ($userkey=~/^\Q$env{'request.course.id'}\E/) { |
my $newkey=$userkey; |
my $newkey=$userkey; |
$newkey=~s/^($env{'request.course.id'}\.)/$1\[useropt\:$tuname\:$tudom\]\./; |
$newkey=~s/^($env{'request.course.id'}\.)/$1\[useropt\:$tuname\:$tudom\]\./; |
$$resourcedata{$newkey}=$$useropt{$userkey}; |
$$resourcedata{$newkey}=$$useropt{$userkey}; |
} |
} |
|
} |
} |
} |
} |
} |
} |
|
return $resourcedata; |
return $resourcedata; |
} |
} |
|
|
Line 2814 sub storedata {
|
Line 3015 sub storedata {
|
my @deldata=(); |
my @deldata=(); |
undef @deldata; |
undef @deldata; |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
|
my $now = time; |
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
my $cmd=$1; |
my $cmd=$1; |
my $thiskey=$2; |
my $thiskey=$2; |
|
next if ($cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny'); |
my ($tuname,$tudom)=&extractuser($thiskey); |
my ($tuname,$tudom)=&extractuser($thiskey); |
my $tkey=$thiskey; |
my $tkey=$thiskey; |
if ($tuname) { |
if ($tuname) { |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
} |
} |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
my ($data, $typeof, $text, $name); |
my ($data, $typeof, $text, $name, $valchk, $valmatch); |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
$data=$env{$key}; |
$data=$env{$key}; |
|
$valmatch = ''; |
|
$valchk = $data; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified parameter for'); |
$text = &mt('Saved modified parameter for'); |
if ($typeof eq 'string_questiontype') { |
if ($typeof eq 'string_questiontype') { |
$name = 'type'; |
$name = 'type'; |
} elsif ($typeof eq 'string_lenient') { |
} elsif ($typeof eq 'string_lenient') { |
$name = 'lenient'; |
$name = 'lenient'; |
|
my $stringmatch = &standard_string_matches($typeof); |
|
if (ref($stringmatch) eq 'ARRAY') { |
|
foreach my $item (@{$stringmatch}) { |
|
if (ref($item) eq 'ARRAY') { |
|
my ($regexpname,$pattern) = @{$item}; |
|
if ($pattern ne '') { |
|
if ($data =~ /$pattern/) { |
|
$valmatch = $regexpname; |
|
$valchk = ''; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} |
} elsif ($typeof eq 'string_discussvote') { |
} elsif ($typeof eq 'string_discussvote') { |
$name = 'discussvote'; |
$name = 'discussvote'; |
|
} elsif ($typeof eq 'string_examcode') { |
|
$name = 'examcode'; |
|
if (&Apache::lonnet::validCODE($data)) { |
|
$valchk = 'valid'; |
|
} |
} elsif ($typeof eq 'string_yesno') { |
} elsif ($typeof eq 'string_yesno') { |
if ($thiskey =~ /\.retrypartial$/) { |
if ($thiskey =~ /\.retrypartial$/) { |
$name = 'retrypartial'; |
$name = 'retrypartial'; |
} |
} |
} |
} |
if ($name ne '') { |
} elsif ($cmd eq 'datepointer') { |
my ($needsrelease,$needsnewer); |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
$needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$data"}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
if ($needsrelease) { |
$text = &mt('Saved modified date for'); |
unless ($got_chostname) { |
if ($typeof eq 'date_start') { |
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
if ($thiskey =~ /\.printstartdate$/) { |
$got_chostname = 1; |
$name = 'printstartdate'; |
|
if (($data) && ($data > $now)) { |
|
$valchk = 'future'; |
} |
} |
$needsnewer = ¶meter_releasecheck($name,$data, |
|
$needsrelease, |
|
$chostname,$cmajor, |
|
$cminor); |
|
} |
} |
|
} elsif ($typeof eq 'date_end') { |
|
if ($thiskey =~ /\.printenddate$/) { |
|
$name = 'printenddate'; |
|
if (($data) && ($data < $now)) { |
|
$valchk = 'past'; |
|
} |
|
} |
|
} |
|
} elsif ($cmd eq 'dateinterval') { |
|
$data=&get_date_interval_from_form($thiskey); |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} |
|
if ($name ne '') { |
|
my ($needsrelease,$needsnewer); |
|
$needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$valchk:$valmatch"}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = ¶meter_releasecheck($name,$valchk,$valmatch, |
|
$needsrelease, |
|
$cmajor,$cminor); |
if ($needsnewer) { |
if ($needsnewer) { |
$r->print('<br />'.&oldversion_warning($name,$data, |
$r->print('<br />'.&oldversion_warning($name,$data, |
$chostname,$cmajor, |
$chostname,$cmajor, |
Line 2860 sub storedata {
|
Line 3107 sub storedata {
|
next; |
next; |
} |
} |
} |
} |
} elsif ($cmd eq 'datepointer') { |
|
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} elsif ($cmd eq 'dateinterval') { |
|
$data=&get_date_interval_from_form($thiskey); |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} |
} |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if ($tuname) { |
if ($tuname) { |
Line 2905 sub storedata {
|
Line 3144 sub storedata {
|
} |
} |
# Store all course level |
# Store all course level |
my $delentries=$#deldata+1; |
my $delentries=$#deldata+1; |
my @newdatakeys=keys %newdata; |
my @newdatakeys=keys(%newdata); |
my $putentries=$#newdatakeys+1; |
my $putentries=$#newdatakeys+1; |
if ($delentries) { |
if ($delentries) { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
my %loghash=map { $_ => '' } @deldata; |
my %loghash=map { $_ => '' } @deldata; |
&log_parmset(\%loghash,1); |
&log_parmset(\%loghash,1); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries)); |
$r->print('<h2>'.&mt('Deleted [quant,_1,parameter]',$delentries/2).'</h2>'); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</div>'); |
&mt('Error deleting parameters').'</div>'); |
Line 2921 sub storedata {
|
Line 3160 sub storedata {
|
if ($putentries) { |
if ($putentries) { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
&log_parmset(\%newdata,0); |
&log_parmset(\%newdata,0); |
$r->print('<h3>'.&mt('Saved [_1] parameter(s)',$putentries/2).'</h3>'); |
$r->print('<h3>'.&mt('Saved [quant,_1,parameter]',$putentries/2).'</h3>'); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error saving parameters').'</div>'); |
&mt('Error saving parameters').'</div>'); |
Line 3006 sub listdata {
|
Line 3245 sub listdata {
|
} |
} |
|
|
$result; |
$result; |
} keys %{$listdata}) { |
} keys(%{$listdata})) { |
|
|
if ($$listdata{$thiskey.'.type'}) { |
if ($$listdata{$thiskey.'.type'}) { |
my $thistype=$$listdata{$thiskey.'.type'}; |
my $thistype=$$listdata{$thiskey.'.type'}; |
Line 3145 sub default_selector {
|
Line 3384 sub default_selector {
|
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'" />'; |
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'" />'; |
} |
} |
|
|
|
sub string_ip_selector { |
|
my ($thiskey, $showval) = @_; |
|
my %access = ( |
|
allow => [], |
|
deny => [], |
|
); |
|
if ($showval ne '') { |
|
my @current; |
|
if ($showval =~ /,/) { |
|
@current = split(/,/,$showval); |
|
} else { |
|
@current = ($showval); |
|
} |
|
foreach my $item (@current) { |
|
if ($item =~ /^\!([\[\]a-zA-Z\.\d\*\-]+)$/) { |
|
push(@{$access{'deny'}},$1); |
|
} elsif ($item =~ /^([\[\]a-zA-Z\.\d\*\-]+)$/) { |
|
push(@{$access{'allow'}},$item); |
|
} |
|
} |
|
} |
|
if (!@{$access{'allow'}}) { |
|
@{$access{'allow'}} = (''); |
|
} |
|
if (!@{$access{'deny'}}) { |
|
@{$access{'deny'}} = (''); |
|
} |
|
my $output = '<input type="hidden" name="set_'.$thiskey.'" /> |
|
<table><tr><th>'.&mt('Allow from').'</th><th>'.&mt('Deny from').'</th></tr><tr>'; |
|
foreach my $acctype ('allow','deny') { |
|
$output .= ' |
|
<td valign="top"> |
|
<div class="LC_string_ipacc_wrap" id="LC_string_ipacc_'.$acctype.'_'.$thiskey.'"> |
|
<div class="LC_string_ipacc_inner">'."\n"; |
|
my $num = 0; |
|
foreach my $curr (@{$access{$acctype}}) { |
|
$output .= '<div><input type="text" name="setip'.$acctype.'_'.$thiskey.'" value="'.$curr.'">'; |
|
if ($num > 0) { |
|
$output .= '<a href="#" class="LC_remove_ipacc">'.&mt('Remove').'</a>'; |
|
} |
|
$output .= '</div>'."\n"; |
|
$num ++; |
|
} |
|
$output .= ' |
|
</div> |
|
<button class="LC_add_ipacc_button">'.&mt('Add more').'</button> |
|
</div> |
|
</td>'; |
|
} |
|
$output .= ' |
|
</tr> |
|
</table>'."\n"; |
|
return $output; |
|
} |
|
|
|
{ |
my %strings = |
my %strings = |
( |
( |
'string_yesno' |
'string_yesno' |
Line 3159 my %strings =
|
Line 3454 my %strings =
|
=> [[ 'problem', 'Standard Problem'], |
=> [[ 'problem', 'Standard Problem'], |
[ 'survey', 'Survey'], |
[ 'survey', 'Survey'], |
[ 'anonsurveycred', 'Anonymous Survey (credit for submission)'], |
[ 'anonsurveycred', 'Anonymous Survey (credit for submission)'], |
[ 'exam', 'Exam'], |
[ 'exam', 'Bubblesheet Exam'], |
[ 'anonsurvey', 'Anonymous Survey'], |
[ 'anonsurvey', 'Anonymous Survey'], |
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], |
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], |
[ 'practice', 'Practice'], |
[ 'practice', 'Practice'], |
Line 3167 my %strings =
|
Line 3462 my %strings =
|
'string_lenient' |
'string_lenient' |
=> [['yes', 'Yes' ], |
=> [['yes', 'Yes' ], |
[ 'no', 'No' ], |
[ 'no', 'No' ], |
[ 'default', 'Default - only bubblesheet grading is lenient' ]], |
[ 'default', 'Default - only bubblesheet grading is lenient' ], |
|
[ 'weighted', 'Yes, weighted (optionresponse in checkbox mode)' ]], |
'string_discussvote' |
'string_discussvote' |
=> [['yes','Yes'], |
=> [['yes','Yes'], |
['notended','Yes, unless discussion ended'], |
['notended','Yes, unless discussion ended'], |
['no','No']], |
['no','No']], |
|
'string_ip' |
|
=> [['_allowfrom_','Hostname(s), or IP(s) from which access is allowed'], |
|
['_denyfrom_',], 'Hostname(s) or IP(s) from which access is disallowed'], |
); |
); |
|
|
|
my %stringmatches = ( |
|
'string_lenient' |
|
=> [['weighted','^\-?[.\d]+,\-?[.\d]+,\-?[.\d]+,\-?[.\d]+$'],], |
|
'string_ip' |
|
=> [['_allowfrom_','[^\!]+'], |
|
['_denyfrom_','\!']], |
|
); |
|
|
|
my %stringtypes = ( |
|
type => 'string_questiontype', |
|
lenient => 'string_lenient', |
|
retrypartial => 'string_yesno', |
|
discussvote => 'string_discussvote', |
|
examcode => 'string_examcode', |
|
acc => 'string_ip', |
|
); |
|
|
sub standard_string_options { |
sub standard_string_options { |
my ($string_type) = @_; |
my ($string_type) = @_; |
if (ref($strings{$string_type}) eq 'ARRAY') { |
if (ref($strings{$string_type}) eq 'ARRAY') { |
Line 3182 sub standard_string_options {
|
Line 3498 sub standard_string_options {
|
return; |
return; |
} |
} |
|
|
|
sub standard_string_matches { |
|
my ($string_type) = @_; |
|
if (ref($stringmatches{$string_type}) eq 'ARRAY') { |
|
return $stringmatches{$string_type}; |
|
} |
|
return; |
|
} |
|
|
|
sub get_stringtype { |
|
my ($name) = @_; |
|
if (exists($stringtypes{$name})) { |
|
return $stringtypes{$name}; |
|
} |
|
return; |
|
} |
|
|
sub string_selector { |
sub string_selector { |
my ($thistype, $thiskey, $showval, $name) = @_; |
my ($thistype, $thiskey, $showval, $name) = @_; |
|
|
if (!exists($strings{$thistype})) { |
if (!exists($strings{$thistype})) { |
return &default_selector($thiskey,$showval); |
return &default_selector($thiskey,$showval); |
} |
} |
|
|
my %skiptype; |
my %skiptype; |
if (($thistype eq 'string_questiontype') || |
if (($thistype eq 'string_questiontype') || |
($thistype eq 'string_lenient') || |
($thistype eq 'string_lenient') || |
($thistype eq 'string_discussvote') || |
($thistype eq 'string_discussvote') || |
|
($thistype eq 'string_ip') || |
($name eq 'retrypartial')) { |
($name eq 'retrypartial')) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
foreach my $possibilities (@{ $strings{$thistype} }) { |
foreach my $possibilities (@{ $strings{$thistype} }) { |
next unless (ref($possibilities) eq 'ARRAY'); |
next unless (ref($possibilities) eq 'ARRAY'); |
my ($parmval, $description) = @{ $possibilities }; |
my ($parmval, $description) = @{ $possibilities }; |
my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval"}; |
my $parmmatch; |
|
if (ref($stringmatches{$thistype}) eq 'ARRAY') { |
|
foreach my $item (@{$stringmatches{$thistype}}) { |
|
if (ref($item) eq 'ARRAY') { |
|
if ($parmval eq $item->[0]) { |
|
$parmmatch = $parmval; |
|
$parmval = ''; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval:$parmmatch"}; |
if ($needsrelease) { |
if ($needsrelease) { |
unless ($got_chostname) { |
unless ($got_chostname) { |
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
$got_chostname = 1; |
$got_chostname = 1; |
} |
} |
my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease, |
my $needsnewer=¶meter_releasecheck($name,$parmval,$parmmatch, |
$chostname,$cmajor, |
$needsrelease,$cmajor,$cminor); |
$cminor); |
|
if ($needsnewer) { |
if ($needsnewer) { |
$skiptype{$parmval} = 1; |
if ($parmmatch ne '') { |
|
$skiptype{$parmmatch} = 1; |
|
} elsif ($parmval ne '') { |
|
$skiptype{$parmval} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
|
if ($thistype eq 'string_ip') { |
|
return &string_ip_selector($thiskey,$showval); |
|
} |
|
|
my $result; |
my $result; |
my $numinrow = 3; |
my $numinrow = 3; |
Line 3230 sub string_selector {
|
Line 3581 sub string_selector {
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
foreach my $possibilities (@{ $strings{$thistype} }) { |
next unless (ref($possibilities) eq 'ARRAY'); |
next unless (ref($possibilities) eq 'ARRAY'); |
my ($name, $description) = @{ $possibilities }; |
my ($name, $description) = @{ $possibilities }; |
next if ($skiptype{$name}); |
next if ($skiptype{$name}); |
$rem = $i%($numinrow); |
$rem = $i%($numinrow); |
if ($rem == 0) { |
if ($rem == 0) { |
if ($i > 0) { |
if ($i > 0) { |
Line 3238 sub string_selector {
|
Line 3589 sub string_selector {
|
} |
} |
$result .= '<tr>'; |
$result .= '<tr>'; |
} |
} |
$result .= '<td class="LC_left_item">'. |
my $colspan; |
|
if ($i == @{ $strings{$thistype} }-1) { |
|
$rem = @{ $strings{$thistype} }%($numinrow); |
|
if ($rem) { |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft) { |
|
$colspan = $colsleft+1; |
|
$colspan = ' colspan="'.$colspan.'"'; |
|
} |
|
} |
|
} |
|
my ($add,$onchange,$css_class); |
|
if ($thistype eq 'string_lenient') { |
|
if ($name eq 'weighted') { |
|
my $display; |
|
my %relatives = &Apache::lonlocal::texthash( |
|
corrchkd => 'Correct (checked)', |
|
corrunchkd => 'Correct (unchecked)', |
|
incorrchkd => 'Incorrect (checked)', |
|
incorrunchkd => 'Incorrect (unchecked)', |
|
); |
|
my %textval = ( |
|
corrchkd => '1.0', |
|
corrunchkd => '1.0', |
|
incorrchkd => '0.0', |
|
incorrunchkd => '0.0', |
|
); |
|
if ($showval =~ /^([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)$/) { |
|
$textval{'corrchkd'} = $1; |
|
$textval{'corrunchkd'} = $2; |
|
$textval{'incorrchkd'} = $3; |
|
$textval{'incorrunchkd'} = $4; |
|
$display = 'inline'; |
|
$showval = $name; |
|
} else { |
|
$display = 'none'; |
|
} |
|
$add = ' <div id="LC_parmtext_'.$thiskey.'" style="display:'.$display.'"><table>'. |
|
'<tr><th colspan="2">'.&mt("Foil's submission status").'</th><th>'.&mt('Points').'</th></tr>'; |
|
foreach my $reltype ('corrchkd','corrunchkd','incorrchkd','incorrunchkd') { |
|
$add .= '<tr><td> </td><td>'.$relatives{$reltype}.'</td>'."\n". |
|
'<td><input type="text" name="settext_'.$thiskey.'"'. |
|
' value="'.$textval{$reltype}.'" size="3" />'. |
|
'</td></tr>'; |
|
} |
|
$add .= '</table></div>'."\n"; |
|
} |
|
$onchange = ' onclick="javascript:toggleParmTextbox(this.form,'."'$thiskey'".');"'; |
|
$css_class = ' class="LC_lenient_radio"'; |
|
} |
|
$result .= '<td class="LC_left_item"'.$colspan.'>'. |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="radio" name="set_'.$thiskey. |
'<input type="radio" name="set_'.$thiskey. |
'" value="'.$name.'"'; |
'" value="'.$name.'"'.$onchange.$css_class; |
if ($showval eq $name) { |
if ($showval eq $name) { |
$result .= ' checked="checked"'; |
$result .= ' checked="checked"'; |
} |
} |
$result .= ' />'.&mt($description).'</label></span></td>'; |
$result .= ' />'.&mt($description).'</label>'.$add.'</span></td>'; |
$i++; |
$i++; |
} |
} |
$rem = @{ $strings{$thistype} }%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$result .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$result .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$result .= '</tr>'; |
$result .= '</tr>'; |
} |
} |
if ($result) { |
if ($result) { |
Line 3264 sub string_selector {
|
Line 3657 sub string_selector {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub oldversion_warning { |
|
my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_; |
|
my $desc; |
|
my $stringtype = &get_stringtype($name); |
|
if ($stringtype ne '') { |
|
if ($name eq 'examcode') { |
|
$desc = $value; |
|
} elsif (ref($strings{$stringtypes{$name}}) eq 'ARRAY') { |
|
foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($parmval, $description) = @{ $possibilities }; |
|
my $parmmatch; |
|
if (ref($stringmatches{$stringtypes{$name}}) eq 'ARRAY') { |
|
foreach my $item (@{$stringmatches{$stringtypes{$name}}}) { |
|
if (ref($item) eq 'ARRAY') { |
|
my ($regexpname,$pattern) = @{$item}; |
|
if ($parmval eq $regexpname) { |
|
if ($value =~ /$pattern/) { |
|
$desc = $description; |
|
$parmmatch = 1; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
last if ($parmmatch); |
|
} elsif ($parmval eq $value) { |
|
$desc = $description; |
|
last; |
|
} |
|
} |
|
} |
|
} elsif (($name eq 'printstartdate') || ($name eq 'printenddate')) { |
|
my $now = time; |
|
if ($value =~ /^\d+$/) { |
|
if ($name eq 'printstartdate') { |
|
if ($value > $now) { |
|
$desc = &Apache::lonlocal::locallocaltime($value); |
|
} |
|
} elsif ($name eq 'printenddate') { |
|
if ($value < $now) { |
|
$desc = &Apache::lonlocal::locallocaltime($value); |
|
} |
|
} |
|
} |
|
} |
|
my $standard_name = &standard_parameter_names($name); |
|
return '<p class="LC_warning">'. |
|
&mt('[_1] was [_2]not[_3] set to [_4].', |
|
$standard_name,'<b>','</b>','"'.$desc.'"').'<br />'. |
|
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
|
$cmajor.'.'.$cminor,$chostname, |
|
$needsrelease). |
|
'</p>'; |
|
} |
|
|
|
} |
|
|
# |
# |
# Shift all start and end dates by $shift |
# Shift all start and end dates by $shift |
# |
# |
Line 3274 sub dateshift {
|
Line 3725 sub dateshift {
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs); |
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs); |
# ugly retro fix for broken version of types |
# ugly retro fix for broken version of types |
foreach my $key (keys %data) { |
foreach my $key (keys(%data)) { |
if ($key=~/\wtype$/) { |
if ($key=~/\wtype$/) { |
my $newkey=$key; |
my $newkey=$key; |
$newkey=~s/type$/\.type/; |
$newkey=~s/type$/\.type/; |
Line 3284 sub dateshift {
|
Line 3735 sub dateshift {
|
} |
} |
my %storecontent=(); |
my %storecontent=(); |
# go through all parameters and look for dates |
# go through all parameters and look for dates |
foreach my $key (keys %data) { |
foreach my $key (keys(%data)) { |
if ($data{$key.'.type'}=~/^date_(start|end)$/) { |
if ($data{$key.'.type'}=~/^date_(start|end)$/) { |
my $newdate=$data{$key}+$shift; |
my $newdate=$data{$key}+$shift; |
$storecontent{$key}=$newdate; |
$storecontent{$key}=$newdate; |
Line 3304 sub newoverview {
|
Line 3755 sub newoverview {
|
|
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
|
|
my %loaditems = ( |
my %loaditems = ( |
'onload' => "showHide_courseContent(); resize_scrollbox('mapmenuscroll','1','1');", |
'onload' => "showHide_courseContent(); resize_scrollbox('mapmenuscroll','1','1'); showHideLenient();", |
); |
); |
my $js = ' |
my $js = ' |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 3316 sub newoverview {
|
Line 3768 sub newoverview {
|
'. |
'. |
&Apache::lonhtmlcommon::resize_scrollbox_js('params')."\n". |
&Apache::lonhtmlcommon::resize_scrollbox_js('params')."\n". |
&showhide_js()."\n". |
&showhide_js()."\n". |
|
&toggleparmtextbox_js()."\n". |
|
&validateparms_js()."\n". |
|
&ipacc_boxes_js()."\n". |
'// ]]> |
'// ]]> |
</script> |
</script> |
'; |
'; |
|
|
my $start_page = &Apache::loncommon::start_page('Set Parameters',$js, |
my $start_page = &Apache::loncommon::start_page('Set Parameters',$js, |
{'add_entries' => \%loaditems,}); |
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset'); |
&startSettingsScreen($r,'parmset',$crstype); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform" onsubmit="return validateParms();"> |
ENDOVER |
ENDOVER |
my @ids=(); |
my @ids=(); |
my %typep=(); |
my %typep=(); |
Line 3468 sub secgroup_lister {
|
Line 3924 sub secgroup_lister {
|
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat}; |
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat}; |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
# map-level parameter |
# map-level parameter |
foreach my $mapid (keys %{$allmaps}) { |
foreach my $mapid (keys(%{$allmaps})) { |
if (($pschp ne 'all') && ($pschp ne $mapid)) { next; } |
if (($pschp ne 'all') && ($pschp ne $mapid)) { next; } |
my $newparmkey=$rootparmkey.'.'.$$allmaps{$mapid}.'___(all).'.$part.'.'.$cat; |
my $newparmkey=$rootparmkey.'.'.$$allmaps{$mapid}.'___(all).'.$part.'.'.$cat; |
$$listdata{$newparmkey}=1; |
$$listdata{$newparmkey}=1; |
Line 3492 sub overview {
|
Line 3948 sub overview {
|
my ($r) = @_; |
my ($r) = @_; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
|
my $js = '<script type="text/javascript">'."\n". |
|
'// <![CDATA['."\n". |
|
&toggleparmtextbox_js()."\n". |
|
&validateparms_js()."\n". |
|
&ipacc_boxes_js()."\n". |
|
'// ]]>'."\n". |
|
'</script>'."\n"; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my %loaditems = ( |
|
'onload' => "showHideLenient();", |
|
); |
|
|
|
my $start_page=&Apache::loncommon::start_page('Modify Parameters',$js,{'add_entries' => \%loaditems,}); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset'); |
&startSettingsScreen($r,'parmset',$crstype); |
$r->print('<form method="post" action="/adm/parmset?action=setoverview" name="parmform">'); |
$r->print('<form method="post" action="/adm/parmset?action=setoverview" name="parmform" onsubmit="return validateParms();">'); |
|
|
# Store modified |
# Store modified |
|
|
Line 3517 sub overview {
|
Line 3984 sub overview {
|
# List data |
# List data |
|
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
|
|
$r->print(&tableend().'<p>'. |
$r->print(&tableend().'<p>'. |
($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':&mt('There are no parameters.')).'</p></form>'. |
($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':'<span class="LC_info">'.&mt('There are no parameters.').'</span>').'</p></form>'. |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 3595 ENDOVER
|
Line 4061 ENDOVER
|
} elsif ($data{'realm_type'} eq 'symb') { |
} elsif ($data{'realm_type'} eq 'symb') { |
my ($map,$resid,$url) = |
my ($map,$resid,$url) = |
&Apache::lonnet::decode_symb($data{'realm'}); |
&Apache::lonnet::decode_symb($data{'realm'}); |
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
$r->print(&mt('Resource: [_1]with ID: [_2]in folder [_3]', |
$url,$resid,$map)); |
$url.' <br /> ', |
|
$resid.' <br /> ',$map)); |
} |
} |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print('</td></tr>'); |
$r->print('</td></tr>'); |
Line 3614 sub date_shift_one {
|
Line 4081 sub date_shift_one {
|
my ($r) = @_; |
my ($r) = @_; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
text=>"Shifting Dates"}); |
text=>"Shifting Dates"}); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset'); |
&startSettingsScreen($r,'parmset',$crstype); |
$r->print('<form name="shiftform" method="post">'. |
$r->print('<form name="shiftform" method="post" action="">'. |
'<table><tr><td>'.&mt('Currently set date:').'</td><td>'. |
'<table><tr><td>'.&mt('Currently set date:').'</td><td>'. |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'. |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'. |
'<tr><td>'.&mt('Shifted date:').'</td><td>'. |
'<tr><td>'.&mt('Shifted date:').'</td><td>'. |
&Apache::lonhtmlcommon::dshowerfuck.net |
&Apache::lonhtmlcommon::date_setter('shiftform', |
ate_setter('shiftform', |
|
'timeshifted', |
'timeshifted', |
$env{'form.timebase'},, |
$env{'form.timebase'},, |
''). |
''). |
Line 3642 sub date_shift_two {
|
Line 4109 sub date_shift_two {
|
my ($r) = @_; |
my ($r) = @_; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
text=>"Shifting Dates"}); |
text=>"Shifting Dates"}); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset'); |
&startSettingsScreen($r,'parmset',$crstype); |
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
$r->print(&mt('Shifting all dates such that [_1] becomes [_2]', |
$r->print('<h2>'.&mt('Shift Dates').'</h2>'. |
|
'<p>'.&mt('Shifting all dates such that [_1] becomes [_2]', |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
&Apache::lonlocal::locallocaltime($timeshifted))); |
&Apache::lonlocal::locallocaltime($timeshifted)).'</p>'); |
my $delta=$timeshifted-$env{'form.timebase'}; |
my $delta=$timeshifted-$env{'form.timebase'}; |
&dateshift($delta); |
&dateshift($delta); |
|
$r->print( |
|
&Apache::lonhtmlcommon::confirm_success(&mt('Done')). |
|
'<br /><br />'. |
|
&Apache::lonhtmlcommon::actionbox( |
|
['<a href="/adm/parmset">'.&mt('Content and Problem Settings').'</a>'])); |
&endSettingsScreen($r); |
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
Line 3709 sub print_main_menu {
|
Line 4183 sub print_main_menu {
|
# |
# |
$r->print(&header()); |
$r->print(&header()); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Content and Problem Settings')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Content and Problem Settings')); |
&startSettingsScreen($r,'parmset'); |
my $crstype = &Apache::loncommon::course_type(); |
|
my $lc_crstype = lc($crstype); |
|
|
|
&startSettingsScreen($r,'parmset',$crstype); |
$r->print(<<ENDMAINFORMHEAD); |
$r->print(<<ENDMAINFORMHEAD); |
<form method="post" enctype="multipart/form-data" |
<form method="post" enctype="multipart/form-data" |
action="/adm/parmset" name="studentform"> |
action="/adm/parmset" name="studentform"> |
Line 3725 ENDMAINFORMHEAD
|
Line 4202 ENDMAINFORMHEAD
|
'/'.$env{'request.course.sec'}); |
'/'.$env{'request.course.sec'}); |
} |
} |
|
|
my $crstype = &Apache::loncommon::course_type(); |
|
my $lc_crstype = lc($crstype); |
|
|
|
my @menu = |
my @menu = |
( { categorytitle=>"Content Settings for this $crstype", |
( { categorytitle=>"Content Settings for this $crstype", |
items => [ |
items => [ |
Line 3795 ENDMAINFORMHEAD
|
Line 4269 ENDMAINFORMHEAD
|
}]} |
}]} |
); |
); |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
|
$r->print('</form>'); |
&endSettingsScreen($r); |
&endSettingsScreen($r); |
|
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
Line 3863 sub order_meta_fields {
|
Line 4339 sub order_meta_fields {
|
my $idx = 1; |
my $idx = 1; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};; |
$r->print(&Apache::loncommon::start_page('Order Metadata Fields')); |
$r->print(&Apache::loncommon::start_page('Order Metadata Fields')); |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
text=>"Add Metadata Field"}); |
text=>"Add Metadata Field"}); |
Line 3871 sub order_meta_fields {
|
Line 4348 sub order_meta_fields {
|
text=>"Restrict Metadata"}, |
text=>"Restrict Metadata"}, |
{text=>"Order Metadata"}); |
{text=>"Order Metadata"}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Order Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Order Metadata')); |
&startSettingsScreen($r,'parmset'); |
&startSettingsScreen($r,'parmset',$crstype); |
if ($env{'form.storeorder'}) { |
if ($env{'form.storeorder'}) { |
my $newpos = $env{'form.newpos'} - 1; |
my $newpos = $env{'form.newpos'} - 1; |
my $currentpos = $env{'form.currentpos'} - 1; |
my $currentpos = $env{'form.currentpos'} - 1; |
my @neworder = (); |
my @neworder = (); |
my @oldorder = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
my @oldorder = split(/,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}); |
my $i; |
my $i; |
if ($newpos > $currentpos) { |
if ($newpos > $currentpos) { |
# moving stuff up |
# moving stuff up |
Line 3910 sub order_meta_fields {
|
Line 4387 sub order_meta_fields {
|
} |
} |
my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $ordered_fields; |
my $ordered_fields; |
my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
my @fields_in_order = split(/,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}); |
if (!@fields_in_order) { |
if (!@fields_in_order) { |
# no order found, pick sorted order then create metadata.addedorder key. |
# no order found, pick sorted order then create metadata.addedorder key. |
foreach my $key (sort keys %$fields) { |
foreach my $key (sort(keys(%$fields))) { |
push @fields_in_order, $key; |
push @fields_in_order, $key; |
$ordered_fields = join ",", @fields_in_order; |
$ordered_fields = join ",", @fields_in_order; |
} |
} |
Line 3925 sub order_meta_fields {
|
Line 4402 sub order_meta_fields {
|
foreach my $key (@fields_in_order) { |
foreach my $key (@fields_in_order) { |
$r->print('<tr><td>'); |
$r->print('<tr><td>'); |
$r->print('<form method="post" action="">'); |
$r->print('<form method="post" action="">'); |
$r->print('<select name="newpos" onChange="this.form.submit()">'); |
$r->print('<select name="newpos" onchange="this.form.submit()">'); |
for (my $i = 1;$i le $num_fields;$i ++) { |
for (my $i = 1;$i le $num_fields;$i ++) { |
if ($i eq $idx) { |
if ($i eq $idx) { |
$r->print('<option value="'.$i.'" SELECTED>('.$i.')</option>'); |
$r->print('<option value="'.$i.'" SELECTED>('.$i.')</option>'); |
Line 3961 sub addmetafield {
|
Line 4438 sub addmetafield {
|
text=>"Add Metadata Field"}); |
text=>"Add Metadata Field"}); |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field')); |
&startSettingsScreen($r,'parmset'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
|
&startSettingsScreen($r,'parmset',$crstype); |
if (exists($env{'form.undelete'})) { |
if (exists($env{'form.undelete'})) { |
my @meta_fields = &Apache::loncommon::get_env_multiple('form.undeletefield'); |
my @meta_fields = &Apache::loncommon::get_env_multiple('form.undeletefield'); |
foreach my $meta_field(@meta_fields) { |
foreach my $meta_field(@meta_fields) { |
Line 4018 sub setrestrictmeta {
|
Line 4496 sub setrestrictmeta {
|
text=>"Restrict Metadata"}); |
text=>"Restrict Metadata"}); |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
&startSettingsScreen($r,'parmset'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
|
&startSettingsScreen($r,'parmset',$crstype); |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
my $save_field = ''; |
my $save_field = ''; |
if ($env{'form.restrictmeta'}) { |
if ($env{'form.restrictmeta'}) { |
Line 4132 sub defaultsetter {
|
Line 4611 sub defaultsetter {
|
|
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', |
text=>"Set Defaults"}); |
text=>"Set Defaults"}); |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset'); |
&startSettingsScreen($r,'parmset',$crstype); |
$r->print('<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">'); |
$r->print('<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">'); |
|
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my @ids=(); |
my @ids=(); |
my %typep=(); |
my %typep=(); |
my %keyp=(); |
my %keyp=(); |
Line 4191 sub defaultsetter {
|
Line 4671 sub defaultsetter {
|
} |
} |
} |
} |
} |
} |
foreach my $key (keys %allparms) { |
foreach my $key (keys(%allparms)) { |
$newrules{$key.'_triggers'}=$triggers{$key}; |
$newrules{$key.'_triggers'}=$triggers{$key}; |
} |
} |
&Apache::lonnet::put('parmdefactions',\%newrules,$dom,$crs); |
&Apache::lonnet::put('parmdefactions',\%newrules,$cdom,$cnum); |
&Apache::lonnet::del('parmdefactions',\@delrules,$dom,$crs); |
&Apache::lonnet::del('parmdefactions',\@delrules,$cdom,$cnum); |
&resetrulescache(); |
&resetrulescache(); |
} |
} |
my %lt=&Apache::lonlocal::texthash('days' => 'Days', |
my %lt=&Apache::lonlocal::texthash('days' => 'Days', |
Line 4372 sub standard_parameter_types {
|
Line 4852 sub standard_parameter_types {
|
|
|
sub parm_change_log { |
sub parm_change_log { |
my ($r)=@_; |
my ($r)=@_; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'} |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
text=>"Parameter Change Log"}); |
text=>"Parameter Change Log"}); |
my $js = '<script type="text/javascript">'."\n". |
my $js = '<script type="text/javascript">'."\n". |
Line 4381 sub parm_change_log {
|
Line 4864 sub parm_change_log {
|
'</script>'."\n"; |
'</script>'."\n"; |
$r->print(&Apache::loncommon::start_page('Parameter Change Log',$js)); |
$r->print(&Apache::loncommon::start_page('Parameter Change Log',$js)); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); |
&startSettingsScreen($r,'parmset'); |
&startSettingsScreen($r,'parmset',$crstype); |
my %parmlog=&Apache::lonnet::dump('nohist_parameterlog', |
my %parmlog=&Apache::lonnet::dump('nohist_parameterlog',$cdom,$cnum); |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
|
|
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } |
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } |
|
|
Line 4402 sub parm_change_log {
|
Line 4883 sub parm_change_log {
|
'<input type="submit" value="'.&mt('Display').'" />'. |
'<input type="submit" value="'.&mt('Display').'" />'. |
'</form></fieldset></div><br clear="all" />'); |
'</form></fieldset></div><br clear="all" />'); |
|
|
my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
|
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
Line 4598 sub update_slots {
|
Line 5078 sub update_slots {
|
action => 'reserve', |
action => 'reserve', |
context => 'parameter', |
context => 'parameter', |
); |
); |
&Apache::lonnet::write_log('slotreservationslog',\%storehash, |
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash, |
'',$uname,$udom,$cnum,$cdom); |
'',$uname,$udom,$cnum,$cdom); |
|
|
&Apache::lonnet::write_log($cdom.'_'.$cnum.'_slotlog',\%storehash, |
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, |
'',$uname,$udom,$uname,$udom); |
'',$uname,$udom,$uname,$udom); |
} |
} |
return $success; |
return $success; |
Line 4632 sub delete_slots {
|
Line 5112 sub delete_slots {
|
action => 'release', |
action => 'release', |
context => 'parameter', |
context => 'parameter', |
); |
); |
&Apache::lonnet::write_log('slotreservationslog',\%storehash, |
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash, |
1,$uname,$udom,$cnum,$cdom); |
1,$uname,$udom,$cnum,$cdom); |
&Apache::lonnet::write_log($cdom.'_'.$cnum.'_slotlog',\%storehash, |
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, |
1,$uname,$udom,$uname,$udom); |
1,$uname,$udom,$uname,$udom); |
} |
} |
} |
} |
Line 4658 sub parameter_release_vars {
|
Line 5138 sub parameter_release_vars {
|
} |
} |
|
|
sub parameter_releasecheck { |
sub parameter_releasecheck { |
my ($name,$value,$needsrelease,$chostname,$cmajor,$cminor) = @_; |
my ($name,$value,$valmatch,$needsrelease,$cmajor,$cminor) = @_; |
my $needsnewer; |
my $needsnewer; |
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
if (($cmajor < $needsmajor) || |
if (($cmajor < $needsmajor) || |
($cmajor == $needsmajor && $cminor < $needsminor)) { |
($cmajor == $needsmajor && $cminor < $needsminor)) { |
$needsnewer = 1; |
$needsnewer = 1; |
} else { |
} elsif ($valmatch) { |
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value}); |
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.'::'.$valmatch}); |
|
} elsif ($value) { |
|
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value.':'}); |
} |
} |
return $needsnewer; |
return $needsnewer; |
} |
} |
|
|
sub oldversion_warning { |
|
my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_; |
|
my $desc; |
|
my %stringtypes = ( |
|
type => 'string_questiontype', |
|
lenient => 'string_lenient', |
|
retrypartial => 'string_yesno', |
|
discussvote => 'string_discussvote', |
|
); |
|
if (exists($stringtypes{$name})) { |
|
if (ref($strings{$stringtypes{$name}}) eq 'ARRAY') { |
|
foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($parmval, $description) = @{ $possibilities }; |
|
if ($parmval eq $value) { |
|
$desc = $description; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
my $standard_name = &standard_parameter_names($name); |
|
return '<p class="LC_warning">'. |
|
&mt('[_1] was [_2]not[_3] set to [_4].', |
|
$standard_name,'<b>','</b>','"'.$desc.'"').'<br />'. |
|
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
|
$cmajor.'.'.$cminor,$chostname, |
|
$needsrelease). |
|
'</p>'; |
|
} |
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|