Cleanup: Updated copyright comments
[Packages/TYPO3.CMS.git] / typo3 / sysext / info / mod1 / index.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 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 * Module: Web>Info
29 * Presents various page related information from extensions
30 *
31 * $Id$
32 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
33 * XHTML compliant
34 *
35 * @author Kasper Skårhøj <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 Skårhøj <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->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
149 } else {
150 // If no access or if ID == zero
151 $this->doc = t3lib_div::makeInstance('mediumDoc');
152 $this->doc->backPath = $BACK_PATH;
153
154 $this->content = $this->doc->header($LANG->getLL('title'));
155 $this->content .= $this->doc->spacer(5);
156 $this->content .= $this->doc->spacer(10);
157 }
158 // Renders the module page
159 $this->content = $this->doc->render(
160 $LANG->getLL('title'),
161 $this->content
162 );
163 }
164
165 /**
166 * Print module content (from $this->content)
167 *
168 * @return void
169 */
170 function printContent() {
171 $this->content = $this->doc->insertStylesAndJS($this->content);
172 echo $this->content;
173 }
174
175 /**
176 * Create the panel of buttons for submitting the form or otherwise perform operations.
177 *
178 * @return array all available buttons as an assoc. array
179 */
180 protected function getButtons() {
181 global $TCA, $LANG, $BACK_PATH, $BE_USER;
182
183 $buttons = array(
184 'csh' => '',
185 'view' => '',
186 'record_list' => '',
187 'shortcut' => '',
188 );
189 // CSH
190 $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '', TRUE);
191
192 // View page
193 $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) . '">' .
194 t3lib_iconWorks::getSpriteIcon('actions-document-view') .
195 '</a>';
196
197 // Shortcut
198 if ($BE_USER->mayMakeShortcut()) {
199 $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']);
200 }
201
202 // If access to Web>List for user, then link to that module.
203 $buttons['record_list'] = t3lib_BEfunc::getListViewLink(
204 array(
205 'id' => $this->pageinfo['uid'],
206 'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI'),
207 ),
208 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList')
209 );
210
211 return $buttons;
212 }
213
214 }
215
216 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/mod/web/info/index.php'])) {
217 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/mod/web/info/index.php']);
218 }
219
220
221
222 // Make instance:
223 $SOBE = t3lib_div::makeInstance('SC_mod_web_info_index');
224 $SOBE->init();
225
226 // Include files?
227 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
228 $SOBE->checkExtObj(); // Checking for first level external objects
229
230 // Repeat Include files! - if any files has been added by second-level extensions
231 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
232 $SOBE->checkSubExtObj(); // Checking second level external objects
233
234 $SOBE->main();
235 $SOBE->printContent();
236
237 ?>