--- loncom/interface/lonextresedit.pm 2025/03/15 03:10:09 1.8.2.4.4.4
+++ loncom/interface/lonextresedit.pm 2018/01/31 14:51:05 1.24
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: lonextresedit.pm,v 1.8.2.4.4.4 2025/03/15 03:10:09 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.24 2018/01/31 14:51:05 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -98,18 +98,7 @@ sub handler {
}
my %ltitools;
if ($type eq 'tool') {
- my (%domtools,%crstools);
- my %tooltypes = &Apache::loncommon::usable_exttools();
- if ($tooltypes{'dom'}) {
- %domtools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
- }
- if ($tooltypes{'crs'}) {
- %crstools = &Apache::lonnet::get_course_lti($cnum,$cdom,'consumer');
- }
- %ltitools = (
- dom => \%domtools,
- crs => \%crstools,
- );
+ %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
}
my $js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript());
my $pathitem = '';
- }
- if ($ltihash->{'url'} =~ m{://}) {
- (my $prot,my $host,$providerurl) = ($ltihash->{'url'} =~ m{^([^/]+)://([^/]+)(|/.+)$});
- } else {
- $providerurl = $ltihash->{'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" ';
- }
- $width = $toolhash{'width'};
- $height = $toolhash{'height'};
- $linktext = $toolhash{'linktext'};
- $explanation = $toolhash{'explanation'};
- if ($toolhash{'gradable'}) {
- $chkgrd = ' checked="checked"';
- } else {
- $chknogrd = ' checked="checked"';
- }
- if (ref($ltihash->{'crsconf'}) eq 'HASH') {
- if ($ltihash->{'crsconf'}->{'title'}) {
- $crstitle = $toolhash{'crstitle'};
- $titlestyle = 'display:inline';
- }
- if ($ltihash->{'crsconf'}->{'label'}) {
- $crslabel = $toolhash{'crslabel'};
- $labelstyle = 'display:inline';
- }
- if ($ltihash->{'crsconf'}->{'append'}) {
- $crsappend = $toolhash{'crsappend'};
- $appendstyle = 'display:inline';
- }
- if ($ltihash->{'crsconf'}->{'target'}) {
- $dispdivstyle = 'display:block';
- }
- if ($ltihash->{'crsconf'}->{'linktext'}) {
- $linktextstyle = 'padding:0;display:inline';
- }
- 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 (keys(%{$ltitools})) {
+ if (ref($ltitools->{$toolhash{'id'}}) eq 'HASH') {
+ my $tooltitle = $ltitools->{$toolhash{'id'}}->{'title'};
+ my $icon = $ltitools->{$toolhash{'id'}}->{'image'};
+ my $image;
+ 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" ';
+ }
+ $width = $toolhash{'width'};
+ $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'};
+ $titlestyle = 'display:inline';
+ }
+ if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'label'}) {
+ $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';
+ }
+ if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'linktext'}) {
+ $linktextstyle = 'padding:0;display:inline';
+ }
+ if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'explanation'}) {
+ $explanationstyle = 'padding:0;display:inline';
+ }
+ }
+ $toolelem = ''.$image.' '.$tooltitle.'
';
+ $gradablestyle = 'display:inline';
}
- }
+ }
}
- $toolelem = ''.$image.' '.$tooltitle.'
';
- $gradablestyle = 'display:inline';
}
}
} else {
- $subdivstyle = 'display:none';
- my $toolradio = 'exttooltype';
- my $exttypeon = 'LC_exttoolon';
- my $exttypeoff = 'LC_exttooloff';
- my $exttypeonsty = 'display:none';
- my $exttypeoffsty = 'display:none';
- my $exttypeofftext;
- if ($supplementalflag) {
- $toolradio = 'suppexttooltype';
- $exttypeon = 'LC_exttoolonsupp';
- $exttypeoff = 'LC_exttooloffsupp';
- }
- my ($numcrstools,$numdomtools,$typeclick,%defcheck,%typedesc);
- %typedesc = (
- crs => 'Defined in course',
- dom => 'Defined in domain',
- );
-#FIXME need crstype
- my $seloptions;
- $subdivid = 'LC_addtool';
- if ($supplementalflag) {
- $subdivid = 'LC_addtoolsupp';
- }
+ $toolelem = ''."\n".
+ '
';
$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 .= '