(feature/cleanup) Refactored clickmenu to speed up the BE
[Packages/TYPO3.CMS.git] / typo3 / mod / web / info / index.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 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 * Module: Web>Info
29 * Presents various page related information from extensions
30 *
31 * $Id$
32 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
33 * XHTML compliant
34 *
35 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
36 */
37 /**
38 * [CLASS/FUNCTION INDEX of SCRIPT]
39 *
40 *
41 *
42 * 70: class SC_mod_web_info_index extends t3lib_SCbase
43 * 82: function main()
44 * 178: function printContent()
45 *
46 * TOTAL FUNCTIONS: 2
47 * (This index is automatically created/updated by the extension "extdeveval")
48 *
49 */
50
51 unset($MCONF);
52 require('conf.php');
53 require($BACK_PATH.'init.php');
54 require($BACK_PATH.'template.php');
55 $LANG->includeLLFile('EXT:lang/locallang_mod_web_info.xml');
56 require_once (PATH_t3lib.'class.t3lib_scbase.php');
57
58 $BE_USER->modAccess($MCONF,1);
59
60
61
62 /**
63 * Script Class for the Web > Info module
64 * This class creates the framework to which other extensions can connect their sub-modules
65 *
66 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
67 * @package TYPO3
68 * @subpackage core
69 */
70 class SC_mod_web_info_index extends t3lib_SCbase {
71
72 // Internal, dynamic:
73 var $be_user_Array;
74 var $CALC_PERMS;
75 var $pageinfo;
76
77 /**
78 * Document Template Object
79 *
80 * @var mediumDoc
81 */
82 var $doc;
83
84 /**
85 * Initialize module header etc and call extObjContent function
86 *
87 * @return void
88 */
89 function main() {
90 global $BE_USER,$LANG,$BACK_PATH;
91
92 // Access check...
93 // The page will show only if there is a valid page and if this page may be viewed by the user
94 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
95 $access = is_array($this->pageinfo) ? 1 : 0;
96
97 if (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id)) {
98 $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);
99 if ($BE_USER->user['admin'] && !$this->id) {
100 $this->pageinfo=array('title' => '[root-level]','uid'=>0,'pid'=>0);
101 }
102
103 $this->doc = t3lib_div::makeInstance('mediumDoc');
104 $this->doc->backPath = $BACK_PATH;
105 $this->doc->docType = 'xhtml_trans';
106 $this->doc->tableLayout = Array (
107 '0' => Array (
108 '0' => Array('<td valign="top"><b>','</b></td>'),
109 "defCol" => Array('<td><img src="'.$this->doc->backPath.'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><b>','</b></td>')
110 ),
111 "defRow" => Array (
112 "0" => Array('<td valign="top">','</td>'),
113 "defCol" => Array('<td><img src="'.$this->doc->backPath.'clear.gif" width="10" height="1" alt="" /></td><td valign="top">','</td>')
114 )
115 );
116
117 // JavaScript
118 $this->doc->JScode = $this->doc->wrapScriptTags('
119 script_ended = 0;
120 function jumpToUrl(URL) { //
121 window.location.href = URL;
122 }
123 ');
124 $this->doc->postCode=$this->doc->wrapScriptTags('
125 script_ended = 1;
126 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
127 ');
128
129
130 // Setting up the context sensitive menu:
131 $this->doc->getContextMenuCode();
132
133 $headerSection = $this->doc->getHeader('pages',$this->pageinfo,$this->pageinfo['_thePath']).'<br />'.
134 $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path',1).': '.
135 '<span title="'.htmlspecialchars($this->pageinfo['_thePathFull']).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'],-50)).'</span>';
136
137 // Draw the header.
138 $this->doc->form = '<form action="index.php" method="post" name="webinfoForm">';
139 $this->content.=$this->doc->startPage($LANG->getLL('title'));
140 $this->content.=$this->doc->header($LANG->getLL('title'));
141 $this->content.=$this->doc->spacer(5);
142 $this->content.=$this->doc->section('',$this->doc->funcMenu($headerSection,t3lib_BEfunc::getFuncMenu($this->id,'SET[function]',$this->MOD_SETTINGS['function'],$this->MOD_MENU['function'])));
143 $this->content.=$this->doc->divider(5);
144
145
146 $vContent = $this->doc->getVersionSelector($this->id,1);
147 if ($vContent) {
148 $this->content.=$this->doc->section('',$vContent);
149 }
150
151 $this->extObjContent();
152
153
154
155
156 // Info Module CSH:
157 $this->content.= t3lib_BEfunc::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '<br/>|', FALSE, 'margin-top: 30px;');
158
159 // ShortCut
160 if ($BE_USER->mayMakeShortcut()) {
161 $this->content.=$this->doc->spacer(20).$this->doc->section('',$this->doc->makeShortcutIcon('id',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name']));
162 }
163
164 $this->content.=$this->doc->spacer(10);
165 } else {
166 // If no access or if ID == zero
167 $this->doc = t3lib_div::makeInstance('mediumDoc');
168 $this->doc->backPath = $BACK_PATH;
169
170 $this->content.=$this->doc->startPage($LANG->getLL('title'));
171 $this->content.=$this->doc->header($LANG->getLL('title'));
172 $this->content.=$this->doc->spacer(5);
173 $this->content.=$this->doc->spacer(10);
174 }
175 }
176
177 /**
178 * Print module content (from $this->content)
179 *
180 * @return void
181 */
182 function printContent() {
183 $this->content.= $this->doc->endPage();
184 $this->content = $this->doc->insertStylesAndJS($this->content);
185 echo $this->content;
186 }
187 }
188
189 // Include extension?
190 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/web/info/index.php']) {
191 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/web/info/index.php']);
192 }
193
194
195
196
197
198
199
200
201
202
203
204
205 // Make instance:
206 $SOBE = t3lib_div::makeInstance('SC_mod_web_info_index');
207 $SOBE->init();
208
209 // Include files?
210 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
211 $SOBE->checkExtObj(); // Checking for first level external objects
212
213 // Repeat Include files! - if any files has been added by second-level extensions
214 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
215 $SOBE->checkSubExtObj(); // Checking second level external objects
216
217 $SOBE->main();
218 $SOBE->printContent();
219 ?>