diff --git a/lib/weblib.php b/lib/weblib.php index bacfd8cd1df..09d37161469 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1168,11 +1168,14 @@ function print_textfield ($name, $value, $alt = '',$size=50,$maxlength=0, $retur * @param string $targetwindow The name of the target page to open the linked page in. * @param string $selectlabel Text to place in a [label] element - preferred for accessibility. * @param array $optionsextra TODO, an array? + * @param mixed $gobutton If set, this turns off the JavaScript and uses a 'go' + * button instead (as is always included for JS-disabled users). Set to true + * for a literal 'Go' button, or to a string to change the name of the button. * @return string If $return is true then the entire form is returned as a string. * @todo Finish documenting this function
*/ function popup_form($common, $options, $formid, $selected='', $nothing='choose', $help='', $helptext='', $return=false, -$targetwindow='self', $selectlabel='', $optionsextra=NULL) { +$targetwindow='self', $selectlabel='', $optionsextra=NULL, $gobutton=NULL) { global $CFG; static $go, $choose; /// Locally cached, in case there's lots on a page @@ -1209,17 +1212,24 @@ $targetwindow='self', $selectlabel='', $optionsextra=NULL) { $selectlabel = ''; } - //IE and Opera fire the onchange when ever you move into a dropdwown list with the keyboard. - //onfocus will call a function inside dropdown.js. It fixes this IE/Opera behavior. - //Note: There is a bug on Opera+Linux with the javascript code (first mouse selection is inactive), - //so we do not fix the Opera behavior on Linux - if (check_browser_version('MSIE') || (check_browser_version('Opera') && !check_browser_operating_system("Linux"))) { - $output .= '
'.$selectlabel.$button.''."\n"; - } + if ($gobutton) { + // Using the no-JavaScript version + $javascript = ''; + } else if (check_browser_version('MSIE') || (check_browser_version('Opera') && !check_browser_operating_system("Linux"))) { + //IE and Opera fire the onchange when ever you move into a dropdown list with the keyboard. + //onfocus will call a function inside dropdown.js. It fixes this IE/Opera behavior. + //Note: There is a bug on Opera+Linux with the javascript code (first mouse selection is inactive), + //so we do not fix the Opera behavior on Linux + $javascript = ' onfocus="initSelect(\''.$formid.'\','.$targetwindow.')"'; + } else { + //Other browser + $javascript = ' onchange="'.$targetwindow. + '.location=document.getElementById(\''.$formid. + '\').jump.options[document.getElementById(\''. + $formid.'\').jump.selectedIndex].value;"'; + } + + $output .= '
'.$selectlabel.$button.''; $output .= ''; - $output .= '
'; - $output .= '
'; - $output .= ''; - $output .= '
'; + if ($gobutton) { + $output .= ''; + } else { + $output .= '
'; + $output .= '
'; + $output .= ''; + $output .= '
'; + } $output .= ''; if ($return) { diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php index dbb8229d5cf..c564ec6b610 100644 --- a/mod/forum/discuss.php +++ b/mod/forum/discuss.php @@ -205,7 +205,8 @@ if (!empty($forummenu)) { echo "
"; echo popup_form("$CFG->wwwroot/mod/forum/", $forummenu, "forummenu", "", - get_string("movethisdiscussionto", "forum"), "", "", true); + get_string("movethisdiscussionto", "forum"), "", "", true,'self','',NULL, + get_string('move')); echo "
"; } }