--- loncom/interface/lonextresedit.pm 2017/05/08 14:20:20 1.18 +++ 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.18 2017/05/08 14:20:20 raeburn Exp $ +# $Id: lonextresedit.pm,v 1.19 2017/05/10 13:49:14 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -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; @@ -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,7 +921,7 @@ 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'; @@ -972,17 +987,21 @@ function updateTooldim(form,dimendiv,win dimen = 'block'; linkconf = 'block'; } else { - if (document.getElementById(widthinput)) { - document.getElementById(widthinput).value = ''; - } - if (document.getElementById(heightinput)) { - document.getElementById(heightinput).value = ''; - } - if (document.getElementById(linkinput)) { - document.getElementById(linkinput).value = ''; - } - if (document.getElementById(explaininput)) { - document.getElementById(explaininput).value = ''; + if (form.exttooltarget[i].value == 'tab') { + linkconf = 'block'; + } else { + if (document.getElementById(widthinput)) { + document.getElementById(widthinput).value = ''; + } + if (document.getElementById(heightinput)) { + document.getElementById(heightinput).value = ''; + } + if (document.getElementById(linkinput)) { + document.getElementById(linkinput).value = ''; + } + if (document.getElementById(explaininput)) { + document.getElementById(explaininput).value = ''; + } } } if (document.getElementById(dimendiv)) {