From 829eabfec2fcf31469ee0d97ad6a048984f5564a Mon Sep 17 00:00:00 2001 From: tjhunt Date: Thu, 18 Sep 2008 07:34:45 +0000 Subject: [PATCH] New option on close_window_button to reload the page that opened this pop-up, as the pop-up is closed. Needed in preparation for MDL-16334. --- lib/weblib.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 26dceb51d3..8dadfbc3da 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -719,17 +719,24 @@ function button_to_popup_window ($url, $name=null, $linkname=null, /** * Prints a simple button to close a window * @param string $name name of the window to close - * @param boolean $return whether this function should return a string or output it + * @param boolean $return whether this function should return a string or output it. + * @param boolean $reloadopener if true, clicking the button will also reload + * the page that opend this popup window. * @return string if $return is true, nothing otherwise */ -function close_window_button($name='closewindow', $return=false) { +function close_window_button($name='closewindow', $return=false, $reloadopener = false) { global $CFG; + $js = 'self.close();'; + if ($reloadopener) { + $js = 'window.opener.location.reload(1);' . $js; + } + $output = ''; $output .= '
' . "\n"; $output .= '
'; - $output .= ''; + $output .= ''; $output .= '
'; $output .= '
' . "\n"; -- 2.39.5