--- loncom/interface/lonextresedit.pm 2017/04/25 22:18:59 1.16
+++ loncom/interface/lonextresedit.pm 2022/09/09 14:24:30 1.30
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: lonextresedit.pm,v 1.16 2017/04/25 22:18:59 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.30 2022/09/09 14:24:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -60,7 +60,7 @@ sub handler {
$symb,$type);
if (($env{'form.folderpath'} =~ /^supplemental/) && ($env{'form.suppurl'})) {
$supplementalflag = 1;
- if (&unescape($env{'form.suppurl'}) =~ m{^/adm/$cdom/$cnum/\d+/exttools?$}) {
+ if (&unescape($env{'form.suppurl'}) =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}) {
$type = 'tool';
}
}
@@ -79,7 +79,7 @@ sub handler {
if ($symb ne $env{'form.symb'}) {
$env{'form.symb'} = $symb;
}
- if ($url =~ m{/adm/$cdom/$cnum/\d+/exttools?$}) {
+ if ($url =~ m{/adm/$cdom/$cnum/\d+/ext\.tool$}) {
$type = 'tool';
}
}
@@ -98,7 +98,7 @@ sub handler {
}
my %ltitools;
if ($type eq 'tool') {
- %ltitools = &Apache::lonnet::get_domain_ltitools($cdom);
+ %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
}
my $js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript());
my $pathitem = ''.$legend.'';
if ($symb) {
@@ -385,7 +443,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"';
@@ -400,7 +458,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 {
@@ -418,7 +476,7 @@ sub extedit_form {
} else {
$orig_title = $lt{'et'};
$save = $lt{'at'};
- $orig_url = "/adm/$cdom/$cnum/new/exttool";
+ $orig_url = "/adm/$cdom/$cnum/new/ext\.tool";
}
$pathitem .= '
';
}
@@ -429,7 +487,7 @@ sub extedit_form {
my $class = 'LC_nobreak';
if ($residx) {
$class = 'LC_docs_ext_edit LC_nobreak';
- if ($orig_url =~ m{^/adm/$cdom/$cnum/(\d+)/exttools?$}) {
+ if ($orig_url =~ m{^/adm/$cdom/$cnum/(\d+)/ext\.tool$}) {
my $marker = $1;
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum);
if ($toolhash{'id'}) {
@@ -442,11 +500,19 @@ sub extedit_form {
if ($icon) {
$image = '';
}
+ if ($ltitools->{$toolhash{'id'}}->{'url'} =~ m{://}) {
+ (my $prot,my $host,$providerurl) = ($ltitools->{$toolhash{'id'}}->{'url'} =~ m{^([^/]+)://([^/]+)(|/.+)$});
+ } else {
+ $providerurl = $ltitools->{$toolhash{'id'}}->{'url'};
+ }
$tooltarget = $toolhash{'target'};
if ($tooltarget eq 'window') {
$dimendivstyle = 'display:block';
$windivstyle = 'display:block';
$chkstate{'window'} = 'checked="checked" ';
+ } elsif ($tooltarget eq 'tab') {
+ $windivstyle = 'display:block';
+ $chkstate{'tab'} = 'checked="checked" ';
} else {
$chkstate{'iframe'} = 'checked="checked" ';
}
@@ -454,6 +520,11 @@ sub extedit_form {
$height = $toolhash{'height'};
$linktext = $toolhash{'linktext'};
$explanation = $toolhash{'explanation'};
+ if ($toolhash{'gradable'}) {
+ $chkgrd = ' checked="checked"';
+ } else {
+ $chknogrd = ' checked="checked"';
+ }
if (ref($ltitools->{$toolhash{'id'}}->{'crsconf'}) eq 'HASH') {
if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'title'}) {
$crstitle = $toolhash{'crstitle'};
@@ -463,6 +534,10 @@ sub extedit_form {
$crslabel = $toolhash{'crslabel'};
$labelstyle = 'display:inline';
}
+ if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'append'}) {
+ $crsappend = $toolhash{'crsappend'};
+ $appendstyle = 'display:inline';
+ }
if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'target'}) {
$dispdivstyle = 'display:block';
}
@@ -474,6 +549,7 @@ sub extedit_form {
}
}
$toolelem = ''.$image.' '.$tooltitle.'
';
+ $gradablestyle = 'display:inline';
}
}
}
@@ -505,12 +581,17 @@ sub extedit_form {
$toolelem .= '
';
$crslabel = $env{'course.'.$cdom.'_'.$cnum.'.internal.coursecode'};
$crstitle = $env{'course.'.$cdom.'_'.$cnum.'.description'};
+ $crsappend = '';
+ $chknogrd = ' checked="checked"';
}
$toolelem .= '