TYPO3 CMS  TYPO3_8-7
EditPopup.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
22 
27 class EditPopup extends AbstractNode
28 {
34  public function render()
35  {
36  $languageService = $this->getLanguageService();
37  $options = $this->data['renderData']['fieldControlOptions'];
38 
39  $title = $options['title'] ?? 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.edit';
40 
41  $parameterArray = $this->data['parameterArray'];
42  $itemName = $parameterArray['itemFormElName'];
43  $windowOpenParameters = $options['windowOpenParameters'] ?? 'height=800,width=600,status=0,menubar=0,scrollbars=1';
44 
45  $flexFormDataStructureIdentifier = $this->data['flexFormDataStructureIdentifier'] ?? '';
46  $flexFormDataStructurePath = '';
47  if (!empty($flexFormDataStructureIdentifier)) {
48  if (empty($this->data['flexFormContainerName'])) {
49  // simple flex form element
50  $flexFormDataStructurePath = 'sheets/'
51  . $this->data['flexFormSheetName']
52  . '/ROOT/el/'
53  . $this->data['flexFormFieldName']
54  . '/TCEforms/config';
55  } else {
56  // flex form section container element
57  $flexFormDataStructurePath = 'sheets/'
58  . $this->data['flexFormSheetName']
59  . '/ROOT/el/'
60  . $this->data['flexFormFieldName']
61  . '/el/'
62  . $this->data['flexFormContainerName']
63  . '/el/'
64  . $this->data['flexFormContainerFieldName']
65  . '/TCEforms/config';
66  }
67  }
68 
69  $urlParameters = [
70  'P' => [
71  'table' => $this->data['tableName'],
72  'field' => $this->data['fieldName'],
73  'formName' => 'editform',
74  'flexFormDataStructureIdentifier' => $flexFormDataStructureIdentifier,
75  'flexFormDataStructurePath' => $flexFormDataStructurePath,
76  'hmac' => GeneralUtility::hmac('editform' . $itemName, 'wizard_js'),
77  'fieldChangeFunc' => $parameterArray['fieldChangeFunc'],
78  'fieldChangeFuncHash' => GeneralUtility::hmac(serialize($parameterArray['fieldChangeFunc'])),
79  ],
80  ];
81 
82  $url = BackendUtility::getModuleUrl('wizard_edit', $urlParameters);
83  $onClick = [];
84  $onClick[] = 'this.blur();';
85  $onClick[] = 'if (!TBE_EDITOR.curSelected(' . GeneralUtility::quoteJSvalue($itemName) . ')) {';
86  $onClick[] = 'top.TYPO3.Modal.confirm(';
87  $onClick[] = '"' . $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:warning.header') . '",';
88  $onClick[] = '"' . $languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:mess.noSelItemForEdit') . '",';
89  $onClick[] = 'top.TYPO3.Severity.notice, [{text: TYPO3.lang[\'button.ok\'] || \'OK\', btnClass: \'btn-notice\', name: \'ok\'}]';
90  $onClick[] = ')';
91  $onClick[] = '.on("button.clicked", function(e) {';
92  $onClick[] = 'if (e.target.name == "ok") { top.TYPO3.Modal.dismiss(); }}';
93  $onClick[] = ');';
94  $onClick[] = 'return false;';
95  $onClick[] = '}';
96  $onClick[] = 'vHWin=window.open(';
97  $onClick[] = GeneralUtility::quoteJSvalue($url);
98  $onClick[] = '+\'&P[currentValue]=\'+TBE_EDITOR.rawurlencode(';
99  $onClick[] = 'document.editform[' . GeneralUtility::quoteJSvalue($itemName) . '].value';
100  $onClick[] = ')';
101  $onClick[] = '+\'&P[currentSelectedValues]=\'+TBE_EDITOR.curSelected(';
102  $onClick[] = GeneralUtility::quoteJSvalue($itemName);
103  $onClick[] = '),';
104  $onClick[] = '\'\',';
105  $onClick[] = GeneralUtility::quoteJSvalue($windowOpenParameters);
106  $onClick[] = ');';
107  $onClick[] = 'vHWin.focus();';
108  $onClick[] = 'return false;';
109 
110  return [
111  'iconIdentifier' => 'actions-open',
112  'title' => $title,
113  'linkAttributes' => [
114  'onClick' => implode('', $onClick),
115  ],
116  ];
117  }
118 
124  protected function getLanguageService()
125  {
126  return $GLOBALS['LANG'];
127  }
128 }
static hmac($input, $additionalSecret='')
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']