Fixed bugs #3655 and #4701: No wrappers for certain events (patch by Martin Kutschker)
authorOliver Hader <oliver.hader@typo3.org>
Tue, 20 Feb 2007 22:09:19 +0000 (22:09 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 20 Feb 2007 22:09:19 +0000 (22:09 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2065 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/class.tslib_pagegen.php

index 4a66d9f..50c5e16 100755 (executable)
--- 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  <ingmar@typo3.org>
 
index b192ddd..2fea458 100755 (executable)
@@ -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
        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)
index b6d4ea6..5bb450c 100755 (executable)
@@ -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 <a href="http://wiki.typo3.org/index.php/TYPO3_3.8.1" target="_blank">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)?'