Commit 35d9b1ff authored by Benni Mack's avatar Benni Mack Committed by Anja Leichsenring
Browse files

[TASK] Make alt_doc.php dispatched

Resolves: #65292
Releases: master
Change-Id: Ib94e59bf5d9896186aa6923eab50a2236308bd6a
Reviewed-on: http://review.typo3.org/38113


Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent e26def8c
......@@ -22,6 +22,10 @@
require_once 'init.php';
\TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords();
\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
'The entry point to FormEngine was moved to an own module. Please use BackendUtility::getModuleUrl(\'record_edit\') to link to alt_doc.php. This script will be removed in TYPO3 CMS 8.'
);
/* @var $editDocumentController \TYPO3\CMS\Backend\Controller\EditDocumentController */
$editDocumentController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);
......
......@@ -6,7 +6,7 @@
<html>
<head>
<!-- Close script, used in particular by the alt_doc.php script to close the current edit window -->
<!-- Close script, used in particular by FormEngine to close the current edit window -->
<!-- TYPO3 Script ID: typo3/close.html -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
......@@ -20,4 +20,4 @@
</head>
<body>
</body>
</html>
\ No newline at end of file
</html>
......@@ -652,8 +652,10 @@ class ClickMenu {
* @internal
*/
public function DB_editAccess($table, $uid) {
$addParam = '&columnsOnly=' . rawurlencode((implode(',', $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']) . ($table === 'pages' ? ',extendToSubpages' : '')));
$url = 'alt_doc.php?edit[' . $table . '][' . $uid . ']=edit' . $addParam;
$url = BackendUtility::getModuleUrl('record_edit', array(
'columnsOnly' => rawurlencode((implode(',', $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']) . ($table === 'pages' ? ',extendToSubpages' : ''))),
'edit[' . $table . '][' . $uid . ']' => 'edit'
));
return $this->linkItem($this->languageService->makeEntities($this->languageService->getLL('CM_editAccess')), IconUtility::getSpriteIcon('actions-document-edit-access'), $this->urlRefForCM($url, 'returnUrl'), 1);
}
......@@ -665,7 +667,9 @@ class ClickMenu {
* @internal
*/
public function DB_editPageProperties($uid) {
$url = 'alt_doc.php?edit[pages][' . $uid . ']=edit';
$url = BackendUtility::getModuleUrl('record_edit', array(
'edit[pages][' . $uid . ']' => 'edit'
));
return $this->linkItem($this->languageService->makeEntities($this->languageService->getLL('CM_editPageProperties')), IconUtility::getSpriteIcon('actions-page-open'), $this->urlRefForCM($url, 'returnUrl'), 1);
}
......@@ -685,16 +689,21 @@ class ClickMenu {
$loc = 'top.content.list_frame';
$addParam = '';
$theIcon = 'actions-document-open';
$link = BackendUtility::getModuleUrl('record_edit', array(
'edit[' . $table . '][' . $uid . ']' => 'edit'
));
if ($this->iParts[0] === 'pages' && $this->iParts[1] && $this->backendUser->check('modules', $pageModule)) {
$this->editPageIconSet = TRUE;
if ($this->backendUser->uc['classicPageEditMode']) {
$addParam = '&editRegularContentFromId=' . (int)$this->iParts[1];
} else {
$editOnClick = 'if(' . $loc . '){' . $loc . '.location.href=top.TS.PATH_typo3+\'alt_doc.php?returnUrl=\'+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+\'&edit[' . $table . '][' . $uid . ']=edit' . $addParam . '\';}';
$editOnClick = 'if(' . $loc . '){' . $loc . '.location.href=top.TS.PATH_typo3+\'' . $link . '&returnUrl=\'+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+\'' . $addParam . '\';}';
}
}
if (!$editOnClick) {
$editOnClick = 'if(' . $loc . '){' . $loc . '.location.href=top.TS.PATH_typo3+\'alt_doc.php?returnUrl=\'+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+\'&edit[' . $table . '][' . $uid . ']=edit' . $addParam . '\';}';
$editOnClick = 'if(' . $loc . '){' . $loc . '.location.href=top.TS.PATH_typo3+\'' . $link . '&returnUrl=\'+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+\'' . $addParam . '\';}';
}
return $this->linkItem($this->label('edit'), IconUtility::getSpriteIcon($theIcon), $editOnClick . ';');
}
......@@ -711,8 +720,8 @@ class ClickMenu {
$frame = 'top.content.list_frame';
$location = $this->frameLocation($frame . '.document');
$module = $this->listFrame
? GeneralUtility::quoteJSvalue('alt_doc.php?edit[' . $table . '][-' . $uid . ']=new&returnUrl=') . '+top.rawurlencode(' . $location . '.pathname+' . $location . '.search)'
: GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('db_new', ['id' => (int)$uid]));
? GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('record_edit', array('edit[' . $table . '][-' . $uid . ']' => 'new')) . '&returnUrl=') . '+top.rawurlencode(' . $location . '.pathname+' . $location . '.search)'
: GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('db_new', array('id' => (int)$uid)));
$editOnClick = 'if(' . $frame . '){' . $frame . '.location.href=top.TS.PATH_typo3+' . $module . ';}';
$icon = IconUtility::getSpriteIcon('actions-' . ($table === 'pages' ? 'page' : 'document') . '-new');
return $this->linkItem($this->label('new'), $icon, $editOnClick);
......
......@@ -592,20 +592,19 @@ class Clipboard {
/**
* editUrl of all current elements
* ONLY database
* Links to alt_doc.php
* Links to FormEngine
*
* @return string The URL to alt_doc.php with parameters.
* @return string The URL to FormEngine with parameters.
*/
public function editUrl() {
$parameters = array();
// All records
$elements = $this->elFromTable('');
$editCMDArray = array();
foreach ($elements as $tP => $value) {
list($table, $uid) = explode('|', $tP);
$editCMDArray[] = '&edit[' . $table . '][' . $uid . ']=edit';
$parameters['edit[' . $table . '][' . $uid . ']'] = 'edit';
}
$rU = $this->backPath . 'alt_doc.php?' . implode('', $editCMDArray);
return $rU;
return BackendUtility::getModuleUrl('record_edit', $parameters);
}
/**
......
......@@ -305,6 +305,7 @@ class BackendController {
}
$this->pageRenderer->addInlineSetting('RecordHistory', 'moduleUrl', BackendUtility::getModuleUrl('record_history'));
$this->pageRenderer->addInlineSetting('NewRecord', 'moduleUrl', BackendUtility::getModuleUrl('db_new'));
$this->pageRenderer->addInlineSetting('FormEngine', 'moduleUrl', BackendUtility::getModuleUrl('record_edit'));
}
}
......
......@@ -232,7 +232,7 @@ class EditDocumentController {
/**
* Return URL script, processed. This contains the script (if any) that we should
* RETURN TO from the alt_doc.php script IF we press the close button. Thus this
* RETURN TO from the FormEngine script IF we press the close button. Thus this
* variable is normally passed along from the calling script so we can properly return if needed.
*
* @var string
......@@ -454,7 +454,7 @@ class EditDocumentController {
$this->dontStoreDocumentRef = 0;
$this->storeTitle = '';
// Get session data for the module:
$this->docDat = $GLOBALS['BE_USER']->getModuleData('alt_doc.php', 'ses');
$this->docDat = $GLOBALS['BE_USER']->getModuleData('FormEngine', 'ses');
$this->docHandler = $this->docDat[0];
// If a request for closing the document has been sent, act accordingly:
if ($this->closeDoc > 0) {
......@@ -739,7 +739,7 @@ class EditDocumentController {
// Checking if the currently open document is stored in the list of "open documents" - if not, then add it:
if (($this->docDat[1] !== $this->storeUrlMd5 || !isset($this->docHandler[$this->storeUrlMd5])) && !$this->dontStoreDocumentRef) {
$this->docHandler[$this->storeUrlMd5] = array($this->storeTitle, $this->storeArray, $this->storeUrl, $this->firstEl);
$GLOBALS['BE_USER']->pushModuleData('alt_doc.php', array($this->docHandler, $this->storeUrlMd5));
$GLOBALS['BE_USER']->pushModuleData('FormEngine', array($this->docHandler, $this->storeUrlMd5));
BackendUtility::setUpdateSignal('OpendocsController::updateNumber', count($this->docHandler));
}
// Module configuration
......@@ -1124,11 +1124,11 @@ class EditDocumentController {
*/
public function functionMenus() {
if ($GLOBALS['BE_USER']->getTSConfigVal('options.enableShowPalettes')) {
// Show palettes:
// Show palettes
return '<div class="checkbox">' .
'<label for="checkShowPalettes">' .
BackendUtility::getFuncCheck('', 'SET[showPalettes]', $this->MOD_SETTINGS['showPalettes'], 'alt_doc.php', (GeneralUtility::implodeArrayForUrl('', array_merge($this->R_URL_getvars, array('SET' => ''))) . BackendUtility::getUrlToken('editRecord')), 'id="checkShowPalettes"') .
BackendUtility::getFuncCheck('', 'SET[showPalettes]', $this->MOD_SETTINGS['showPalettes'], BackendUtility::getModuleUrl('record_edit'), (GeneralUtility::implodeArrayForUrl('', array_merge($this->R_URL_getvars, array('SET' => ''))) . BackendUtility::getUrlToken('editRecord')), 'id="checkShowPalettes"') .
$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPalettes', TRUE) .
'</label>'.
'</div>';
......@@ -1233,11 +1233,16 @@ class EditDocumentController {
$newTranslation = isset($rowsByLang[$lang['uid']]) ? '' : ' [' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.new', TRUE) . ']';
// Create url for creating a localized record
if ($newTranslation) {
$href = $this->doc->issueCommand('&cmd[' . $table . '][' . $rowsByLang[0]['uid'] . '][localize]=' . $lang['uid'], $this->backPath . 'alt_doc.php?justLocalized=' . rawurlencode(($table . ':' . $rowsByLang[0]['uid'] . ':' . $lang['uid'])) . '&returnUrl=' . rawurlencode($this->retUrl) . BackendUtility::getUrlToken('editRecord'));
$redirectUrl = BackendUtility::getModuleUrl('record_edit', array(
'justLocalized' => rawurlencode(($table . ':' . $rowsByLang[0]['uid'] . ':' . $lang['uid'])),
'returnUrl' => rawurlencode($this->retUrl) . BackendUtility::getUrlToken('editRecord')
));
$href = $this->doc->issueCommand('&cmd[' . $table . '][' . $rowsByLang[0]['uid'] . '][localize]=' . $lang['uid'], $redirectUrl);
} else {
$href = $this->backPath . 'alt_doc.php?';
$href .= '&edit[' . $table . '][' . $rowsByLang[$lang['uid']]['uid'] . ']=edit';
$href .= '&returnUrl=' . rawurlencode($this->retUrl) . BackendUtility::getUrlToken('editRecord');
$href = BackendUtility::getModuleUrl('record_edit', array(
'edit[' . $table . '][' . $rowsByLang[$lang['uid']]['uid'] . ']' => 'edit',
'returnUrl' => rawurlencode($this->retUrl) . BackendUtility::getUrlToken('editRecord')
));
}
$langSelItems[$lang['uid']] = '
<option value="' . htmlspecialchars($href) . '"' . ($currentLanguage == $lang['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars(($lang['title'] . $newTranslation)) . '</option>';
......@@ -1257,7 +1262,7 @@ class EditDocumentController {
}
/**
* Redirects to alt_doc with new parameters to edit a just created localized record
* Redirects to FormEngine with new parameters to edit a just created localized record
*
* @param string $justLocalized String passed by GET &justLocalized=
* @return void
......@@ -1268,10 +1273,11 @@ class EditDocumentController {
$localizedRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid', $table, $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . (int)$language . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . (int)$orig_uid . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table));
if (is_array($localizedRecord)) {
// Create parameters and finally run the classic page module for creating a new page translation
$params = '&edit[' . $table . '][' . $localizedRecord['uid'] . ']=edit';
$returnUrl = '&returnUrl=' . rawurlencode(GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')));
$location = $GLOBALS['BACK_PATH'] . 'alt_doc.php?' . $params . $returnUrl . BackendUtility::getUrlToken('editRecord');
HttpUtility::redirect($location);
$location = BackendUtility::getModuleUrl('record_edit', array(
'edit[' . $table . '][' . $localizedRecord['uid'] . ']' => 'edit',
'returnUrl' => rawurlencode(GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl')))
));
HttpUtility::redirect($location . BackendUtility::getUrlToken('editRecord'));
}
}
}
......@@ -1471,7 +1477,7 @@ class EditDocumentController {
$this->docHandler = array();
}
$GLOBALS['BE_USER']->pushModuleData('opendocs::recent', $recentDocs);
$GLOBALS['BE_USER']->pushModuleData('alt_doc.php', array($this->docHandler, $this->docDat[1]));
$GLOBALS['BE_USER']->pushModuleData('FormEngine', array($this->docHandler, $this->docDat[1]));
BackendUtility::setUpdateSignal('OpendocsController::updateNumber', count($this->docHandler));
}
// If ->returnEditConf is set, then add the current content of editconf to the ->retUrl variable: (used by other scripts, like wizard_add, to know which records was created or so...)
......@@ -1480,7 +1486,8 @@ class EditDocumentController {
}
// If code is NOT set OR set to 1, then make a header location redirect to $this->retUrl
if (!$code || $code == 1) {
HttpUtility::redirect($this->retUrl);
// @todo: find out why we need rawurldecode here!
HttpUtility::redirect(rawurldecode($this->retUrl));
} else {
$this->setDocument('', $this->retUrl);
}
......
......@@ -656,14 +656,17 @@ class PageLayoutController {
$this->doc->getContextMenuCode();
// Set the edit_record value for internal use in this function:
$edit_record = $this->edit_record;
// If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php:
// If a command to edit all records in a column is issue, then select all those elements, and redirect to FormEngine
if (substr($edit_record, 0, 9) == '_EDIT_COL') {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . (int)$this->id . ' AND colPos=' . (int)substr($edit_record, 10) . ' AND sys_language_uid=' . (int)$this->current_sys_language . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting');
$idListA = array();
while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$idListA[] = $cRow['uid'];
}
$url = $GLOBALS['BACK_PATH'] . 'alt_doc.php?edit[tt_content][' . implode(',', $idListA) . ']=edit&returnUrl=' . rawurlencode($this->local_linkThisScript(array('edit_record' => '')));
$url = BackendUtility::getModuleUrl('record_edit', array(
'edit[tt_content][' . implode(',', $idListA) . ']' => 'edit',
'returnUrl' => rawurlencode($this->local_linkThisScript(array('edit_record' => '')))
));
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($url);
}
// If the former record edited was the creation of a NEW record, this will look up the created records uid:
......
......@@ -22,8 +22,8 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
* sending the posted data to the object.
*
* Used by many smaller forms/links in TYPO3, including the QuickEdit module.
* Is not used by alt_doc.php though (main form rendering script) - that uses the same class (TCEmain) but makes its own initialization (to save the redirect request).
* For all other cases than alt_doc.php it is recommended to use this script for submitting your editing forms - but the best solution in any case would probably be to link your application to alt_doc.php, that will give you easy form-rendering as well.
* Is not used by FormEngine though (main form rendering script) - that uses the same class (TCEmain) but makes its own initialization (to save the redirect request).
* For all other cases than FormEngine it is recommended to use this script for submitting your editing forms - but the best solution in any case would probably be to link your application to FormEngine, that will give you easy form-rendering as well.
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
......
......@@ -54,7 +54,7 @@ class AddController extends AbstractWizardController {
public $table;
/**
* Loaded with the created id of a record when TCEforms (alt_doc.php) returns ...
* Loaded with the created id of a record FormEngine returns ...
*
* @var int
*/
......@@ -68,7 +68,7 @@ class AddController extends AbstractWizardController {
public $P;
/**
* Information coming back from alt_doc.php script, telling what the table/id was of the newly created record.
* Information coming back from the FormEngine script, telling what the table/id was of the newly created record.
*
* @var array
*/
......@@ -136,7 +136,7 @@ class AddController extends AbstractWizardController {
/**
* Main function
* Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
* Will issue a location-header, redirecting either BACK or to a new FormEngine instance...
*
* @return void
*/
......@@ -195,12 +195,16 @@ class AddController extends AbstractWizardController {
$tce->process_datamap();
}
}
// Return to the parent alt_doc.php record editing session:
// Return to the parent FormEngine record editing session:
HttpUtility::redirect(GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']));
} else {
// Redirecting to alt_doc.php with instructions to create a new record
// Redirecting to FormEngine with instructions to create a new record
// AND when closing to return back with information about that records ID etc.
$redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '&returnEditConf=1&edit[' . $this->P['params']['table'] . '][' . $this->pid . ']=new';
$redirectUrl = BackendUtility::getModuleUrl('record_edit', array(
'returnEditConf' => 1,
'edit[' . $this->P['params']['table'] . '][' . $this->pid . ']' => 'new',
'returnUrl' => rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))
));
HttpUtility::redirect($redirectUrl);
}
}
......
......@@ -56,7 +56,7 @@ class EditController extends AbstractWizardController {
*/
protected function init() {
$this->P = GeneralUtility::_GP('P');
// Used for the return URL to alt_doc.php so that we can close the window.
// Used for the return URL to FormEngine so that we can close the window.
$this->doClose = GeneralUtility::_GP('doClose');
}
......@@ -75,28 +75,35 @@ class EditController extends AbstractWizardController {
$field = $this->P['field'];
$config = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
$fTable = $this->P['currentValue'] < 0 ? $config['neg_foreign_table'] : $config['foreign_table'];
$urlParameters = array(
'returnUrl' => rawurlencode(BackendUtility::getModuleUrl('wizard_edit', array('doClose' => 1)))
);
// Detecting the various allowed field type setups and acting accordingly.
if (is_array($config) && $config['type'] == 'select' && !$config['MM'] && $config['maxitems'] <= 1 && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->P['currentValue']) && $this->P['currentValue'] && $fTable) {
// SINGLE value:
$redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode(BackendUtility::getModuleUrl('wizard_edit', array('doClose' => 1))) . '&edit[' . $fTable . '][' . $this->P['currentValue'] . ']=edit';
HttpUtility::redirect($redirectUrl);
// SINGLE value
$urlParameters['edit[' . $fTable . '][' . $this->P['currentValue'] . ']'] = 'edit';
// Redirect to FormEngine
$url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
HttpUtility::redirect($url);
} elseif (is_array($config) && $this->P['currentSelectedValues'] && ($config['type'] == 'select' && $config['foreign_table'] || $config['type'] == 'group' && $config['internal_type'] == 'db')) {
// MULTIPLE VALUES:
// Init settings:
$allowedTables = $config['type'] == 'group' ? $config['allowed'] : $config['foreign_table'] . ',' . $config['neg_foreign_table'];
$prependName = 1;
$params = '';
// Selecting selected values into an array:
$dbAnalysis = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\RelationHandler::class);
$dbAnalysis->start($this->P['currentSelectedValues'], $allowedTables);
$value = $dbAnalysis->getValueArray($prependName);
// Traverse that array and make parameters for alt_doc.php:
// Traverse that array and make parameters for FormEngine
foreach ($value as $rec) {
$recTableUidParts = GeneralUtility::revExplode('_', $rec, 2);
$params .= '&edit[' . $recTableUidParts[0] . '][' . $recTableUidParts[1] . ']=edit';
$urlParameters['edit[' . $recTableUidParts[0] . '][' . $recTableUidParts[1] . ']'] = 'edit';
}
// Redirect to alt_doc.php:
HttpUtility::redirect('alt_doc.php?returnUrl=' . rawurlencode(BackendUtility::getModuleUrl('wizard_edit', array('doClose' => 1))) . $params);
// Redirect to FormEngine
$url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
HttpUtility::redirect($url);
} else {
$this->closeWindow();
}
......
......@@ -63,7 +63,7 @@ class ListController extends AbstractWizardController {
/**
* Main function
* Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
* Will issue a location-header, redirecting either BACK or to a new FormEngine instance...
*
* @return void
*/
......
......@@ -737,11 +737,12 @@ class InlineElement {
'sys_file_metadata',
'file = ' . (int)substr($rec['uid_local'], 9) . ' AND sys_language_uid = ' . $rec['sys_language_uid']
);
$editUid = $recordInDatabase['uid'];
if ($GLOBALS['BE_USER']->check('tables_modify', 'sys_file_metadata')) {
$editOnClick = 'if(top.content.list_frame){top.content.list_frame.location.href=top.TS.PATH_typo3+\'alt_doc.php?returnUrl=\'+top.rawurlencode('
. 'top.content.list_frame.document.location' . '.pathname+top.content.list_frame.document.location' . '.search)+'
. '\'&edit[sys_file_metadata][' . (int)$editUid . ']=edit\';}';
$url = BackendUtility::getModuleUrl('record_edit', array(
'edit[sys_file_metadata][' . (int)$recordInDatabase['uid'] . ']' => 'edit'
));
$editOnClick = 'if(top.content.list_frame){top.content.list_frame.location.href=top.TS.PATH_typo3+\'' . $url . '&returnUrl=\'+top.rawurlencode('
. 'top.content.list_frame.document.location' . '.pathname+top.content.list_frame.document.location' . '.search);}';
$title = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata');
$cells['editmetadata'] = '
<a class="btn btn-default" href="#" class="btn" onclick="' . htmlspecialchars($editOnClick) . '" title="' . htmlspecialchars($title) . '">
......@@ -2176,7 +2177,7 @@ class InlineElement {
}
/**
* Checks the page access rights (Code for access check mostly taken from alt_doc.php)
* Checks the page access rights (Code for access check mostly taken from EditDocumentController)
* as well as the table access rights of the user.
*
* @param string $cmd The command that should be performed ('new' or 'edit')
......
......@@ -372,7 +372,7 @@ class FormEngine {
public $hookObjectsSingleField = array();
/**
* Rows getting inserted into the alt_doc headers (when called from alt_doc.php)
* Rows getting inserted into the headers (when called from the EditDocumentController)
*
* @var array
*/
......@@ -920,10 +920,14 @@ class FormEngine {
$item = $this->renderDefaultLanguageContent($table, $field, $row, $item);
$item = $this->renderDefaultLanguageDiff($table, $field, $row, $item);
}
// If the record has been saved and the "linkTitleToSelf" is set, we make the field name into a link, which will load ONLY this field in alt_doc.php
// If the record has been saved and the "linkTitleToSelf" is set, we make the field name into a link, which will load ONLY this field in the EditDocumentController
$label = htmlspecialchars($PA['label'], ENT_COMPAT, 'UTF-8', FALSE);
if (MathUtility::canBeInterpretedAsInteger($row['uid']) && $PA['fieldTSConfig']['linkTitleToSelf'] && !GeneralUtility::_GP('columnsOnly')) {
$lTTS_url = 'alt_doc.php?edit[' . $table . '][' . $row['uid'] . ']=edit&columnsOnly=' . $field . '&returnUrl=' . rawurlencode($this->thisReturnUrl());
$lTTS_url = BackendUtility::getModuleUrl('record_edit', array(
'edit[' . $table . '][' . $row['uid'] . ']' => 'edit',
'columnsOnly' => $field,
'returnUrl' => rawurlencode($this->thisReturnUrl())
));
$label = '<a href="' . htmlspecialchars($lTTS_url) . '">' . $label . '</a>';
}
......@@ -1366,7 +1370,7 @@ class FormEngine {
* Will register data from original language records if the current record is a translation of another.
* The original data is shown with the edited record in the form.
* The information also includes possibly diff-views of what changed in the original record.
* Function called from outside (see alt_doc.php + quick edit) before rendering a form for a record
* Function called from outside (see EditDocumentController + quick edit) before rendering a form for a record
*
* @param string $table Table name of the record being edited
* @param array $rec Record array of the record being edited
......@@ -1664,7 +1668,7 @@ class FormEngine {
/**
* Wraps all the table rows into a single table.
* Used externally from scripts like alt_doc.php and db_layout.php (which uses TCEforms...)
* Used externally from scripts like EditDocumentController and PageLayoutController (which uses FormEngine)
*
* @param string $c Code to output between table-parts; table rows
* @param array $rec The record
......
......@@ -117,7 +117,7 @@ class FrontendFormEngine extends \TYPO3\CMS\Backend\Form\FormEngine {
/**
* Initializes an anonymous template container.
* The created container can be compared to alt_doc.php in backend-only disposal.
* The created container can be compared to "record_edit" module in backend-only disposal.
*
* @return void
*/
......
......@@ -244,11 +244,13 @@ class LiveSearch {
} else {
$permsEdit = $calcPerms & Permission::CONTENT_EDIT;
}
// "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
// @todo Is there an existing function to generate this link?
// "Edit" link - Only if permissions to edit the page-record of the content of the parent page ($this->id)
if ($permsEdit) {
$returnUrl = BackendUtility::getModuleUrl('web_list', array('id' => $row['pid']));
$editLink = 'alt_doc.php?' . '&edit[' . $tableName . '][' . $row['uid'] . ']=edit&returnUrl=' . rawurlencode($returnUrl);
$editLink = BackendUtility::getModuleUrl('record_edit', array(
'edit[' . $tableName . '][' . $row['uid'] . ']' => 'edit',
'returnUrl' => rawurlencode($returnUrl)
));
}
return $editLink;
}
......
......@@ -2668,11 +2668,11 @@ class BackendUtility {
}
/**
* Returns a JavaScript string (for an onClick handler) which will load the alt_doc.php script that shows the form for editing of the record(s) you have send as params.
* Returns a JavaScript string (for an onClick handler) which will load the EditDocumentController script that shows the form for editing of the record(s) you have send as params.
* REMEMBER to always htmlspecialchar() content in href-properties to ampersands get converted to entities (XHTML requirement and XSS precaution)
*
* @param string $params Parameters sent along to alt_doc.php. This requires a much more details description which you must seek in Inside TYPO3s documentation of the alt_doc.php API. And example could be '&edit[pages][123] = edit' which will show edit form for page record 123.
* @param string $backPath Must point back to the TYPO3_mainDir directory (where alt_doc.php is)
* @param string $params Parameters sent along to EditDocumentController. This requires a much more details description which you must seek in Inside TYPO3s documentation of the FormEngine API. And example could be '&edit[pages][123] = edit' which will show edit form for page record 123.
* @param string $backPath Must point back to the TYPO3_mainDir directory (where the main entry point is)
* @param string $requestUri An optional returnUrl you can set - automatically set to REQUEST_URI.
*
* @return string
......@@ -2683,7 +2683,7 @@ class BackendUtility {
? '\'+T3_THIS_LOCATION+\''
: rawurlencode($requestUri ?: GeneralUtility::getIndpEnv('REQUEST_URI'));
$retUrlParam = 'returnUrl=' . $returnUrl;
return 'window.location.href=\'' . $backPath . 'alt_doc.php?' . $retUrlParam . $params . '\'; return false;';
return 'window.location.href=\'' . self::getModuleUrl('record_edit', array(), $backPath) . '&' . $retUrlParam . $params . '\'; return false;';
}
/**
......@@ -3266,7 +3266,7 @@ class BackendUtility {
* @param int $uid Record uid
* @return array
* @internal
* @see class.db_layout.inc, alt_db_navframe.php, alt_doc.php, db_layout.php
* @see class.db_layout.inc, alt_db_navframe.php, EditDocumentController, db_layout.php
*/
static public function isRecordLocked($table, $uid) {
if (!is_array($GLOBALS['LOCKED_RECORDS'])) {
......
......@@ -1228,8 +1228,8 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
* Draw header for a content element column:
*
* @param string $colName Column name
* @param string $editParams Edit params (Syntax: &edit[...] for alt_doc.php)
* @param string $newParams New element params (Syntax: &edit[...] for alt_doc.php) OBSOLETE
* @param string $editParams Edit params (Syntax: &edit[...] for FormEngine)
* @param string $newParams New element params (Syntax: &edit[...] for FormEngine) OBSOLETE
* @param array|NULL $pasteParams Paste element params (i.e. array(colPos => 1, sys_language_uid => 2))
* @return string HTML table
*/
......@@ -1832,10 +1832,12 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
}
// If any languages are left, make selector:
if (count($langSelItems) > 1) {
$onChangeContent = 'window.location.href=\'' . $this->backPath . 'alt_doc.php?&edit[pages_language_overlay]['
. $id . ']=new&overrideVals[pages_language_overlay][doktype]=' . (int)$this->pageRecord['doktype']
. '&overrideVals[pages_language_overlay][sys_language_uid]=\'+this.options[this.selectedIndex].value+\'&returnUrl='
. rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\'';
$url = BackendUtility::getModuleUrl('record_edit', array(
'edit[pages_language_overlay]['. $id . ']' => 'new',
'overrideVals[pages_language_overlay][doktype]' => (int)$this->pageRecord['doktype'],
'returnUrl' => rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))
), $this->backPath);
$onChangeContent = 'window.location.href=\'' . $url . '&overrideVals[pages_language_overlay][sys_language_uid]=\'+this.options[this.selectedIndex].value';
return '<div class="form-inline form-inline-spaced">'
. '<div class="form-group">'
. '<label for="createNewLanguage">'
......
<?php
// Required for mod.php
$MCONF['name'] = 'record_edit';
$MCONF['script'] = '_DISPATCH';
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Main form rendering script
* By sending certain parameters to this script you can bring up a form
* which allows the user to edit the content of one or more database records.
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
\TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords();
/* @var $editDocumentController \TYPO3\CMS\Backend\Controller\EditDocumentController */
$editDocumentController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);