[LON-CAPA-cvs] cvs: loncom /interface lonextresedit.pm

raeburn raeburn at source.lon-capa.org
Sat Feb 18 19:15:51 EST 2017


raeburn		Sun Feb 19 00:15:51 2017 EDT

  Modified files:              
    /loncom/interface	lonextresedit.pm 
  Log:
  - Preview of external http:// URL displayed in separate pop-up window  
    instead of in modal window on https:// server (see bug 6662).
  
  
Index: loncom/interface/lonextresedit.pm
diff -u loncom/interface/lonextresedit.pm:1.13 loncom/interface/lonextresedit.pm:1.14
--- loncom/interface/lonextresedit.pm:1.13	Tue Nov 29 16:03:03 2016
+++ loncom/interface/lonextresedit.pm	Sun Feb 19 00:15:51 2017
@@ -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 @@
         $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 @@
         $srcclass = ' class="LC_nobreak"';
         if ($type eq 'ext') {
             $extsrc = '<span class="LC_docs_ext_edit">'.$lt{'ul'}.' </span>';
-            $preview = ' <a class="LC_docs_ext_edit" href="javascript:extUrlPreview('."'$urlid'".');">'.$lt{'pr'}.'</a>';
+            $preview = ' <a class="LC_docs_ext_edit" href="javascript:extUrlPreview('."'$urlid','$protocol'".');">'.$lt{'pr'}.'</a>';
         }
         $title = '<span class="LC_docs_ext_edit">'.$lt{'ti'}.' </span>';
         $save = $lt{'sv'};
@@ -399,7 +400,7 @@
             $orig_url = 'http://';
             $orig_title = $lt{'ex'};
             $extsrc = $lt{'ul'}.':<br />';
-            $preview = '<input type="button" name="view" value="'.$lt{'pr'}.'" onclick="javascript:extUrlPreview('."'$urlid'".');"'.$disabled.' />';
+            $preview = '<input type="button" name="view" value="'.$lt{'pr'}.'" onclick="javascript:extUrlPreview('."'$urlid','$protocol'".');"'.$disabled.' />';
             $save = $lt{'al'};
         } else {
             $orig_title = $lt{'et'};
@@ -733,11 +734,16 @@
     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'}");
         }




More information about the LON-CAPA-cvs mailing list