0042e9c8c1dac7b77063d91ae75d4b0a4396fd66
[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 */
68 public function editPanel($content, array $conf, $currentRecord='', array $dataArr=array(), $table='', $allow='', $newUID=0, array $hiddenFields=array()) {
69 // Special content is about to be shown, so the cache must be disabled.
70 $GLOBALS['TSFE']->set_no_cache();
71 $formName = 'TSFE_EDIT_FORM_' . substr($GLOBALS['TSFE']->uniqueHash(), 0, 4);
72 $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;">';
73 $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
74 $labelField = $GLOBALS['TCA'][$table]['ctrl']['label'];
75 $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
76 $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 />' : '';
77
78 $theCmd='';
79 $TSFE_EDIT = $GLOBALS['BE_USER']->frontendEdit->TSFE_EDIT;
80 if (is_array($TSFE_EDIT) && $TSFE_EDIT['record'] == $currentRecord && !$TSFE_EDIT['update_close']) {
81 $theCmd =$TSFE_EDIT['cmd'];
82 }
83
84 switch($theCmd) {
85 case 'edit':
86 case 'new':
87 $finalOut = $this->editContent($formTag, $formName, $theCmd, $newUID, $dataArr, $table, $currentRecord, $blackLine);
88 break;
89 default:
90 $panel = '';
91 if (isset($allow['toolbar']) && ($GLOBALS['BE_USER']->adminPanel instanceof tslib_AdminPanel)) {
92 $panel .= $GLOBALS['BE_USER']->adminPanel->ext_makeToolBar() . '<img src="clear.gif" width="2" height="1" alt="" title="" />';
93 }
94 if (isset($allow['edit'])) {
95 $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);
96 }
97 // Hiding in workspaces because implementation is incomplete
98 if (isset($allow['move']) && $sortField && $GLOBALS['BE_USER']->workspace === 0) {
99 $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');
100 $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');
101 }
102 // Hiding in workspaces because implementation is incomplete, Hiding for localizations because it is unknown what should be the function in that case
103 if (isset($allow['hide']) && $hideField && $GLOBALS['BE_USER']->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
104 if ($dataArr[$hideField]) {
105 $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');
106 } else {
107 $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'));
108 }
109 }
110 if (isset($allow['new'])) {
111 if ($table == 'pages') {
112 $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, '');
113 } else {
114 $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);
115 }
116 }
117 // Hiding in workspaces because implementation is incomplete, Hiding for localizations because it is unknown what should be the function in that case
118 if (isset($allow['delete']) && $GLOBALS['BE_USER']->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
119 $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'));
120 }
121 // Final
122 $labelTxt = $this->cObj->stdWrap($conf['label'],$conf['label.']);
123
124 foreach((array) $hiddenFields as $name => $value) {
125 $hiddenFieldString .= '<input type="hidden" name="TSFE_EDIT[' . $name . ']" value="' . $value . '"/>' . LF;
126 }
127
128 $panel='
129
130 <!-- BE_USER Edit Panel: -->
131 ' . $formTag .
132 $hiddenFieldString . '
133 <input type="hidden" name="TSFE_EDIT[cmd]" value="" />
134 <input type="hidden" name="TSFE_EDIT[record]" value="' . $currentRecord . '" />
135 <table border="0" cellpadding="0" cellspacing="0" class="typo3-editPanel" summary="">
136 <tr>
137 <td nowrap="nowrap" bgcolor="#ABBBB4" class="typo3-editPanel-controls">' . $panel . '</td>' .
138 ($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>' : '') . '
139 </tr>
140 </table>
141 </form>';
142 // wrap the panel
143 if ($conf['innerWrap']) {
144 $panel = $this->cObj->wrap($panel, $conf['innerWrap']);
145 }
146 if ($conf['innerWrap.']) {
147 $panel = $this->cObj->stdWrap($panel, $conf['innerWrap.']);
148 }
149
150 // add black line:
151 $panel .= $blackLine;
152
153 // wrap the complete panel
154 if ($conf['outerWrap']) {
155 $panel = $this->cObj->wrap($panel, $conf['outerWrap']);
156 }
157 if ($conf['outerWrap.']) {
158 $panel = $this->cObj->stdWrap($panel, $conf['outerWrap.']);
159 }
160 if ($conf['printBeforeContent']) {
161 $finalOut = $panel . $content;
162 } else {
163 $finalOut = $content . $panel;
164 }
165 break;
166 }
167
168 if ($conf['previewBorder']) {
169 if (!is_array($conf['previewBorder.'])) {
170 $conf['previewBorder.'] = array();
171 }
172 $finalOut = $this->editPanelPreviewBorder($table, $dataArr, $finalOut, $conf['previewBorder'], $conf['previewBorder.']);
173 }
174
175 return $finalOut;
176 }
177
178 /**
179 * 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.
180 * This implements TYPO3 context sensitive editing facilities. Only backend users will have access (if properly configured as well).
181 *
182 * @param string The content to which the edit icons should be appended
183 * @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
184 * @param array TypoScript properties for configuring the edit icons.
185 * @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"
186 * @param array Alternative data array to use. Default is $this->data
187 * @param string Additional URL parameters for the link pointing to alt_doc.php
188 * @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.
189 */
190 public function editIcons($content, $params, array $conf=array(), $currentRecord='', array $dataArr=array(), $addUrlParamStr='', $table, $editUid, $fieldList) {
191 // Special content is about to be shown, so the cache must be disabled.
192 $GLOBALS['TSFE']->set_no_cache();
193 $style = $conf['styleAttribute'] ? ' style="' . htmlspecialchars($conf['styleAttribute']) . '"' : '';
194 $iconTitle = $this->cObj->stdWrap($conf['iconTitle'], $conf['iconTitle.']);
195 $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="" />';
196 $nV=t3lib_div::_GP('ADMCMD_view') ? 1 : 0;
197 $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir;
198 $icon = $this->editPanelLinkWrap_doWrap($iconImg, $adminURL . 'alt_doc.php?edit[' . $table . '][' . $editUid . ']=edit&columnsOnly=' . rawurlencode($fieldList) . '&noView=' . $nV . $addUrlParamStr, $currentRecord);
199
200 if ($conf['beforeLastTag'] < 0) {
201 $content = $icon . $content;
202 } elseif ($conf['beforeLastTag'] > 0) {
203 $cBuf = rtrim($content);
204 $securCount = 30;
205 while($securCount && substr($cBuf, -1) == '>' && substr($cBuf, -4) != '</a>') {
206 $cBuf = rtrim(preg_replace('/<[^<]*>$/', '', $cBuf));
207 $securCount--;
208 }
209 $content = (strlen($cBuf) && $securCount) ? substr($content, 0, strlen($cBuf)) . $icon . substr($content, strlen($cBuf)) : $content = $icon . $content;
210 } else {
211 $content .= $icon;
212 }
213
214 return $content;
215 }
216
217 /**
218 * Helper function for editPanel() which wraps icons in the panel in a link with the action of the panel.
219 * The links are for some of them not simple hyperlinks but onclick-actions which submits a little form which the panel is wrapped in.
220 *
221 * @param string The string to wrap in a link, typ. and image used as button in the edit panel.
222 * @param string The name of the form wrapping the edit panel.
223 * @param string The command of the link. There is a predefined list available: edit, new, up, down etc.
224 * @param string The "table:uid" of the record being processed by the panel.
225 * @param string Text string with confirmation message; If set a confirm box will be displayed before carrying out the action (if Yes is pressed)
226 * @param integer "New pid" - for new records
227 * @return string A <a> tag wrapped string.
228 * @see editPanel(), editIcons(), t3lib_tsfeBeUserAuth::extEditAction()
229 */
230 protected function editPanelLinkWrap($string, $formName, $cmd, $currentRecord='', $confirm='', $nPid='') {
231 // Editing forms on page only supported in Live workspace (because of incomplete implementation)
232 $editFormsOnPage = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editFormsOnPage'] && $GLOBALS['BE_USER']->workspace === 0;
233 $nV=t3lib_div::_GP('ADMCMD_view') ? 1 : 0;
234 $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir;
235
236 if ($cmd == 'edit' && !$editFormsOnPage) {
237 $rParts = explode(':', $currentRecord);
238 $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'alt_doc.php?edit[' . $rParts[0] . '][' . $rParts[1] . ']=edit&noView=' . $nV, $currentRecord);
239 } elseif ($cmd == 'new' && !$editFormsOnPage) {
240 $rParts = explode(':', $currentRecord);
241 if ($rParts[0] == 'pages') {
242 $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'db_new.php?id=' . $rParts[1] . '&pagesOnly=1', $currentRecord);
243 } else {
244 if (!intval($nPid)) {
245 $nPid = t3lib_div::testInt($rParts[1]) ? -$rParts[1] : $GLOBALS['TSFE']->id;
246 }
247 $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'alt_doc.php?edit[' . $rParts[0] . '][' . $nPid . ']=new&noView=' . $nV, $currentRecord);
248 }
249 } else {
250 if ($confirm && $GLOBALS['BE_USER']->jsConfirmation(8)) {
251 // Gets htmlspecialchared later
252 $cf1 = 'if (confirm(' . t3lib_div::quoteJSvalue($confirm, true) . ')) {';
253 $cf2 = '}';
254 } else {
255 $cf1 = $cf2 = '';
256 }
257 $out = '<a href="#" onclick="' .
258 htmlspecialchars($cf1 . 'document.' . $formName . '[\'TSFE_EDIT[cmd]\'].value=\'' . $cmd . '\'; document.' . $formName . '.submit();' . $cf2 . ' return false;') .
259 '">' . $string . '</a>';
260 }
261
262 return $out;
263 }
264
265 /**
266 * 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.
267 *
268 * @param string The string to wrap in a link, typ. and image used as button in the edit panel.
269 * @param string The URL of the link. Should be absolute if supposed to work with <base> path set.
270 * @param string The "table:uid" of the record being processed by the panel.
271 * @return string A <a> tag wrapped string.
272 * @see editPanelLinkWrap()
273 */
274 protected function editPanelLinkWrap_doWrap($string, $url, $currentRecord) {
275 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editNoPopup'] || $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceNoPopup']) {
276 $retUrl = t3lib_div::getIndpEnv('REQUEST_URI');
277 $rParts = explode(':', $currentRecord);
278 // This parentRecordNumber is used to make sure that only elements 3- of ordinary content elements makes a 'anchor' jump down the page.
279 if ($rParts[0] == 'tt_content' && $this->parentRecordNumber > 2) {
280 $retUrl .= '#' . $rParts[1];
281 }
282 return '<a href="' . htmlspecialchars($url . '&returnUrl=' . rawurlencode($retUrl)) . '" class="frontEndEditIconLinks">' . $string . '</a>';
283 } else {
284 return '<a href="#" onclick="' .
285 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;') .
286 '" class="frontEndEditIconLinks">' . $string . '</a>';
287 }
288 }
289
290 /**
291 * Wraps the input content string in a table with a gray border if the table/row combination evaluates to being disabled/hidden.
292 * Used for marking previewed records in the frontend.
293 *
294 * @param string The table name
295 * @param array The data record from $table
296 * @param string The content string to wrap
297 * @param integer The thickness of the border
298 * @param array The array with TypoScript properties for the content object
299 * @return string The input string wrapped in a table with a border color of #cccccc and thickness = $thick
300 * @see editPanel()
301 */
302 protected function editPanelPreviewBorder($table, array $row, $content, $thick, array $conf = array()) {
303 if ($this->isDisabled($table, $row)) {
304 $thick = t3lib_div::intInRange($thick, 1, 100);
305 $color = $conf['color'] ? $conf['color'] : '#cccccc';
306 if ($conf['innerWrap']) {
307 $content = $this->wrap($content,$conf['innerWrap']);
308 }
309 if ($conf['innerWrap.']) {
310 $content = $this->stdWrap($content,$conf['innerWrap.']);
311 }
312 $content = '<table class="typo3-editPanel-previewBorder" border="' . $thick . '" cellpadding="0" cellspacing="0" bordercolor="' . $color . '" width="100%" summary=""><tr><td>' . $content . '</td></tr></table>';
313 if ($conf['outerWrap']) {
314 $content = $this->wrap($content,$conf['outerWrap']);
315 }
316 if ($conf['outerWrap.']) {
317 $content = $this->stdWrap($panel,$conf['outerWrap.']);
318 }
319 }
320
321 return $content;
322 }
323
324 /**
325 * Returns true if the input table/row would be hidden in the frontend (according nto the current time and simulate user group)
326 *
327 * @param string The table name
328 * @param array The data record
329 * @return boolean
330 * @see editPanelPreviewBorder()
331 */
332 protected function isDisabled($table, $row) {
333 if (($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']]) ||
334 ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group'] && $GLOBALS['TSFE']->simUserGroup && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group']] == $GLOBALS['TSFE']->simUserGroup) ||
335 ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime'] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime']] > $GLOBALS['EXEC_TIME']) ||
336 ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime'] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']] < $GLOBALS['EXEC_TIME'])) {
337 return true;
338 }
339 }
340
341 /**
342 * Returns the editing form for a content element.
343 *
344 * @param string Form tag
345 * @param string Form name
346 * @param string the command
347 * @param integer newUID
348 * @param array dataArray for element
349 * @param string Table name of element
350 * @param string Current record
351 * @param string Blackline
352 * @return string
353 */
354 protected function editContent($formTag, $formName, $theCmd, $newUID, array $dataArray, $table, $currentRecord, $blackLine) {
355 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms_FE');
356 $tceforms->prependFormFieldNames = 'TSFE_EDIT[data]';
357 $tceforms->prependFormFieldNames_file = 'TSFE_EDIT_file';
358 $tceforms->doSaveFieldName = 'TSFE_EDIT[doSave]';
359 $tceforms->formName = $formName;
360 $tceforms->backPath = TYPO3_mainDir;
361 $tceforms->setFancyDesign();
362 $tceforms->defStyle = 'font-family:Verdana;font-size:10px;';
363 $tceforms->edit_showFieldHelp = $GLOBALS['BE_USER']->uc['edit_showFieldHelp'];
364
365 // Icon only mode for CSH destroys the layout for frontend editing so force full text mode instead.
366 // @todo Make sure the necessary Javascript and CSS are included so that CSH can work properly in all modes.
367 if($tceforms->edit_showFieldHelp == 'icon') {
368 $tceforms->edit_showFieldHelp = 'text';
369 }
370
371 $tceforms->helpTextFontTag = '<font face="verdana,sans-serif" color="#333333" size="1">';
372
373 $trData = t3lib_div::makeInstance('t3lib_transferData');
374 $trData->addRawData = true;
375 $trData->lockRecords = 1;
376 // Added without testing - should provide ability to submit default values in frontend editing, in-page.
377 $trData->defVals = t3lib_div::_GP('defVals');
378 $trData->fetchRecord($table, ($theCmd == 'new' ? $newUID : $dataArray['uid']), ($theCmd == 'new' ? 'new' : '') );
379 reset($trData->regTableItems_data);
380 $processedDataArr = current($trData->regTableItems_data);
381 $processedDataArr['uid'] = $theCmd == 'new' ? 'NEW' : $dataArray['uid'];
382 $processedDataArr['pid'] = $theCmd == 'new' ? $newUID : $dataArray['pid'];
383
384 $panel = '';
385 $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) . '" />';
386 $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) . '" />';
387 $buttons .= '<input type="image" border="0" name="TSFE_EDIT[cancel]" onclick="' .
388 htmlspecialchars('window.location.href=\'' . t3lib_div::getIndpEnv('REQUEST_URI') . '\';return false;') .
389 '" 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) . '" />';
390 // Buttons top
391 $panel .= $tceforms->intoTemplate(array('ITEM' => $buttons));
392 $panel .= $tceforms->getMainFields($table, $processedDataArr);
393
394 $hiddenF = "";
395 if ($theCmd == 'new') {
396 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[data][' . $table . '][NEW][pid]" value="' . $newUID . '" />';
397 if ($table == 'pages') {
398 // If a new page is created in front-end, then show it by default!
399 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[data][' . $table . '][NEW][hidden]" value="0" />';
400 } else {
401 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[record]" value="' . $currentRecord . '" />';
402 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[cmd]" value="edit" />';
403 }
404 }
405 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[doSave]" value="0" />';
406 // Buttons AND hidden fields bottom.
407 $panel .= $tceforms->intoTemplate(array('ITEM' => $buttons . $hiddenF));
408
409 $panel = $formTag . $tceforms->wrapTotal($panel, $dataArray, $table) . '</form>' . ($theCmd != 'new' ? $blackLine : '');
410
411 $finalOut = $tceforms->printNeededJSFunctions_top() . ($conf['edit.']['displayRecord'] ? $content : '') . $panel . ($theCmd=='new' ? $blackLine : '') . $tceforms->printNeededJSFunctions();
412
413 $GLOBALS['SOBE']->doc->insertHeaderData();
414
415 return $finalOut;
416 }
417
418 }
419
420 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/feedit/view/class.tx_feedit_editpanel.php'])) {
421 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/feedit/view/class.tx_feedit_editpanel.php']);
422 }
423
424 ?>