--- loncom/interface/lonparmset.pm 2017/07/13 15:29:56 1.578
+++ loncom/interface/lonparmset.pm 2019/02/18 13:25:49 1.589
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.578 2017/07/13 15:29:56 raeburn Exp $
+# $Id: lonparmset.pm,v 1.589 2019/02/18 13:25:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,7 +36,8 @@ lonparmset - Handler to set parameters f
=head1 SYNOPSIS
-lonparmset provides an interface to setting course parameters.
+lonparmset provides an interface to setting content parameters in a
+course.
It contains all the code for the "Content and Problem Settings" UI, except
for the helpers parameter.helper and resettimes.helper, and lonhelper.pm,
@@ -137,7 +138,7 @@ javascript function 'pjump'.
=item print_td()
-=item print_usergroups()
+=item check_other_groups()
=item parm_control_group()
@@ -1064,12 +1065,13 @@ sub valout {
# @param {string} $marker - identifier for the parameter, "resource id&part_parameter name&level", will be passed as pres_marker when the user submits a change.
# @param {string} $return - prefix for the name of the form and field names that will be used to submit the form ('parmform.pres')
# @param {string} $call - javascript function to call to submit the form ('psub')
-# @param {boolean} $recursive - true if link is for a map/folder where parameter is currently set to be recursive.
+# @param {boolean} $recursive - true if link is for a map/folder where parameter is currently set to be recursive.
+# @param {string} $extra - optional additional information to send as tenth arg in call to javascript pjump function.
sub plink {
- my ($type,$dis,$value,$marker,$return,$call,$recursive)=@_;
+ my ($type,$dis,$value,$marker,$return,$call,$recursive,$extra)=@_;
my $winvalue=$value;
unless ($winvalue) {
- if (&isdateparm($type)) {
+ if ((&isdateparm($type) || (&is_specialstring($type))) {
$winvalue=$env{'form.recent_'.$type};
} else {
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]};
@@ -1081,13 +1083,13 @@ sub plink {
my $valout = &valout($value,$type,$parmname,1);
my $unencmarker = $marker;
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call,
- \$hour, \$min, \$sec) {
+ \$hour, \$min, \$sec, \$extra) {
$$item = &HTML::Entities::encode($$item,'"<>&');
$$item =~ s/\'/\\\'/g;
}
return '
');
+ }
if ($parmlev eq 'full') {
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.
'.'.$$name{$which},$$symbp{$rid});
@@ -1557,6 +1740,9 @@ sub print_row {
}
$r->print('');
$r->print("\n");
+ if (($numlinks) && (ref($reclinks))) {
+ $$reclinks = $numlinks;
+ }
}
# Prints a cell for table mode.
@@ -1576,10 +1762,11 @@ sub print_row {
# @param {hash reference} $display - parameter key -> full title for the parameter
# @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters
# @param {boolean} $readonly -true if editing not allowed.
-# @param {boolean} $ismaplevel - true if level is for a map.
+# @param {boolean} $ismaplevel - true if level is for a map.
+# @param {strring} $extra - extra informatio to pass to plink.
sub print_td {
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,
- $noeditgrp,$readonly,$ismaplevel)=@_;
+ $noeditgrp,$readonly,$ismaplevel,$extra)=@_;
my ($ineffect,$recursive,$currval,$currtype,$currlevel);
$ineffect = 0;
$currval = $$outpar[$which];
@@ -1633,16 +1820,15 @@ sub print_td {
} else {
$r->print(&plink($currtype,
$$display{$value},$currval,
- $mprefix.$currlevel,'parmform.pres','psub',$recursive));
+ $mprefix.$currlevel,'parmform.pres','psub',$recursive,
+ $extra));
}
$r->print(''."\n");
}
-# FIXME: Despite the name, this does not print anything, the $r parameter is unused.
# Returns HTML and other info for the cell added when a user is selected
# and that user is in several groups. This is the cell with the title "Control by other group".
#
-# @param {Apache2::RequestRec} $r - the Apache request (unused)
# @param {string} $what - parameter part.'.'.parameter name
# @param {string} $rid - resource id
# @param {string} $cgroup - group name
@@ -1650,9 +1836,9 @@ sub print_td {
# @param {array reference} $usersgroups - list of groups the user belongs to, if any
# @param {integer} $result - level
# @param {hash reference} $courseopt - course parameters hash (result of lonnet::get_courseresdata, dump of course's resourcedata.db)
-# @returns {Array} - array (parameter value for the other group, HTML for the cell, HTML with the value, name of the other group)
-sub print_usergroups {
- my ($r,$what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_;
+# @returns {Array} - array (parameter value for the other group, HTML for the cell, HTML with the value, name of the other group, true if recursive)
+sub check_other_groups {
+ my ($what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_;
my $courseid = $env{'request.course.id'};
my $output;
my $symb = &symbcache($rid);
@@ -1664,16 +1850,22 @@ sub print_usergroups {
&parm_control_group($courseid,$usersgroups,$symbparm,$mapparm,
$recurseparm,$what,$courseopt);
my $bgcolor = $defbg;
- my $grp_parm;
+ my ($grp_parm,$grp_is_rec);
if (($coursereply) && ($cgroup ne $resultgroup)) {
+ my ($parmname) = ($what =~ /\.([^.]+)$/);
if ($result > 3) {
$bgcolor = '#AAFFAA';
- $grp_parm = &valout($coursereply,$resulttype,$what);
}
- $grp_parm = &valout($coursereply,$resulttype,$what);
+ $grp_parm = &valout($coursereply,$resulttype,$parmname);
$output = '