From fbbd5dd6ddabd021359ed0c82e026e8f64557446 Mon Sep 17 00:00:00 2001 From: Oliver Hader Date: Tue, 20 Feb 2007 22:09:19 +0000 Subject: [PATCH] Fixed bugs #3655 and #4701: No wrappers for certain events (patch by Martin Kutschker) git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2065 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 1 + typo3/sysext/cms/tslib/class.tslib_fe.php | 7 ++++- .../sysext/cms/tslib/class.tslib_pagegen.php | 30 ++++++++----------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a66d9fb785..50c5e169b04 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ * Fixed bug #4202: be_groups - fields restricted by a low maxitems value * Fixed bug #4873: EM - Warning on uploading extension to TER (unserialize) + * Fixed bugs #3655 and #4701: No wrappers for certain events (patch by Martin Kutschker) 2007-02-20 Ingmar Schlecht diff --git a/typo3/sysext/cms/tslib/class.tslib_fe.php b/typo3/sysext/cms/tslib/class.tslib_fe.php index b192ddd9970..2fea4583e5a 100755 --- a/typo3/sysext/cms/tslib/class.tslib_fe.php +++ b/typo3/sysext/cms/tslib/class.tslib_fe.php @@ -2,7 +2,7 @@ /*************************************************************** * Copyright notice * -* (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) +* (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is @@ -284,7 +284,12 @@ var $JSeventFuncCalls = array( // you can add JavaScript functions to each entry in these arrays. Please see how this is done in the GMENU_LAYERS script. The point is that many applications on a page can set handlers for onload, onmouseover and onmouseup 'onmousemove' => array(), 'onmouseup' => array(), + 'onmousemove' => array(), + 'onkeydown' => array(), + 'onkeyup' => array(), + 'onkeypress' => array(), 'onload' => array(), + 'onunload' => array(), ); var $JSCode=''; // Deprecated, use additionalJavaScript instead. var $JSImgCode=''; // Used to accumulate JavaScript loaded images (by menus) diff --git a/typo3/sysext/cms/tslib/class.tslib_pagegen.php b/typo3/sysext/cms/tslib/class.tslib_pagegen.php index b6d4ea67be8..5bb450cc9fa 100755 --- a/typo3/sysext/cms/tslib/class.tslib_pagegen.php +++ b/typo3/sysext/cms/tslib/class.tslib_pagegen.php @@ -2,7 +2,7 @@ /*************************************************************** * Copyright notice * -* (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) +* (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is @@ -303,22 +303,18 @@ See wiki.t * @return array Array with a) a JavaScript section with event handlers and variables set and b) an array with attributes for the body tag. */ function JSeventFunctions() { - $functions=array(); - $setEvents=array(); - $setBody=array(); - - if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onmousemove'])) { - $functions[]=' function T3_onmousemoveWrapper(e) { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']).' }'; - $setEvents[]=' document.onmousemove=T3_onmousemoveWrapper;'; - } - if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onmouseup'])) { - $functions[]=' function T3_onmouseupWrapper(e) { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls['onmouseup']).' }'; - $setEvents[]=' document.onmouseup=T3_onmouseupWrapper;'; - } - if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onload']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onload'])) { - $functions[]=' function T3_onloadWrapper() { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls['onload']).' }'; - $setEvents[]=' document.onload=T3_onloadWrapper;'; - $setBody[]='onload="T3_onloadWrapper();"'; + $functions = array(); + $setEvents = array(); + $setBody = array(); + + foreach ($GLOBALS['TSFE']->JSeventFuncCalls as $event => $handlers) { + if (count($handlers)) { + $functions[] = ' function T3_'.$event.'Wrapper(e) { '.implode(' ',$handlers).' }'; + $setEvents[] = ' document.'.$event.'=T3_'.$event.'Wrapper;'; + if ($event == 'onload') { + $setBody[]='onload="T3_onloadWrapper();"'; // dubiuos double setting breaks on some browser - do we need it? + } + } } return Array(count($functions)?' -- 2.20.1