--- loncom/interface/lonextresedit.pm 2016/11/29 16:03:03 1.13 +++ 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.13 2016/11/29 16:03:03 raeburn Exp $ +# $Id: lonextresedit.pm,v 1.14 2017/02/19 00:15:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -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'}; @@ -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'}"); }