--- loncom/interface/londocs.pm 2025/02/03 22:52:36 1.723
+++ loncom/interface/londocs.pm 2025/06/14 02:50:25 1.728
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.723 2025/02/03 22:52:36 raeburn Exp $
+# $Id: londocs.pm,v 1.728 2025/06/14 02:50:25 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1704,7 +1704,7 @@ sub group_import {
my $marker = $2;
my $info = $3;
my ($toolid,$toolprefix,$tooltype,%toolhash,%toolsettings);
- my @extras = ('linktext','explanation','crslabel','crstitle','crsappend');
+ my @extras = ('linktext','explanation','crslabel','crstitle','crsappend','returnurl','backtourl','desturl','delay');
my @toolinfo = split(/:/,$info);
if ($residx) {
%toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum);
@@ -1721,10 +1721,17 @@ sub group_import {
$toolid =~ s/\D//g;
($toolhash{'target'},$toolhash{'width'},$toolhash{'height'},
$toolhash{'linktext'},$toolhash{'explanation'},$toolhash{'crslabel'},
- $toolhash{'crstitle'},$toolhash{'crsappend'},$toolhash{'gradable'}) = @toolinfo;
+ $toolhash{'crstitle'},$toolhash{'crsappend'},$toolhash{'gradable'},
+ $toolhash{'returnurl'},$toolhash{'backtourl'},$toolhash{'desturl'},
+ $toolhash{'delay'}) = @toolinfo;
foreach my $item (@extras) {
$toolhash{$item} = &unescape($toolhash{$item});
}
+ foreach my $item ('crsappend','gradable','returnurl',
+ 'backtourl','desturl','delay') {
+ $toolhash{$item} =~ s/^\s+//;
+ $toolhash{$item} =~ s/\s+$//;
+ }
if ($folder =~ /^supplemental/) {
delete($toolhash{'gradable'});
} else {
@@ -1785,6 +1792,7 @@ sub group_import {
}
}
}
+ my $nocrsdest = 1;
if (ref($tools{'crsconf'}) eq 'HASH') {
foreach my $item ('label','title','linktext','explanation') {
my $crsitem;
@@ -1808,6 +1816,25 @@ sub group_import {
}
}
}
+ if ($tools{'crsconf'}{'returnurl'}) {
+ unless ($toolhash{'returnurl'} eq 'custom') {
+ delete($toolhash{'backtourl'});
+ }
+ } else {
+ delete($toolhash{'returnurl'});
+ delete($toolhash{'backtourl'});
+ }
+ if ($tools{'crsconf'}{'desturl'}) {
+ if ($toolhash{'desturl'} =~ m{^(https?\://|/)}) {
+ undef($nocrsdest);
+ } else {
+ delete($toolhash{'desturl'});
+ delete($toolhash{'delay'});
+ }
+ } else {
+ delete($toolhash{'desturl'});
+ delete($toolhash{'delay'});
+ }
}
if ($toolhash{'passback'}) {
my $gradesecret = UUID::Tiny::create_uuid_as_string(UUID_V4);
@@ -1819,6 +1846,17 @@ sub group_import {
$toolhash{'rostersecret'} = $rostersecret;
$toolhash{'rostersecretdate'} = time;
}
+ if ($nocrsdest) {
+ foreach my $item ('desturl','delay') {
+ if (exists($toolhash{$item})) {
+ delete($toolhash{$item});
+ }
+ }
+ } elsif (exists($toolhash{'delay'})) {
+ unless ($toolhash{'delay'} =~ /^(\d+\.?\d*)$/) {
+ delete($toolhash{'delay'});
+ }
+ }
my $changegradable;
if (($residx) && ($folder =~ /^default/)) {
if ($toolsettings{'gradable'}) {
@@ -1836,6 +1874,20 @@ sub group_import {
}
}
}
+ if ($residx) {
+ if (($toolsettings{'backtourl'} ne '') && (!exists($toolhash{'backtourl'}))) {
+ push(@deleted,'backtourl');
+ }
+ if (($toolsettings{'returnurl'} ne '') && (!exists($toolhash{'returnurl'}))) {
+ push(@deleted,'returnurl');
+ }
+ if (($toolsettings{'desturl'} ne '') && (!exists($toolhash{'desturl'}))) {
+ push(@deleted,'desturl');
+ }
+ if (($toolsettings{'delay'} ne '') && (!exists($toolhash{'delay'}))) {
+ push(@deleted,'delay');
+ }
+ }
my $putres = &Apache::lonnet::put('exttool_'.$marker,\%toolhash,$coursedom,$coursenum);
if ($putres eq 'ok') {
if (@deleted) {
@@ -4985,7 +5037,7 @@ sub editor {
.&Apache::loncommon::help_open_menu('Navigation Screen',
$helpitem,undef,'RAT')
.'
'.&mt('Tools:').'
'
- .'