Added more comments, $Id$ keywords etc for the whole core of TYPO3.
[Packages/TYPO3.CMS.git] / typo3 / wizard_edit.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2003 Kasper Skaarhoj (kasper@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 * Wizard to edit records to a table
29 *
30 * $Id$
31 *
32 * @author Kasper Skaarhoj <kasper@typo3.com>
33 */
34 /**
35 * [CLASS/FUNCTION INDEX of SCRIPT]
36 *
37 *
38 *
39 * 74: class SC_wizard_edit
40 * 80: function init()
41 * 89: function main()
42 *
43 * TOTAL FUNCTIONS: 2
44 * (This index is automatically created/updated by the extension "extdeveval")
45 *
46 */
47
48
49
50 $BACK_PATH='';
51 require ('init.php');
52 require ('template.php');
53 include ('sysext/lang/locallang_wizards.php');
54 require_once (PATH_t3lib.'class.t3lib_loaddbgroup.php');
55
56
57
58
59
60
61
62
63
64
65
66
67 /**
68 * Script Class
69 *
70 * @author Kasper Skaarhoj <kasper@typo3.com>
71 * @package TYPO3
72 * @subpackage core
73 */
74 class SC_wizard_edit {
75 var $P;
76
77 /**
78 * @return [type] ...
79 */
80 function init() {
81 $this->P = t3lib_div::GPvar('P',1);
82 }
83
84 /**
85 * [Describe function...]
86 *
87 * @return [type] ...
88 */
89 function main() {
90 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$HTTP_GET_VARS,$HTTP_POST_VARS,$CLIENT,$TYPO3_CONF_VARS;
91
92 if (t3lib_div::GPvar("doClose")) {
93 echo '<script language="javascript" type="text/javascript">close();</script>';
94 } else {
95 $table = $this->P["table"];
96 $field = $this->P["field"];
97 t3lib_div::loadTCA($table);
98 $config = $TCA[$table]["columns"][$field]["config"];
99 $fTable = $this->P["currentValue"]<0 ? $config["neg_foreign_table"] : $config["foreign_table"];
100
101 if (is_array($config) && $config["type"]=="select" && !$config["MM"] && t3lib_div::testInt($this->P["currentValue"]) && $this->P["currentValue"] && $fTable) {
102 header("Location: ".t3lib_div::locationHeaderUrl("alt_doc.php?returnUrl=".rawurlencode("wizard_edit.php?doClose=1")."&edit[".$fTable."][".$this->P["currentValue"]."]=edit"));
103 } elseif (is_array($config) && $this->P["currentSelectedValues"] && (($config["type"]=="select" && $config["foreign_table"]) || ($config["type"]=="group" && $config["internal_type"]=="db"))) {
104 $allowedTables = $config["type"]=="group" ? $config["allowed"] : $config["foreign_table"].",".$config["neg_foreign_table"];
105 //$prependName = $config["type"]=="group" ? $config["prepend_tname"] : $config["neg_foreign_table"];
106 $prependName=1;
107 $dbAnalysis = t3lib_div::makeInstance("t3lib_loadDBGroup");
108 $dbAnalysis->start($this->P["currentSelectedValues"],$allowedTables);
109 $value = $dbAnalysis->getValueArray($prependName);
110 reset($value);
111 $params="";
112 while(list(,$rec)=each($value)) {
113 $recTableUidParts = t3lib_div::revExplode("_",$rec,2);
114 $params.="&edit[".$recTableUidParts[0]."][".$recTableUidParts[1]."]=edit";
115 }
116 header("Location: ".t3lib_div::locationHeaderUrl("alt_doc.php?returnUrl=".rawurlencode("wizard_edit.php?doClose=1").$params));
117 } else {
118 echo '<script language="javascript" type="text/javascript">close();</script>';
119 }
120 }
121 }
122 }
123
124 // Include extension?
125 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_edit.php']) {
126 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_edit.php']);
127 }
128
129
130
131
132
133
134
135
136
137
138
139
140 // Make instance:
141 $SOBE = t3lib_div::makeInstance('SC_wizard_edit');
142 $SOBE->init();
143 $SOBE->main();
144 ?>