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