--- loncom/interface/lonextresedit.pm 2017/05/08 14:20:20 1.18
+++ loncom/interface/lonextresedit.pm 2017/11/30 01:52:14 1.20
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: lonextresedit.pm,v 1.18 2017/05/08 14:20:20 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.20 2017/11/30 01:52:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -261,25 +261,32 @@ sub update_exttool {
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum);
my (%newhash,$changed,@deleted,$errormsg);
($newhash{'target'},$newhash{'width'},$newhash{'height'},$newhash{'linktext'},$newhash{'explanation'},
- $newhash{'crslabel'},$newhash{'crstitle'}) = split(/:/,$args);
- foreach my $item ('linktext','explanation','crslabel','crstitle') {
+ $newhash{'crslabel'},$newhash{'crstitle'},$newhash{'crsappend'}) = split(/:/,$args);
+ foreach my $item ('linktext','explanation','crslabel','crstitle','crsappend') {
$newhash{$item} = &unescape($newhash{$item});
}
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum);
- foreach my $item ('target','width','height','linktext','explanation','crslabel','crstitle') {
+ foreach my $item ('target','width','height','linktext','explanation','crslabel','crstitle','crsappend') {
$newhash{$item} =~ s/^\s+//;
$newhash{$item} =~ s/\s+$//;
if (($item eq 'width') || ($item eq 'height') || ($item eq 'linktext') || ($item eq 'explanation')) {
if ($newhash{'target'} eq 'iframe') {
$newhash{$item} = '';
+ } elsif ($newhash{'target'} eq 'tab') {
+ if (($item eq 'width') || ($item eq 'height')) {
+ $newhash{$item} = '';
+ }
}
}
if ($toolhash{$item} ne $newhash{$item}) {
if ($newhash{$item} eq '') {
unless (($item eq 'target') ||
- ((($item eq 'width') || ($item eq 'height') || ($item eq 'linktext') || ($item eq 'explanation')) &&
+ ((($item eq 'width') || ($item eq 'height')) &&
(($newhash{'target'} eq 'window') ||
- (($newhash{'target'} eq '') && ($toolhash{'target'} eq 'window'))))) {
+ (($newhash{'target'} eq '') && ($toolhash{'target'} eq 'window')))) ||
+ ((($item eq 'linktext') || ($item eq 'explanation')) &&
+ ((($newhash{'target'} =~ /^(window|tab)$/)) ||
+ (($newhash{'target'} eq '') && ($toolhash{'target'} =~ /^(window|tab)$/))))) {
delete($toolhash{$item});
push(@deleted,$item);
$changed = 1;
@@ -328,15 +335,16 @@ sub extedit_form {
}
my ($formname,$formid,$toggle,$fieldsetid,$urlid,$dispdivstyle,$dimendivstyle,
$windivstyle,$linktextstyle,$explanationstyle,$labelstyle,$titlestyle,
- $legend,$urlelem,$toolelem,%toolattr);
+ $appendstyle,$legend,$urlelem,$toolelem,%toolattr);
$formname = 'new'.$type;
$toggle = $type;
$fieldsetid = 'upload'.$type.'form';
$urlid = $type.'url';
map { $toolattr{$_} = $type.$_; } ('dispdiv','dimendiv','dimenwidth','dimenheight',
- 'crstitlediv','crslabeldiv','crstitle','crslabel',
- 'windiv','linktextdiv','explanationdiv','linktext',
- 'explanation');
+ 'crstitlediv','crslabeldiv','crsappenddiv',
+ 'crstitle','crslabel','crsappend','windiv',
+ 'linktextdiv','explanationdiv','linktext',
+ 'explanation','providerurl');
$dispdivstyle = 'display:none';
$dimendivstyle = 'display:none';
$windivstyle = 'display:none';
@@ -344,6 +352,7 @@ sub extedit_form {
$explanationstyle = 'display:none';
$labelstyle = 'display:none';
$titlestyle = 'display:none';
+ $appendstyle = 'display:none';
if ($supplementalflag) {
$formname = 'newsupp'.$type;
$toggle = 'supp'.$type;
@@ -352,8 +361,8 @@ sub extedit_form {
map { $toolattr{$_} = 'supp'.$toolattr{$_}; } (keys(%toolattr));
}
my ($link,$legend,$active,$srcclass,$extsrc,$preview,$title,$save,$crstitle,$crslabel,
- $fieldsetstyle,$action,$hiddenelem,$form,$width,$height,$tooltarget,
- $linktext,$explanation,%chkstate);
+ $crsappend,$fieldsetstyle,$action,$hiddenelem,$form,$width,$height,$tooltarget,
+ $linktext,$explanation,$providerurl,%chkstate);
$fieldsetstyle = 'display: none;';
$action = '/adm/coursedocs';
my $protocol = ($ENV{'SERVER_PORT'} == 443?'https':'http');
@@ -442,11 +451,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" ';
}
@@ -463,6 +480,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';
}
@@ -505,12 +526,16 @@ sub extedit_form {
$toolelem .= '
';
$crslabel = $env{'course.'.$cdom.'_'.$cnum.'.internal.coursecode'};
$crstitle = $env{'course.'.$cdom.'_'.$cnum.'.description'};
+ $crsappend = '';
}
$toolelem .= '