class.t3lib_frontendedit.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2008-2010 Jeff Segars <jeff@webempoweredchurch.org>
00006 *  (c) 2008-2010 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  * Controller class for frontend editing.
00030  *
00031  * $Id: class.t3lib_frontendedit.php 7905 2010-06-13 14:42:33Z ohader $
00032  *
00033  * @author  Jeff Segars <jeff@webempoweredchurch.org>
00034  * @author  David Slayback <dave@webempoweredchurch.org>
00035  * @package TYPO3
00036  * @subpackage t3lib
00037  */
00038 class t3lib_frontendedit {
00039     /**
00040      * GET/POST parameters for the FE editing.
00041      * Accessed as $GLOBALS['BE_USER']->frontendEdit->TSFE_EDIT, thus public
00042      *
00043      * @var array
00044      */
00045     public $TSFE_EDIT;
00046 
00047     /**
00048      * TCEmain object.
00049      *
00050      * @var t3lib_tcemain
00051      */
00052     protected $tce;
00053 
00054     /**
00055      * Initializes configuration options.
00056      *
00057      * @return  void
00058      */
00059     public function initConfigOptions() {
00060         $this->TSFE_EDIT = t3lib_div::_GP('TSFE_EDIT');
00061 
00062             // Include classes for editing IF editing module in Admin Panel is open
00063         if ($GLOBALS['BE_USER']->isFrontendEditingActive()) {
00064             $GLOBALS['TSFE']->includeTCA();
00065             if ($this->isEditAction()) {
00066                 $this->editAction();
00067             }
00068         }
00069     }
00070 
00071     /**
00072      * 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.
00073      * With the "edit panel" the user will see buttons with links to editing, moving, hiding, deleting the element
00074      * This function is used for the cObject EDITPANEL and the stdWrap property ".editPanel"
00075      *
00076      * @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.
00077      * @param   array       TypoScript configuration properties for the editPanel
00078      * @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"
00079      * @param   array       Alternative data array to use. Default is $this->data
00080      * @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.
00081      * @link    http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=375&cHash=7d8915d508
00082      */
00083     public function displayEditPanel($content, array $conf, $currentRecord, array $dataArray) {
00084         if ($conf['newRecordFromTable']) {
00085             $currentRecord = $conf['newRecordFromTable'] . ':NEW';
00086             $conf['allow'] = 'new';
00087         }
00088 
00089         list($table, $uid) = explode(':', $currentRecord);
00090 
00091             // Page ID for new records, 0 if not specified
00092         $newRecordPid = intval($conf['newRecordInPid']);
00093         if (!$conf['onlyCurrentPid'] || $dataArray['pid'] == $GLOBALS['TSFE']->id) {
00094             if ($table=='pages') {
00095                 $newUid = $uid;
00096             } else {
00097                 if ($conf['newRecordFromTable']) {
00098                     $newUid = $GLOBALS['TSFE']->id;
00099                     if ($newRecordPid) {
00100                          $newUid = $newRecordPid;
00101                     }
00102                 } else {
00103                     $newUid = -1 * $uid;
00104                 }
00105             }
00106         }
00107 
00108         if ($GLOBALS['TSFE']->displayEditIcons && $table && $this->allowedToEdit($table, $dataArray, $conf) && $this->allowedToEditLanguage($table, $dataArray)) {
00109             $editClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['edit'];
00110             if ($editClass) {
00111                 $edit = t3lib_div::getUserObj($editClass, false);
00112                 if (is_object($edit)) {
00113                     $allowedActions = $this->getAllowedEditActions($table, $conf, $dataArray['pid']);
00114                     $content = $edit->editPanel($content, $conf, $currentRecord, $dataArray, $table, $allowedActions, $newUid, $this->getHiddenFields($dataArray));
00115                 }
00116             }
00117         }
00118 
00119         return $content;
00120     }
00121 
00122     /**
00123      * 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.
00124      * This implements TYPO3 context sensitive editing facilities. Only backend users will have access (if properly configured as well).
00125      *
00126      * @param   string      The content to which the edit icons should be appended
00127      * @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
00128      * @param   array       TypoScript properties for configuring the edit icons.
00129      * @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"
00130      * @param   array       Alternative data array to use. Default is $this->data
00131      * @param   string      Additional URL parameters for the link pointing to alt_doc.php
00132      * @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.
00133      */
00134 
00135     public function displayEditIcons($content, $params, array $conf=array(), $currentRecord = '', array $dataArray = array(), $addUrlParamStr = '') {
00136             // Check incoming params:
00137         list($currentRecordTable, $currentRecordUID) = explode(':', $currentRecord);
00138         list($fieldList, $table) = array_reverse(t3lib_div::trimExplode(':', $params, 1)); // Reverse the array because table is optional
00139         if (!$table) {
00140             $table = $currentRecordTable;
00141         } elseif ($table != $currentRecordTable) {
00142                 return $content;    // If the table is set as the first parameter, and does not match the table of the current record, then just return.
00143         }
00144 
00145         $editUid = $dataArray['_LOCALIZED_UID'] ? $dataArray['_LOCALIZED_UID'] : $currentRecordUID;
00146 
00147             // Edit icons imply that the editing action is generally allowed, assuming page and content element permissions permit it.
00148         if (!array_key_exists('allow', $conf)) {
00149             $conf['allow'] = 'edit';
00150         }
00151 
00152         if ($GLOBALS['TSFE']->displayFieldEditIcons && $table && $this->allowedToEdit($table, $dataArray, $conf) && $fieldList && $this->allowedToEditLanguage($table, $dataArray)) {
00153             $editClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/classes/class.frontendedit.php']['edit'];
00154             if ($editClass) {
00155                 $edit = t3lib_div::getUserObj($editClass);
00156                 if (is_object($edit)) {
00157                     $content = $edit->editIcons($content, $params, $conf, $currentRecord, $dataArray, $addURLParamStr, $table, $editUid, $fieldList);
00158                 }
00159             }
00160         }
00161 
00162         return $content;
00163     }
00164 
00165     /*****************************************************
00166      *
00167      * Frontend Editing
00168      *
00169      ****************************************************/
00170 
00171     /**
00172      * Returns true if an edit-action is sent from the Admin Panel
00173      *
00174      * @return  boolean
00175      * @see index_ts.php
00176      */
00177     public function isEditAction() {
00178         if (is_array($this->TSFE_EDIT)) {
00179             if ($this->TSFE_EDIT['cancel']) {
00180                 unset($this->TSFE_EDIT['cmd']);
00181             } else {
00182                 $cmd = (string) $this->TSFE_EDIT['cmd'];
00183                 if (($cmd != 'edit' || (is_array($this->TSFE_EDIT['data']) && ($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']))) && $cmd != 'new') {
00184                         // $cmd can be a command like "hide" or "move". If $cmd is "edit" or "new" it's an indication to show the formfields. But if data is sent with update-flag then $cmd = edit is accepted because edit may be sent because of .keepGoing flag.
00185                     return true;
00186                 }
00187             }
00188         }
00189         return false;
00190     }
00191 
00192     /**
00193      * Returns true if an edit form is shown on the page.
00194      * Used from index_ts.php where a true return-value will result in classes etc. being included.
00195      *
00196      * @return  boolean
00197      * @see index_ts.php
00198      */
00199     public function isEditFormShown() {
00200         if (is_array($this->TSFE_EDIT)) {
00201             $cmd = (string) $this->TSFE_EDIT['cmd'];
00202             if ($cmd == 'edit' || $cmd == 'new') {
00203                 return true;
00204             }
00205         }
00206     }
00207 
00208     /**
00209      * Management of the on-page frontend editing forms and edit panels.
00210      * Basically taking in the data and commands and passes them on to the proper classes as they should be.
00211      *
00212      * @return  void
00213      * @throws UnexpectedValueException if TSFE_EDIT[cmd] is not a valid command
00214      * @see index_ts.php
00215      */
00216     public function editAction() {
00217             // Commands:
00218         list($table, $uid) = explode(':', $this->TSFE_EDIT['record']);
00219         $uid = intval($uid);
00220         $cmd = $this->TSFE_EDIT['cmd'];
00221 
00222             // Look for some TSFE_EDIT data that indicates we should save.
00223         if (($this->TSFE_EDIT['doSave'] || $this->TSFE_EDIT['update'] || $this->TSFE_EDIT['update_close']) && is_array($this->TSFE_EDIT['data'])) {
00224             $cmd = 'save';
00225         }
00226 
00227         if (($cmd == 'save') || ($cmd && $table && $uid && isset($GLOBALS['TCA'][$table]))) {
00228                 // Hook for defining custom editing actions. Naming is incorrect, but preserves compatibility.
00229             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'])) {
00230                 $_params = array();
00231                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['extEditAction'] as $_funcRef) {
00232                     t3lib_div::callUserFunction($_funcRef, $_params, $this);
00233                 }
00234             }
00235 
00236                 // Perform the requested editing command.
00237             $cmdAction = 'do' . ucwords($cmd);
00238             if (is_callable(array($this, $cmdAction))) {
00239                 $this->$cmdAction($table, $uid);
00240             } else {
00241                 throw new UnexpectedValueException(
00242                     'The specified frontend edit command (' . $cmd . ') is not valid.',
00243                     1225818120
00244                 );
00245             }
00246         }
00247     }
00248 
00249     /**
00250      * Hides a specific record.
00251      *
00252      * @param   string      The table name for the record to hide.
00253      * @param   integer     The UID for the record to hide.
00254      * @return  void
00255      */
00256     public function doHide($table, $uid) {
00257         $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
00258         if ($hideField) {
00259             $recData = array();
00260             $recData[$table][$uid][$hideField] = 1;
00261 
00262             $this->initializeTceMain();
00263             $this->tce->start($recData, array());
00264             $this->tce->process_datamap();
00265         }
00266     }
00267 
00268     /**
00269      * Unhides (shows) a specific record.
00270      *
00271      * @param   string      The table name for the record to unhide.
00272      * @param   integer     The UID for the record to unhide.
00273      * @return  void
00274      */
00275     public function doUnhide($table, $uid) {
00276         $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
00277         if ($hideField) {
00278             $recData = array();
00279             $recData[$table][$uid][$hideField] = 0;
00280 
00281             $this->initializeTceMain();
00282             $this->tce->start($recData, array());
00283             $this->tce->process_datamap();
00284         }
00285     }
00286 
00287     /**
00288      * Moves a record up.
00289      *
00290      * @param   string      The table name for the record to move.
00291      * @param   integer     The UID for the record to hide.
00292      * @return  void
00293      */
00294     public function doUp($table, $uid) {
00295         $this->move($table, $uid, 'up');
00296     }
00297 
00298     /**
00299      * Moves a record down.
00300      *
00301      * @param   string      The table name for the record to move.
00302      * @param   integer     The UID for the record to move.
00303      * @return  void
00304      */
00305     public function doDown($table, $uid) {
00306         $this->move($table, $uid, 'down');
00307     }
00308 
00309     /**
00310      * Moves a record after a given element. Used for drag.
00311      *
00312      * @param   string      The table name for the record to move.
00313      * @param   integer     The UID for the record to move.
00314      * @return  void
00315      */
00316     public function doMoveAfter($table, $uid) {
00317         $afterUID = $GLOBALS['BE_USER']->frontendEdit->TSFE_EDIT['moveAfter'];
00318         $this->move($table, $uid, '', $afterUID);
00319     }
00320 
00321     /**
00322      * Moves a record
00323      *
00324      * @param   string      The table name for the record to move.
00325      * @param   integer     The UID for the record to move.
00326      * @param   string      The direction to move, either 'up' or 'down'.
00327      * @param   integer     The UID of record to move after. This is specified for dragging only.
00328      * @return  void
00329      */
00330     protected function move($table, $uid, $direction='', $afterUID=0) {
00331         $cmdData = array();
00332         $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby'];
00333         if ($sortField) {
00334                 // Get self:
00335             $fields = array_unique(t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields'] . ',uid,pid,' . $sortField, true));
00336             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',', $fields), $table, 'uid=' . $uid);
00337             if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00338                     // record before or after
00339                 if (($GLOBALS['BE_USER']->adminPanel instanceOf tslib_AdminPanel) && ($GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview'))) {
00340                     $ignore = array('starttime'=>1, 'endtime'=>1, 'disabled'=>1, 'fe_group'=>1);
00341                 }
00342                 $copyAfterFieldsQuery = '';
00343                 if ($GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields']) {
00344                     $cAFields = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['copyAfterDuplFields'], true);
00345                     foreach($cAFields as $fieldName) {
00346                         $copyAfterFieldsQuery .= ' AND ' . $fieldName . '="' . $row[$fieldName] . '"';
00347                     }
00348                 }
00349                 if (!empty($direction)) {
00350                     if ($direction == 'up') {
00351                         $operator = '<';
00352                         $order = 'DESC';
00353                     } else {
00354                         $operator = '>';
00355                         $order = 'ASC';
00356                     }
00357                     $sortCheck = ' AND ' . $sortField . $operator . intval($row[$sortField]);
00358                 }
00359                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00360                             'uid,pid',
00361                             $table,
00362                             'pid=' . intval($row['pid']) .
00363                                 $sortCheck .
00364                                 $copyAfterFieldsQuery .
00365                                 $GLOBALS['TSFE']->sys_page->enableFields($table, '', $ignore),
00366                             '',
00367                             $sortField . ' ' . $order,
00368                             '2'
00369                         );
00370                 if ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00371                     if ($afterUID) {
00372                         $cmdData[$table][$uid]['move'] = -$afterUID;
00373                     }
00374                     elseif ($direction == 'down') {
00375                         $cmdData[$table][$uid]['move'] = -$row2['uid'];
00376                     }
00377                     elseif ($row3 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {  // Must take the second record above...
00378                         $cmdData[$table][$uid]['move'] = -$row3['uid'];
00379                     }
00380                     else {  // ... and if that does not exist, use pid
00381                         $cmdData[$table][$uid]['move'] = $row['pid'];
00382                     }
00383                 } elseif ($direction == 'up') {
00384                     $cmdData[$table][$uid]['move'] = $row['pid'];
00385                 }
00386             }
00387             if (!empty($cmdData)) {
00388                 $this->initializeTceMain();
00389                 $this->tce->start(array(), $cmdData);
00390                 $this->tce->process_cmdmap();
00391             }
00392         }
00393     }
00394 
00395     /**
00396      * Deletes a specific record.
00397      *
00398      * @param   string      The table name for the record to delete.
00399      * @param   integer     The UID for the record to delete.
00400      * @return  void
00401      */
00402     public function doDelete($table, $uid) {
00403         $cmdData[$table][$uid]['delete'] = 1;
00404         if (count($cmdData)) {
00405             $this->initializeTceMain();
00406             $this->tce->start(array(), $cmdData);
00407             $this->tce->process_cmdmap();
00408         }
00409     }
00410 
00411     /**
00412      * Saves a record based on its data array.
00413      *
00414      * @param   string      The table name for the record to save.
00415      * @param   integer     The UID for the record to save.
00416      * @return  void
00417      */
00418     public function doSave($table, $uid) {
00419         $data = $this->TSFE_EDIT['data'];
00420 
00421         if (!empty($data)) {
00422             $this->initializeTceMain();
00423             $this->tce->start($data, array());
00424             $this->tce->process_uploads($_FILES);
00425             $this->tce->process_datamap();
00426 
00427                 // Save the new UID back into TSFE_EDIT
00428             $newUID = $this->tce->substNEWwithIDs['NEW'];
00429             if ($newUID) {
00430                 $GLOBALS['BE_USER']->frontendEdit->TSFE_EDIT['newUID'] = $newUID;
00431             }
00432         }
00433     }
00434 
00435     /**
00436      * Saves a record based on its data array and closes it.
00437      *
00438      * @param   string      The table name for the record to save.
00439      * @param   integer     The UID for the record to save.
00440      * @return  void
00441      * @note    This method is only a wrapper for doSave() but is needed so
00442      *          that frontend editing views can handle "save" differently from
00443      *          "save and close".
00444      *          Example: When editing a page record, "save" reloads the same
00445      *          editing form.  "Save and close" reloads the entire page at
00446      *          the appropriate URL.
00447      */
00448     public function doSaveAndClose($table, $uid) {
00449         $this->doSave($table, $uid);
00450     }
00451 
00452 
00453     /**
00454      * Stub for closing a record. No real functionality needed since content
00455      * element rendering will take care of everything.
00456      *
00457      * @param   string      The table name for the record to close.
00458      * @param   integer     The UID for the record to close.
00459      * @return  void
00460      */
00461     public function doClose($table, $uid) {
00462         // Do nothing.
00463     }
00464 
00465     /**
00466      * Checks whether the user has access to edit the language for the
00467      * requested record.
00468      *
00469      * @param   string      The name of the table.
00470      * @param   array       The record.
00471      * @return  boolean
00472      */
00473     protected function allowedToEditLanguage($table, array $currentRecord) {
00474             // If no access right to record languages, return immediately
00475         if ($table === 'pages') {
00476             $lang = $GLOBALS['TSFE']->sys_language_uid;
00477         } elseif ($table === 'tt_content') {
00478             $lang = $GLOBALS['TSFE']->sys_language_content;
00479         } elseif ($GLOBALS['TCA'][$table]['ctrl']['languageField']) {
00480             $lang = $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['languageField']];
00481         } else {
00482             $lang = -1;
00483         }
00484 
00485         if ($GLOBALS['BE_USER']->checkLanguageAccess($lang)) {
00486             $languageAccess = true;
00487         } else {
00488             $languageAccess = false;
00489         }
00490 
00491         return $languageAccess;
00492     }
00493 
00494     /**
00495      * Checks whether the user is allowed to edit the requested table.
00496      *
00497      * @param   string  The name of the table.
00498      * @param   array   The data array.
00499      * @param   array   The configuration array for the edit panel.
00500      * @return  boolean
00501      */
00502     protected function allowedToEdit($table, array $dataArray, array $conf) {
00503 
00504             // Unless permissions specifically allow it, editing is not allowed.
00505         $mayEdit = false;
00506 
00507         if ($table=='pages') {
00508                 // 2 = permission to edit the page
00509             if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess($dataArray, 2)) {
00510                 $mayEdit = true;
00511             }
00512         } else {
00513                 // 16 = permission to edit content on the page
00514             if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess(t3lib_BEfunc::getRecord('pages', $dataArray['pid']), 16)) {
00515                 $mayEdit = true;
00516             }
00517         }
00518 
00519         if (!$conf['onlyCurrentPid'] || ($dataArray['pid'] == $GLOBALS['TSFE']->id)) {
00520                 // Permissions:
00521             $types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']),1);
00522             $allow = array_flip($types);
00523 
00524             $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
00525             if ($table == 'pages') {
00526                 $allow = $this->getAllowedEditActions($table, $conf, $dataArray['pid'], $allow);
00527 
00528                     // Can only display editbox if there are options in the menu
00529                 if (count($allow)) {
00530                     $mayEdit = true;
00531                 }
00532             } else {
00533                 $mayEdit = count($allow) && ($perms & 16);
00534             }
00535         }
00536 
00537         return $mayEdit;
00538     }
00539 
00540     /**
00541      * Takes an array of generally allowed actions and filters that list based on page and content permissions.
00542      *
00543      * @param   string  The name of the table.
00544      * @param   array   The configuration array.
00545      * @param   integer The PID where editing will occur.
00546      * @param   string  Comma-separated list of actions that are allowed in general.
00547      * @return  array
00548      */
00549     protected function getAllowedEditActions($table, array $conf, $pid, $allow = '') {
00550 
00551         if (!$allow) {
00552             $types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']), true);
00553             $allow = array_flip($types);
00554         }
00555 
00556         if (!$conf['onlyCurrentPid'] || $pid == $GLOBALS['TSFE']->id) {
00557                 // Permissions:
00558             $types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']), true);
00559             $allow = array_flip($types);
00560 
00561             $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
00562             if ($table=='pages') {
00563                     // rootpage!
00564                 if (count($GLOBALS['TSFE']->config['rootLine']) == 1) {
00565                     unset($allow['move']);
00566                     unset($allow['hide']);
00567                     unset($allow['delete']);
00568                 }
00569                 if (!($perms & 2)){
00570                     unset($allow['edit']);
00571                     unset($allow['move']);
00572                     unset($allow['hide']);
00573                 }
00574                 if (!($perms & 4)) {
00575                     unset($allow['delete']);
00576                 }
00577                 if (!($perms&8)) {
00578                     unset($allow['new']);
00579                 }
00580             }
00581         }
00582 
00583         return $allow;
00584     }
00585 
00586     /**
00587      * Adds any extra Javascript includes needed for Front-end editing
00588      *
00589      * @param   none
00590      * @return  string
00591      */
00592     public function getJavascriptIncludes() {
00593             // No extra JS includes needed
00594         return '';
00595     }
00596 
00597     /**
00598      * Gets the hidden fields (array key=field name, value=field value) to be used in the edit panel for a particular content element.
00599      * In the normal case, no hidden fields are needed but special controllers such as TemplaVoila need to track flexform pointers, etc.
00600      *
00601      * @param   array   The data array for a specific content element.
00602      * @return  array
00603      */
00604     public function getHiddenFields(array $dataArray) {
00605             // No special hidden fields needed.
00606         return array();
00607     }
00608 
00609     /**
00610      * Initializes t3lib_TCEmain since it is used on modification actions.
00611      *
00612      * @return  void
00613      */
00614     protected function initializeTceMain() {
00615         if (!isset($this->tce)) {
00616             $this->tce = t3lib_div::makeInstance('t3lib_TCEmain');
00617             $this->tce->stripslashes_values=0;
00618         }
00619     }
00620 }
00621 
00622 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_frontendedit.php']) {
00623     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_frontendedit.php']);
00624 }
00625 
00626 ?>

Generated on Sat Jul 24 04:17:17 2010 for TYPO3 API by  doxygen 1.4.7