2 namespace TYPO3\CMS\Backend\Controller;
19 use TYPO3\CMS\Backend\Form\Exception\AccessDeniedException;
411 parent::__construct();
423 if (!isset($this->signalSlotDispatcher)) {
462 if (!is_array($this->defVals) && is_array($this->overrideVals)) {
466 $this->retUrl = $this->returnUrl ?: BackendUtility::getModuleUrl(
'dummy');
476 $this->docDat = $this->
getBackendUser()->getModuleData(
'FormEngine',
'ses');
477 $this->docHandler = $this->docDat[0];
479 if ($this->closeDoc > 0) {
485 if (is_array($this->R_URL_getvars) && count($this->R_URL_getvars) < 2 && !is_array($this->editconf)) {
490 if ($this->workspace !== null) {
505 || isset($_POST[
'_savedok'])
506 || isset($_POST[
'_saveandclosedok'])
507 || isset($_POST[
'_savedokview'])
508 || isset($_POST[
'_savedoknew'])
509 || isset($_POST[
'_translation_savedok_x'])
510 || isset($_POST[
'_translation_savedokclear_x']);
519 public function processData()
535 $tce->stripslashes_values =
false;
537 if (!empty($control)) {
538 $tce->setControl($control);
540 if (isset($_POST[
'_translation_savedok_x'])) {
541 $tce->updateModeL10NdiffData =
'FORCE_FFUPD';
543 if (isset($_POST[
'_translation_savedokclear_x'])) {
544 $tce->updateModeL10NdiffData =
'FORCE_FFUPD';
545 $tce->updateModeL10NdiffDataClear =
true;
548 $TCAdefaultOverride = $beUser->getTSConfigProp(
'TCAdefaults');
549 if (is_array($TCAdefaultOverride)) {
550 $tce->setDefaultsFromUserTS($TCAdefaultOverride);
553 if ($beUser->uc[
'neverHideAtCopy']) {
554 $tce->neverHideAtCopy = 1;
557 $tce->start($this->data, $this->cmd);
558 if (is_array($this->mirror)) {
559 $tce->setMirror($this->mirror);
564 if ($httpHost != $refInfo[
'host']
565 && $this->vC != $beUser->veriCode()
566 && !
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'doNotCheckReferer']
574 'Referer host \'%s\' and server host \'%s\' did not match and veriCode was not valid either!',
576 array($refInfo[
'host'], $httpHost)
578 debug(
'Error: Referer host did not match with server host.');
581 $tce->process_uploads($_FILES);
582 $tce->process_datamap();
583 $tce->process_cmdmap();
585 if ($tce->pagetreeNeedsRefresh
586 && (isset($this->data[
'pages']) || $beUser->workspace != 0 && !empty($this->data))
591 if (!empty($tce->substNEWwithIDs_table)) {
594 $newEditConf = array();
595 foreach ($this->editconf as $tableName => $tableCmds) {
596 $keys = array_keys($tce->substNEWwithIDs_table, $tableName);
598 foreach ($keys as $key) {
599 $editId = $tce->substNEWwithIDs[$key];
601 if (!(is_array($tce->newRelatedIDs[$tableName])
602 && in_array($editId, $tce->newRelatedIDs[$tableName]))
611 $editId = $versionRec[
'uid'];
613 $newEditConf[$tableName][$editId] =
'edit';
617 if ($tableName ==
'pages'
618 && $this->retUrl != BackendUtility::getModuleUrl(
'dummy')
619 && $this->returnNewPageId
621 $this->retUrl .=
'&id=' . $tce->substNEWwithIDs[$key];
625 $newEditConf[$tableName] = $tableCmds;
629 if (!empty($newEditConf)) {
630 $this->editconf = $newEditConf;
635 unset($this->R_URL_getvars[
'defVals']);
640 if (!empty($tce->autoVersionIdMap)) {
644 if (isset($_POST[
'_savedoknew']) && is_array($this->editconf)) {
646 reset($this->editconf);
647 $nTable = key($this->editconf);
649 reset($this->editconf[$nTable]);
650 $nUid = key($this->editconf[$nTable]);
653 $this->editconf = array();
655 $this->editconf[$nTable][$nRec[
'pid']] =
'new';
657 $this->editconf[$nTable][-$nRec[
'uid']] =
'new';
665 if (isset($_POST[
'_savedokview'])) {
667 $table = reset(array_keys($this->data));
668 $id = reset(array_keys($this->data[$table]));
670 $id = $tce->substNEWwithIDs[$id];
673 $this->previewData[
'table'] = $table;
674 $this->previewData[
'id'] = $id;
676 $tce->printLogErrorMessages(isset($_POST[
'_saveandclosedok']) || isset($_POST[
'_translation_savedok_x']) ? $this->retUrl : $this->R_URL_parts[
'path'] .
'?' .
GeneralUtility::implodeArrayForUrl(
'', $this->R_URL_getvars));
680 if (isset($_POST[
'_saveandclosedok']) || isset($_POST[
'_translation_savedok_x']) || $this->closeDoc < 0) {
700 $this->perms_clause = $beUser->getPagePermsClause(1);
708 $this->MCONF[
'name'] =
'xMOD_alt_doc.php';
711 $this->doc =
$GLOBALS[
'TBE_TEMPLATE'];
713 $pageRenderer->addInlineLanguageLabelFile(
'EXT:lang/locallang_alt_doc.xlf');
715 $this->moduleTemplate->addJavaScriptCode(
718 function jumpToUrl(URL,formEl) {
719 if (!TBE_EDITOR.isFormChanged()) {
720 window.location.href = URL;
721 } else if (formEl && formEl.type=="checkbox") {
722 formEl.checked = formEl.checked ? 0 : 1;
728 $popupWindowWidth = 700;
729 $popupWindowHeight = 750;
730 $popupWindowSize = trim($beUser->getTSConfigVal(
'options.popupWindowSize'));
731 if (!empty($popupWindowSize)) {
734 $t3Configuration = array(
735 'PopupWindow' => array(
736 'width' => $popupWindowWidth,
737 'height' => $popupWindowHeight
747 'csh_tooltip_loading' =>
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:csh_tooltip_loading')
749 $generatedLabels = array();
750 $generatedLabels[
'core'] = $coreLabels;
751 $code =
'TYPO3.LLL = ' . json_encode($generatedLabels) .
';';
752 $filePath =
'typo3temp/Language/Backend-' . sha1($code) .
'.js';
753 if (!file_exists(PATH_site . $filePath)) {
756 if ($error !== null) {
757 throw new \RuntimeException(
'Locallang JS file could not be written to ' . $filePath .
'. Reason: ' . $error, 1446118286);
760 $pageRenderer->addJsFile(
'../' . $filePath);
763 $rtePopupWindowSize = trim($beUser->getTSConfigVal(
'options.rte.popupWindowSize'));
764 if (!empty($rtePopupWindowSize)) {
767 $rtePopupWindowWidth = !empty($rtePopupWindowWidth) ? (int)$rtePopupWindowWidth : ($popupWindowWidth-200);
768 $rtePopupWindowHeight = !empty($rtePopupWindowHeight) ? (int)$rtePopupWindowHeight : ($popupWindowHeight-250);
769 $t3Configuration[
'RTEPopupWindow'] = [
770 'width' => $rtePopupWindowWidth,
771 'height' => $rtePopupWindowHeight
776 TYPO3.configuration = ' . json_encode($t3Configuration) .
';
778 // passwordDummy and decimalSign are used by tbe_editor.js and have to be declared here as
779 // TS object overwrites the object declared in tbe_editor.js
780 function typoSetup() { //
782 this.passwordDummy = "********";
783 this.PATH_typo3 = "";
784 this.decimalSign = ".";
786 var TS = new typoSetup();
789 function launchView(table,uid,bP) { //
790 var backPath= bP ? bP : "";
791 var thePreviewWindow = window.open(
792 backPath+' .
GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl(
'show_item') .
'&table=') .
' + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid),
793 "ShowItem" + TS.uniqueID,
794 "height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0"
796 if (thePreviewWindow && thePreviewWindow.focus) {
797 thePreviewWindow.focus();
800 function deleteRecord(table,id,url) { //
801 window.location.href = ' .
GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl(
'tce_db') .
'&cmd[') .
'+table+"]["+id+"][delete]=1&redirect="+escape(url)+"&vC=' . $beUser->veriCode() .
'&prErr=1&uPT=1";
805 $previewCode = isset($_POST[
'_savedokview']) && $this->popViewId ? $this->
generatePreviewCode() :
'';
806 $this->moduleTemplate->addJavaScriptCode(
808 $javascript . $previewCode
811 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/ClickMenu');
822 $table = $this->previewData[
'table'];
823 $recordId = $this->previewData[
'id'];
826 $previewConfiguration = isset($pageTsConfig[
'TCEMAIN.'][
'preview.'][$table .
'.'])
827 ? $pageTsConfig[
'TCEMAIN.'][
'preview.'][$table .
'.']
834 if (isset($previewConfiguration[
'previewPageId'])) {
835 $previewPageId = $previewConfiguration[
'previewPageId'];
838 if (!$previewPageId) {
839 $rootPageData = null;
841 $currentPage = reset($rootLine);
844 $previewPageId = $currentPageId;
847 foreach ($rootLine as $page) {
848 if ($page[
'is_siteroot']) {
849 $rootPageData = $page;
853 $previewPageId = isset($rootPageData)
854 ? (int)$rootPageData[
'uid']
864 $languageField = isset(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField'])
865 ?
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']
867 if ($languageField && !empty($recordArray[$languageField])) {
868 $l18nPointer = isset(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transOrigPointerField'])
869 ?
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transOrigPointerField']
871 if ($l18nPointer && !empty($recordArray[$l18nPointer])
872 && isset($previewConfiguration[
'useDefaultLanguageRecord'])
873 && !$previewConfiguration[
'useDefaultLanguageRecord']
876 $recordId = $recordArray[$l18nPointer];
878 $linkParameters[
'L'] = $recordArray[$languageField];
882 if (isset($previewConfiguration[
'fieldToParameterMap.'])) {
883 foreach ($previewConfiguration[
'fieldToParameterMap.'] as $field => $parameterName) {
884 $value = $recordArray[$field];
885 if ($field ===
'uid') {
888 $linkParameters[$parameterName] = $value;
893 if (isset($previewConfiguration[
'additionalGetParameters.'])) {
894 $additionalGetParameters = [];
896 $additionalGetParameters,
897 $previewConfiguration[
'additionalGetParameters.']
899 $linkParameters = array_replace($linkParameters, $additionalGetParameters);
902 $this->popViewId = $previewPageId;
912 $previewPageRootline,
915 $this->popViewId_addParams,
924 $previewPageRootline,
927 $this->popViewId_addParams
944 foreach ($typoScript as $key => $value) {
945 if (is_array($value)) {
946 $key = rtrim($key,
'.');
947 $parameters[$key] = [];
950 $parameters[$key] = $value;
960 public function main()
964 if (is_array($this->editconf)) {
972 $editForm = $this->makeEditForm();
974 $this->firstEl = reset($this->elementsData);
976 if (($this->docDat[1] !== $this->storeUrlMd5
977 || !isset($this->docHandler[$this->storeUrlMd5]))
978 && !$this->dontStoreDocumentRef
986 $this->
getBackendUser()->pushModuleData(
'FormEngine', array($this->docHandler, $this->storeUrlMd5));
994 $body = $this->formResultCompiler->JStop();
996 $body .= $this->formResultCompiler->printNeededJSFunctions();
1003 if ($this->pageinfo) {
1004 $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
1008 $this->
languageSwitch($this->firstEl[
'table'], $this->firstEl[
'uid'], $this->firstEl[
'pid']);
1009 $this->moduleTemplate->setContent($body);
1034 public function makeEditForm()
1037 $this->elementsData = array();
1045 foreach ($this->editconf as $table => $conf) {
1046 if (is_array($conf) &&
$GLOBALS[
'TCA'][$table] && $beUser->check(
'tables_modify', $table)) {
1048 foreach ($conf as $cKey => $command) {
1049 if ($command ==
'edit' || $command ==
'new') {
1053 foreach ($ids as $theUid) {
1055 if ($command ===
'new') {
1056 $this->dontStoreDocumentRef = 1;
1069 $this->viewId_addParams =
'';
1071 $formDataCompilerInput = [
1072 'tableName' => $table,
1073 'vanillaUid' => (int)$theUid,
1074 'command' => $command,
1075 'returnUrl' => $this->R_URI,
1077 if (is_array($this->overrideVals) && is_array($this->overrideVals[$table])) {
1078 $formDataCompilerInput[
'overrideValues'] = $this->overrideVals[$table];
1081 $formData = $formDataCompiler->compile($formDataCompilerInput);
1084 if ($command ===
'new'
1085 && $table !==
'pages'
1086 && !empty($formData[
'parentPageRow'][
'uid'])
1088 $this->viewId = $formData[
'parentPageRow'][
'uid'];
1090 if ($table ==
'pages') {
1091 $this->viewId = $formData[
'databaseRow'][
'uid'];
1092 }
elseif (!empty($formData[
'parentPageRow'][
'uid'])) {
1093 $this->viewId = $formData[
'parentPageRow'][
'uid'];
1095 if (!empty($formData[
'processedTca'][
'ctrl'][
'languageField'])
1096 && is_array($formData[
'databaseRow'][$formData[
'processedTca'][
'ctrl'][
'languageField']])
1097 && $formData[
'databaseRow'][$formData[
'processedTca'][
'ctrl'][
'languageField']][0] > 0
1099 $this->viewId_addParams =
'&L=' . $formData[
'databaseRow'][$formData[
'processedTca'][
'ctrl'][
'languageField']][0];
1105 $deleteAccess =
false;
1106 if ($command ===
'edit') {
1107 $permission = $formData[
'userPermissionOnPage'];
1108 if ($formData[
'tableName'] ===
'pages') {
1116 if ($command ===
'edit') {
1121 FlashMessage::class,
1122 htmlspecialchars($lockInfo[
'msg']),
1129 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
1130 $defaultFlashMessageQueue->enqueue($flashMessage);
1135 if (!$this->storeTitle) {
1136 $this->storeTitle = $this->recTitle
1137 ? htmlspecialchars($this->recTitle)
1138 : BackendUtility::getRecordTitle($table, FormEngineUtility::databaseRowCompatibility($formData[
'databaseRow']), true);
1141 $this->elementsData[] = array(
1143 'uid' => $formData[
'databaseRow'][
'uid'],
1144 'pid' => $formData[
'databaseRow'][
'pid'],
1146 'deleteAccess' => $deleteAccess
1149 if ($command !==
'new') {
1150 BackendUtility::lockRecords($table, $formData[
'databaseRow'][
'uid'], $table ===
'tt_content' ? $formData[
'databaseRow'][
'pid'] : 0);
1155 if ($this->columnsOnly) {
1156 if (is_array($this->columnsOnly)) {
1157 $formData[
'fieldListToRender'] = $this->columnsOnly[$table];
1163 $formData[
'renderType'] =
'outerWrapContainer';
1164 $formResult = $nodeFactory->create($formData)->render();
1166 $html = $formResult[
'html'];
1168 $formResult[
'html'] =
'';
1169 $formResult[
'doSaveFieldName'] =
'doSave';
1174 $this->formResultCompiler->mergeResult($formResult);
1177 if ($command ==
'new') {
1180 .
'<input type="hidden"'
1181 .
' name="data[' . $table .
'][' . $formData[
'databaseRow'][
'uid'] .
'][pid]"'
1182 .
' value="' . $formData[
'databaseRow'][
'pid'] .
'" />';
1187 }
catch (AccessDeniedException $e) {
1191 $message = $beUser->errorMsg;
1192 if (empty($message)) {
1194 $message = $e->getMessage() .
' ' . $e->getCode();
1196 $editForm .= $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.noEditPermission',
true)
1197 .
'<br /><br />' . htmlspecialchars($message) .
'<br /><br />';
1217 $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
1218 if (!$this->errorC && !
$GLOBALS[
'TCA'][$this->firstEl[
'table']][
'ctrl'][
'readOnly']) {
1219 $saveSplitButton = $buttonBar->makeSplitButton();
1221 $saveButton = $buttonBar->makeInputButton()
1222 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.saveDoc',
true))
1223 ->setName(
'_savedok')
1225 ->setForm(
'EditDocumentController')
1226 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-save',
Icon::SIZE_SMALL));
1227 $saveSplitButton->addItem($saveButton,
true);
1230 if ($this->viewId && !$this->noView && $this->
getNewIconMode($this->firstEl[
'table'],
'saveDocView')) {
1232 if (isset($pagesTSconfig[
'TCEMAIN.'][
'preview.'][
'disableButtonForDokType'])) {
1235 $pagesTSconfig[
'TCEMAIN.'][
'preview.'][
'disableButtonForDokType'],
1240 $excludeDokTypes = array(
1246 if (!in_array((
int)$this->pageinfo[
'doktype'], $excludeDokTypes,
true)
1247 || isset($pagesTSconfig[
'TCEMAIN.'][
'preview.'][$this->firstEl[
'table'].
'.'][
'previewPageId'])
1249 $saveAndOpenButton = $buttonBar->makeInputButton()
1250 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow',
true))
1251 ->setName(
'_savedokview')
1253 ->setForm(
'EditDocumentController')
1254 ->setOnClick(
"window.open('', 'newTYPO3frontendWindow');")
1255 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
1256 'actions-document-save-view',
1259 $saveSplitButton->addItem($saveAndOpenButton);
1263 if (count($this->elementsData) === 1 && $this->
getNewIconMode($this->firstEl[
'table'])) {
1264 $saveAndNewButton = $buttonBar->makeInputButton()
1265 ->setName(
'_savedoknew')
1266 ->setClasses(
't3js-editform-submitButton')
1268 ->setForm(
'EditDocumentController')
1269 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.saveNewDoc',
true))
1270 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
1271 'actions-document-save-new',
1274 $saveSplitButton->addItem($saveAndNewButton);
1277 $saveAndCloseButton = $buttonBar->makeInputButton()
1278 ->setName(
'_saveandclosedok')
1279 ->setClasses(
't3js-editform-submitButton')
1281 ->setForm(
'EditDocumentController')
1282 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc',
true))
1283 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
1284 'actions-document-save-close',
1287 $saveSplitButton->addItem($saveAndCloseButton);
1289 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'explicitConfirmationOfTranslation']) {
1290 $saveTranslationButton = $buttonBar->makeInputButton()
1291 ->setName(
'_translation_savedok')
1293 ->setForm(
'EditDocumentController')
1294 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.translationSaveDoc',
true))
1295 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
1296 'actions-document-save-cleartranslationcache',
1299 $saveSplitButton->addItem($saveTranslationButton);
1300 $saveAndClearTranslationButton = $buttonBar->makeInputButton()
1301 ->setName(
'_translation_savedokclear')
1303 ->setForm(
'EditDocumentController')
1304 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.translationSaveDocClear',
true))
1305 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
1306 'actions-document-save-cleartranslationcache',
1309 $saveSplitButton->addItem($saveAndClearTranslationButton);
1314 $closeButton = $buttonBar->makeLinkButton()
1316 ->setClasses(
't3js-editform-close')
1317 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.closeDoc',
true))
1318 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
1319 'actions-document-close',
1322 $buttonBar->addButton($closeButton);
1325 && !
$GLOBALS[
'TCA'][$this->firstEl[
'table']][
'ctrl'][
'readOnly']
1326 && count($this->elementsData) === 1
1330 if ($this->firstEl[
'deleteAccess']
1331 && !
$GLOBALS[
'TCA'][$this->firstEl[
'table']][
'ctrl'][
'readOnly']
1332 && !$this->
getNewIconMode($this->firstEl[
'table'],
'disableDelete')
1334 $deleteButton = $buttonBar->makeLinkButton()
1336 ->setClasses(
't3js-editform-delete-record')
1337 ->setTitle(
$lang->getLL(
'deleteItem',
true))
1338 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
1339 'actions-edit-delete',
1342 ->setDataAttributes([
1343 'return-url' => $this->retUrl,
1344 'uid' => $this->firstEl[
'uid'],
1345 'table' => $this->firstEl[
'table']
1356 . (
int)$this->firstEl[
'uid'],
1362 $aOnClick =
'window.location.href=' .
1364 BackendUtility::getModuleUrl(
1367 'element' => $this->firstEl[
'table'] .
':' . $this->firstEl[
'uid'],
1368 'revert' =>
'ALL_FIELDS',
1370 'returnUrl' => $this->R_URI,
1373 ) .
'; return false;';
1375 $undoButton = $buttonBar->makeLinkButton()
1377 ->setOnClick(htmlspecialchars($aOnClick))
1380 $lang->getLL(
'undoLastChange'),
1382 (
$GLOBALS[
'EXEC_TIME'] - $undoButtonR[
'tstamp']),
1383 $lang->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')
1387 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
1388 'actions-edit-undo',
1393 if ($this->
getNewIconMode($this->firstEl[
'table'],
'showHistory')) {
1394 $aOnClick =
'window.location.href=' .
1396 BackendUtility::getModuleUrl(
1399 'element' => $this->firstEl[
'table'] .
':' . $this->firstEl[
'uid'],
1400 'returnUrl' => $this->R_URI,
1403 ) .
'; return false;';
1405 $historyButton = $buttonBar->makeLinkButton()
1407 ->setOnClick($aOnClick)
1408 ->setTitle(
'Open history of this record')
1409 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
1410 'actions-document-history-open',
1416 if ($this->columnsOnly) {
1417 $columnsOnlyButton = $buttonBar->makeLinkButton()
1418 ->setHref(htmlspecialchars(($this->R_URI .
'&columnsOnly=')))
1419 ->setTitle(
$lang->getLL(
'editWholeRecord',
true))
1420 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
1421 'actions-document-open',
1428 $cshButton = $buttonBar->makeHelpButton()->setModuleName(
'xMOD_csh_corebe')->setFieldName(
'TCEforms');
1429 $buttonBar->addButton($cshButton);
1443 <!-- EDITING FORM -->
1445 action="' . htmlspecialchars($this->R_URI) .
'"
1447 enctype="multipart/form-data"
1449 id="EditDocumentController"
1450 onsubmit="TBE_EDITOR.checkAndDoSubmit(1); return false;">
1453 <input type="hidden" name="returnUrl" value="' . htmlspecialchars($this->retUrl) .
'" />
1454 <input type="hidden" name="viewUrl" value="' . htmlspecialchars($this->viewUrl) .
'" />';
1455 if ($this->returnNewPageId) {
1456 $formContent .=
'<input type="hidden" name="returnNewPageId" value="1" />';
1458 $formContent .=
'<input type="hidden" name="popViewId" value="' . htmlspecialchars($this->viewId) .
'" />';
1459 if ($this->viewId_addParams) {
1460 $formContent .=
'<input type="hidden" name="popViewId_addParams" value="' . htmlspecialchars($this->viewId_addParams) .
'" />';
1463 <input type="hidden" name="closeDoc" value="0" />
1464 <input type="hidden" name="doSave" value="0" />
1465 <input type="hidden" name="_serialNumber" value="' . md5(microtime()) .
'" />
1466 <input type="hidden" name="_scrollPosition" value="" />';
1467 return $formContent;
1475 if ($this->returnUrl !==
'sysext/backend/Resources/Private/Templates/Close.html') {
1476 $shortCutButton = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->makeShortcutButton();
1477 $shortCutButton->setModuleName($this->MCONF[
'name'])
1485 'editRegularContentFromId',
1487 $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->addButton($shortCutButton);
1496 if ($this->returnUrl !==
'sysext/backend/Resources/Private/Templates/Close.html') {
1498 array(
'returnUrl' =>
'sysext/backend/Resources/Private/Templates/Close.html')
1502 .
',\'width=670,height=500,status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;';
1503 $openInNewWindowButton = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()
1507 'LLL:EXT:lang/locallang_core.xlf:labels.openInNewWindow',
1510 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-window-open',
Icon::SIZE_SMALL))
1511 ->setOnClick(htmlspecialchars($aOnClick));
1512 $this->moduleTemplate->getDocHeaderComponent()->getButtonBar()->addButton(
1513 $openInNewWindowButton,
1535 $languageField =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField'];
1536 $transOrigPointerField =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transOrigPointerField'];
1540 && $transOrigPointerField && !
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transOrigPointerTable']
1542 if (is_null($pid)) {
1549 if (is_array($langRows) && count($langRows) > 1) {
1550 $rowsByLang = array();
1551 $fetchFields =
'uid,' . $languageField .
',' . $transOrigPointerField;
1554 if (!is_array($rowCurrent)) {
1557 $currentLanguage = (int)$rowCurrent[$languageField];
1559 if ($currentLanguage > -1) {
1561 if ($currentLanguage && $rowCurrent[$transOrigPointerField]) {
1564 $rowCurrent[$transOrigPointerField],
1567 if (!is_array($rowsByLang[0])) {
1570 $rowCurrent[$transOrigPointerField],
1575 $rowsByLang[$rowCurrent[$languageField]] = $rowCurrent;
1577 if ($rowCurrent[$transOrigPointerField] || $currentLanguage === 0) {
1584 foreach ($translations as $row) {
1585 $rowsByLang[$row[$languageField]] = $row;
1588 $languageMenu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
1589 $languageMenu->setIdentifier(
'_langSelector');
1591 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
1594 foreach ($langRows as
$lang) {
1595 if ($this->
getBackendUser()->checkLanguageAccess($lang[
'uid'])) {
1596 $newTranslation = isset($rowsByLang[$lang[
'uid']]) ?
'' :
' [' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.new',
true) .
']';
1598 if ($newTranslation) {
1599 $redirectUrl = BackendUtility::getModuleUrl(
'record_edit', array(
1600 'justLocalized' => $table .
':' . $rowsByLang[0][
'uid'] .
':' . $lang[
'uid'],
1601 'returnUrl' => $this->retUrl
1604 '&cmd[' . $table .
'][' . $rowsByLang[0][
'uid'] .
'][localize]=' . $lang[
'uid'],
1608 $href = BackendUtility::getModuleUrl(
'record_edit', array(
1609 'edit[' . $table .
'][' . $rowsByLang[$lang[
'uid']][
'uid'] .
']' =>
'edit',
1610 'returnUrl' => $this->retUrl
1613 $menuItem = $languageMenu->makeMenuItem()
1614 ->setTitle($lang[
'title'] . $newTranslation)
1616 if ((
int)$lang[
'uid'] === $currentLanguage) {
1617 $menuItem->setActive(
true);
1619 $languageMenu->addMenuItem($menuItem);
1623 $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($languageMenu);
1637 list($table, $orig_uid, $language) = explode(
':', $justLocalized);
1639 &&
$GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField']
1640 &&
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transOrigPointerField']
1645 $GLOBALS[
'TCA'][$table][
'ctrl'][
'languageField'] .
'=' . (
int)$language .
' AND '
1646 .
$GLOBALS[
'TCA'][$table][
'ctrl'][
'transOrigPointerField'] .
'=' . (
int)$orig_uid
1649 if (is_array($localizedRecord)) {
1651 $location = BackendUtility::getModuleUrl(
'record_edit', array(
1652 'edit[' . $table .
'][' . $localizedRecord[
'uid'] .
']' =>
'edit',
1672 if (preg_match(
'/\\.gif$/', $modSharedTSconfig[
'properties'][
'defaultLanguageFlag'])) {
1673 $modSharedTSconfig[
'properties'][
'defaultLanguageFlag'] = str_replace(
1676 $modSharedTSconfig[
'properties'][
'defaultLanguageFlag']
1684 'title' => $modSharedTSconfig[
'properties'][
'defaultLanguageLabel'] !==
''
1685 ? $modSharedTSconfig[
'properties'][
'defaultLanguageLabel'] .
' (' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage') .
')'
1686 : $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'),
1687 'flag' => $modSharedTSconfig[
'properties'][
'defaultLanguageFlag']
1690 $exQ = $this->
getBackendUser()->isAdmin() ?
'' :
' AND sys_language.hidden=0';
1694 'pages_language_overlay,sys_language',
1695 'pages_language_overlay.sys_language_uid=sys_language.uid
1698 'pages_language_overlay.sys_language_uid,
1701 sys_language.tstamp,
1702 sys_language.hidden,
1704 sys_language.language_isocode,
1705 sys_language.static_lang_isocode,
1707 'sys_language.title'
1713 'sys_language.hidden=0',
1715 'sys_language.title'
1719 foreach ($rows as $row) {
1720 $languages[$row[
'uid']] = $row;
1740 if (is_array($this->editconf)) {
1742 foreach ($this->editconf as $table => $conf) {
1743 if (is_array($conf) &&
$GLOBALS[
'TCA'][$table]) {
1746 foreach ($conf as $cKey =>
$cmd) {
1747 if (
$cmd ==
'edit') {
1750 foreach ($ids as $idKey => $theUid) {
1751 if (is_array($mapArray)) {
1752 if ($mapArray[$table][$theUid]) {
1753 $ids[$idKey] = $mapArray[$table][$theUid];
1758 if (is_array($calcPRec)) {
1760 $ids[$idKey] = $calcPRec[
'uid'];
1765 $newConf[implode(
',', $ids)] =
$cmd;
1767 $newConf[$cKey] =
$cmd;
1771 $this->editconf[$table] = $newConf;
1788 if (is_array($reqRecord)) {
1792 if (
$GLOBALS[
'TCA'][$table] &&
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS']) {
1794 if ($reqRecord[
'pid'] == -1) {
1808 return is_array($versionRec) ? $versionRec : $reqRecord;
1836 $res = $dbConnection->exec_SELECTquery(
1844 if ($dbConnection->sql_num_rows($res)) {
1846 while ($ecRec = $dbConnection->sql_fetch_assoc($res)) {
1847 $ecUids[] = $ecRec[
'uid'];
1849 $this->editconf[
'tt_content'][implode(
',', $ecUids)] =
'edit';
1851 $dbConnection->sql_free_result($res);
1863 'edit,defVals,overrideVals,columnsOnly,noView,editRegularContentFromId,workspace',
1864 $this->R_URL_getvars
1867 $this->storeUrlMd5 = md5($this->storeUrl);
1880 $TSconfig = $this->
getBackendUser()->getTSConfig(
'options.' . $key);
1881 $output = trim(isset($TSconfig[
'properties'][$table]) ? $TSconfig[
'properties'][$table] : $TSconfig[
'value']);
1896 if (isset($this->docHandler[$this->storeUrlMd5])) {
1898 $recentDocs = $this->
getBackendUser()->getModuleData(
'opendocs::recent');
1899 if (!is_array($recentDocs)) {
1900 $recentDocs = array();
1903 $recentDocs = array_merge(array($this->storeUrlMd5 => $closedDoc), $recentDocs);
1904 if (count($recentDocs) > 8) {
1905 $recentDocs = array_slice($recentDocs, 0, 8);
1908 unset($this->docHandler[$this->storeUrlMd5]);
1910 $recentDocs = array_merge($this->docHandler, $recentDocs);
1911 $this->docHandler = array();
1913 $this->
getBackendUser()->pushModuleData(
'opendocs::recent', $recentDocs);
1914 $this->
getBackendUser()->pushModuleData(
'FormEngine', array($this->docHandler, $this->docDat[1]));
1919 if ($this->returnEditConf && $this->retUrl != BackendUtility::getModuleUrl(
'dummy')) {
1920 $this->retUrl .=
'&returnEditConf=' . rawurlencode(json_encode($this->editconf));
1923 if (!$code || $code == 1) {
1944 if (!$this->modTSconfig[
'properties'][
'disableDocSelector']
1945 && is_array($this->docHandler)
1946 && !empty($this->docHandler)
1948 if (isset($this->docHandler[$currentDocFromHandlerMD5])) {
1949 $setupArr = $this->docHandler[$currentDocFromHandlerMD5];
1951 $setupArr = reset($this->docHandler);
1955 $retUrl = $sParts[
'path'] .
'?' . $setupArr[2] .
'&returnUrl=' . rawurlencode(
$retUrl);
1977 $this->processData();
1983 $response->
getBody()->write($this->moduleTemplate->renderContent());