039bc785c4d14423b83498ef16f4c69267f4f2e1
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / media / scripts / example_keepRollover.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Demonstrates how to manipulate menu generation so that a click on a menu item will trigger two (or more) frames to load an URL
29 * Used in the "testsite" package
30 *
31 * $Id$
32 * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj
33 * XHTML compliant
34 *
35 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
36 */
37
38
39
40
41
42
43
44 /**
45 * Example can be found in the testsite package at the page-path "/Intro/TypoScript examples/Menu object examples/Loading multiple.../"
46 *
47 * @param array The menu item array, $this->I (in the parent object)
48 * @param array TypoScript configuration for the function. Notice that the property "parentObj" is a reference to the parent (calling) object (the tslib_Xmenu class instantiated)
49 * @return array The processed $I array returned (and stored in $this->I of the parent object again)
50 * @see tslib_menu::userProcess(), tslib_tmenu::writeMenu(), tslib_gmenu::writeMenu()
51 */
52 function user_keepRolloverAtOnClick($I,$conf) {
53 $itemRow = $conf['parentObj']->menuArr[$I['key']];
54
55 // Setting the document status content to the value of the page title on mouse over
56 if (!$I['linkHREF']['TARGET']) {
57 $I['linkHREF']['HREF']='#';
58 $I['linkHREF']['onClick'].='ARO_setLocation'.($conf['setLocation']).'('.$itemRow['uid'].',\''.$I['theName'].'\'); return false;';
59 } else {
60 $I['linkHREF']['onClick'].='ARO_setActiveImg'.'(\''.$I['theName'].'\');';
61 }
62 if ($I['linkHREF']['onMouseover']) $I['linkHREF']['onMouseover']='ARO_'.$I['linkHREF']['onMouseover'];
63 if ($I['linkHREF']['onMouseout']) $I['linkHREF']['onMouseout']='ARO_'.$I['linkHREF']['onMouseout'];
64
65 if ($conf['parentObj']->isActive($itemRow['uid'])) {
66 $conf['parentObj']->WMextraScript.='
67 <script type="text/javascript">
68 /*<![CDATA[*/
69 ARO_Image = "'.$I['theName'].'";
70 '.$I['linkHREF']['onMouseover'].'
71 /*]]>*/
72 </script>
73 ';
74 }
75
76 // Update the link in the parent object:
77 $conf['parentObj']->I = $I; // setting internal $I - needed by setATagParts() function!
78 $conf['parentObj']->setATagParts(); // Setting the A1 and A2 of the internal $I
79 $I = $conf['parentObj']->I; // retrieving internal $I
80 $I['parts']['ATag_begin']=$I['A1']; // Setting the ATag_begin to the value of this $I
81
82 // Debug:
83 if ($conf['debug']) {
84 // Outputting for debug example:
85 echo 'ITEM: <h2>'.htmlspecialchars($itemRow['uid'].': '.$itemRow['title']).'</h2>';
86 t3lib_utility_Debug::debug($itemRow);
87 t3lib_utility_Debug::debug($I);
88 echo '<hr />';
89 }
90
91 // Returns $I:
92 return $I;
93 }
94
95 ?>