]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-13766, if moodle is working on HTTPS, then we are not allowed to access parent...
authordongsheng <dongsheng>
Mon, 4 May 2009 09:25:14 +0000 (09:25 +0000)
committerdongsheng <dongsheng>
Mon, 4 May 2009 09:25:14 +0000 (09:25 +0000)
repository/ws.php

index 3e0b95d52abedb17fc7ab6434b398d63aff92094..e64a8c536f330fc9ffd753cae9d7485809717134 100644 (file)
         // the callback url should be something like this:
         // http://xx.moodle.com/repository/ws.php?callback=yes&repo_id=1&sid=xxx
         // sid is the attached auth token from external source
+        // If Moodle is working on HTTPS mode, then we are not allowed to access
+        // parent window, in this case, we need to alert user to refresh the repository
+        // manually.
         $js  =<<<EOD
 <html><head><script type="text/javascript">
+if(window.opener){
     window.opener.repository_callback($repo_id);
     window.close();
+} else {
+    alert("If parent window is on HTTPS, then we are not allowed to access window.opener object, so we cannot refresh the repository for you automatically, but we already got your session, just go back to file picker and select the repository again, it should work now.");
+}
 </script><body></body></html>
 EOD;
         echo $js;