2 namespace TYPO3\CMS\Backend\Controller;
61 parent::__construct();
71 public function init()
74 $lang->includeLLFile(
'EXT:lang/locallang_wizards.xlf');
78 $this->formName = $this->P[
'formName'];
79 $this->fieldName = $this->P[
'itemName'];
81 if (!$this->P[
'hmac'] || ($this->P[
'hmac'] !== $hmac_validate)) {
82 throw new \InvalidArgumentException(
'Hmac Validation failed for backend_layout wizard', 1385811397);
84 $uid = (int)$this->P[
'uid'];
88 $pageRenderer->loadExtJS();
90 .
'Resources/Public/JavaScript/grideditor.js');
91 $pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/Tooltip');
92 $pageRenderer->addInlineSetting(
95 BackendUtility::getModuleUrl(
96 'help_CshmanualCshmanual',
98 'tx_cshmanual_help_cshmanualcshmanual' => array (
99 'controller' =>
'Help',
105 $pageRenderer->addJsInlineCode(
'storeData',
'
106 function storeData(data) {
107 if (parent.opener && parent.opener.document && parent.opener.document.' . $this->formName .
' && parent.opener.document.' . $this->formName .
'[' .
GeneralUtility::quoteJSvalue($this->fieldName) .
']) {
109 parent.opener.TBE_EDITOR.fieldChanged("backend_layout","' . $uid .
'","config","data[backend_layout][' . $uid .
'][config]");
113 $languageLabels = array(
114 'save' =>
$lang->sL(
'LLL:EXT:lang/locallang_wizards.xlf:grid_labelSave',
true),
115 'title' =>
$lang->sL(
'LLL:EXT:lang/locallang_wizards.xlf:grid_windowTitle',
true),
116 'editCell' =>
$lang->sL(
'LLL:EXT:lang/locallang_wizards.xlf:grid_editCell',
true),
117 'mergeCell' =>
$lang->sL(
'LLL:EXT:lang/locallang_wizards.xlf:grid_mergeCell',
true),
118 'splitCell' =>
$lang->sL(
'LLL:EXT:lang/locallang_wizards.xlf:grid_splitCell',
true),
119 'name' =>
$lang->sL(
'LLL:EXT:lang/locallang_wizards.xlf:grid_name',
true),
120 'column' =>
$lang->sL(
'LLL:EXT:lang/locallang_wizards.xlf:grid_column',
true),
121 'notSet' =>
$lang->sL(
'LLL:EXT:lang/locallang_wizards.xlf:grid_notSet',
true),
122 'nameHelp' =>
$lang->sL(
'LLL:EXT:lang/locallang_wizards.xlf:grid_nameHelp',
true),
123 'columnHelp' =>
$lang->sL(
'LLL:EXT:lang/locallang_wizards.xlf:grid_columnHelp',
true)
125 $pageRenderer->addInlineLanguageLabelArray($languageLabels);
130 'uid=' . (
int)$this->P[
'uid']
132 if (trim($record[0][$this->P[
'field']]) ==
'') {
133 $rows = array(array(array(
'colspan' => 1,
'rowspan' => 1,
'spanned' =>
false,
'name' =>
'')));
139 $parser->parse($record[0][$this->P[
'field']]);
140 $data = $parser->setup[
'backend_layout.'];
142 $colCount = $data[
'colCount'];
143 $rowCount = $data[
'rowCount'];
144 $dataRows = $data[
'rows.'];
145 $spannedMatrix = array();
146 for ($i = 1; $i <= $rowCount; $i++) {
148 $row = array_shift($dataRows);
149 $columns = $row[
'columns.'];
150 for ($j = 1; $j <= $colCount; $j++) {
152 if (!$spannedMatrix[$i][$j]) {
153 if (is_array($columns) && !empty($columns)) {
154 $column = array_shift($columns);
155 if (isset($column[
'colspan'])) {
156 $cellData[
'colspan'] = (int)$column[
'colspan'];
157 $columnColSpan = (int)$column[
'colspan'];
158 if (isset($column[
'rowspan'])) {
159 $columnRowSpan = (int)$column[
'rowspan'];
160 for ($spanRow = 0; $spanRow < $columnRowSpan; $spanRow++) {
161 for ($spanColumn = 0; $spanColumn < $columnColSpan; $spanColumn++) {
162 $spannedMatrix[$i + $spanRow][$j + $spanColumn] = 1;
166 for ($spanColumn = 0; $spanColumn < $columnColSpan; $spanColumn++) {
167 $spannedMatrix[$i][$j + $spanColumn] = 1;
171 $cellData[
'colspan'] = 1;
172 if (isset($column[
'rowspan'])) {
173 $columnRowSpan = (int)$column[
'rowspan'];
174 for ($spanRow = 0; $spanRow < $columnRowSpan; $spanRow++) {
175 $spannedMatrix[$i + $spanRow][$j] = 1;
179 if (isset($column[
'rowspan'])) {
180 $cellData[
'rowspan'] = (int)$column[
'rowspan'];
182 $cellData[
'rowspan'] = 1;
184 if (isset($column[
'name'])) {
185 $cellData[
'name'] = $column[
'name'];
187 if (isset($column[
'colPos'])) {
188 $cellData[
'column'] = (int)$column[
'colPos'];
192 $cellData = array(
'colspan' => 1,
'rowspan' => 1,
'spanned' => 1);
194 $cells[] = $cellData;
197 if (!empty($spannedMatrix[$i]) && is_array($spannedMatrix[$i])) {
198 ksort($spannedMatrix[$i]);
202 $pageRenderer->addExtOnReadyCode(
'
203 t3Grid = new TYPO3.Backend.t3Grid({
204 data: ' . json_encode($rows, JSON_HEX_QUOT | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS) .
',
205 colCount: ' . (
int)$colCount .
',
206 rowCount: ' . (
int)$rowCount .
',
207 targetElement: \'editor\'
213 .
'Resources/Public/Css/grideditor.css');
228 $this->
setPagePath($this->P[
'table'], $this->P[
'uid']);
231 $this->moduleTemplate->setContent($this->content);
232 $response->
getBody()->write($this->moduleTemplate->renderContent());
247 if ($table ===
'pages') {
251 $pageId = $record[
'pid'];
255 if (is_array($pageAccess)) {
256 $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($pageAccess);
267 $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
271 .
'Resources/Public/Images/BackendLayoutWizard/';
273 $saveButton = $buttonBar->makeInputButton()
274 ->setName(
'_savedok')
276 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.saveDoc',
true))
277 ->setOnClick(
'storeData(t3Grid.export2LayoutRecord());return true;')
278 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-save',
Icon::SIZE_SMALL));
280 $saveAndCloseButton = $buttonBar->makeInputButton()
281 ->setName(
'_savedokandclose')
283 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc',
true))
284 ->setOnClick(
'storeData(t3Grid.export2LayoutRecord());window.close();return true;')
286 $this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-save-close',
Icon::SIZE_SMALL)
289 $splitButton = $buttonBar->makeSplitButton()
290 ->addItem($saveButton)
291 ->addItem($saveAndCloseButton);
292 $buttonBar->addButton($splitButton);
294 $closeButton = $buttonBar->makeLinkButton()
296 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.closeDoc',
true))
297 ->setOnClick(
'window.close();return true;')
298 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-close',
Icon::SIZE_SMALL));
303 <table border="0" width="90%" height="90%" id="outer_container">
305 <td class="editor_cell">
309 <td width="20" valign="center">
310 <a class="addCol" href="#" title="' .
$lang->getLL(
'grid_addColumn') .
'" onclick="t3Grid.addColumn(); t3Grid.drawTable(\'editor\');">
311 <img src="' . $resourcePath .
't3grid-tableright.png" border="0" />
313 <a class="removeCol" href="#" title="' .
$lang->getLL(
'grid_removeColumn') .
'" onclick="t3Grid.removeColumn(); t3Grid.drawTable(\'editor\');">
314 <img src="' . $resourcePath .
't3grid-tableleft.png" border="0" />
319 <td colspan="2" height="20" align="center">
320 <a class="addCol" href="#" title="' .
$lang->getLL(
'grid_addRow') .
'" onclick="t3Grid.addRow(); t3Grid.drawTable(\'editor\');">
321 <img src="' . $resourcePath .
't3grid-tabledown.png" border="0" />
323 <a class="removeCol" href="#" title="' .
$lang->getLL(
'grid_removeRow') .
'" onclick="t3Grid.removeRow(); t3Grid.drawTable(\'editor\');">
324 <img src="' . $resourcePath .
't3grid-tableup.png" border="0" />