Cleanup: Updated copyright comments
[Packages/TYPO3.CMS.git] / typo3 / sysext / feedit / view / class.tx_feedit_editpanel.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2008-2011 Jeff Segars <jeff@webempoweredchurch.org>
6 * (c) 2008-2011 David Slayback <dave@webempoweredchurch.org>
7 * All rights reserved
8 *
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
17 * A copy is found in the textfile GPL.txt and important notices to the license
18 * from the author is found in LICENSE.txt distributed with these scripts.
19 *
20 *
21 * This script is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * This copyright notice MUST APPEAR in all copies of the script!
27 ***************************************************************/
28 /**
29 * View class for the edit panels in frontend editing.
30 *
31 * $Id$
32 *
33 * @author Jeff Segars <jeff@webempoweredchurch.org>
34 * @author David Slayback <dave@webempoweredchurch.org>
35 * @package TYPO3
36 * @subpackage feedit
37 */
38 class tx_feedit_editpanel {
39
40 /**
41 * Local instance of tslib_cObj.
42 *
43 * @var tslib_cObj
44 */
45 protected $cObj;
46
47 /**
48 * Constructor for the edit panel. Creates a new cObject instance to be used in wrapping, etc.
49 *
50 * @return void
51 */
52 public function __construct() {
53 $this->cObj = t3lib_div::makeInstance('tslib_cObj');
54 $this->cObj->start(array());
55 }
56
57 /**
58 * Generates the "edit panels" which can be shown for a page or records on a page when the Admin Panel is enabled for a backend users surfing the frontend.
59 * With the "edit panel" the user will see buttons with links to editing, moving, hiding, deleting the element
60 * This function is used for the cObject EDITPANEL and the stdWrap property ".editPanel"
61 *
62 * @param string A content string containing the content related to the edit panel. For cObject "EDITPANEL" this is empty but not so for the stdWrap property. The edit panel is appended to this string and returned.
63 * @param array TypoScript configuration properties for the editPanel
64 * @param string The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW"
65 * @param array Alternative data array to use. Default is $this->data
66 * @return string The input content string with the editPanel appended. This function returns only an edit panel appended to the content string if a backend user is logged in (and has the correct permissions). Otherwise the content string is directly returned.
67 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=375&cHash=7d8915d508
68 */
69 public function editPanel($content, array $conf, $currentRecord='', array $dataArr=array(), $table='', $allow='', $newUID=0, array $hiddenFields=array()) {
70 // Special content is about to be shown, so the cache must be disabled.
71 $GLOBALS['TSFE']->set_no_cache();
72 $formName = 'TSFE_EDIT_FORM_' . substr($GLOBALS['TSFE']->uniqueHash(), 0, 4);
73 $formTag = '<form name="' . $formName . '" id ="' . $formName . '" action="' . htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" onsubmit="return TBE_EDITOR.checkSubmit(1);" style="margin: 0 0 0 0;">';
74 $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
75 $labelField = $GLOBALS['TCA'][$table]['ctrl']['label'];
76 $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
77 $blackLine = $conf['line'] ? '<img src="clear.gif" width="1" height="' . intval($conf['line']) . '" alt="" title="" /><br /><table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="black" style="border: 0px;" summary=""><tr style="border: 0px;"><td style="border: 0px;"><img src="clear.gif" width="1" height="1" alt="" title="" /></td></tr></table><br />' : '';
78
79 $theCmd='';
80 $TSFE_EDIT = $GLOBALS['BE_USER']->frontendEdit->TSFE_EDIT;
81 if (is_array($TSFE_EDIT) && $TSFE_EDIT['record'] == $currentRecord && !$TSFE_EDIT['update_close']) {
82 $theCmd =$TSFE_EDIT['cmd'];
83 }
84
85 switch($theCmd) {
86 case 'edit':
87 case 'new':
88 $finalOut = $this->editContent($formTag, $formName, $theCmd, $newUID, $dataArr, $table, $currentRecord, $blackLine);
89 break;
90 default:
91 $panel = '';
92 if (isset($allow['toolbar']) && ($GLOBALS['BE_USER']->adminPanel instanceof tslib_AdminPanel)) {
93 $panel .= $GLOBALS['BE_USER']->adminPanel->ext_makeToolBar() . '<img src="clear.gif" width="2" height="1" alt="" title="" />';
94 }
95 if (isset($allow['edit'])) {
96 $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/edit2.gif" width="11" height="12" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_editRecord').'" align="top" alt="" />', $formName, 'edit', $dataArr['_LOCALIZED_UID'] ? $table . ':' . $dataArr['_LOCALIZED_UID'] : $currentRecord);
97 }
98 // Hiding in workspaces because implementation is incomplete
99 if (isset($allow['move']) && $sortField && $GLOBALS['BE_USER']->workspace === 0) {
100 $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/button_up.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_moveUp') . '" align="top" alt="" />', $formName, 'up');
101 $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/button_down.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_moveDown') . '" align="top" alt="" />', $formName, 'down');
102 }
103 // Hiding in workspaces because implementation is incomplete, Hiding for localizations because it is unknown what should be the function in that case
104 if (isset($allow['hide']) && $hideField && $GLOBALS['BE_USER']->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
105 if ($dataArr[$hideField]) {
106 $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/button_unhide.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_unhide') . '" align="top" alt="" />', $formName, 'unhide');
107 } else {
108 $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/button_hide.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_hide') . '" align="top" alt="" />', $formName, 'hide', '', $GLOBALS['BE_USER']->extGetLL('p_hideConfirm'));
109 }
110 }
111 if (isset($allow['new'])) {
112 if ($table == 'pages') {
113 $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/new_page.gif" width="13" height="12" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_newSubpage') . '" align="top" alt="" />', $formName, 'new', $currentRecord, '');
114 } else {
115 $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/new_record.gif" width="16" height="12" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_newRecordAfter') . '" align="top" alt="" />', $formName, 'new', $currentRecord, '', $newUID);
116 }
117 }
118 // Hiding in workspaces because implementation is incomplete, Hiding for localizations because it is unknown what should be the function in that case
119 if (isset($allow['delete']) && $GLOBALS['BE_USER']->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
120 $panel .= $this->editPanelLinkWrap('<img src="' . TYPO3_mainDir . 'gfx/delete_record.gif" width="12" height="12" vspace="1" hspace="2" border="0" title="' . $GLOBALS['BE_USER']->extGetLL('p_delete').'" align="top" alt="" />', $formName, 'delete', '', $GLOBALS['BE_USER']->extGetLL('p_deleteConfirm'));
121 }
122 // Final
123 $labelTxt = $this->cObj->stdWrap($conf['label'],$conf['label.']);
124
125 foreach((array) $hiddenFields as $name => $value) {
126 $hiddenFieldString .= '<input type="hidden" name="TSFE_EDIT[' . $name . ']" value="' . $value . '"/>' . LF;
127 }
128
129 $panel='
130
131 <!-- BE_USER Edit Panel: -->
132 ' . $formTag .
133 $hiddenFieldString . '
134 <input type="hidden" name="TSFE_EDIT[cmd]" value="" />
135 <input type="hidden" name="TSFE_EDIT[record]" value="' . $currentRecord . '" />
136 <table border="0" cellpadding="0" cellspacing="0" class="typo3-editPanel" summary="">
137 <tr>
138 <td nowrap="nowrap" bgcolor="#ABBBB4" class="typo3-editPanel-controls">' . $panel . '</td>' .
139 ($labelTxt ? '<td nowrap="nowrap" bgcolor="#F6F2E6" class="typo3-editPanel-label"><font face="verdana" size="1" color="black">&nbsp;' . sprintf($labelTxt, htmlspecialchars(t3lib_div::fixed_lgd_cs($dataArr[$labelField], 50))) . '&nbsp;</font></td>' : '') . '
140 </tr>
141 </table>
142 </form>';
143 // wrap the panel
144 if ($conf['innerWrap']) {
145 $panel = $this->cObj->wrap($panel, $conf['innerWrap']);
146 }
147 if ($conf['innerWrap.']) {
148 $panel = $this->cObj->stdWrap($panel, $conf['innerWrap.']);
149 }
150
151 // add black line:
152 $panel .= $blackLine;
153
154 // wrap the complete panel
155 if ($conf['outerWrap']) {
156 $panel = $this->cObj->wrap($panel, $conf['outerWrap']);
157 }
158 if ($conf['outerWrap.']) {
159 $panel = $this->cObj->stdWrap($panel, $conf['outerWrap.']);
160 }
161 if ($conf['printBeforeContent']) {
162 $finalOut = $panel . $content;
163 } else {
164 $finalOut = $content . $panel;
165 }
166 break;
167 }
168
169 if ($conf['previewBorder']) {
170 if (!is_array($conf['previewBorder.'])) {
171 $conf['previewBorder.'] = array();
172 }
173 $finalOut = $this->editPanelPreviewBorder($table, $dataArr, $finalOut, $conf['previewBorder'], $conf['previewBorder.']);
174 }
175
176 return $finalOut;
177 }
178
179 /**
180 * Adds an edit icon to the content string. The edit icon links to alt_doc.php with proper parameters for editing the table/fields of the context.
181 * This implements TYPO3 context sensitive editing facilities. Only backend users will have access (if properly configured as well).
182 *
183 * @param string The content to which the edit icons should be appended
184 * @param string The parameters defining which table and fields to edit. Syntax is [tablename]:[fieldname],[fieldname],[fieldname],... OR [fieldname],[fieldname],[fieldname],... (basically "[tablename]:" is optional, default table is the one of the "current record" used in the function). The fieldlist is sent as "&columnsOnly=" parameter to alt_doc.php
185 * @param array TypoScript properties for configuring the edit icons.
186 * @param string The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW"
187 * @param array Alternative data array to use. Default is $this->data
188 * @param string Additional URL parameters for the link pointing to alt_doc.php
189 * @return string The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content.
190 */
191 public function editIcons($content, $params, array $conf=array(), $currentRecord='', array $dataArr=array(), $addUrlParamStr='', $table, $editUid, $fieldList) {
192 // Special content is about to be shown, so the cache must be disabled.
193 $GLOBALS['TSFE']->set_no_cache();
194 $style = $conf['styleAttribute'] ? ' style="' . htmlspecialchars($conf['styleAttribute']) . '"' : '';
195 $iconTitle = $this->cObj->stdWrap($conf['iconTitle'], $conf['iconTitle.']);
196 $iconImg = $conf['iconImg'] ? $conf['iconImg'] : '<img src="' . TYPO3_mainDir . 'gfx/edit_fe.gif" width="11" height="12" border="0" align="top" title="' . t3lib_div::deHSCentities(htmlspecialchars($iconTitle)) . '"' . $style . ' class="frontEndEditIcons" alt="" />';
197 $nV=t3lib_div::_GP('ADMCMD_view') ? 1 : 0;
198 $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir;
199 $icon = $this->editPanelLinkWrap_doWrap($iconImg, $adminURL . 'alt_doc.php?edit[' . $table . '][' . $editUid . ']=edit&columnsOnly=' . rawurlencode($fieldList) . '&noView=' . $nV . $addUrlParamStr, $currentRecord);
200
201 if ($conf['beforeLastTag'] < 0) {
202 $content = $icon . $content;
203 } elseif ($conf['beforeLastTag'] > 0) {
204 $cBuf = rtrim($content);
205 $securCount = 30;
206 while($securCount && substr($cBuf, -1) == '>' && substr($cBuf, -4) != '</a>') {
207 $cBuf = rtrim(preg_replace('/<[^<]*>$/', '', $cBuf));
208 $securCount--;
209 }
210 $content = (strlen($cBuf) && $securCount) ? substr($content, 0, strlen($cBuf)) . $icon . substr($content, strlen($cBuf)) : $content = $icon . $content;
211 } else {
212 $content .= $icon;
213 }
214
215 return $content;
216 }
217
218 /**
219 * Helper function for editPanel() which wraps icons in the panel in a link with the action of the panel.
220 * The links are for some of them not simple hyperlinks but onclick-actions which submits a little form which the panel is wrapped in.
221 *
222 * @param string The string to wrap in a link, typ. and image used as button in the edit panel.
223 * @param string The name of the form wrapping the edit panel.
224 * @param string The command of the link. There is a predefined list available: edit, new, up, down etc.
225 * @param string The "table:uid" of the record being processed by the panel.
226 * @param string Text string with confirmation message; If set a confirm box will be displayed before carrying out the action (if Yes is pressed)
227 * @param integer "New pid" - for new records
228 * @return string A <a> tag wrapped string.
229 * @see editPanel(), editIcons(), t3lib_tsfeBeUserAuth::extEditAction()
230 */
231 protected function editPanelLinkWrap($string, $formName, $cmd, $currentRecord='', $confirm='', $nPid='') {
232 // Editing forms on page only supported in Live workspace (because of incomplete implementation)
233 $editFormsOnPage = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editFormsOnPage'] && $GLOBALS['BE_USER']->workspace === 0;
234 $nV=t3lib_div::_GP('ADMCMD_view') ? 1 : 0;
235 $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir;
236
237 if ($cmd == 'edit' && !$editFormsOnPage) {
238 $rParts = explode(':', $currentRecord);
239 $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'alt_doc.php?edit[' . $rParts[0] . '][' . $rParts[1] . ']=edit&noView=' . $nV, $currentRecord);
240 } elseif ($cmd == 'new' && !$editFormsOnPage) {
241 $rParts = explode(':', $currentRecord);
242 if ($rParts[0] == 'pages') {
243 $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'db_new.php?id=' . $rParts[1] . '&pagesOnly=1', $currentRecord);
244 } else {
245 if (!intval($nPid)) {
246 $nPid = t3lib_div::testInt($rParts[1]) ? -$rParts[1] : $GLOBALS['TSFE']->id;
247 }
248 $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'alt_doc.php?edit[' . $rParts[0] . '][' . $nPid . ']=new&noView=' . $nV, $currentRecord);
249 }
250 } else {
251 if ($confirm && $GLOBALS['BE_USER']->jsConfirmation(8)) {
252 // Gets htmlspecialchared later
253 $cf1 = 'if (confirm(' . t3lib_div::quoteJSvalue($confirm, true) . ')) {';
254 $cf2 = '}';
255 } else {
256 $cf1 = $cf2 = '';
257 }
258 $out = '<a href="#" onclick="' .
259 htmlspecialchars($cf1 . 'document.' . $formName . '[\'TSFE_EDIT[cmd]\'].value=\'' . $cmd . '\'; document.' . $formName . '.submit();' . $cf2 . ' return false;') .
260 '">' . $string . '</a>';
261 }
262
263 return $out;
264 }
265
266 /**
267 * Creates a link to a script (eg. typo3/alt_doc.php or typo3/db_new.php) which either opens in the current frame OR in a pop-up window.
268 *
269 * @param string The string to wrap in a link, typ. and image used as button in the edit panel.
270 * @param string The URL of the link. Should be absolute if supposed to work with <base> path set.
271 * @param string The "table:uid" of the record being processed by the panel.
272 * @return string A <a> tag wrapped string.
273 * @see editPanelLinkWrap()
274 */
275 protected function editPanelLinkWrap_doWrap($string, $url, $currentRecord) {
276 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editNoPopup'] || $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceNoPopup']) {
277 $retUrl = t3lib_div::getIndpEnv('REQUEST_URI');
278 $rParts = explode(':', $currentRecord);
279 // This parentRecordNumber is used to make sure that only elements 3- of ordinary content elements makes a 'anchor' jump down the page.
280 if ($rParts[0] == 'tt_content' && $this->parentRecordNumber > 2) {
281 $retUrl .= '#' . $rParts[1];
282 }
283 return '<a href="' . htmlspecialchars($url . '&returnUrl=' . rawurlencode($retUrl)) . '" class="frontEndEditIconLinks">' . $string . '</a>';
284 } else {
285 return '<a href="#" onclick="' .
286 htmlspecialchars('vHWin=window.open(\'' . $url . '&returnUrl=close.html\',\'FEquickEditWindow\',\'' . ($GLOBALS['BE_USER']->uc['edit_wideDocument'] ? 'width=690,height=500' : 'width=540,height=400') . ',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;') .
287 '" class="frontEndEditIconLinks">' . $string . '</a>';
288 }
289 }
290
291 /**
292 * Wraps the input content string in a table with a gray border if the table/row combination evaluates to being disabled/hidden.
293 * Used for marking previewed records in the frontend.
294 *
295 * @param string The table name
296 * @param array The data record from $table
297 * @param string The content string to wrap
298 * @param integer The thickness of the border
299 * @param array The array with TypoScript properties for the content object
300 * @return string The input string wrapped in a table with a border color of #cccccc and thickness = $thick
301 * @see editPanel()
302 */
303 protected function editPanelPreviewBorder($table, array $row, $content, $thick, array $conf = array()) {
304 if ($this->isDisabled($table, $row)) {
305 $thick = t3lib_div::intInRange($thick, 1, 100);
306 $color = $conf['color'] ? $conf['color'] : '#cccccc';
307 if ($conf['innerWrap']) {
308 $content = $this->wrap($content,$conf['innerWrap']);
309 }
310 if ($conf['innerWrap.']) {
311 $content = $this->stdWrap($content,$conf['innerWrap.']);
312 }
313 $content = '<table class="typo3-editPanel-previewBorder" border="' . $thick . '" cellpadding="0" cellspacing="0" bordercolor="' . $color . '" width="100%" summary=""><tr><td>' . $content . '</td></tr></table>';
314 if ($conf['outerWrap']) {
315 $content = $this->wrap($content,$conf['outerWrap']);
316 }
317 if ($conf['outerWrap.']) {
318 $content = $this->stdWrap($panel,$conf['outerWrap.']);
319 }
320 }
321
322 return $content;
323 }
324
325 /**
326 * Returns true if the input table/row would be hidden in the frontend (according nto the current time and simulate user group)
327 *
328 * @param string The table name
329 * @param array The data record
330 * @return boolean
331 * @see editPanelPreviewBorder()
332 */
333 protected function isDisabled($table, $row) {
334 if (($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']]) ||
335 ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group'] && $GLOBALS['TSFE']->simUserGroup && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group']] == $GLOBALS['TSFE']->simUserGroup) ||
336 ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime'] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime']] > $GLOBALS['EXEC_TIME']) ||
337 ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime'] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']] < $GLOBALS['EXEC_TIME'])) {
338 return true;
339 }
340 }
341
342 /**
343 * Returns the editing form for a content element.
344 *
345 * @param string Form tag
346 * @param string Form name
347 * @param string the command
348 * @param integer newUID
349 * @param array dataArray for element
350 * @param string Table name of element
351 * @param string Current record
352 * @param string Blackline
353 * @return string
354 */
355 protected function editContent($formTag, $formName, $theCmd, $newUID, array $dataArray, $table, $currentRecord, $blackLine) {
356 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms_FE');
357 $tceforms->prependFormFieldNames = 'TSFE_EDIT[data]';
358 $tceforms->prependFormFieldNames_file = 'TSFE_EDIT_file';
359 $tceforms->doSaveFieldName = 'TSFE_EDIT[doSave]';
360 $tceforms->formName = $formName;
361 $tceforms->backPath = TYPO3_mainDir;
362 $tceforms->setFancyDesign();
363 $tceforms->defStyle = 'font-family:Verdana;font-size:10px;';
364 $tceforms->edit_showFieldHelp = $GLOBALS['BE_USER']->uc['edit_showFieldHelp'];
365
366 // Icon only mode for CSH destroys the layout for frontend editing so force full text mode instead.
367 // @todo Make sure the necessary Javascript and CSS are included so that CSH can work properly in all modes.
368 if($tceforms->edit_showFieldHelp == 'icon') {
369 $tceforms->edit_showFieldHelp = 'text';
370 }
371
372 $tceforms->helpTextFontTag = '<font face="verdana,sans-serif" color="#333333" size="1">';
373
374 $trData = t3lib_div::makeInstance('t3lib_transferData');
375 $trData->addRawData = true;
376 $trData->lockRecords = 1;
377 // Added without testing - should provide ability to submit default values in frontend editing, in-page.
378 $trData->defVals = t3lib_div::_GP('defVals');
379 $trData->fetchRecord($table, ($theCmd == 'new' ? $newUID : $dataArray['uid']), ($theCmd == 'new' ? 'new' : '') );
380 reset($trData->regTableItems_data);
381 $processedDataArr = current($trData->regTableItems_data);
382 $processedDataArr['uid'] = $theCmd == 'new' ? 'NEW' : $dataArray['uid'];
383 $processedDataArr['pid'] = $theCmd == 'new' ? $newUID : $dataArray['pid'];
384
385 $panel = '';
386 $buttons = '<input type="image" border="0" name="TSFE_EDIT[update]" src="' . $tceforms->backPath . 'gfx/savedok.gif" hspace="2" width="21" height="16" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" />';
387 $buttons .= '<input type="image" border="0" name="TSFE_EDIT[update_close]" src="' . $tceforms->backPath . 'gfx/saveandclosedok.gif" hspace="2" width="21" height="16" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', 1) . '" />';
388 $buttons .= '<input type="image" border="0" name="TSFE_EDIT[cancel]" onclick="' .
389 htmlspecialchars('window.location.href=\'' . t3lib_div::getIndpEnv('REQUEST_URI') . '\';return false;') .
390 '" src="' . $tceforms->backPath . 'gfx/closedok.gif" hspace="2" width="21" height="16" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', 1) . '" />';
391 // Buttons top
392 $panel .= $tceforms->intoTemplate(array('ITEM' => $buttons));
393 $panel .= $tceforms->getMainFields($table, $processedDataArr);
394
395 $hiddenF = "";
396 if ($theCmd == 'new') {
397 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[data][' . $table . '][NEW][pid]" value="' . $newUID . '" />';
398 if ($table == 'pages') {
399 // If a new page is created in front-end, then show it by default!
400 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[data][' . $table . '][NEW][hidden]" value="0" />';
401 } else {
402 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[record]" value="' . $currentRecord . '" />';
403 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[cmd]" value="edit" />';
404 }
405 }
406 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[doSave]" value="0" />';
407 // Buttons AND hidden fields bottom.
408 $panel .= $tceforms->intoTemplate(array('ITEM' => $buttons . $hiddenF));
409
410 $panel = $formTag . $tceforms->wrapTotal($panel, $dataArray, $table) . '</form>' . ($theCmd != 'new' ? $blackLine : '');
411
412 $finalOut = $tceforms->printNeededJSFunctions_top() . ($conf['edit.']['displayRecord'] ? $content : '') . $panel . ($theCmd=='new' ? $blackLine : '') . $tceforms->printNeededJSFunctions();
413
414 $GLOBALS['SOBE']->doc->insertHeaderData();
415
416 return $finalOut;
417 }
418
419 }
420
421 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/feedit/view/class.tx_feedit_editpanel.php'])) {
422 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/feedit/view/class.tx_feedit_editpanel.php']);
423 }
424
425 ?>