Fixed bug 5701: linkHandler Hook Not Initialized Properly, patch supplied by Jeff...
[Packages/TYPO3.CMS.git] / typo3 / logomenu.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2006 Kasper Skaarhoj (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 * Logo menu
29 *
30 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
31 */
32 /**
33 * [CLASS/FUNCTION INDEX of SCRIPT]
34 *
35 */
36
37
38 require ('init.php');
39 require ('template.php');
40
41 require_once(PATH_t3lib.'class.t3lib_topmenubase.php');
42
43
44
45 /**
46 * Script Class for rendering logo menu
47 *
48 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
49 * @package TYPO3
50 * @subpackage core
51 */
52 class SC_logomenu extends t3lib_topmenubase {
53
54 var $id = '_logomenu';
55
56 /**
57 * Main function
58 *
59 * @return void
60 */
61 function main() {
62 switch((string)t3lib_div::_GET('cmd')) {
63 case 'menuitem':
64 echo '
65 <img src="gfx/x_t3logo.png" width="61" height="16" hspace="3" alt="" />';
66
67 $menuItems = array(
68 array(
69 'title' => 'About TYPO3',
70 'xurl' => 'http://typo3.com/',
71 'subitems' => array(
72 array(
73 'title' => 'License',
74 'xurl' => 'http://typo3.com/License.1625.0.html',
75 ),
76 array(
77 'title' => 'Support',
78 'subitems' => array(
79 array(
80 'title' => 'Mailing lists',
81 'xurl' => 'http://lists.netfielders.de/cgi-bin/mailman/listinfo',
82 ),
83 array(
84 'title' => 'Documentation',
85 'xurl' => 'http://typo3.org/documentation/',
86 ),
87 array(
88 'title' => 'Find consultancy',
89 'xurl' => 'http://typo3.com/Consultancies.1248.0.html',
90 ),
91 )
92 ),
93 array(
94 'title' => 'Contribute',
95 'xurl' => 'http://typo3.org/community/participate/'
96 ),
97 array(
98 'title' => 'Donate',
99 'xurl' => 'http://typo3.com/Donations.1261.0.html',
100 'icon' => '1'
101 )
102 )
103 ),
104 array(
105 'title' => 'Extensions',
106 'url' => 'mod/tools/em/index.php'
107 ),
108 array(
109 'title' => 'Menu preferences and such things',
110 'onclick' => 'alert("A dialog is now shown which will allow user configuration of items in the menu");event.stopPropagation();',
111 'state' => 'checked'
112 ),
113 array(
114 'title' => '--div--'
115 ),
116 array(
117 'title' => 'Recent Items',
118 'id' => $this->id.'_recent',
119 'subitems' => array(),
120 'html' => $this->menuItemObject($this->id.'_recent','
121 fetched: false,
122 onActivate: function() {
123 // if (!this.fetched) {
124 //Element.update("'.$this->id.'_recent-layer","asdfasdf");
125 getElementContent("'.$this->id.'_recent-layer", 0, "logomenu.php?cmd=recent")
126 this.fetched = true;
127 // }
128 }
129 ')
130 ),
131 array(
132 'title' => '--div--'
133 ),
134 array(
135 'title' => 'View frontend',
136 'xurl' => t3lib_div::getIndpEnv('TYPO3_SITE_URL')
137 ),
138 array(
139 'title' => 'Log out',
140 'onclick' => "top.document.location='logout.php';"
141 ),
142 );
143
144 echo $this->menuLayer($menuItems);
145 break;
146 case 'recent':
147
148 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
149 'sys_log.*, MAX(sys_log.tstamp) AS tstamp_MAX',
150 'sys_log,pages',
151 'pages.uid=sys_log.event_pid AND sys_log.userid='.intval($GLOBALS['BE_USER']->user['uid']).
152 ' AND sys_log.event_pid>0 AND sys_log.type=1 AND sys_log.action=2 AND sys_log.error=0',
153 'tablename,recuid',
154 'tstamp_MAX DESC',
155 20
156 );
157
158 $items = array();
159
160 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
161 $elRow = t3lib_BEfunc::getRecord($row['tablename'],$row['recuid']);
162 if (is_array($elRow)) {
163 $items[] = array(
164 'title' => t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($row['tablename'],$elRow),$GLOBALS['BE_USER']->uc['titleLen']).' - '.t3lib_BEfunc::calcAge(time()-$row['tstamp_MAX']),
165 'icon' => array(t3lib_iconworks::getIcon($row['tablename'],$elRow),'width="18" height="16"'),
166 'onclick' => 'content.'.t3lib_BEfunc::editOnClick('&edit['.$row['tablename'].']['.$row['recuid'].']=edit','','dummy.php')
167 );
168 }
169 }
170
171 echo $this->menuItems($items);
172 break;
173 }
174 }
175 }
176
177 // Include extension?
178 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/logomenu.php']) {
179 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/logomenu.php']);
180 }
181
182
183
184 // Make instance:
185 $SOBE = t3lib_div::makeInstance('SC_logomenu');
186 $SOBE->main();
187 ?>