888ee3a2e846642c5f8613c40e5fb525ce7b93cc
[Packages/TYPO3.CMS.git] / typo3 / sysext / info / index.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2010 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
57 $BE_USER->modAccess($MCONF,1);
58
59
60
61 /**
62 * Script Class for the Web > Info module
63 * This class creates the framework to which other extensions can connect their sub-modules
64 *
65 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
66 * @package TYPO3
67 * @subpackage core
68 */
69 class SC_mod_web_info_index extends t3lib_SCbase {
70
71 // Internal, dynamic:
72 var $be_user_Array;
73 var $CALC_PERMS;
74 var $pageinfo;
75
76 /**
77 * Document Template Object
78 *
79 * @var mediumDoc
80 */
81 var $doc;
82
83 /**
84 * Initialize module header etc and call extObjContent function
85 *
86 * @return void
87 */
88 function main() {
89 global $BE_USER,$LANG,$BACK_PATH;
90
91 // Access check...
92 // The page will show only if there is a valid page and if this page may be viewed by the user
93 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
94 $access = is_array($this->pageinfo) ? 1 : 0;
95
96 if (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id)) {
97 $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);
98 if ($BE_USER->user['admin'] && !$this->id) {
99 $this->pageinfo=array('title' => '[root-level]','uid'=>0,'pid'=>0);
100 }
101
102 $this->doc = t3lib_div::makeInstance('template');
103 $this->doc->backPath = $BACK_PATH;
104 $this->doc->setModuleTemplate('templates/info.html');
105 $this->doc->tableLayout = Array (
106 '0' => Array (
107 '0' => Array('<td valign="top"><strong>','</strong></td>'),
108 "defCol" => Array('<td><img src="'.$this->doc->backPath.'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>','</strong></td>')
109 ),
110 "defRow" => Array (
111 "0" => Array('<td valign="top">','</td>'),
112 "defCol" => Array('<td><img src="'.$this->doc->backPath.'clear.gif" width="10" height="1" alt="" /></td><td valign="top">','</td>')
113 )
114 );
115
116 // JavaScript
117 $this->doc->JScode = $this->doc->wrapScriptTags('
118 script_ended = 0;
119 function jumpToUrl(URL) { //
120 window.location.href = URL;
121 }
122 ');
123 $this->doc->postCode = $this->doc->wrapScriptTags('
124 script_ended = 1;
125 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
126 ');
127
128 // Setting up the context sensitive menu:
129 $this->doc->getContextMenuCode();
130 $this->doc->form = '<form action="index.php" method="post" name="webinfoForm">';
131
132 $vContent = $this->doc->getVersionSelector($this->id,1);
133 if ($vContent) {
134 $this->content.=$this->doc->section('',$vContent);
135 }
136
137 $this->extObjContent();
138
139 // Setting up the buttons and markers for docheader
140 $docHeaderButtons = $this->getButtons();
141 $markers = array(
142 'CSH' => $docHeaderButtons['csh'],
143 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
144 'CONTENT' => $this->content
145 );
146
147 // Build the <body> for the module
148 $this->content = $this->doc->startPage($LANG->getLL('title'));
149 $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
150 $this->content.= $this->doc->endPage();
151 $this->content = $this->doc->insertStylesAndJS($this->content);
152 } else {
153 // If no access or if ID == zero
154 $this->doc = t3lib_div::makeInstance('mediumDoc');
155 $this->doc->backPath = $BACK_PATH;
156
157 $this->content.=$this->doc->startPage($LANG->getLL('title'));
158 $this->content.=$this->doc->header($LANG->getLL('title'));
159 $this->content.=$this->doc->spacer(5);
160 $this->content.=$this->doc->spacer(10);
161 $this->content.= $this->doc->endPage();
162 $this->content = $this->doc->insertStylesAndJS($this->content);
163 }
164 }
165
166 /**
167 * Print module content (from $this->content)
168 *
169 * @return void
170 */
171 function printContent() {
172 $this->content = $this->doc->insertStylesAndJS($this->content);
173 echo $this->content;
174 }
175
176 /**
177 * Create the panel of buttons for submitting the form or otherwise perform operations.
178 *
179 * @return array all available buttons as an assoc. array
180 */
181 protected function getButtons() {
182 global $TCA, $LANG, $BACK_PATH, $BE_USER;
183
184 $buttons = array(
185 'csh' => '',
186 'view' => '',
187 'record_list' => '',
188 'shortcut' => '',
189 );
190 // CSH
191 $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '', TRUE);
192
193 // View page
194 $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '">' .
195 t3lib_iconWorks::getSpriteIcon('actions-document-view') .
196 '</a>';
197
198 // Shortcut
199 if ($BE_USER->mayMakeShortcut()) {
200 $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
201 }
202
203 // If access to Web>List for user, then link to that module.
204 if ($BE_USER->check('modules','web_list')) {
205 $href = $BACK_PATH . 'db_list.php?id=' . $this->pageinfo['uid'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
206 $buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '">' .
207 t3lib_iconWorks::getSpriteIcon('actions-system-list-open') .
208 '</a>';
209 }
210 return $buttons;
211 }
212
213 }
214
215 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/web/info/index.php']) {
216 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/mod/web/info/index.php']);
217 }
218
219
220
221 // Make instance:
222 $SOBE = t3lib_div::makeInstance('SC_mod_web_info_index');
223 $SOBE->init();
224
225 // Include files?
226 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
227 $SOBE->checkExtObj(); // Checking for first level external objects
228
229 // Repeat Include files! - if any files has been added by second-level extensions
230 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
231 $SOBE->checkSubExtObj(); // Checking second level external objects
232
233 $SOBE->main();
234 $SOBE->printContent();
235
236 ?>