📄 db_new_content_el.php
字号:
<?php/**************************************************************** Copyright notice** (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)* All rights reserved** This script is part of the TYPO3 project. The TYPO3 project is* free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** The GNU General Public License can be found at* http://www.gnu.org/copyleft/gpl.html.* A copy is found in the textfile GPL.txt and important notices to the license* from the author is found in LICENSE.txt distributed with these scripts.*** This script is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.** This copyright notice MUST APPEAR in all copies of the script!***************************************************************//** * New content elements wizard * (Part of the 'cms' extension) * * $Id: db_new_content_el.php 2373 2007-07-02 16:03:23Z ohader $ * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj * XHTML compatible. * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> *//** * [CLASS/FUNCTION INDEX of SCRIPT] * * * * 101: class ext_posMap extends t3lib_positionMap * 111: function wrapRecordTitle($str,$row) * 125: function onClickInsertRecord($row,$vv,$moveUid,$pid,$sys_lang=0) * * * 153: class SC_db_new_content_el * 176: function init() * 212: function main() * 359: function printContent() * * SECTION: OTHER FUNCTIONS: * 388: function getWizardItems() * 398: function wizardArray() * 549: function removeInvalidElements(&$wizardItems) * * TOTAL FUNCTIONS: 8 * (This index is automatically created/updated by the extension "extdeveval") * */unset($MCONF);require('conf.php');require($BACK_PATH.'init.php');require($BACK_PATH.'template.php'); // Unset MCONF/MLANG since all we wanted was back path etc. for this particular script.unset($MCONF);unset($MLANG); // Merging locallang files/arrays:$LANG->includeLLFile('EXT:lang/locallang_misc.xml');$LOCAL_LANG_orig = $LOCAL_LANG;$LANG->includeLLFile('EXT:cms/layout/locallang_db_new_content_el.xml');$LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG_orig,$LOCAL_LANG); // Exits if 'cms' extension is not loaded:t3lib_extMgm::isLoaded('cms',1); // Include needed libraries:require_once(PATH_t3lib.'class.t3lib_page.php');require_once(PATH_t3lib.'class.t3lib_positionmap.php');/** * Local position map class * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage core */class ext_posMap extends t3lib_positionMap { var $dontPrintPageInsertIcons = 1; /** * Wrapping the title of the record - here we just return it. * * @param string The title value. * @param array The record row. * @return string Wrapped title string. */ function wrapRecordTitle($str,$row) { return $str; } /** * Create on-click event value. * * @param array The record. * @param string Column position value. * @param integer Move uid * @param integer PID value. * @param integer System language * @return string */ function onClickInsertRecord($row,$vv,$moveUid,$pid,$sys_lang=0) { $table='tt_content'; $location=$this->backPath.'alt_doc.php?edit[tt_content]['.(is_array($row)?-$row['uid']:$pid).']=new&defVals[tt_content][colPos]='.$vv.'&defVals[tt_content][sys_language_uid]='.$sys_lang.'&returnUrl='.rawurlencode($GLOBALS['SOBE']->R_URI); return 'window.location.href=\''.$location.'\'+document.editForm.defValues.value; return false;'; }}/** * Script Class for the New Content element wizard * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage core */class SC_db_new_content_el { // Internal, static (from GPvars): var $id; // Page id var $sys_language=0; // Sys language var $R_URI=''; // Return URL. var $colPos; // If set, the content is destined for a specific column. var $uid_pid; // // Internal, static: var $modTSconfig=array(); // Module TSconfig. var $doc; // Internal backend template object // Internal, dynamic: var $include_once = array(); // Includes a list of files to include between init() and main() - see init() var $content; // Used to accumulate the content of the module. var $access; // Access boolean. /** * Constructor, initializing internal variables. * * @return void */ function init() { global $BE_USER,$BACK_PATH,$TBE_MODULES_EXT; // Setting class files to include: if (is_array($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'])) { $this->include_once = array_merge($this->include_once,$TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']); } // Setting internal vars: $this->id = intval(t3lib_div::_GP('id')); $this->sys_language = intval(t3lib_div::_GP('sys_language_uid')); $this->R_URI = t3lib_div::_GP('returnUrl'); $this->colPos = t3lib_div::_GP('colPos'); $this->uid_pid = intval(t3lib_div::_GP('uid_pid')); $this->MCONF['name'] = 'xMOD_db_new_content_el'; $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id,'mod.'.$this->MCONF['name']); // Starting the document template object: $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->docType= 'xhtml_trans'; $this->doc->backPath = $BACK_PATH; $this->doc->JScode=''; $this->doc->form='<form action="" name="editForm"><input type="hidden" name="defValues" value="" />'; // Getting the current page and receiving access information (used in main()) $perms_clause = $BE_USER->getPagePermsClause(1); $pageinfo = t3lib_BEfunc::readPageAccess($this->id,$perms_clause); $this->access = is_array($pageinfo) ? 1 : 0; } /** * Creating the module output. * * @return void */ function main() { global $LANG,$BACK_PATH; if ($this->id && $this->access) { // Init position map object: $posMap = t3lib_div::makeInstance('ext_posMap'); $posMap->cur_sys_language = $this->sys_language; $posMap->backPath = $BACK_PATH; if ((string)$this->colPos!='') { // If a column is pre-set: if ($this->uid_pid<0) { $row=array(); $row['uid']=abs($this->uid_pid); } else { $row=''; } $onClickEvent = $posMap->onClickInsertRecord($row,$this->colPos,'',$this->uid_pid,$this->sys_language); } else { $onClickEvent=''; } $this->doc->JScode=$this->doc->wrapScriptTags(' function goToalt_doc() { // '.$onClickEvent.' } '); // *************************** // Creating content // *************************** $this->content=''; $this->content.=$this->doc->startPage($LANG->getLL('newContentElement')); $this->content.=$this->doc->header($LANG->getLL('newContentElement')); $this->content.=$this->doc->spacer(5); $elRow = t3lib_BEfunc::getRecordWSOL('pages',$this->id); $hline = t3lib_iconWorks::getIconImage('pages',$elRow,$BACK_PATH,' title="'.htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($elRow,'pages')).'" align="top"'); $hline.= t3lib_BEfunc::getRecordTitle('pages',$elRow,TRUE); $this->content.=$this->doc->section('',$hline,0,1); $this->content.=$this->doc->spacer(10); // Wizard $code=''; $lines=array(); $wizardItems = $this->getWizardItems(); // Traverse items for the wizard. // An item is either a header or an item rendered with a radio button and title/description and icon: $cc=0; foreach ($wizardItems as $k => $wInfo) { if ($wInfo['header']) { if ($cc>0) $lines[]=' <tr> <td colspan="3"><br /></td> </tr>'; $lines[]=' <tr class="bgColor5"> <td colspan="3"><strong>'.htmlspecialchars($wInfo['header']).'</strong></td> </tr>'; } else { $tL=array(); // Radio button: $oC = "document.editForm.defValues.value=unescape('".rawurlencode($wInfo['params'])."');goToalt_doc();".(!$onClickEvent?"window.location.hash='#sel2';":''); $tL[]='<input type="radio" name="tempB" value="'.htmlspecialchars($k).'" onclick="'.htmlspecialchars($this->doc->thisBlur().$oC).'" />'; // Onclick action for icon/title: $aOnClick = 'document.getElementsByName(\'tempB\')['.$cc.'].checked=1;'.$this->doc->thisBlur().$oC.'return false;'; // Icon: $iInfo = @getimagesize($wInfo['icon']); $tL[]='<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,$wInfo['icon'],'').' alt="" /></a>'; // Title + description: $tL[]='<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><strong>'.htmlspecialchars($wInfo['title']).'</strong><br />'.nl2br(htmlspecialchars(trim($wInfo['description']))).'</a>'; // Finally, put it together in a table row: $lines[]=' <tr> <td valign="top">'.implode('</td> <td valign="top">',$tL).'</td> </tr>'; $cc++; } } // Add the wizard table to the content: $code.=$LANG->getLL('sel1',1).'<br /><br /> <!-- Content Element wizard table: --> <table border="0" cellpadding="1" cellspacing="2" id="typo3-ceWizardTable"> '.implode('',$lines).' </table>'; $this->content.= $this->doc->section(!$onClickEvent?$LANG->getLL('1_selectType'):'',$code,0,1); // If the user must also select a column: if (!$onClickEvent) { // Add anchor "sel2" $this->content.= $this->doc->section('','<a name="sel2"></a>');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -