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