--- loncom/interface/lonextresedit.pm 2016/11/29 16:03:03 1.13
+++ loncom/interface/lonextresedit.pm 2017/05/08 14:20:20 1.18
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: lonextresedit.pm,v 1.13 2016/11/29 16:03:03 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.18 2017/05/08 14:20:20 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';
}
}
@@ -146,7 +146,7 @@ sub process_changes {
$oldtitle = &unescape($env{'form.title'});
$container = 'sequence';
$supplementalflag = 1;
- if ($oldurl =~ m{^/adm/$cdom/$cnum/\d+/exttools?$}) {
+ if ($oldurl =~ m{^/adm/$cdom/$cnum/\d+/ext\.tool$}) {
$type = 'tool';
} else {
$type = 'ext';
@@ -157,7 +157,7 @@ sub process_changes {
if ($env{'form.importdetail'}) {
($newtitle,$newurl,$newidx) =
map {&unescape($_)} split(/\=/,$env{'form.importdetail'});
- if ($newurl =~ m{^(/adm/$cdom/$cnum/(\d+)/exttools?)\:?(.*)$}) {
+ if ($newurl =~ m{^(/adm/$cdom/$cnum/(\d+)/ext\.tool)\:?(.*)$}) {
$newurl = $1;
$marker = $2;
$args = $3;
@@ -260,14 +260,16 @@ sub update_exttool {
my ($marker,$cdom,$cnum,$args) = @_;
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum);
my (%newhash,$changed,@deleted,$errormsg);
- ($newhash{'target'},$newhash{'width'},$newhash{'height'},$newhash{'crslabel'},$newhash{'crstitle'}) = split(/:/,$args);
- $newhash{'crslabel'} = &unescape($newhash{'crslabel'});
- $newhash{'crstitle'} = &unescape($newhash{'crstitle'});
+ ($newhash{'target'},$newhash{'width'},$newhash{'height'},$newhash{'linktext'},$newhash{'explanation'},
+ $newhash{'crslabel'},$newhash{'crstitle'}) = split(/:/,$args);
+ foreach my $item ('linktext','explanation','crslabel','crstitle') {
+ $newhash{$item} = &unescape($newhash{$item});
+ }
my %toolhash=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum);
- foreach my $item ('target','width','height','crslabel','crstitle') {
+ foreach my $item ('target','width','height','linktext','explanation','crslabel','crstitle') {
$newhash{$item} =~ s/^\s+//;
$newhash{$item} =~ s/\s+$//;
- if (($item eq 'width') || ($item eq 'height')) {
+ if (($item eq 'width') || ($item eq 'height') || ($item eq 'linktext') || ($item eq 'explanation')) {
if ($newhash{'target'} eq 'iframe') {
$newhash{$item} = '';
}
@@ -275,7 +277,7 @@ sub update_exttool {
if ($toolhash{$item} ne $newhash{$item}) {
if ($newhash{$item} eq '') {
unless (($item eq 'target') ||
- ((($item eq 'width') || ($item eq 'height')) &&
+ ((($item eq 'width') || ($item eq 'height') || ($item eq 'linktext') || ($item eq 'explanation')) &&
(($newhash{'target'} eq 'window') ||
(($newhash{'target'} eq '') && ($toolhash{'target'} eq 'window'))))) {
delete($toolhash{$item});
@@ -325,15 +327,21 @@ sub extedit_form {
$tabid = 'ee';
}
my ($formname,$formid,$toggle,$fieldsetid,$urlid,$dispdivstyle,$dimendivstyle,
- $labelstyle,$titlestyle,$legend,$urlelem,$toolelem,%toolattr);
+ $windivstyle,$linktextstyle,$explanationstyle,$labelstyle,$titlestyle,
+ $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');
+ 'crstitlediv','crslabeldiv','crstitle','crslabel',
+ 'windiv','linktextdiv','explanationdiv','linktext',
+ 'explanation');
$dispdivstyle = 'display:none';
$dimendivstyle = 'display:none';
+ $windivstyle = 'display:none';
+ $linktextstyle = 'display:none';
+ $explanationstyle = 'display:none';
$labelstyle = 'display:none';
$titlestyle = 'display:none';
if ($supplementalflag) {
@@ -344,13 +352,19 @@ 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,%chkstate);
+ $fieldsetstyle,$action,$hiddenelem,$form,$width,$height,$tooltarget,
+ $linktext,$explanation,%chkstate);
$fieldsetstyle = 'display: none;';
$action = '/adm/coursedocs';
+ my $protocol = ($ENV{'SERVER_PORT'} == 443?'https':'http');
+ my $rows = 2;
+ my $cols = 20;
if ($residx) {
if ($caller eq 'direct') {
$fieldsetstyle = 'display: block;';
$action = '/adm/extresedit';
+ $rows = 10;
+ $cols = 45;
if ($type eq 'tool') {
$legend = $lt{'ee'};
} else {
@@ -377,7 +391,7 @@ sub extedit_form {
$srcclass = ' class="LC_nobreak"';
if ($type eq 'ext') {
$extsrc = ''.$lt{'ul'}.' ';
- $preview = ' '.$lt{'pr'}.'';
+ $preview = ' '.$lt{'pr'}.'';
}
$title = ''.$lt{'ti'}.' ';
$save = $lt{'sv'};
@@ -399,12 +413,12 @@ sub extedit_form {
$orig_url = 'http://';
$orig_title = $lt{'ex'};
$extsrc = $lt{'ul'}.':
';
- $preview = '';
+ $preview = '';
$save = $lt{'al'};
} else {
$orig_title = $lt{'et'};
$save = $lt{'at'};
- $orig_url = "/adm/$cdom/$cnum/new/exttool";
+ $orig_url = "/adm/$cdom/$cnum/new/ext\.tool";
}
$pathitem .= '
';
}
@@ -415,7 +429,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'}) {
@@ -431,12 +445,15 @@ sub extedit_form {
$tooltarget = $toolhash{'target'};
if ($tooltarget eq 'window') {
$dimendivstyle = 'display:block';
+ $windivstyle = 'display:block';
$chkstate{'window'} = 'checked="checked" ';
} else {
$chkstate{'iframe'} = 'checked="checked" ';
}
$width = $toolhash{'width'};
$height = $toolhash{'height'};
+ $linktext = $toolhash{'linktext'};
+ $explanation = $toolhash{'explanation'};
if (ref($ltitools->{$toolhash{'id'}}->{'crsconf'}) eq 'HASH') {
if ($ltitools->{$toolhash{'id'}}->{'crsconf'}->{'title'}) {
$crstitle = $toolhash{'crstitle'};
@@ -449,6 +466,12 @@ sub extedit_form {
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.'
';
}
@@ -486,21 +509,31 @@ sub extedit_form {
$toolelem .= '