[BUGFIX] Regression: filelistFolderTree constructor is recursive
[Packages/TYPO3.CMS.git] / typo3 / alt_doc_nodoc.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 * No-document script
29 * This is used by eg. the Doc module if no documents is registered as "open" (a concept which is better known from the "classic backend"...)
30 *
31 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
32 * XHTML compliant
33 *
34 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
35 */
36
37 require('init.php');
38 require('template.php');
39 $LANG->includeLLFile('EXT:lang/locallang_alt_doc.xml');
40
41 require_once(t3lib_extMgm::extPath('opendocs') . 'class.tx_opendocs.php');
42
43
44 /**
45 * Script Class for the "No-doc" display; This shows most recently edited records.
46 *
47 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
48 * @package TYPO3
49 * @subpackage core
50 */
51 class SC_alt_doc_nodoc {
52
53 // Internal:
54 var $content; // Content accumulation
55
56 /**
57 * Document template object
58 *
59 * @var mediumDoc
60 */
61 var $doc;
62
63 /**
64 * Object for backend modules.
65 *
66 * @var t3lib_loadModules
67 */
68 var $loadModules;
69
70 /**
71 * Constructor, initialize.
72 *
73 * @return void
74 */
75 function init() {
76 // Start the template object:
77 $this->doc = t3lib_div::makeInstance('mediumDoc');
78 $this->doc->bodyTagMargins['x']=5;
79 $this->doc->bodyTagMargins['y']=5;
80 $this->doc->backPath = $GLOBALS['BACK_PATH'];
81
82 // Add JS
83 $this->doc->JScode = $this->doc->wrapScriptTags('
84 function jump(url, modName, mainModName) {
85 // clear information about which entry in nav. tree that might have been highlighted.
86 top.fsMod.navFrameHighlightedID = [];
87
88 if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
89 top.content.nav_frame.refresh_nav();
90 }
91
92 top.nextLoadModuleUrl = url;
93 top.goToModule(modName);
94 }
95 ');
96
97 // Start the page:
98 $this->content='';
99 $this->content.=$this->doc->startPage('TYPO3 Edit Document');
100
101 // Loads the backend modules available for the logged in user.
102 $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
103 $this->loadModules->load($GLOBALS['TBE_MODULES']);
104 }
105
106 /**
107 * Rendering the content.
108 *
109 * @return void
110 */
111 function main() {
112 $msg=array();
113
114 // Add a message, telling that no documents were open...
115 $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg', 1) . '</p><br />';
116
117 // If another page module was specified, replace the default Page module with the new one
118 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
119 $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
120
121 // Perform some acccess checks:
122 $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
123 $a_wp = t3lib_extMgm::isLoaded('cms') && $GLOBALS['BE_USER']->check('modules', $pageModule);
124
125
126 // Finding module images: PAGE
127 $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_layout_tab'];
128 $imgInfo = @getimagesize($imgFile);
129 $img_web_layout = is_array($imgInfo) ? '<img src="../'.substr($imgFile,strlen(PATH_site)).'" '.$imgInfo[3].' alt="" />' : '';
130
131 // Finding module images: LIST
132 $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_list_tab'];
133 $imgInfo = @getimagesize($imgFile);
134 $img_web_list = is_array($imgInfo) ? '<img src="../'.substr($imgFile,strlen(PATH_site)).'" '.$imgInfo[3].' alt="" />' : '';
135
136
137 // If either the Web>List OR Web>Page module are active, show the little message with links to those modules:
138 if ($a_wl || $a_wp) {
139 $msg_2 = array();
140 if ($a_wp) { // Web>Page:
141 $msg_2[] = '<strong><a href="#" onclick="top.goToModule(\'' . $pageModule . '\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_pagemodule', 1) . $img_web_layout . '</a></strong>';
142 if ($a_wl) {
143 $msg_2[] = $GLOBALS['LANG']->getLL('noDocuments_OR');
144 }
145 }
146 if ($a_wl) { // Web>List
147 $msg_2[] = '<strong><a href="#" onclick="top.goToModule(\'web_list\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_listmodule', 1) . $img_web_list . '</a></strong>';
148 }
149 $msg[] = '<p>' . sprintf($GLOBALS['LANG']->getLL('noDocuments_msg2', 1), implode(' ', $msg_2)) . '</p><br />';
150 }
151
152 // Display the list of the most recently edited documents:
153 $modObj = t3lib_div::makeInstance('tx_opendocs');
154 $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg3', TRUE) . '</p><br />' . $modObj->renderMenu();
155
156 // Adding the content:
157 $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('noDocuments'), implode(' ', $msg), 0, 1);
158 }
159
160 /**
161 * Printing the content.
162 *
163 * @return void
164 */
165 function printContent() {
166 $this->content.= $this->doc->endPage();
167 $this->content = $this->doc->insertStylesAndJS($this->content);
168 echo $this->content;
169 }
170 }
171
172
173 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_doc_nodoc.php'])) {
174 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_doc_nodoc.php']);
175 }
176
177
178
179 // Make instance:
180 $SOBE = t3lib_div::makeInstance('SC_alt_doc_nodoc');
181 $SOBE->init();
182 $SOBE->main();
183 $SOBE->printContent();
184
185 ?>