Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2005 Kasper Skaarhoj (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 ***************************************************************/ 00052 $BACK_PATH=''; 00053 require ('init.php'); 00054 require ('template.php'); 00055 $LANG->includeLLFile('EXT:lang/locallang_wizards.xml'); 00056 require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php'); 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00076 class SC_wizard_edit { 00077 00078 // Internal, static: GPvars 00079 var $P; // Wizard parameters, coming from TCEforms linking to the wizard. 00080 var $doClose; // Boolean; if set, the window will be closed by JavaScript 00081 00082 00083 00084 00090 function init() { 00091 $this->P = t3lib_div::_GP('P'); 00092 $this->doClose = t3lib_div::_GP('doClose'); // Used for the return URL to alt_doc.php so that we can close the window. 00093 } 00094 00101 function main() { 00102 global $TCA; 00103 00104 if ($this->doClose) { 00105 $this->closeWindow(); 00106 } else { 00107 00108 // Initialize: 00109 $table = $this->P['table']; 00110 $field = $this->P['field']; 00111 t3lib_div::loadTCA($table); 00112 $config = $TCA[$table]['columns'][$field]['config']; 00113 $fTable = $this->P['currentValue']<0 ? $config['neg_foreign_table'] : $config['foreign_table']; 00114 00115 // Detecting the various allowed field type setups and acting accordingly. 00116 if (is_array($config) && $config['type']=='select' && !$config['MM'] && $config['maxitems']<=1 && t3lib_div::testInt($this->P['currentValue']) && $this->P['currentValue'] && $fTable) { // SINGLE value: 00117 header('Location: '.t3lib_div::locationHeaderUrl('alt_doc.php?returnUrl='.rawurlencode('wizard_edit.php?doClose=1').'&edit['.$fTable.']['.$this->P['currentValue'].']=edit')); 00118 } elseif (is_array($config) && $this->P['currentSelectedValues'] && (($config['type']=='select' && $config['foreign_table']) || ($config['type']=='group' && $config['internal_type']=='db'))) { // MULTIPLE VALUES: 00119 00120 // Init settings: 00121 $allowedTables = $config['type']=='group' ? $config['allowed'] : $config['foreign_table'].','.$config['neg_foreign_table']; 00122 $prependName=1; 00123 $params=''; 00124 00125 // Selecting selected values into an array: 00126 $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup'); 00127 $dbAnalysis->start($this->P['currentSelectedValues'],$allowedTables); 00128 $value = $dbAnalysis->getValueArray($prependName); 00129 00130 // Traverse that array and make parameters for alt_doc.php: 00131 foreach($value as $rec) { 00132 $recTableUidParts = t3lib_div::revExplode('_',$rec,2); 00133 $params.='&edit['.$recTableUidParts[0].']['.$recTableUidParts[1].']=edit'; 00134 } 00135 00136 // Redirect to alt_doc.php: 00137 header('Location: '.t3lib_div::locationHeaderUrl('alt_doc.php?returnUrl='.rawurlencode('wizard_edit.php?doClose=1').$params)); 00138 } else { 00139 $this->closeWindow(); 00140 } 00141 } 00142 } 00143 00149 function closeWindow() { 00150 echo '<script language="javascript" type="text/javascript">close();</script>'; 00151 exit; 00152 } 00153 } 00154 00155 // Include extension? 00156 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_edit.php']) { 00157 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_edit.php']); 00158 } 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 // Make instance: 00172 $SOBE = t3lib_div::makeInstance('SC_wizard_edit'); 00173 $SOBE->init(); 00174 $SOBE->main(); 00175 ?>