Make the close_window function better. Backported from MOODLE_17_STABLE.
This commit is contained in:
@@ -1005,6 +1005,7 @@ $string['periodending'] = 'Period ending ($a)';
|
||||
$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';
|
||||
|
||||
+13
-8
@@ -675,15 +675,20 @@ function close_window_button($name='closewindow') {
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user