--- loncom/interface/lonextresedit.pm 2023/05/22 21:10:55 1.31
+++ loncom/interface/lonextresedit.pm 2025/06/14 02:50:25 1.37
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: lonextresedit.pm,v 1.31 2023/05/22 21:10:55 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.37 2025/06/14 02:50:25 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -109,7 +109,7 @@ sub handler {
%ltitools = (
dom => \%domtools,
crs => \%crstools,
- );
+ );
}
my $js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript());
my $pathitem = '';
} else {
my $class = 'LC_nobreak';
+ my ($nocrsdest,$fixeddest,$fixeddelay,$showprovider,$provider,$scheme);
if ($residx) {
$class = 'LC_docs_ext_edit LC_nobreak';
if ($orig_url =~ m{^/adm/$cdom/$cnum/(\d+)/ext\.tool$}) {
@@ -508,19 +560,14 @@ sub extedit_form {
if ($toolhash{'id'} =~/^c(\d+)$/) {
$tool = $1;
$tooltype = 'crs';
- if (ref($ltitools) eq 'HASH') {
- if (ref($ltitools->{'crs'}) eq 'HASH') {
- $ltihash = $ltitools->{'crs'}->{$tool};
- }
- }
} elsif ($toolhash{'id'} =~/^\d+$/) {
$tooltype = 'dom';
$tool = $toolhash{'id'};
- if (ref($ltitools) eq 'HASH') {
- if (ref($ltitools->{'dom'}) eq 'HASH') {
- $ltihash = $ltitools->{'dom'}->{$tool};
- }
- }
+ }
+ if (($tool ne '') && ($tooltype ne '') && (ref($ltitools) eq 'HASH')) {
+ if (ref($ltitools->{$tooltype}) eq 'HASH') {
+ $ltihash = $ltitools->{$tooltype}->{$tool};
+ }
}
if (($tool ne '') && (ref($ltihash) eq 'HASH')) {
my $tooltitle = $ltihash->{'title'};
@@ -529,10 +576,10 @@ sub extedit_form {
if ($icon) {
$image = '';
}
- if ($ltihash->{'url'} =~ m{://}) {
- (my $prot,my $host,$providerurl) = ($ltihash->{'url'} =~ m{^([^/]+)://([^/]+)(|/.+)$});
+ if ($ltihash->{'url'} =~ m{^https?\://}) {
+ ($scheme,$provider,$path) = ($ltihash->{'url'} =~ m{^(https?\://)([^/]+)(|/.+)$});
} else {
- $providerurl = $ltihash->{'url'};
+ $path = $ltihash->{'url'};
}
$tooltarget = $toolhash{'target'};
if ($tooltarget eq 'window') {
@@ -566,6 +613,7 @@ sub extedit_form {
if ($ltihash->{'crsconf'}->{'append'}) {
$crsappend = $toolhash{'crsappend'};
$appendstyle = 'display:inline';
+ $showprovider = 1;
}
if ($ltihash->{'crsconf'}->{'target'}) {
$dispdivstyle = 'display:block';
@@ -576,9 +624,52 @@ sub extedit_form {
if ($ltihash->{'crsconf'}->{'explanation'}) {
$explanationstyle = 'padding:0;display:inline';
}
+ if ($ltihash->{'crsconf'}->{'returnurl'}) {
+ $returnurl = $toolhash{'returnurl'};
+ $returnurlstyle = 'display:inline';
+ $backtourl = $toolhash{'backtourl'};
+ if ($returnurl eq 'none') {
+ $chknoreturn = ' checked="checked"';
+ $customreturn = 'hidden';
+ } elsif (($returnurl eq 'custom') && ($backtourl ne '')) {
+ $chkreturncust = ' checked="checked"';
+ $customreturn = 'text';
+ } else {
+ $chkreturndef = ' checked="checked"';
+ $customreturn = 'hidden';
+ }
+ }
+ if ($ltihash->{'crsconf'}->{'desturl'}) {
+ $desturl = $toolhash{'desturl'};
+ $desturlstyle = 'display:inline';
+ $delay = $toolhash{'delay'};
+ $showprovider = 1;
+ if ($desturl ne '') {
+ $desturlinfostyle = 'display:inline';
+ $chkdest = ' checked="checked"';
+ $chknodest = '';
+ } else {
+ $desturlinfostyle = 'display:none';
+ $chkdest = '';
+ $chknodest = ' checked="checked"';
+ }
+ } else {
+ $nocrsdest = 1;
+ }
}
$toolelem = ''.$image.' '.$tooltitle.'
';
$gradablestyle = 'display:inline';
+ if (($ltihash->{'desturl'}) && ($nocrsdest) && ($ltihash->{'defdest'} =~ m{^(https?\://|/)})) {
+ $fixeddest = $ltihash->{'defdest'};
+ if ($ltihash->{'defdelay'} =~ /^\d+\.?\d*$/) {
+ $fixeddelay = $ltihash->{'defdelay'};
+ }
+ $desturlfixedstyle = 'display:inline-block';
+ $showprovider = 1;
+ }
+ if (($showprovider) && ($provider ne '')) {
+ $providerstyle = 'display:inline-block';
+ }
}
}
} else {
@@ -631,7 +722,7 @@ sub extedit_form {
$exttypeofftext = &mt('No external tools defined in the domain are available for selection.');
} elsif (!$numcrstools && $numdomtools) {
$defcheck{'dom'} = ' checked="checked"';
- $subdivstyle = 'display:none';
+ $subdivstyle = 'display:block';
$exttypeonsty = 'display:block';
my $firstoption = '';
$seloptions = &ordered_tooloptions($ltitools->{'dom'});
@@ -658,9 +749,49 @@ sub extedit_form {
$crslabel = $env{'course.'.$cdom.'_'.$cnum.'.internal.coursecode'};
$crstitle = $env{'course.'.$cdom.'_'.$cnum.'.description'};
$crsappend = '';
+ $returnurl = '';
+ $backtourl = '';
+ $customreturn = 'hidden';
$chknogrd = ' checked="checked"';
- }
- $toolelem .= '