--- loncom/interface/lonextresedit.pm 2016/11/22 00:43:12 1.11
+++ loncom/interface/lonextresedit.pm 2017/03/08 02:51:08 1.15
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: lonextresedit.pm,v 1.11 2016/11/22 00:43:12 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.15 2017/03/08 02:51:08 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'};
@@ -528,7 +529,7 @@ $title
$pathitem
$hiddenelem
-
+
@@ -542,8 +543,8 @@ ENDFORM
}
sub display_editor {
- my ($url,$folderpath,$symb,$idx,$type,$cdom,$cnum) = @_;
- my ($residx,$supplementalflag,$title,$pathitem,$output,$js);
+ my ($url,$folderpath,$symb,$idx,$type,$cdom,$cnum,$hostname) = @_;
+ 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;
@@ -562,6 +563,9 @@ sub display_editor {
}
$js = &Apache::lonhtmlcommon::scripttag(&extedit_javascript());
my $args = { 'force_register' => $env{'form.register'} };
+ if ($hostname) {
+ $args->{'hostname'} = $hostname;
+ }
my $description = 'External Resource Editor';
if ($type eq 'tool') {
$description = 'External Tool Editor';
@@ -733,11 +737,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'}");
}