2 namespace TYPO3\CMS\Tstemplate\Controller;
67 public function tableRow($label, $data, $field, $id)
70 if ($field ===
'config' || $field ===
'constants') {
72 'id' => $this->pObj->id,
77 $url = BackendUtility::getModuleUrl(
'web_ts', $urlParameters);
85 'columnsOnly' => $field,
86 'createExtension' => 0,
89 $url = BackendUtility::getModuleUrl(
'record_edit', $urlParameters);
91 $title =
$lang->sL(
'LLL:EXT:lang/locallang_common.xlf:editField',
true);
92 $startAnchor =
'<a href="' . htmlspecialchars(
$url) .
'" title="' . $title .
'">';
93 $icon = $this->iconFactory->getIcon(
'actions-document-open',
Icon::SIZE_SMALL)->render();
95 $ret .= $startAnchor .
'<strong>' . $label .
'</strong></a>';
96 $ret .=
'</td><td width="80%">' . $data .
'</td><td>' . $startAnchor .
'<span class="btn btn-default">' . $icon .
'</span></a></td></tr>';
111 public function initialize_editor($pageId, $template_uid = 0)
118 $tmpl->tt_track =
false;
122 $GLOBALS[
'tplRow'] = $tmpl->ext_getFirstTemplate($pageId, $template_uid);
138 if ($this->pObj->MOD_SETTINGS[
'includeTypoScriptFileContent']) {
141 $tplRow[
'config'] = TypoScriptParser::checkIncludeLines($tplRow[
'config'], 91);
142 $tplRow[
'constants'] = TypoScriptParser::checkIncludeLines($tplRow[
'constants'], 91);
155 if ($this->pObj->MOD_SETTINGS[
'includeTypoScriptFileContent']) {
177 $lang->includeLLFile(
'EXT:tstemplate/Resources/Private/Language/locallang_info.xlf');
178 $this->pObj->MOD_MENU[
'includeTypoScriptFileContent'] =
true;
181 $manyTemplatesMenu = $this->pObj->templateMenu();
183 if ($manyTemplatesMenu) {
184 $template_uid = $this->pObj->MOD_SETTINGS[
'templatesOnPage'];
187 $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
190 if ($existTemplate) {
191 $saveId = $tplRow[
'_ORIG_uid'] ? $tplRow[
'_ORIG_uid'] : $tplRow[
'uid'];
194 $newId = $this->pObj->createTemplate($this->pObj->id, $saveId);
198 'id' => $this->pObj->id,
199 'SET[templatesOnPage]' => $newId
201 $url = BackendUtility::getModuleUrl(
'web_ts', $urlParameters);
206 if ($existTemplate) {
210 isset($POST[
'_savedok'])
211 || isset($POST[
'_saveandclosedok'])
215 $alternativeFileName = array();
216 if (is_array($POST[
'data'])) {
217 foreach ($POST[
'data'] as $field => $val) {
221 $recData[
'sys_template'][$saveId][$field] = $val;
226 if (!empty($recData)) {
230 $tce->stripslashes_values =
false;
231 $tce->alternativeFileName = $alternativeFileName;
233 $tce->start($recData, array());
235 $tce->process_datamap();
237 $tce->clear_cacheCmd(
'all');
239 $this->tce_processed =
true;
241 $this->initialize_editor($this->pObj->id, $template_uid);
244 $manyTemplatesMenu = $this->pObj->templateMenu();
248 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/tstemplate_info/class.tx_tstemplateinfo.php'][
'postTCEProcessingHook'])) {
249 $postTCEProcessingHook = &
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/tstemplate_info/class.tx_tstemplateinfo.php'][
'postTCEProcessingHook'];
250 if (is_array($postTCEProcessingHook)) {
251 $hookParameters = array(
255 foreach ($postTCEProcessingHook as $hookFunction) {
260 $content =
'<a href="#" class="t3-js-clickmenutrigger" data-table="sys_template" data-uid="' . $tplRow[
'uid'] .
'" data-listframe="1">' . $this->iconFactory->getIconForRecord(
'sys_template', $tplRow,
Icon::SIZE_SMALL)->render() .
'</a><strong>' . htmlspecialchars($tplRow[
'title']) .
'</strong>' . (trim($tplRow[
'sitetitle']) ? htmlspecialchars(
' (' . $tplRow[
'sitetitle'] .
')') :
'');
261 $theOutput .=
'<h2>' .
$lang->getLL(
'templateInformation',
true) .
'</h2><div>' . $content .
'</div>';
262 if ($manyTemplatesMenu) {
263 $theOutput .=
'<div>' . $manyTemplatesMenu .
'</div>';
265 $theOutput .=
'<div style="padding-top: 10px;"></div>';
268 if (isset($POST[
'_saveandclosedok'])) {
271 if (isset($e[
'constants'])) {
272 $outCode =
'<textarea name="data[constants]" rows="' . $numberOfRows .
'" wrap="off" class="text-monospace enable-tab"' . $this->pObj->doc->formWidth(48,
true,
'width:98%;height:70%') .
' class="text-monospace">' . htmlspecialchars($tplRow[
'constants']) .
'</textarea>';
273 $outCode .=
'<input type="hidden" name="e[constants]" value="1">';
275 $outCode .=
'<div class="checkbox"><label for="checkIncludeTypoScriptFileContent">' .
BackendUtility::getFuncCheck($this->pObj->id,
'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS[
'includeTypoScriptFileContent'],
'',
'&e[constants]=1',
'id="checkIncludeTypoScriptFileContent"');
276 $outCode .=
$lang->getLL(
'includeTypoScriptFileContent') .
'</label></div><br />';
277 $theOutput .=
'<div style="padding-top: 15px;"></div>';
278 $theOutput .=
'<h3>' .
$lang->getLL(
'constants',
true) .
'</h3>';
279 $theOutput .= $outCode;
281 if (isset($e[
'config'])) {
282 $outCode =
'<textarea name="data[config]" rows="' . $numberOfRows .
'" wrap="off" class="text-monospace enable-tab"' . $this->pObj->doc->formWidth(48,
true,
'width:98%;height:70%') .
' class="text-monospace">' . htmlspecialchars($tplRow[
'config']) .
'</textarea>';
283 $outCode .=
'<input type="hidden" name="e[config]" value="1">';
285 $outCode .=
'<div class="checkbox"><label for="checkIncludeTypoScriptFileContent">' .
BackendUtility::getFuncCheck($this->pObj->id,
'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS[
'includeTypoScriptFileContent'],
'',
'&e[config]=1',
'id="checkIncludeTypoScriptFileContent"');
286 $outCode .=
$lang->getLL(
'includeTypoScriptFileContent') .
'</label></div><br />';
287 $theOutput .=
'<div style="padding-top: 15px;"></div>';
288 $theOutput .=
'<h3>' .
$lang->getLL(
'setup',
true) .
'</h3>';
289 $theOutput .= $outCode;
294 $outCode .= $this->
tableRow(
$lang->getLL(
'title'), htmlspecialchars($tplRow[
'title']),
'title', $tplRow[
'uid']);
295 $outCode .= $this->
tableRow(
$lang->getLL(
'sitetitle'), htmlspecialchars($tplRow[
'sitetitle']),
'sitetitle', $tplRow[
'uid']);
296 $outCode .= $this->
tableRow(
$lang->getLL(
'description'), nl2br(htmlspecialchars($tplRow[
'description'])),
'description', $tplRow[
'uid']);
297 $outCode .= $this->
tableRow(
$lang->getLL(
'constants'), sprintf(
$lang->getLL(
'editToView'), trim($tplRow[
'constants']) ? count(explode(LF, $tplRow[
'constants'])) : 0),
'constants', $tplRow[
'uid']);
298 $outCode .= $this->
tableRow(
$lang->getLL(
'setup'), sprintf(
$lang->getLL(
'editToView'), trim($tplRow[
'config']) ? count(explode(LF, $tplRow[
'config'])) : 0),
'config', $tplRow[
'uid']);
299 $outCode =
'<div class="table-fit"><table class="table table-striped table-hover">' . $outCode .
'</table></div>';
305 $tplRow[
'uid'] =>
'edit'
308 'createExtension' => 0,
311 $url = BackendUtility::getModuleUrl(
'record_edit', $urlParameters);
312 $title =
$lang->getLL(
'editTemplateRecord',
true);
313 $icon = $this->iconFactory->getIcon(
'actions-document-open',
Icon::SIZE_SMALL)->render();
314 $outCode .=
'<br /><a class="btn btn-default" href="' . htmlspecialchars(
$url)
315 .
'"><strong>' . $icon .
' ' . $title .
'</strong></a>';
316 $theOutput .=
'<div>' . $outCode .
'</div>';
319 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/tstemplate_info/class.tx_tstemplateinfo.php'][
'postOutputProcessingHook'])) {
320 $postOutputProcessingHook = &
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/tstemplate_info/class.tx_tstemplateinfo.php'][
'postOutputProcessingHook'];
321 if (is_array($postOutputProcessingHook)) {
322 $hookParameters = array(
323 'theOutput' => &$theOutput,
327 'numberOfRows' => $numberOfRows
329 foreach ($postOutputProcessingHook as $hookFunction) {
335 $theOutput .= $this->pObj->noTemplate(1);