--- loncom/interface/lonparmset.pm 2017/07/15 02:31:33 1.579
+++ loncom/interface/lonparmset.pm 2019/01/06 15:27:48 1.588
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.579 2017/07/15 02:31:33 raeburn Exp $
+# $Id: lonparmset.pm,v 1.588 2019/01/06 15:27:48 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -138,7 +138,7 @@ javascript function 'pjump'.
=item print_td()
-=item print_usergroups()
+=item check_other_groups()
=item parm_control_group()
@@ -1065,9 +1065,10 @@ 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)) {
@@ -1082,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});
@@ -1558,6 +1738,9 @@ sub print_row {
}
$r->print('');
$r->print("\n");
+ if (($numlinks) && (ref($reclinks))) {
+ $$reclinks = $numlinks;
+ }
}
# Prints a cell for table mode.
@@ -1577,10 +1760,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];
@@ -1634,16 +1818,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
@@ -1651,9 +1834,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);
@@ -1665,16 +1848,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 = '
';
}
- return ($coursereply,$output,$grp_parm,$resultgroup);
+ return ($coursereply,$output,$grp_parm,$resultgroup,$grp_is_rec);
}
# Looks for a group with a defined parameter for given user and parameter.
-# Used by print_usergroups.
+# Used by check_other_groups.
#
# @param {string} $courseid - the course id
# @param {array reference} $usersgroups - list of groups the user belongs to, if any
@@ -1763,23 +1952,27 @@ sub extractResourceInformation {
my $srcf=$resource->src();
$srcf=~/\.(\w+)$/;
$$typep{$id}=$1;
+ my $toolsymb;
+ if ($srcf =~ /ext\.tool$/) {
+ $toolsymb = $resource->symb();
+ }
$$keyp{$id}='';
$$uris{$id}=$srcf;
- foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {
+ foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys',$toolsymb))) {
next if ($key!~/^parameter_/);
# Hidden parameters
- next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm');
+ next if (&Apache::lonnet::metadata($srcf,$key.'.hidden',$toolsymb) eq 'parm');
#
# allparms is a hash of parameter names
#
- my $name=&Apache::lonnet::metadata($srcf,$key.'.name');
+ my $name=&Apache::lonnet::metadata($srcf,$key.'.name',$toolsymb);
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {
my ($display,$parmdis);
$display = &standard_parameter_names($name);
if ($display eq '') {
- $display= &Apache::lonnet::metadata($srcf,$key.'.display');
+ $display= &Apache::lonnet::metadata($srcf,$key.'.display',$toolsymb);
$parmdis = $display;
$parmdis =~ s/\s*\[Part.*$//g;
} else {
@@ -1788,14 +1981,14 @@ sub extractResourceInformation {
$$allparms{$name}=$parmdis;
if (ref($defkeytype)) {
$$defkeytype{$name}=
- &Apache::lonnet::metadata($srcf,$key.'.type');
+ &Apache::lonnet::metadata($srcf,$key.'.type',$toolsymb);
}
}
#
# allparts is a hash of all parts
#
- my $part= &Apache::lonnet::metadata($srcf,$key.'.part');
+ my $part= &Apache::lonnet::metadata($srcf,$key.'.part',$toolsymb);
$$allparts{$part} = &mt('Part: [_1]',$part);
#
# Remember all keys going with this resource
@@ -1836,6 +2029,29 @@ sub extractResourceInformation {
}
}
+sub get_recursive {
+ my ($recurseup,$resdata,$what,$prefix) = @_;
+ if ((ref($resdata) eq 'HASH') && (ref($recurseup) eq 'ARRAY')) {
+ foreach my $item (@{$recurseup}) {
+ my $norecursechk=$prefix.'.'.$item.'___(all).'.$what;
+ if (defined($resdata->{$norecursechk})) {
+ if ($what =~ /\.(encrypturl|hiddenresource)$/) {
+ my $type = $resdata->{$norecursechk.'.type'};
+ return [$resdata->{$norecursechk},$type,$item];
+ } else {
+ last;
+ }
+ }
+ my $recursechk=$prefix.'.'.$item.'___(rec).'.$what;
+ if (defined($resdata->{$recursechk})) {
+ my $type = $resdata->{$recursechk.'.type'};
+ return [$resdata->{$recursechk},$type,$item];
+ }
+ }
+ }
+ return;
+}
+
# Tells if a parameter type is a date.
#
@@ -1847,15 +2063,10 @@ sub isdateparm {
}
# Prints the HTML and Javascript to select parameters, with various shortcuts.
-# FIXME: remove unused parameters
#
-# @param {Apache2::RequestRec} $r - the Apache request (unused)
-# @param {hash reference} $allparms - hash parameter name -> parameter title
-# @param {array reference} $pscat - list of selected parameter names (unused)
-# @param {hash reference} $keyorder - hash parameter key -> appearance rank (unused)
+# @param {Apache2::RequestRec} $r - the Apache request
sub parmmenu {
- my ($r,$allparms,$pscat,$keyorder)=@_;
- my $tempkey;
+ my ($r)=@_;
$r->print(<
// print('');
- &shortCuts($r,$allparms,$pscat,$keyorder);
+ &shortCuts($r);
$r->print('');
}
@@ -1986,6 +2197,7 @@ sub lookUpTableParameter {
'buttonshide' => 'hiding',
'turnoffeditor' => 'hiding',
'encrypturl' => 'hiding',
+ 'deeplink' => 'hiding',
'randomorder' => 'high_level_randomization',
'randompick' => 'high_level_randomization',
'available' => 'slots',
@@ -2001,7 +2213,7 @@ sub lookUpTableParameter {
'lenient' => 'grading',
'retrypartial' => 'tries',
'discussvote' => 'misc',
- 'examcode' => 'high_level_randomization',
+ 'examcode' => 'high_level_randomization',
);
}
@@ -2113,14 +2325,10 @@ sub parmboxes {
}
# Prints HTML with shortcuts to select groups of parameters in one click, or deselect all.
-# FIXME: remove unused parameters
#
# @param {Apache2::RequestRec} $r - the Apache request
-# @param {hash reference} $allparms - hash parameter name -> parameter title (unused)
-# @param {array reference} $pscat - list of selected parameter names (unused)
-# @param {hash reference} $keyorder - hash parameter key -> appearance rank (unused)
sub shortCuts {
- my ($r,$allparms,$pscat,$keyorder)=@_;
+ my ($r)=@_;
# Parameter Selection
$r->print(
@@ -2210,7 +2418,7 @@ sub usermenu {
if (($pssymb) || &Apache::lonnet::allowed('mdg',$env{'request.course.id'})) {
%grouphash = &Apache::longroup::coursegroups();
} elsif ($env{'request.course.groups'} ne '') {
- map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'});
+ map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'});
}
my $g_s_header='';
@@ -2313,16 +2521,15 @@ function group_or_section(caller) {
# @param {Apache2::RequestRec} $r - the Apache request
# @param {hash reference} $allparms - hash parameter name -> parameter title
# @param {array reference} $pscat - list of selected parameter names
-# @param {array reference} $psprt - list of selected parameter parts (unused)
# @param {hash reference} $keyorder - hash parameter key -> appearance rank
# @param {string} [$divid] - name used to give an id to the HTML element for the scroll box
sub displaymenu {
- my ($r,$allparms,$pscat,$psprt,$keyorder,$divid)=@_;
+ my ($r,$allparms,$pscat,$keyorder,$divid)=@_;
$r->print(&Apache::lonhtmlcommon::start_pick_box());
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));
- &parmmenu($r,$allparms,$pscat,$keyorder); # only $allparms is used by parmmenu
+ &parmmenu($r);
$r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid));
&parmboxes($r,$allparms,$pscat,$keyorder);
$r->print(&Apache::loncommon::end_scrollbox());
@@ -2555,7 +2762,7 @@ sub groupmenu {
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) {
%grouphash = &Apache::longroup::coursegroups();
} elsif ($env{'request.course.groups'} ne '') {
- map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'});
+ map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'});
}
return '' if (!%grouphash);
@@ -2721,6 +2928,7 @@ sub assessparms {
my %uris=(); # hash resource/map id -> resource src
my %maptitles=(); # hash map pc or src -> map title
my %allmaps=(); # hash map pc -> map src
+ my %allmaps_inverted=(); # hash map src -> map pc
my %alllevs=(); # hash English level title -> value
my $uname; # selected user name
@@ -2729,6 +2937,7 @@ sub assessparms {
my $csec; # selected section name
my $cgroup; # selected group name
my @usersgroups = (); # list of the user groups
+ my $numreclinks = 0;
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'};
@@ -2762,7 +2971,7 @@ sub assessparms {
if ($cgroup ne '') {
unless (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) {
if (($env{'request.course.groups'} eq '') ||
- (!grep(/^\Q$cgroup\E$/,split(/,/,$env{'request.course.groups'})))) {
+ (!grep(/^\Q$cgroup\E$/,split(/:/,$env{'request.course.groups'})))) {
$noeditgrp = 1;
}
}
@@ -2876,6 +3085,8 @@ sub assessparms {
\%mapp, \%symbp,\%maptitles,\%uris,
\%keyorder);
+ %allmaps_inverted = reverse(%allmaps);
+
$mapp{'0.0'} = '';
$symbp{'0.0'} = '';
@@ -3040,6 +3251,7 @@ sub assessparms {
.'';
}
}
+
#----------------------------------------------- if all selected, fill in array
if ($pscat[0] eq "all") {
@pscat = (keys(%allparms));
@@ -3106,7 +3318,7 @@ ENDPARMSELSCRIPT
# Step 2
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2'));
- &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder,'parmmenuscroll');
+ &displaymenu($r,\%allparms,\@pscat,\%keyorder,'parmmenuscroll');
# Step 3
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3'));
@@ -3265,7 +3477,6 @@ ENDTABLEHEADFOUR
foreach my $rid (@ids) {
my ($inmapid)=($rid=~/\.(\d+)$/);
-
if ((!$pssymb &&
(($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid})))
||
@@ -3295,19 +3506,23 @@ ENDTABLEHEADFOUR
my %type= ();
my %default=();
my $uri=&Apache::lonnet::declutter($uris{$rid});
+ my $toolsymb;
+ if ($uri =~ /ext\.tool$/) {
+ $toolsymb = $symbp{$rid};
+ }
my $filter=$env{'form.filter'};
foreach my $tempkeyp (&keysplit($keyp{$rid})) {
if (grep $_ eq $tempkeyp, @catmarker) {
- my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name');
+ my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name',$toolsymb);
# We may only want certain parameters listed
if ($filter) {
unless ($filter=~/\Q$parmname\E/) { next; }
}
$name{$tempkeyp}=$parmname;
- $part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part');
+ $part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part',$toolsymb);
- my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display');
+ my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display',$toolsymb);
if ($allparms{$name{$tempkeyp}} ne '') {
my $identifier;
if ($parmdis =~ /(\s*\[Part.*)$/) {
@@ -3319,15 +3534,20 @@ ENDTABLEHEADFOUR
}
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
- $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp);
- $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type');
- $thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title');
+ $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp,$toolsymb);
+ $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type',$toolsymb);
+ $thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title',$toolsymb);
}
}
my $totalparms=scalar(keys(%name));
if ($totalparms>0) {
my $firstrow=1;
my $title=&Apache::lonnet::gettitle($symbp{$rid});
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ my @recurseup;
+ if (ref($navmap) && $mapp{$rid}) {
+ @recurseup = $navmap->recurseup_maps($mapp{$rid});
+ }
$r->print('
'.
@@ -3359,7 +3579,9 @@ ENDTABLEHEADFOUR
&print_row($r,$item,\%part,\%name,\%symbp,$rid,\%default,
\%type,\%display,$defbgone,$defbgtwo,
$defbgthree,$parmlev,$uname,$udom,$csec,
- $cgroup,\@usersgroups,$noeditgrp,$readonly);
+ $cgroup,\@usersgroups,$noeditgrp,$readonly,
+ \@recurseup,\%maptitles,\%allmaps_inverted,
+ \$numreclinks);
}
}
}
@@ -3405,6 +3627,11 @@ ENDTABLEHEADFOUR
if ($map eq $mapid) {
my $uri=&Apache::lonnet::declutter($uris{$rid});
+ my $toolsymb;
+ if ($uri =~ /ext\.tool$/) {
+ $toolsymb = $symbp{$rid};
+ }
+
# $r->print("Keys: $keyp{$rid} \n");
#--------------------------------------------------------------------
@@ -3420,8 +3647,8 @@ ENDTABLEHEADFOUR
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
$part{$tempkeyp}="0";
- $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
- my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+ $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name',$toolsymb);
+ my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display',$toolsymb);
if ($allparms{$name{$tempkeyp}} ne '') {
my $identifier;
if ($parmdis =~ /(\s*\[Part.*)$/) {
@@ -3434,8 +3661,8 @@ ENDTABLEHEADFOUR
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
$display{$tempkeyp} =~ s/_\w+_/_0_/;
- $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
- $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
+ $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp,$toolsymb);
+ $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type',$toolsymb);
}
} # end loop through keys
}
@@ -3477,12 +3704,23 @@ ENDTABLEHEADFOUR
.&Apache::loncommon::end_data_table_header_row()
);
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ my @recurseup;
+ if (ref($navmap)) {
+ my $mapres = $navmap->getByMapPc($mapid);
+ if (ref($mapres)) {
+ @recurseup = $navmap->recurseup_maps($mapres->src());
+ }
+ }
+
+
foreach my $item (&keysinorder(\%name,\%keyorder)) {
$r->print(&Apache::loncommon::start_data_table_row());
&print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default,
\%type,\%display,$defbgone,$defbgtwo,$defbgthree,
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp,
- $readonly);
+ $readonly,\@recurseup,\%maptitles,\%allmaps_inverted,
+ \$numreclinks);
}
$r->print(&Apache::loncommon::end_data_table().''
.''
@@ -3509,6 +3747,10 @@ ENDTABLEHEADFOUR
my $rid = $id;
my $uri=&Apache::lonnet::declutter($uris{$rid});
+ my $toolsymb;
+ if ($uri =~ /ext\.tool$/) {
+ $toolsymb = $symbp{$rid};
+ }
#--------------------------------------------------------------------
# @catmarker contains list of all possible parameters including part #s
@@ -3522,8 +3764,8 @@ ENDTABLEHEADFOUR
$tempkeyp =~ s/_\w+_/_0_/;
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
$part{$tempkeyp}="0";
- $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
- my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+ $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name',$toolsymb);
+ my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display',$toolsymb);
if ($allparms{$name{$tempkeyp}} ne '') {
my $identifier;
if ($parmdis =~ /(\s*\[Part.*)$/) {
@@ -3536,8 +3778,8 @@ ENDTABLEHEADFOUR
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
$display{$tempkeyp} =~ s/_\w+_/_0_/;
- $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
- $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
+ $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp,$toolsymb);
+ $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type',$toolsymb);
}
} # end loop through keys
} # end loop through ids
@@ -3582,6 +3824,25 @@ ENDMAPONE
} # end of $parmlev eq general
}
$r->print('');
+ if ($numreclinks) {
+ $r->print(<<"END");
+
+
+END
+ }
&endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
} # end sub assessparms
@@ -3667,7 +3928,7 @@ sub readdata {
# Stores parameter data, using form parameters directly.
#
# Uses the following form parameters. The variable part in the names is a resourcedata key (except for a modification for user data).
-# set_* (except settext, setipallow, setipdeny) - set a parameter value
+# set_* (except settext, setipallow, setipdeny, setdeeplink) - set a parameter value
# del_* - remove a parameter
# datepointer_* - set a date parameter (value is key_* refering to a set of other form parameters)
# dateinterval_* - set a date interval parameter (value refers to more form parameters)
@@ -3700,7 +3961,7 @@ sub storedata {
my $cmd=$1;
my $thiskey=$2;
my ($altkey,$recursive,$tkey,$tkeyrec,$tkeynonrec);
- next if ($cmd eq 'rec' || $cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny');
+ next if ($cmd eq 'rec' || $cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny' || $cmd eq 'setdeeplink');
if ((($cmd eq 'set') || ($cmd eq 'datepointer') || ($cmd eq 'dateinterval') || ($cmd eq 'del')) &&
($thiskey =~ /(?:sequence|page)\Q___(all)\E/)) {
unless ($thiskey =~ /(encrypturl|hiddenresource)$/) {
@@ -3731,8 +3992,8 @@ sub storedata {
$text = &mt('Saved modified parameter for');
if ($typeof eq 'string_questiontype') {
$name = 'type';
- } elsif ($typeof eq 'string_lenient') {
- $name = 'lenient';
+ } elsif (($typeof eq 'string_lenient') || ($typeof eq 'string_deeplink')) {
+ ($name) = ($typeof =~ /^string_(lenient|deeplink)$/);
my $stringmatch = &standard_string_matches($typeof);
if (ref($stringmatch) eq 'ARRAY') {
foreach my $item (@{$stringmatch}) {
@@ -4118,7 +4379,7 @@ sub listdata {
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) {
%grouphash = &Apache::longroup::coursegroups();
} elsif ($env{'request.course.groups'} ne '') {
- map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'});
+ map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'});
}
}
@@ -4463,6 +4724,139 @@ sub string_ip_selector {
return $output;
}
+sub string_deeplink_selector {
+ my ($thiskey, $showval, $readonly) = @_;
+ my (@components,%values,@current,%titles,%options,%optiontext,%defaults,%posslti);
+ @components = ('listing','scope','urls');
+ %titles = &Apache::lonlocal::texthash (
+ listing => 'In Contents and/or Gradebook',
+ scope => 'Access scope for link',
+ urls => 'Supported link types',
+ );
+ %options = (
+ listing => ['full','absent','grades','details','datestatus'],
+ scope => ['res','map','rec'],
+ urls => ['any','only','key','lti'],
+ );
+ %optiontext = &Apache::lonlocal::texthash (
+ full => 'Listed (linked) in both',
+ absent => 'Not listed',
+ grades => 'Listed in grades only',
+ details => 'Listed (unlinked) in both',
+ datestatus => 'Listed (unlinked) inc. status in both',
+ res => 'resource only',
+ map => 'enclosing map/folder',
+ rec => 'recursive map/folder',
+ any => 'regular + deep',
+ only => 'deep only',
+ key => 'deep with key',
+ lti => 'deep with LTI launch',
+ );
+ if ($showval =~ /,/) {
+ @current = split(/,/,$showval);
+ ($values{'listing'}) = ($current[0] =~ /^(full|absent|grades|details|datestatus)$/);
+ ($values{'scope'}) = ($current[1] =~ /^(res|map|rec)$/);
+ ($values{'urls'}) = ($current[2] =~ /^(any|only|key:\w+|lti:\d+)$/);
+ } else {
+ $defaults{'listing'} = 'full';
+ $defaults{'scope'} = 'res';
+ $defaults{'urls'} = 'any';
+ }
+ my $disabled;
+ if ($readonly) {
+ $disabled=' disabled="disabled"';
+ }
+ my %lti =
+ &Apache::lonnet::get_domain_lti($env{'course.'.$env{'request.course.id'}.'.domain'},
+ 'provider');
+ foreach my $item (keys(%lti)) {
+ if (ref($lti{$item}) eq 'HASH') {
+ unless ($lti{$item}{'requser'}) {
+ $posslti{$item} = $lti{$item}{'consumer'};
+ }
+ }
+ }
+ my $output = '