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