--- loncom/interface/lonextresedit.pm 2016/06/06 17:40:48 1.10 +++ loncom/interface/lonextresedit.pm 2017/02/19 00:15:51 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: lonextresedit.pm,v 1.10 2016/06/06 17:40:48 raeburn Exp $ +# $Id: lonextresedit.pm,v 1.14 2017/02/19 00:15:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -302,7 +302,7 @@ sub update_exttool { sub extedit_form { my ($supplementalflag,$residx,$orig_url,$orig_title,$pathitem,$helpitem,$caller, - $symb,$type,$cdom,$cnum,$ltitools) = @_; + $symb,$type,$cdom,$cnum,$ltitools,$disabled) = @_; if ($type ne 'tool') { $type = 'ext'; } @@ -347,6 +347,7 @@ sub extedit_form { $fieldsetstyle,$action,$hiddenelem,$form,$width,$height,$tooltarget,%chkstate); $fieldsetstyle = 'display: none;'; $action = '/adm/coursedocs'; + my $protocol = ($ENV{'SERVER_PORT'} == 443?'https':'http'); if ($residx) { if ($caller eq 'direct') { $fieldsetstyle = 'display: block;'; @@ -377,7 +378,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,7 +400,7 @@ sub extedit_form { $orig_url = 'http://'; $orig_title = $lt{'ex'}; $extsrc = $lt{'ul'}.':
'; - $preview = ''; + $preview = ''; $save = $lt{'al'}; } else { $orig_title = $lt{'et'}; @@ -410,7 +411,7 @@ sub extedit_form { } $formid = $formname; if ($type eq 'ext') { - $urlelem = ''; + $urlelem = ''; } else { my $class = 'LC_nobreak'; if ($residx) { @@ -459,7 +460,7 @@ sub extedit_form { } else { $toolelem = ''."\n". ''.&mt('iframe').''.(' 'x2). + "'$toolattr{dimendiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}'".');"'.$disabled.'>'.&mt('iframe').''.(' 'x2). ''. + "'$toolattr{dimendiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}'".');"'.$disabled.'>'.&mt('window').''. '
'. ''. - &mt('Width').''.(' 'x2). - &mt('Height').''."\n". + &mt('Width').''.(' 'x2). + &mt('Height').''."\n". '
'. '
'. ''.&mt('Course label:').' '. - '
'. + '
'. '
'. '
'. ''.&mt('Course title:').' '. - '
'. + '
'. '
'; } my $chooser = $toolelem; @@ -524,11 +525,11 @@ $chooser
$title - + $pathitem $hiddenelem - +
@@ -543,7 +544,7 @@ ENDFORM sub display_editor { my ($url,$folderpath,$symb,$idx,$type,$cdom,$cnum) = @_; - my ($residx,$supplementalflag,$title,$pathitem,$output,$js); + my ($residx,$supplementalflag,$title,$pathitem,$output,$js,$navmap); if ($folderpath =~ /^supplemental/) { $supplementalflag = 1; $residx = $idx; @@ -553,7 +554,7 @@ sub display_editor { (my $map,$residx,my $res) = &Apache::lonnet::decode_symb($symb); $title = &Apache::lonnet::gettitle($symb); - my $path = &Apache::loncommon::symb_to_docspath($symb); + my $path = &Apache::loncommon::symb_to_docspath($symb,\$navmap); $pathitem = ''; } my %ltitools; @@ -733,11 +734,16 @@ function editext(residx,type) { return; } -function extUrlPreview(caller) { +function extUrlPreview(caller,protocol) { if (document.getElementById(caller)) { var url = document.getElementById(caller).value; if (regexp.test(url)) { - openMyModal(url,500,400,'yes'); + var http_regex = /^http\:\/\//gi; + if ((protocol == 'https') && (http_regex.test(url))) { + window.open(url,"externalpreview","height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1"); + } else { + openMyModal(url,500,400,'yes'); + } } else { alert("$js_lt{'invurl'}"); }