MDL-21400 migrated falsh detection to YUI3

This commit is contained in:
Petr Skoda 2010-02-06 12:58:19 +00:00
parent 0a7b1f11cf
commit 4abd5b9b2a
3 changed files with 11 additions and 10 deletions

View File

@ -347,6 +347,10 @@ class page_requirements_manager {
$module = array('name'=>'core_dock', 'fullpath'=>'/blocks/dock.js', 'requires'=>array('base', 'cookie', 'dom', 'io', 'node', 'event-custom')); $module = array('name'=>'core_dock', 'fullpath'=>'/blocks/dock.js', 'requires'=>array('base', 'cookie', 'dom', 'io', 'node', 'event-custom'));
} else if ($name === 'core_calendar') { } else if ($name === 'core_calendar') {
$module = array('name'=>'core_calendar', 'fullpath'=>'/calendar/calendar.js', 'requires'=>array('dom', 'event', 'node', 'yui2-container','event-mouseenter')); $module = array('name'=>'core_calendar', 'fullpath'=>'/calendar/calendar.js', 'requires'=>array('dom', 'event', 'node', 'yui2-container','event-mouseenter'));
} else if ($name === 'core_message') {
$module = array('name'=>'core_message', 'fullpath'=>'/message/module.js');
} else if ($name === 'core_flashdetect') {
$module = array('name'=>'core_flashdetect', 'fullpath'=>'/lib/flashdetect/flashdetect.js', 'requires'=>array('io'));
} }
} else { } else {
if ($dir = get_component_directory($name, false)) { if ($dir = get_component_directory($name, false)) {

View File

@ -19,12 +19,12 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/* /*
* Library for flash destection * Library for flash player version detection
*/ */
//WARNING: before to use this function you need to load lib/swfobject/swfobject.js + YUI: 'yahoo-min.js', 'event-min.js', 'connection-min.js' M.core_flashdetect = {};
function setflashversiontosession (wwwroot, sesskey) {
M.core_flashdetect.init = function(Y) {
var flashversion = swfobject.getFlashPlayerVersion(); var flashversion = swfobject.getFlashPlayerVersion();
var callback = {}; //the callback is mandatory in 2.8.0r4 because there is a bug when checking xdr attribute Y.io(M.cfg.wwwroot+'/login/environment.php?sesskey='+M.cfg.sesskey+'&flashversion='+flashversion.major+'.'+flashversion.minor+'.'+flashversion.release, {method: "POST"});
YAHOO.util.Connect.asyncRequest('GET',wwwroot+'/login/environment.php?sesskey='+sesskey+'&flashversion='+flashversion.major+'.'+flashversion.minor+'.'+flashversion.release, callback);
} }

View File

@ -343,11 +343,8 @@ class core_renderer extends renderer_base {
// Perform a browser environment check for the flash version. Should only run once per login session. // Perform a browser environment check for the flash version. Should only run once per login session.
if (isloggedin() && !empty($CFG->excludeoldflashclients) && empty($SESSION->flashversion)) { if (isloggedin() && !empty($CFG->excludeoldflashclients) && empty($SESSION->flashversion)) {
$this->page->requires->yui2_lib('event'); $this->page->requires->js('/lib/swfobject/swfobject.js');
$this->page->requires->yui2_lib('connection'); $this->page->requires->js_init_call('M.core_flashdetect.init');
$this->page->requires->js('/lib/swfobject/swfobject.js')->in_head();
$this->page->requires->js('/lib/flashdetect/flashdetect.js')->in_head();
$this->page->requires->js_function_call('setflashversiontosession', array($CFG->wwwroot, sesskey()));
} }
// Get any HTML from the page_requirements_manager. // Get any HTML from the page_requirements_manager.