Skip to content

Commit

Permalink
Make the close_window function better. Merged from MOODLE_17_STABLE.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhunt committed Oct 31, 2006
1 parent d84d379 commit dfa924c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions lang/en_utf8/moodle.php
Expand Up @@ -1047,6 +1047,7 @@
$string['personalprofile'] = 'Personal profile';
$string['phone'] = 'Phone';
$string['phpinfo'] = 'PHP info';
$string['pleaseclose'] = 'Please close this window now.';
$string['pluginsetup'] = 'Setting up plugin tables';
$string['policyagree'] = 'You must agree to this policy to continue using this site. Do you agree?';
$string['policyagreement'] = 'Site Policy Agreement';
Expand Down
21 changes: 13 additions & 8 deletions lib/weblib.php
Expand Up @@ -690,15 +690,20 @@ function close_window_button($name='closewindow', $return=false) {
* Try and close the current window immediately using Javascript
*/
function close_window($delay=0) {
echo '<script language="JavaScript" type="text/javascript">'."\n";
echo '<!--'."\n";
if ($delay) {
sleep($delay);
?>
<script type="text/javascript">
<!--
function close_this_window() {
self.close();
}
echo 'self.close();'."\n";
echo '-->'."\n";
echo '</script>'."\n";
exit;
setTimeout("close_this_window()", <?php echo $delay * 1000 ?>);
-->
</script>
<noscript><center>
<?php print_string('pleaseclose') ?>
</center></noscript>
<?php
die;
}


Expand Down

0 comments on commit dfa924c

Please sign in to comment.