--- loncom/interface/lonextresedit.pm 2023/07/11 23:17:40 1.8.2.4.4.3
+++ loncom/interface/lonextresedit.pm 2025/03/15 01:03:33 1.36
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: lonextresedit.pm,v 1.8.2.4.4.3 2023/07/11 23:17:40 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.36 2025/03/15 01:03:33 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -284,10 +284,8 @@ sub process_changes {
if ($ferr) {
$errormsg = &mt('Reload failed: [_1].',$ferr);
} else {
- unless ($supplementalflag) {
- &Apache::loncommon::update_content_constraints($cdom,$cnum,$chome,
- $cdom.'_'.$cnum);
- }
+ &Apache::loncommon::update_content_constraints($cdom,$cnum,$chome,
+ $cdom.'_'.$cnum);
}
}
if (($type eq 'tool') && ($newgradable)) {
@@ -311,12 +309,13 @@ sub update_exttool {
my ($marker,$cdom,$cnum,$supplementalflag,$args) = @_;
my (%newhash,$changed,$newgradable,@deleted,$errormsg);
($newhash{'target'},$newhash{'width'},$newhash{'height'},$newhash{'linktext'},$newhash{'explanation'},
- $newhash{'crslabel'},$newhash{'crstitle'},$newhash{'crsappend'},$newhash{'gradable'}) = split(/:/,$args);
- foreach my $item ('linktext','explanation','crslabel','crstitle','crsappend') {
+ $newhash{'crslabel'},$newhash{'crstitle'},$newhash{'crsappend'},$newhash{'gradable'},
+ $newhash{'returnurl'},$newhash{'backtourl'}) = split(/:/,$args);
+ foreach my $item ('linktext','explanation','crslabel','crstitle','crsappend','backtourl') {
$newhash{$item} = &unescape($newhash{$item});
}
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum);
- foreach my $item ('target','width','height','linktext','explanation','crslabel','crstitle','crsappend','gradable') {
+ foreach my $item ('target','width','height','linktext','explanation','crslabel','crstitle','crsappend','gradable','returnurl','backtourl') {
$newhash{$item} =~ s/^\s+//;
$newhash{$item} =~ s/\s+$//;
if (($item eq 'width') || ($item eq 'height') || ($item eq 'linktext') || ($item eq 'explanation')) {
@@ -331,6 +330,10 @@ sub update_exttool {
unless ($newhash{$item} == 1) {
$newhash{$item} = '';
}
+ } elsif ($item eq 'backtourl') {
+ unless ($newhash{'returnurl'} eq 'custom') {
+ $newhash{$item} = '';
+ }
}
if ($toolhash{$item} ne $newhash{$item}) {
if (($item eq 'gradable') && (!$supplementalflag)) {
@@ -354,7 +357,7 @@ sub update_exttool {
}
} else {
$toolhash{$item} = $newhash{$item};
- $changed = 1;
+ $changed = 1;
}
}
}
@@ -398,16 +401,17 @@ sub extedit_form {
}
my ($formname,$formid,$toggle,$fieldsetid,$urlid,$subdivid,$dispdivstyle,$dimendivstyle,
$windivstyle,$linktextstyle,$explanationstyle,$labelstyle,$titlestyle,
- $appendstyle,$gradablestyle,$subdivstyle,$legend,$urlelem,$toolelem,%toolattr);
+ $appendstyle,$gradablestyle,$returnurlstyle,$subdivstyle,$legend,$urlelem,
+ $toolelem,%toolattr);
$formname = 'new'.$type;
$toggle = $type;
- $fieldsetid = 'upload'.$type.'form';
+ $fieldsetid = 'external'.$type.'form';
$urlid = $type.'url';
map { $toolattr{$_} = $type.$_; } ('dispdiv','dimendiv','dimenwidth','dimenheight',
'crstitlediv','crslabeldiv','crsappenddiv',
- 'gradablediv','crstitle','crslabel','crsappend',
- 'windiv','linktextdiv','explanationdiv',
- 'linktext','explanation','providerurl');
+ 'gradablediv','returnurldiv','crstitle','crslabel',
+ 'crsappend','windiv','linktextdiv','explanationdiv',
+ 'linktext','explanation','providerurl','customreturnurl');
$dispdivstyle = 'display:none';
$dimendivstyle = 'display:none';
$windivstyle = 'display:none';
@@ -417,17 +421,19 @@ sub extedit_form {
$titlestyle = 'display:none';
$appendstyle = 'display:none';
$gradablestyle = 'display:none';
+ $returnurlstyle = 'display:none';
$subdivstyle = 'display:block';
if ($supplementalflag) {
$formname = 'newsupp'.$type;
$toggle = 'supp'.$type;
- $fieldsetid = 'uploadsupp'.$type.'form';
+ $fieldsetid = 'externalsupp'.$type.'form';
$urlid = 'supp'.$type.'url';
map { $toolattr{$_} = 'supp'.$toolattr{$_}; } (keys(%toolattr));
}
my ($link,$legend,$active,$srcclass,$extsrc,$preview,$title,$save,$crstitle,$crslabel,
$crsappend,$fieldsetstyle,$action,$hiddenelem,$form,$width,$height,$tooltarget,
- $linktext,$explanation,$providerurl,$chkgrd,$chknogrd,%chkstate);
+ $linktext,$explanation,$providerurl,$returnurl,$chkgrd,$chknogrd,%chkstate,
+ $chknoreturn,$chkreturndef,$chkreturncust,$customreturn,$backtourl);
$fieldsetstyle = 'display: none;';
$action = '/adm/coursedocs';
my $protocol = ($ENV{'SERVER_PORT'} == 443?'https':'http');
@@ -459,7 +465,7 @@ sub extedit_form {
$active = '';
}
$formname = 'edit'.$type.'_'.$residx;
- $fieldsetid = 'upload'.$type.$residx;
+ $fieldsetid = 'external'.$type.$residx;
$urlid = $type.'url_'.$residx;
map { $toolattr{$_} .= '_'.$residx; } (keys(%toolattr));
$srcclass = ' class="LC_nobreak"';
@@ -474,7 +480,7 @@ sub extedit_form {
if ($type eq 'tool') {
$link = $lt{'et'};
}
- $link = ''.$link.''.$helpitem;
+ $link = ''.$link.''.$helpitem;
if ($type eq 'tool') {
$legend = $lt{'te'};
} else {
@@ -578,6 +584,21 @@ 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';
+ }
+ }
}
$toolelem = ''.$image.' '.$tooltitle.'
';
$gradablestyle = 'display:inline';
@@ -660,8 +681,15 @@ sub extedit_form {
$crslabel = $env{'course.'.$cdom.'_'.$cnum.'.internal.coursecode'};
$crstitle = $env{'course.'.$cdom.'_'.$cnum.'.description'};
$crsappend = '';
+ $returnurl = '';
+ $backtourl = '';
+ $customreturn = 'hidden';
$chknogrd = ' checked="checked"';
+ $chknoreturn = '';
+ $chkreturndef = ' checked="checked"';
+ $chkreturncust = '';
}
+ my $onclickreturl = ' onclick="updateReturnUrl('."this.form,'$toolattr{'customreturnurl'}','$toolattr{'returnurldiv'}','exttoolreturnurl'".');"';
$toolelem .= '