2 namespace TYPO3\CMS\Tstemplate\Controller;
110 $this->
getLanguageService()->includeLLFile(
'EXT:tstemplate/Resources/Private/Language/locallang.xlf');
112 $this->MCONF = array(
113 'name' => $this->moduleName
115 $this->moduleTemplate->addJavaScriptCode(
118 function jumpToUrl(URL) {
119 window.location.href = URL;
138 $this->perms_clause = $this->
getBackendUser()->getPagePermsClause(1);
146 public function clearCache()
151 $tce->stripslashes_values =
false;
152 $tce->start(array(), array());
153 $tce->clear_cacheCmd(
'all');
162 public function main()
174 $this->access = is_array($this->pageinfo);
182 if ($this->
id && $this->access) {
183 $urlParameters = array(
187 $aHref = BackendUtility::getModuleUrl(
'web_ts', $urlParameters);
190 $this->moduleTemplate->addJavaScriptCode(
191 'TSTemplateInlineJS',
'
192 function uFormUrl(aname) {
195 function brPoint(lnumber,t) {
196 window.location.href = ' .
GeneralUtility::quoteJSvalue(($aHref .
'&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateObjectBrowserModuleFunctionController&SET[ts_browser_type]=')) .
'+(t?"setup":"const")+"&breakPointLN="+lnumber;
199 if (top.fsMod) top.fsMod.recentIds["web"] = ' . $this->
id .
';
201 $this->moduleTemplate->getPageRenderer()->addCssInlineBlock(
202 'TSTemplateInlineStyle',
'
203 TABLE#typo3-objectBrowser { width: 100%; margin-bottom: 24px; }
204 TABLE#typo3-objectBrowser A { text-decoration: none; }
205 TABLE#typo3-objectBrowser .comment { color: maroon; font-weight: bold; }
206 .ts-typoscript { width: 100%; }
207 .tsob-search-submit {margin-left: 3px; margin-right: 3px;}
208 .tst-analyzer-options { margin:5px 0; }
211 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/ClickMenu');
213 $this->content =
'<form action="' . htmlspecialchars($aHref) .
'" method="post" enctype="multipart/form-data" id="TypoScriptTemplateModuleController" name="editForm" class="form">';
214 $this->content .= $this->doc->header(
$lang->getLL(
'moduleTitle'));
219 $this->content .=
'</form>';
223 'pages.uid, count(*) AS count, max(sys_template.root) AS root_max_val, min(sys_template.root) AS root_min_val',
224 'pages,sys_template',
225 'pages.uid=sys_template.pid'
231 'pages.pid, pages.sorting'
234 foreach ($records as $record) {
238 $table =
'<div class="table-fit"><table class="table table-striped table-hover" id="ts-overview">' .
241 '<th>' .
$lang->getLL(
'pageName') .
'</th>' .
242 '<th>' .
$lang->getLL(
'templates') .
'</th>' .
243 '<th>' .
$lang->getLL(
'isRoot') .
'</th>' .
244 '<th>' .
$lang->getLL(
'isExt') .
'</th>' .
247 '<tbody>' . implode(
'', $this->
renderList($pArray)) .
'</tbody>' .
250 $this->content = $this->doc->header(
$lang->getLL(
'moduleTitle'));
251 $this->content .=
'<div><p class="lead">' .
$lang->getLL(
'overview') .
'</p>' . $table .
'</div>';
267 $menu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
268 $menu->setIdentifier(
'WebFuncJumpMenu');
269 foreach ($this->MOD_MENU[
'function'] as $controller => $title) {
273 BackendUtility::getModuleUrl(
278 'function' => $controller
284 if ($controller === $this->MOD_SETTINGS[
'function']) {
285 $item->setActive(
true);
287 $menu->addMenuItem($item);
289 $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
311 $this->moduleTemplate->setContent($this->content);
312 $response->
getBody()->write($this->moduleTemplate->renderContent());
335 $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
338 if ($this->
id && $this->access) {
340 $viewButton = $buttonBar->makeLinkButton()
343 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.showPage',
true))
344 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-view',
Icon::SIZE_SMALL));
346 if ($this->extClassConf[
'name'] === TypoScriptTemplateInformationModuleFunctionController::class) {
348 $urlParameters = array(
351 'createExtension' =>
'new'
355 $saveButton = $buttonBar->makeInputButton()
356 ->setName(
'_savedok')
358 ->setForm(
'TypoScriptTemplateModuleController')
359 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-save',
Icon::SIZE_SMALL))
360 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.saveDoc',
true));
362 $saveAndCloseButton = $buttonBar->makeInputButton()
363 ->setName(
'_saveandclosedok')
365 ->setForm(
'TypoScriptTemplateModuleController')
366 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc',
true))
367 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-save-close',
Icon::SIZE_SMALL));
369 $splitButtonElement = $buttonBar->makeSplitButton()
370 ->addItem($saveButton)
371 ->addItem($saveAndCloseButton);
376 $closeButton = $buttonBar->makeLinkButton()
377 ->setHref(BackendUtility::getModuleUrl(
'web_ts', array(
'id' => $this->
id)))
378 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.closeDoc',
true))
379 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-close',
Icon::SIZE_SMALL));
380 $buttonBar->addButton($closeButton);
382 $newButton = $buttonBar->makeLinkButton()
383 ->setHref(BackendUtility::getModuleUrl(
'web_ts', $urlParameters))
384 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle',
true))
385 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-new',
Icon::SIZE_SMALL));
386 $buttonBar->addButton($newButton);
388 }
elseif ($this->extClassConf[
'name'] === TypoScriptTemplateConstantEditorModuleFunctionController::class && !empty($this->MOD_MENU[
'constant_editor_cat'])) {
390 $saveButton = $buttonBar->makeInputButton()
391 ->setName(
'_savedok')
393 ->setForm(
'TypoScriptTemplateModuleController')
394 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.saveDoc',
true))
395 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-save',
Icon::SIZE_SMALL))
396 ->setShowLabelText(
true);
397 $buttonBar->addButton($saveButton);
398 }
elseif ($this->extClassConf[
'name'] === TypoScriptTemplateObjectBrowserModuleFunctionController::class) {
399 if (!empty($this->sObj)) {
401 $urlParameters = array(
404 $backButton = $buttonBar->makeLinkButton()
405 ->setHref(BackendUtility::getModuleUrl(
'web_ts', $urlParameters))
406 ->setClasses(
'typo3-goBack')
407 ->setTitle(
$lang->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.goBack',
true))
408 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-view-go-back',
Icon::SIZE_SMALL));
409 $buttonBar->addButton($backButton);
414 $shortcutButton = $buttonBar->makeShortcutButton()
415 ->setModuleName($this->MCONF[
'name'])
416 ->setGetVariables([
'id',
'M']);
417 $buttonBar->addButton($shortcutButton);
430 $urlParameters = array(
433 $aHref = BackendUtility::getModuleUrl(
'web_ts', $urlParameters);
435 $title =
'<a href="' . htmlspecialchars(($aHref .
'&e[' . $onlyKey .
']=1&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateInformationModuleFunctionController')) .
'">' . htmlspecialchars($title) .
'</a>';
437 $title =
'<a href="' . htmlspecialchars(($aHref .
'&e[constants]=1&e[config]=1&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateInformationModuleFunctionController')) .
'">' . htmlspecialchars($title) .
'</a>';
448 public function noTemplate($newStandardTemplate = 0)
456 $tmpl->tt_track =
false;
461 $title =
$lang->getLL(
'noTemplate');
462 $message =
'<p>' .
$lang->getLL(
'noTemplateDescription') .
'<br />' .
$lang->getLL(
'createTemplateToEditConfiguration') .
'</p>';
466 $view->assignMultiple(array(
468 'message' => $message,
471 $theOutput = $view->render();
474 if ($newStandardTemplate) {
477 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][TypoScriptTemplateModuleController::class][
'newStandardTemplateView']
482 'selectorHtml' => &$selector,
483 'staticsText' => &$staticsText
486 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][TypoScriptTemplateModuleController::class][
'newStandardTemplateView'],
490 $selector = $reference[
'selectorHtml'];
491 $staticsText = $reference[
'staticsText'];
493 $selector =
'<input type="hidden" name="createStandard" value="" />';
497 $theOutput .=
'<h2>' .
$lang->getLL(
'newWebsite',
true) . $staticsText .
'</h2>';
498 $theOutput .=
'<div><p>' .
$lang->getLL(
'newWebsiteDescription') .
'</p>' . $selector
499 .
'<input class="btn btn-primary" type="submit" form="TypoScriptTemplateModuleController" name="newWebsite" value="'
500 .
$lang->getLL(
'newWebsiteAction') .
'" /></div>';
503 $theOutput .=
'<h2>' .
$lang->getLL(
'extTemplate') .
'</h2>';
504 $theOutput .=
'<div><p>' .
$lang->getLL(
'extTemplateDescription') .
'</p>' .
'<input class="btn btn-default" type="submit" form="TypoScriptTemplateModuleController" name="createExtension" value="' .
$lang->getLL(
'extTemplateAction') .
'" /></div>';
507 $first = $tmpl->ext_prevPageWithTemplate($this->
id, $this->perms_clause);
509 $urlParameters = array(
510 'id' => $first[
'uid']
512 $aHref = BackendUtility::getModuleUrl(
'web_ts', $urlParameters);
513 $theOutput .=
'<h3>' .
$lang->getLL(
'goToClosest') .
'</h3>';
514 $theOutput .=
'<div>' . sprintf(
'<p>' .
$lang->getLL(
'goToClosestDescription') .
'</p>%s' .
$lang->getLL(
'goToClosestAction') .
'%s', htmlspecialchars($first[
'title']), $first[
'uid'],
'<a class="btn btn-default" href="' . htmlspecialchars($aHref) .
'">',
'</a>') .
'</div>';
524 public function templateMenu()
531 $tmpl->tt_track =
false;
534 $all = $tmpl->ext_getAllTemplates($this->
id, $this->perms_clause);
535 if (count($all) > 1) {
536 $this->MOD_MENU[
'templatesOnPage'] = array();
537 foreach ($all as $d) {
538 $this->MOD_MENU[
'templatesOnPage'][$d[
'uid']] = $d[
'title'];
542 return BackendUtility::getFuncMenu($this->
id,
'SET[templatesOnPage]', $this->MOD_SETTINGS[
'templatesOnPage'], $this->MOD_MENU[
'templatesOnPage']);
552 public function createTemplate(
$id, $actTemplateId = 0)
557 $tce->stripslashes_values =
false;
560 $recData[
'sys_template'][
'NEW'] = array(
561 'pid' => $actTemplateId ? -1 * $actTemplateId :
$id,
564 $tce->start($recData, array());
565 $tce->process_datamap();
569 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][TypoScriptTemplateModuleController::class][
'newStandardTemplateHandler']
572 'recData' => &$recData,
576 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][TypoScriptTemplateModuleController::class][
'newStandardTemplateHandler'],
580 $recData = $reference[
'recData'];
582 $recData[
'sys_template'][
'NEW'] = array(
589 # Default PAGE object:
592 page.10.value = HELLO WORLD!
596 $tce->start($recData, array());
597 $tce->process_datamap();
598 $tce->clear_cacheCmd(
'all');
600 return $tce->substNEWwithIDs[
'NEW'];
616 if (!$rlArr[0][
'uid']) {
619 $cEl = current($rlArr);
620 $pArray[$cEl[
'uid']] = htmlspecialchars($cEl[
'title']);
622 if (!empty($rlArr)) {
623 if (!isset($pArray[($cEl[
'uid'] .
'.')])) {
624 $pArray[$cEl[
'uid'] .
'.'] = array();
628 $pArray[$cEl[
'uid'] .
'_'] = $row;
640 public function renderList($pArray, $lines = array(), $c = 0)
644 if (!is_array($pArray)) {
648 $statusCheckedIcon = $this->moduleTemplate->getIconFactory()->getIcon(
'status-status-checked',
Icon::SIZE_SMALL)->render();
649 foreach ($pArray as $k => $v) {
651 if (isset($pArray[$k .
'_'])) {
652 $lines[] =
'<tr class="' . ($i++ % 2 == 0 ?
'bgColor4' :
'bgColor6') .
'">
654 <td>' . $pArray[($k .
'_')][
'count'] .
'</td>
655 <td>' . ($pArray[$k .
'_'][
'root_max_val'] > 0 ? $statusCheckedIcon :
' ') .
'</td>
656 <td>' . ($pArray[$k .
'_'][
'root_min_val'] == 0 ? $statusCheckedIcon :
' ') .
'</td>
659 $lines[] =
'<tr class="' . ($i++ % 2 == 0 ?
'bgColor4' :
'bgColor6') .
'">
666 $lines = $this->
renderList($pArray[$k .
'.'], $lines, $c + 1);