--- loncom/interface/lonextresedit.pm 2017/04/25 22:18:59 1.16 +++ loncom/interface/lonextresedit.pm 2017/05/10 13:49:14 1.19 @@ -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.19 2017/05/10 13:49:14 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; @@ -272,14 +272,21 @@ sub update_exttool { 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; @@ -418,7 +425,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 +436,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'}) { @@ -447,6 +454,9 @@ sub extedit_form { $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" '; } @@ -511,6 +521,9 @@ sub extedit_form { ''.(' 'x2). + ''.(' 'x2). ''. @@ -729,6 +742,8 @@ function setExternal(extform,residx,type var height = extform.exttoolheight.value; height.trim(); info += ':window:'+width+':'+height; + } else if (extform.exttooltarget[i].value == 'tab') { + info += ':tab::'; } else { info += ':iframe::'; } @@ -906,34 +921,34 @@ function updateExttool(caller,form,suppl } } if (document.getElementById(windiv)) { - if (ltitoolsTarget[j] == 'window') { + if ((ltitoolsTarget[j] == 'window') || (ltitoolsTarget[j] == 'tab')) { document.getElementById(windiv).style.display = 'block'; } else { document.getElementById(windiv).style.display = 'none'; } if (document.getElementById(linktextdiv)) { - if ((ltitoolsLink[j]) && (ltitoolsTarget[j] == 'window')) { + if (ltitoolsLink[j]) { document.getElementById(linktextdiv).style.display = 'inline'; } else { document.getElementById(linktextdiv).style.display = 'none'; } } if (document.getElementById(linktextinput)) { - if ((ltitoolsLink[j]) && (ltitoolsTarget[j] == 'window')) { + if (ltitoolsLink[j]) { document.getElementById(linktextinput).value = ltitoolsLinkDef[j]; } else { document.getElementById(linktextinput).value = ''; } } if (document.getElementById(explanationdiv)) { - if ((ltitoolsExplain[j]) && (ltitoolsTarget[j] == 'window')) { + if (ltitoolsExplain[j]) { document.getElementById(explanationdiv).style.display = 'inline'; } else { document.getElementById(explanationdiv).style.display = 'none'; } } if (document.getElementById(explanationinput)) { - if ((ltitoolsExplain[j]) && (ltitoolsTarget[j] == 'window')) { + if (ltitoolsExplain[j]) { document.getElementById(explanationinput).value = ltitoolsExplainDef[j]; } else { document.getElementById(explananationinput).value = ''; @@ -967,22 +982,26 @@ function updateTooldim(form,dimendiv,win for (var i=0; i