TYPO3 API  SVNRelease
index.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Module: Web>Info
00029  * Presents various page related information from extensions
00030  *
00031  * $Id: index.php 10295 2011-01-25 09:33:06Z baschny $
00032  * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
00033  * XHTML compliant
00034  *
00035  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00036  */
00037 /**
00038  * [CLASS/FUNCTION INDEX of SCRIPT]
00039  *
00040  *
00041  *
00042  *   70: class SC_mod_web_info_index extends t3lib_SCbase
00043  *   82:     function main()
00044  *  178:     function printContent()
00045  *
00046  * TOTAL FUNCTIONS: 2
00047  * (This index is automatically created/updated by the extension "extdeveval")
00048  *
00049  */
00050 
00051 unset($MCONF);
00052 require('conf.php');
00053 require($BACK_PATH.'init.php');
00054 require($BACK_PATH.'template.php');
00055 $LANG->includeLLFile('EXT:lang/locallang_mod_web_info.xml');
00056 
00057 $BE_USER->modAccess($MCONF,1);
00058 
00059 
00060 
00061 /**
00062  * Script Class for the Web > Info module
00063  * This class creates the framework to which other extensions can connect their sub-modules
00064  *
00065  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00066  * @package TYPO3
00067  * @subpackage core
00068  */
00069 class SC_mod_web_info_index extends t3lib_SCbase {
00070 
00071         // Internal, dynamic:
00072     var $be_user_Array;
00073     var $CALC_PERMS;
00074     var $pageinfo;
00075 
00076     /**
00077      * Document Template Object
00078      *
00079      * @var mediumDoc
00080      */
00081     var $doc;
00082 
00083     /**
00084      * Initialize module header etc and call extObjContent function
00085      *
00086      * @return  void
00087      */
00088     function main() {
00089         global $BE_USER,$LANG,$BACK_PATH;
00090 
00091         // Access check...
00092         // The page will show only if there is a valid page and if this page may be viewed by the user
00093         $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
00094         $access = is_array($this->pageinfo) ? 1 : 0;
00095 
00096         if (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id))  {
00097             $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);
00098             if ($BE_USER->user['admin'] && !$this->id)  {
00099                 $this->pageinfo=array('title' => '[root-level]','uid'=>0,'pid'=>0);
00100             }
00101 
00102             $this->doc = t3lib_div::makeInstance('template');
00103             $this->doc->backPath = $BACK_PATH;
00104             $this->doc->setModuleTemplate('templates/info.html');
00105             $this->doc->tableLayout = Array (
00106                 '0' => Array (
00107                     '0' => Array('<td valign="top"><strong>','</strong></td>'),
00108                     "defCol" => Array('<td><img src="'.$this->doc->backPath.'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>','</strong></td>')
00109                 ),
00110                 "defRow" => Array (
00111                     "0" => Array('<td valign="top">','</td>'),
00112                     "defCol" => Array('<td><img src="'.$this->doc->backPath.'clear.gif" width="10" height="1" alt="" /></td><td valign="top">','</td>')
00113                 )
00114             );
00115 
00116                 // JavaScript
00117             $this->doc->JScode = $this->doc->wrapScriptTags('
00118                 script_ended = 0;
00119                 function jumpToUrl(URL) {   //
00120                     window.location.href = URL;
00121                 }
00122             ');
00123             $this->doc->postCode = $this->doc->wrapScriptTags('
00124                 script_ended = 1;
00125                 if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
00126             ');
00127 
00128                 // Setting up the context sensitive menu:
00129             $this->doc->getContextMenuCode();
00130             $this->doc->form = '<form action="index.php" method="post" name="webinfoForm">';
00131 
00132             $vContent = $this->doc->getVersionSelector($this->id,1);
00133             if ($vContent)  {
00134                 $this->content.=$this->doc->section('',$vContent);
00135             }
00136 
00137             $this->extObjContent();
00138 
00139                 // Setting up the buttons and markers for docheader
00140             $docHeaderButtons = $this->getButtons();
00141             $markers = array(
00142                 'CSH' => $docHeaderButtons['csh'],
00143                 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
00144                 'CONTENT' => $this->content
00145             );
00146 
00147                 // Build the <body> for the module
00148             $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
00149         } else {
00150                 // If no access or if ID == zero
00151             $this->doc = t3lib_div::makeInstance('mediumDoc');
00152             $this->doc->backPath = $BACK_PATH;
00153 
00154             $this->content = $this->doc->header($LANG->getLL('title'));
00155             $this->content .= $this->doc->spacer(5);
00156             $this->content .= $this->doc->spacer(10);
00157         }
00158         // Renders the module page
00159         $this->content = $this->doc->render(
00160             $LANG->getLL('title'),
00161             $this->content
00162         );
00163     }
00164 
00165     /**
00166      * Print module content (from $this->content)
00167      *
00168      * @return  void
00169      */
00170     function printContent() {
00171         $this->content = $this->doc->insertStylesAndJS($this->content);
00172         echo $this->content;
00173     }
00174 
00175     /**
00176      * Create the panel of buttons for submitting the form or otherwise perform operations.
00177      *
00178      * @return  array   all available buttons as an assoc. array
00179      */
00180     protected function getButtons() {
00181         global $TCA, $LANG, $BACK_PATH, $BE_USER;
00182 
00183         $buttons = array(
00184             'csh' => '',
00185             'view' => '',
00186             'record_list' => '',
00187             'shortcut' => '',
00188         );
00189             // CSH
00190         $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '', TRUE);
00191 
00192             // View page
00193         $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) . '">' .
00194                     t3lib_iconWorks::getSpriteIcon('actions-document-view') .
00195                 '</a>';
00196 
00197             // Shortcut
00198         if ($BE_USER->mayMakeShortcut())    {
00199             $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']);
00200         }
00201 
00202             // If access to Web>List for user, then link to that module.
00203         $buttons['record_list'] = t3lib_BEfunc::getListViewLink(
00204             array(
00205                 'id' => $this->pageinfo['uid'],
00206                 'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI'),
00207             ),
00208             $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList')
00209         );
00210 
00211         return $buttons;
00212     }
00213 
00214 }
00215 
00216 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/mod/web/info/index.php'])) {
00217     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/mod/web/info/index.php']);
00218 }
00219 
00220 
00221 
00222 // Make instance:
00223 $SOBE = t3lib_div::makeInstance('SC_mod_web_info_index');
00224 $SOBE->init();
00225 
00226 // Include files?
00227 foreach($SOBE->include_once as $INC_FILE)   include_once($INC_FILE);
00228 $SOBE->checkExtObj();   // Checking for first level external objects
00229 
00230 // Repeat Include files! - if any files has been added by second-level extensions
00231 foreach($SOBE->include_once as $INC_FILE)   include_once($INC_FILE);
00232 $SOBE->checkSubExtObj();    // Checking second level external objects
00233 
00234 $SOBE->main();
00235 $SOBE->printContent();
00236 
00237 ?>