--- loncom/interface/lonparmset.pm 2023/02/03 01:23:46 1.522.2.28.4.9
+++ loncom/interface/lonparmset.pm 2023/12/29 20:45:18 1.522.2.28.4.11
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.522.2.28.4.9 2023/02/03 01:23:46 raeburn Exp $
+# $Id: lonparmset.pm,v 1.522.2.28.4.11 2023/12/29 20:45:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1408,7 +1408,7 @@ sub print_row {
$extra = 'ltid_'.$domltistr;
}
}
- my %courselti = &Apache::lonnet::get_course_lti($cnum,$cdom);
+ my %courselti = &Apache::lonnet::get_course_lti($cnum,$cdom,'provider');
if (keys(%courselti)) {
foreach my $item (sort { $a <=> $b } keys(%courselti)) {
if (($item =~ /^\d+$/) && (ref($courselti{$item}) eq 'HASH')) {
@@ -1640,23 +1640,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 {
@@ -1665,14 +1669,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
@@ -1876,6 +1880,7 @@ sub lookUpTableParameter {
'lenient' => 'grading',
'retrypartial' => 'tries',
'discussvote' => 'misc',
+ 'texdisplay' => 'misc',
'examcode' => 'high_level_randomization',
);
}
@@ -2886,7 +2891,7 @@ sub assessparms {
'date_interval','int','float','string','string_lenient',
'string_examcode','string_deeplink','string_discussvote',
'string_useslots','string_problemstatus','string_ip',
- 'string_questiontype') {
+ 'string_questiontype','string_tex') {
$r->print('').
'" name="recent_'.$item.'" />');
@@ -3139,20 +3144,24 @@ 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 (&keysplit($keyp{$rid})) {
my $tempkeyp = $_;
if (grep $_ eq $tempkeyp, @catmarker) {
- my $parmname=&Apache::lonnet::metadata($uri,$_.'.name');
+ my $parmname=&Apache::lonnet::metadata($uri,$_.'.name',$toolsymb);
# We may only want certain parameters listed
if ($filter) {
unless ($filter=~/\Q$parmname\E/) { next; }
}
$name{$_}=$parmname;
- $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
+ $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part',$toolsymb);
- my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display');
+ my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display',$toolsymb);
if ($allparms{$name{$_}} ne '') {
my $identifier;
if ($parmdis =~ /(\s*\[Part.*)$/) {
@@ -3164,9 +3173,9 @@ ENDTABLEHEADFOUR
}
unless ($display{$_}) { $display{$_}=''; }
$display{$_}.=' ('.$name{$_}.')';
- $default{$_}=&Apache::lonnet::metadata($uri,$_);
- $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
- $thistitle=&Apache::lonnet::metadata($uri,$_.'.title');
+ $default{$_}=&Apache::lonnet::metadata($uri,$_,$toolsymb);
+ $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type',$toolsymb);
+ $thistitle=&Apache::lonnet::metadata($uri,$_.'.title',$toolsymb);
}
}
my $totalparms=scalar keys %name;
@@ -3251,6 +3260,10 @@ 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");
#--------------------------------------------------------------------
@@ -3267,8 +3280,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.*)$/) {
@@ -3281,8 +3294,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
}
@@ -3356,6 +3369,10 @@ ENDTABLEHEADFOUR
my $rid = $_;
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
@@ -3370,8 +3387,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.*)$/) {
@@ -3384,8 +3401,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
@@ -3556,6 +3573,8 @@ sub storedata {
if ($thiskey =~ /\.retrypartial$/) {
$name = 'retrypartial';
}
+ } elsif ($typeof eq 'string_tex') {
+ $name = 'texdisplay';
}
} elsif ($cmd eq 'datepointer') {
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key});
@@ -4161,7 +4180,8 @@ sub string_deeplink_selector {
}
my %courselti =
&Apache::lonnet::get_course_lti($env{'course.'.$env{'request.course.id'}.'.num'},
- $env{'course.'.$env{'request.course.id'}.'.domain'});
+ $env{'course.'.$env{'request.course.id'}.'.domain'},
+ 'provider');
foreach my $item (keys(%courselti)) {
if (ref($courselti{$item}) eq 'HASH') {
$crslti{$item} = $courselti{$item}{'name'};
@@ -4359,6 +4379,9 @@ my %strings =
['_denyfrom_','Hostname(s) or IP(s) from which access is disallowed']],
'string_deeplink'
=> [['on','Set choices for link protection, resource listing, access scope, shown menu items, embedding, and exit link']],
+ 'string_tex'
+ => [['tth', 'tth (TeX to HTML)'],
+ ['mathjax', 'MathJax']],
);
my %stringmatches = (
@@ -4377,6 +4400,7 @@ my %stringtypes = (
examcode => 'string_examcode',
acc => 'string_ip',
deeplink => 'string_deeplink',
+ texdisplay => 'string_tex',
);
sub standard_string_options {
@@ -5923,7 +5947,11 @@ sub parm_change_log {
$parmitem = &mt($parmitem);
$output .= &mt('Type: [_1]',$parmitem);
} else {
- my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what),
+ my $toolsymb;
+ if ($middle =~ /ext\.tool$/) {
+ $toolsymb = $middle;
+ }
+ my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what,$toolsymb),
$uname,$udom,$issection,$issection,$courseopt);
my $showvalue = $value;
if ($istype{$parmname} eq '') {