TYPO3 API  SVNRelease
class.tx_feedit_editpanel.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2008-2011 Jeff Segars <jeff@webempoweredchurch.org>
00006 *  (c) 2008-2011 David Slayback <dave@webempoweredchurch.org>
00007 *  All rights reserved
00008 *
00009 *  This script is part of the TYPO3 project. The TYPO3 project is
00010 *  free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  The GNU General Public License can be found at
00016 *  http://www.gnu.org/copyleft/gpl.html.
00017 *  A copy is found in the textfile GPL.txt and important notices to the license
00018 *  from the author is found in LICENSE.txt distributed with these scripts.
00019 *
00020 *
00021 *  This script is distributed in the hope that it will be useful,
00022 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024 *  GNU General Public License for more details.
00025 *
00026 *  This copyright notice MUST APPEAR in all copies of the script!
00027 ***************************************************************/
00028 /**
00029  * View class for the edit panels in frontend editing.
00030  *
00031  * $Id: class.tx_feedit_editpanel.php 10317 2011-01-26 00:56:49Z baschny $
00032  *
00033  * @author  Jeff Segars <jeff@webempoweredchurch.org>
00034  * @author  David Slayback <dave@webempoweredchurch.org>
00035  * @package TYPO3
00036  * @subpackage feedit
00037  */
00038 class tx_feedit_editpanel {
00039 
00040     /**
00041      * Local instance of tslib_cObj.
00042      *
00043      * @var tslib_cObj
00044      */
00045     protected $cObj;
00046 
00047     /**
00048      * Constructor for the edit panel. Creates a new cObject instance to be used in wrapping, etc.
00049      *
00050      * @return  void
00051      */
00052     public function __construct() {
00053         $this->cObj = t3lib_div::makeInstance('tslib_cObj');
00054         $this->cObj->start(array());
00055     }
00056 
00057     /**
00058      * 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.
00059      * With the "edit panel" the user will see buttons with links to editing, moving, hiding, deleting the element
00060      * This function is used for the cObject EDITPANEL and the stdWrap property ".editPanel"
00061      *
00062      * @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.
00063      * @param   array       TypoScript configuration properties for the editPanel
00064      * @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"
00065      * @param   array       Alternative data array to use. Default is $this->data
00066      * @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.
00067      */
00068     public function editPanel($content, array $conf, $currentRecord='', array $dataArr=array(), $table='', $allow='', $newUID=0, array $hiddenFields=array()) {
00069             // Special content is about to be shown, so the cache must be disabled.
00070         $GLOBALS['TSFE']->set_no_cache();
00071         $formName = 'TSFE_EDIT_FORM_' . substr($GLOBALS['TSFE']->uniqueHash(), 0, 4);
00072         $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;">';
00073         $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
00074         $labelField = $GLOBALS['TCA'][$table]['ctrl']['label'];
00075         $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
00076         $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 />' : '';
00077 
00078         $theCmd='';
00079         $TSFE_EDIT = $GLOBALS['BE_USER']->frontendEdit->TSFE_EDIT;
00080         if (is_array($TSFE_EDIT) && $TSFE_EDIT['record'] == $currentRecord && !$TSFE_EDIT['update_close']) {
00081             $theCmd =$TSFE_EDIT['cmd'];
00082         }
00083 
00084         switch($theCmd) {
00085             case 'edit':
00086             case 'new':
00087                 $finalOut = $this->editContent($formTag, $formName, $theCmd, $newUID, $dataArr, $table, $currentRecord, $blackLine);
00088             break;
00089             default:
00090                 $panel = '';
00091                 if (isset($allow['toolbar']) && ($GLOBALS['BE_USER']->adminPanel instanceof tslib_AdminPanel)) {
00092                     $panel .= $GLOBALS['BE_USER']->adminPanel->ext_makeToolBar() . '<img src="clear.gif" width="2" height="1" alt="" title="" />';
00093                 }
00094                 if (isset($allow['edit'])) {
00095                     $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);
00096                 }
00097                     // Hiding in workspaces because implementation is incomplete
00098                 if (isset($allow['move']) && $sortField && $GLOBALS['BE_USER']->workspace === 0) {
00099                     $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');
00100                     $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');
00101                 }
00102                     // Hiding in workspaces because implementation is incomplete, Hiding for localizations because it is unknown what should be the function in that case
00103                 if (isset($allow['hide']) && $hideField && $GLOBALS['BE_USER']->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
00104                     if ($dataArr[$hideField]) {
00105                         $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');
00106                     } else {
00107                         $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'));
00108                     }
00109                 }
00110                 if (isset($allow['new'])) {
00111                     if ($table == 'pages') {
00112                         $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, '');
00113                     } else {
00114                         $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);
00115                     }
00116                 }
00117                     // Hiding in workspaces because implementation is incomplete, Hiding for localizations because it is unknown what should be the function in that case
00118                 if (isset($allow['delete']) && $GLOBALS['BE_USER']->workspace === 0 && !$dataArr['_LOCALIZED_UID']) {
00119                     $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'));
00120                 }
00121                     //  Final
00122                 $labelTxt = $this->cObj->stdWrap($conf['label'],$conf['label.']);
00123 
00124                 foreach((array) $hiddenFields as $name => $value) {
00125                     $hiddenFieldString .= '<input type="hidden" name="TSFE_EDIT[' . $name . ']" value="' . $value . '"/>' . LF;
00126                 }
00127 
00128                 $panel='
00129 
00130                             <!-- BE_USER Edit Panel: -->
00131                             ' . $formTag .
00132                             $hiddenFieldString . '
00133                                 <input type="hidden" name="TSFE_EDIT[cmd]" value="" />
00134                                 <input type="hidden" name="TSFE_EDIT[record]" value="' . $currentRecord . '" />
00135                                 <table border="0" cellpadding="0" cellspacing="0" class="typo3-editPanel" summary="">
00136                                     <tr>
00137                                         <td nowrap="nowrap" bgcolor="#ABBBB4" class="typo3-editPanel-controls">' . $panel . '</td>' .
00138                                         ($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>' : '') . '
00139                                     </tr>
00140                                 </table>
00141                             </form>';
00142                     // wrap the panel
00143                 if ($conf['innerWrap']) {
00144                     $panel = $this->cObj->wrap($panel, $conf['innerWrap']);
00145                 }
00146                 if ($conf['innerWrap.']) {
00147                     $panel = $this->cObj->stdWrap($panel, $conf['innerWrap.']);
00148                 }
00149 
00150                     // add black line:
00151                 $panel .= $blackLine;
00152 
00153                     // wrap the complete panel
00154                 if ($conf['outerWrap']) {
00155                     $panel = $this->cObj->wrap($panel, $conf['outerWrap']);
00156                 }
00157                 if ($conf['outerWrap.']) {
00158                     $panel = $this->cObj->stdWrap($panel, $conf['outerWrap.']);
00159                 }
00160                 if ($conf['printBeforeContent']) {
00161                     $finalOut = $panel . $content;
00162                 } else {
00163                     $finalOut = $content . $panel;
00164                 }
00165             break;
00166         }
00167 
00168         if ($conf['previewBorder']) {
00169             if (!is_array($conf['previewBorder.'])) {
00170                 $conf['previewBorder.'] = array();
00171             }
00172             $finalOut = $this->editPanelPreviewBorder($table, $dataArr, $finalOut, $conf['previewBorder'], $conf['previewBorder.']);
00173         }
00174 
00175         return $finalOut;
00176     }
00177 
00178     /**
00179      * 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.
00180      * This implements TYPO3 context sensitive editing facilities. Only backend users will have access (if properly configured as well).
00181      *
00182      * @param   string      The content to which the edit icons should be appended
00183      * @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
00184      * @param   array       TypoScript properties for configuring the edit icons.
00185      * @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"
00186      * @param   array       Alternative data array to use. Default is $this->data
00187      * @param   string      Additional URL parameters for the link pointing to alt_doc.php
00188      * @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.
00189      */
00190     public function editIcons($content, $params, array $conf=array(), $currentRecord='', array $dataArr=array(), $addUrlParamStr='', $table, $editUid, $fieldList) {
00191             // Special content is about to be shown, so the cache must be disabled.
00192         $GLOBALS['TSFE']->set_no_cache();
00193         $style = $conf['styleAttribute'] ? ' style="' . htmlspecialchars($conf['styleAttribute']) . '"' : '';
00194         $iconTitle = $this->cObj->stdWrap($conf['iconTitle'], $conf['iconTitle.']);
00195         $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="" />';
00196         $nV=t3lib_div::_GP('ADMCMD_view') ? 1 : 0;
00197         $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir;
00198         $icon = $this->editPanelLinkWrap_doWrap($iconImg, $adminURL . 'alt_doc.php?edit[' . $table . '][' . $editUid . ']=edit&columnsOnly=' . rawurlencode($fieldList) . '&noView=' . $nV . $addUrlParamStr, $currentRecord);
00199 
00200         if ($conf['beforeLastTag'] < 0) {
00201             $content = $icon . $content;
00202         } elseif ($conf['beforeLastTag'] > 0) {
00203             $cBuf = rtrim($content);
00204             $securCount = 30;
00205             while($securCount && substr($cBuf, -1) == '>' && substr($cBuf, -4) != '</a>') {
00206                 $cBuf = rtrim(preg_replace('/<[^<]*>$/', '', $cBuf));
00207                 $securCount--;
00208             }
00209             $content = (strlen($cBuf) && $securCount) ? substr($content, 0, strlen($cBuf)) . $icon . substr($content, strlen($cBuf)) : $content = $icon . $content;
00210         } else {
00211             $content .= $icon;
00212         }
00213 
00214         return $content;
00215     }
00216 
00217     /**
00218      * Helper function for editPanel() which wraps icons in the panel in a link with the action of the panel.
00219      * The links are for some of them not simple hyperlinks but onclick-actions which submits a little form which the panel is wrapped in.
00220      *
00221      * @param   string      The string to wrap in a link, typ. and image used as button in the edit panel.
00222      * @param   string      The name of the form wrapping the edit panel.
00223      * @param   string      The command of the link. There is a predefined list available: edit, new, up, down etc.
00224      * @param   string      The "table:uid" of the record being processed by the panel.
00225      * @param   string      Text string with confirmation message; If set a confirm box will be displayed before carrying out the action (if Yes is pressed)
00226      * @param   integer     "New pid" - for new records
00227      * @return  string      A <a> tag wrapped string.
00228      * @see editPanel(), editIcons(), t3lib_tsfeBeUserAuth::extEditAction()
00229      */
00230     protected function editPanelLinkWrap($string, $formName, $cmd, $currentRecord='', $confirm='', $nPid='')    {
00231             // Editing forms on page only supported in Live workspace (because of incomplete implementation)
00232         $editFormsOnPage = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editFormsOnPage'] && $GLOBALS['BE_USER']->workspace === 0;
00233         $nV=t3lib_div::_GP('ADMCMD_view') ? 1 : 0;
00234         $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir;
00235 
00236         if ($cmd == 'edit' && !$editFormsOnPage) {
00237             $rParts = explode(':', $currentRecord);
00238             $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'alt_doc.php?edit[' . $rParts[0] . '][' . $rParts[1] . ']=edit&noView=' . $nV, $currentRecord);
00239         } elseif ($cmd == 'new' && !$editFormsOnPage) {
00240             $rParts = explode(':', $currentRecord);
00241             if ($rParts[0] == 'pages') {
00242                 $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'db_new.php?id=' . $rParts[1] . '&pagesOnly=1', $currentRecord);
00243             } else {
00244                 if (!intval($nPid)) {
00245                     $nPid = t3lib_div::testInt($rParts[1]) ? -$rParts[1] : $GLOBALS['TSFE']->id;
00246                 }
00247                 $out = $this->editPanelLinkWrap_doWrap($string, $adminURL . 'alt_doc.php?edit[' . $rParts[0] . '][' . $nPid . ']=new&noView=' . $nV, $currentRecord);
00248             }
00249         } else {
00250             if ($confirm && $GLOBALS['BE_USER']->jsConfirmation(8)) {
00251                     // Gets htmlspecialchared later
00252                 $cf1 = 'if (confirm(' . t3lib_div::quoteJSvalue($confirm, true) . ')) {';
00253                 $cf2 = '}';
00254             } else {
00255                 $cf1 = $cf2 = '';
00256             }
00257             $out = '<a href="#" onclick="' .
00258                 htmlspecialchars($cf1 . 'document.' . $formName . '[\'TSFE_EDIT[cmd]\'].value=\'' . $cmd . '\'; document.' . $formName . '.submit();' . $cf2 . ' return false;') .
00259                 '">' . $string . '</a>';
00260         }
00261 
00262         return $out;
00263     }
00264 
00265     /**
00266      * 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.
00267      *
00268      * @param   string      The string to wrap in a link, typ. and image used as button in the edit panel.
00269      * @param   string      The URL of the link. Should be absolute if supposed to work with <base> path set.
00270      * @param   string      The "table:uid" of the record being processed by the panel.
00271      * @return  string      A <a> tag wrapped string.
00272      * @see editPanelLinkWrap()
00273      */
00274     protected function editPanelLinkWrap_doWrap($string, $url, $currentRecord)  {
00275         if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editNoPopup'] || $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceNoPopup']) {
00276             $retUrl = t3lib_div::getIndpEnv('REQUEST_URI');
00277             $rParts = explode(':', $currentRecord);
00278                 // This parentRecordNumber is used to make sure that only elements 3- of ordinary content elements makes a 'anchor' jump down the page.
00279             if ($rParts[0] == 'tt_content' && $this->parentRecordNumber > 2) {
00280                 $retUrl .= '#' . $rParts[1];
00281             }
00282             return '<a href="' . htmlspecialchars($url . '&returnUrl=' . rawurlencode($retUrl)) . '" class="frontEndEditIconLinks">' . $string . '</a>';
00283         } else {
00284             return '<a href="#" onclick="' .
00285                 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;') .
00286                 '" class="frontEndEditIconLinks">' . $string . '</a>';
00287         }
00288     }
00289 
00290     /**
00291      * Wraps the input content string in a table with a gray border if the table/row combination evaluates to being disabled/hidden.
00292      * Used for marking previewed records in the frontend.
00293      *
00294      * @param   string      The table name
00295      * @param   array       The data record from $table
00296      * @param   string      The content string to wrap
00297      * @param   integer     The thickness of the border
00298      * @param   array       The array with TypoScript properties for the content object
00299      * @return  string      The input string wrapped in a table with a border color of #cccccc and thickness = $thick
00300      * @see editPanel()
00301      */
00302     protected function editPanelPreviewBorder($table, array $row, $content, $thick, array $conf = array()) {
00303         if ($this->isDisabled($table, $row)) {
00304             $thick = t3lib_div::intInRange($thick, 1, 100);
00305             $color = $conf['color'] ? $conf['color'] : '#cccccc';
00306             if ($conf['innerWrap']) {
00307                 $content = $this->wrap($content,$conf['innerWrap']);
00308             }
00309             if ($conf['innerWrap.']) {
00310                 $content = $this->stdWrap($content,$conf['innerWrap.']);
00311             }
00312             $content = '<table class="typo3-editPanel-previewBorder" border="' . $thick . '" cellpadding="0" cellspacing="0" bordercolor="' . $color . '" width="100%" summary=""><tr><td>' . $content . '</td></tr></table>';
00313             if ($conf['outerWrap']) {
00314                 $content = $this->wrap($content,$conf['outerWrap']);
00315             }
00316             if ($conf['outerWrap.']) {
00317                 $content = $this->stdWrap($panel,$conf['outerWrap.']);
00318             }
00319         }
00320 
00321         return $content;
00322     }
00323 
00324     /**
00325      * Returns true if the input table/row would be hidden in the frontend (according nto the current time and simulate user group)
00326      *
00327      * @param   string      The table name
00328      * @param   array       The data record
00329      * @return  boolean
00330      * @see editPanelPreviewBorder()
00331      */
00332     protected function isDisabled($table, $row) {
00333         if (($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']]) ||
00334             ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group'] && $GLOBALS['TSFE']->simUserGroup && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group']] == $GLOBALS['TSFE']->simUserGroup) ||
00335             ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime'] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime']] > $GLOBALS['EXEC_TIME']) ||
00336             ($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime'] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']] && $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']] < $GLOBALS['EXEC_TIME'])) {
00337             return true;
00338         }
00339     }
00340 
00341     /**
00342      * Returns the editing form for a content element.
00343      *
00344      * @param   string      Form tag
00345      * @param   string      Form name
00346      * @param   string      the command
00347      * @param   integer     newUID
00348      * @param   array       dataArray for element
00349      * @param   string      Table name of element
00350      * @param   string      Current record
00351      * @param   string      Blackline
00352      * @return  string
00353      */
00354     protected function editContent($formTag, $formName, $theCmd, $newUID, array $dataArray, $table, $currentRecord, $blackLine) {
00355         $tceforms = t3lib_div::makeInstance('t3lib_TCEforms_FE');
00356         $tceforms->prependFormFieldNames = 'TSFE_EDIT[data]';
00357         $tceforms->prependFormFieldNames_file = 'TSFE_EDIT_file';
00358         $tceforms->doSaveFieldName = 'TSFE_EDIT[doSave]';
00359         $tceforms->formName = $formName;
00360         $tceforms->backPath = TYPO3_mainDir;
00361         $tceforms->setFancyDesign();
00362         $tceforms->defStyle = 'font-family:Verdana;font-size:10px;';
00363         $tceforms->edit_showFieldHelp = $GLOBALS['BE_USER']->uc['edit_showFieldHelp'];
00364 
00365             // Icon only mode for CSH destroys the layout for frontend editing so force full text mode instead.
00366             // @todo    Make sure the necessary Javascript and CSS are included so that CSH can work properly in all modes.
00367         if($tceforms->edit_showFieldHelp == 'icon') {
00368             $tceforms->edit_showFieldHelp = 'text';
00369         }
00370 
00371         $tceforms->helpTextFontTag = '<font face="verdana,sans-serif" color="#333333" size="1">';
00372 
00373         $trData = t3lib_div::makeInstance('t3lib_transferData');
00374         $trData->addRawData = true;
00375         $trData->lockRecords = 1;
00376             // Added without testing - should provide ability to submit default values in frontend editing, in-page.
00377         $trData->defVals = t3lib_div::_GP('defVals');
00378         $trData->fetchRecord($table, ($theCmd == 'new' ? $newUID : $dataArray['uid']), ($theCmd == 'new' ? 'new' : '') );
00379         reset($trData->regTableItems_data);
00380         $processedDataArr = current($trData->regTableItems_data);
00381         $processedDataArr['uid'] = $theCmd == 'new' ? 'NEW' : $dataArray['uid'];
00382         $processedDataArr['pid'] = $theCmd == 'new' ? $newUID : $dataArray['pid'];
00383 
00384         $panel = '';
00385         $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) . '" />';
00386         $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) . '" />';
00387         $buttons .= '<input type="image" border="0" name="TSFE_EDIT[cancel]" onclick="' .
00388             htmlspecialchars('window.location.href=\'' . t3lib_div::getIndpEnv('REQUEST_URI') . '\';return false;') .
00389             '" 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) . '" />';
00390             // Buttons top
00391         $panel .= $tceforms->intoTemplate(array('ITEM' => $buttons));
00392         $panel .= $tceforms->getMainFields($table, $processedDataArr);
00393 
00394         $hiddenF = "";
00395         if ($theCmd == 'new') {
00396             $hiddenF .= '<input type="hidden" name="TSFE_EDIT[data][' . $table . '][NEW][pid]" value="' . $newUID . '" />';
00397             if ($table == 'pages') {
00398                     // If a new page is created in front-end, then show it by default!
00399                 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[data][' . $table . '][NEW][hidden]" value="0" />';
00400             } else {
00401                 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[record]" value="' . $currentRecord . '" />';
00402                 $hiddenF .= '<input type="hidden" name="TSFE_EDIT[cmd]" value="edit" />';
00403             }
00404         }
00405         $hiddenF .= '<input type="hidden" name="TSFE_EDIT[doSave]" value="0" />';
00406             // Buttons AND hidden fields bottom.
00407         $panel .= $tceforms->intoTemplate(array('ITEM' => $buttons . $hiddenF));
00408 
00409         $panel = $formTag . $tceforms->wrapTotal($panel, $dataArray, $table) . '</form>' . ($theCmd != 'new' ? $blackLine : '');
00410 
00411         $finalOut = $tceforms->printNeededJSFunctions_top() . ($conf['edit.']['displayRecord'] ? $content : '') . $panel . ($theCmd=='new' ? $blackLine : '') . $tceforms->printNeededJSFunctions();
00412 
00413         $GLOBALS['SOBE']->doc->insertHeaderData();
00414 
00415         return $finalOut;
00416     }
00417 
00418 }
00419 
00420 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/feedit/view/class.tx_feedit_editpanel.php'])) {
00421     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/feedit/view/class.tx_feedit_editpanel.php']);
00422 }
00423 
00424 ?>