From e79fe53d98c10d76703ebd14959e00cb26576491 Mon Sep 17 00:00:00 2001 From: jerome Date: Wed, 18 Jun 2008 05:58:06 +0000 Subject: [PATCH] MDL-15152 reverse MDL-14439 fix for dropdown menu for Opera+Linux, merged from 19 --- lib/moodlelib.php | 23 ++++++++++++++++++++++- lib/weblib.php | 4 +++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 4ddc8324ee..d67a936c45 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -5721,7 +5721,7 @@ function rc4encrypt($data) { * * @param string $data ? * @return string - * @todo Finish documenting this function + * @todo Finish documenting this function */ function rc4decrypt($data) { $password = 'nfgjeingjk'; @@ -6001,6 +6001,27 @@ function check_php_version($version='5.2.0') { return (version_compare(phpversion(), $version) >= 0); } +/** + * Checks to see if is the browser operating system matches the specified + * brand. + * + * Known brand: 'Windows','Linux','Macintosh','SGI','SunOS','HP-UX' + * + * @uses $_SERVER + * @param string $brand The operating system identifier being tested + * @return bool true if the given brand below to the detected operating system + */ + function check_browser_operating_system($brand) { + if (empty($_SERVER['HTTP_USER_AGENT'])) { + return false; + } + + if (preg_match("/$brand/i", $_SERVER['HTTP_USER_AGENT'])) { + return true; + } + + return false; + } /** * Checks to see if is a browser matches the specified diff --git a/lib/weblib.php b/lib/weblib.php index 9e2bbf21dd..48f4c079bf 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1079,7 +1079,9 @@ $targetwindow='self', $selectlabel='', $optionsextra=NULL) { //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. - if (check_browser_version('MSIE') || check_browser_version('Opera')) { + //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.'