Commit 1526c08a authored by Tino Goratsch's avatar Tino Goratsch

- made it possible to use custom layouts via the "core.controller.custom_template_variable" event

  --> the event listener needs to override the LAYOUT Smarty variable
parent b3eba1be
......@@ -81,7 +81,7 @@ trait DisplayActionTrait
* @return \ACP3\Core\View
*/
abstract protected function getView();
/**
* Gibt den Content-Type der anzuzeigenden Seiten zurück
*
......
......@@ -40,6 +40,10 @@ abstract class FrontendAction extends Core\Controller\WidgetAction
* @var \ACP3\Core\Modules\Helper\Action
*/
protected $actionHelper;
/**
* @var string
*/
private $layout = 'layout.tpl';
/**
* @param \ACP3\Core\Controller\Context\FrontendContext $context
......@@ -104,6 +108,7 @@ abstract class FrontendAction extends Core\Controller\WidgetAction
protected function addCustomTemplateVarsBeforeOutput()
{
$this->view->assign('BREADCRUMB', $this->breadcrumb->getBreadcrumb());
$this->view->assign('LAYOUT', $this->request->isAjax() ? 'system/ajax.tpl' : $this->getLayout());
$this->eventDispatcher->dispatch(
'core.controller.custom_template_variable',
......@@ -111,6 +116,25 @@ abstract class FrontendAction extends Core\Controller\WidgetAction
);
}
/**
* @return string
*/
public function getLayout()
{
return $this->layout;
}
/**
* @param string $layout
* @return $this
*/
public function setLayout($layout)
{
$this->layout = $layout;
return $this;
}
/**
* @return \Symfony\Component\HttpFoundation\Response
*/
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<div class="well well-small">
......@@ -9,4 +9,4 @@
{/foreach}
</ul>
</div>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -63,4 +63,4 @@
{include_js module="articles" file="admin/acp"}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/articles/index/delete"}" method="post">
......@@ -23,4 +23,4 @@
{redirect_message}
{include file="asset:system/datagrid.tpl" dataTable=$grid}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{$page.toc}
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if !empty($articles)}
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -48,4 +48,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/categories/index/delete"}" method="post">
......@@ -24,4 +24,4 @@
{redirect_message}
{include file="asset:system/datagrid.tpl" dataTable=$grid}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -43,4 +43,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -36,4 +36,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/comments/details/delete"}" method="post">
......@@ -22,4 +22,4 @@
{redirect_message}
{include file="asset:system/datagrid.tpl" dataTable=$grid}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/comments/index/delete"}" method="post">
......@@ -23,4 +23,4 @@
{redirect_message}
{include file="asset:system/datagrid.tpl" dataTable=$grid}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -43,4 +43,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -66,4 +66,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<dl>
......@@ -30,4 +30,4 @@
<p class="powered-by text-center">
{$powered_by}
</p>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -46,4 +46,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -36,4 +36,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/emoticons/index/delete"}" method="post">
......@@ -24,4 +24,4 @@
{redirect_message}
{include file="asset:system/datagrid.tpl" dataTable=$grid}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -43,4 +43,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<div class="alert alert-warning text-center">
{lang t="errors|access_denied"}
</div>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<div class="alert alert-warning text-center">
{lang t="errors|file_not_found"}
</div>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -35,4 +35,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -101,4 +101,4 @@
{include_js module="files" file="admin/acp"}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/files/index/delete"}" method="post">
......@@ -24,4 +24,4 @@
{redirect_message}
{include file="asset:system/datagrid.tpl" dataTable=$grid}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -54,4 +54,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<article>
......@@ -31,4 +31,4 @@
</section>
{/if}
</article>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($files)}
......@@ -26,4 +26,4 @@
<strong>{lang t="system|no_entries"}</strong>
</div>
{/if}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if !empty($categories)}
......@@ -22,4 +22,4 @@
<strong>{lang t="system|no_entries"}</strong>
</div>
{/if}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -37,4 +37,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/gallery/index/delete"}" method="post">
......@@ -24,4 +24,4 @@
{redirect_message}
{include file="asset:system/datagrid.tpl" dataTable=$grid}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -118,4 +118,4 @@
{include_js module="gallery" file="admin/index.settings"}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -41,4 +41,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<article>
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if !empty($galleries)}
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($pictures)}
......@@ -42,4 +42,4 @@
<strong>{lang t="gallery|no_pictures"}</strong>
</div>
{/if}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -40,4 +40,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/guestbook/index/delete"}" method="post">
......@@ -23,4 +23,4 @@
{redirect_message}
{include file="asset:system/datagrid.tpl" dataTable=$grid}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -92,4 +92,4 @@
{include_js module="guestbook" file="admin/index.settings"}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -57,4 +57,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if $overlay == 1}
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -32,4 +32,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/menus/items/delete"}" method="post">
......@@ -130,4 +130,4 @@
{include file="asset:system/mark.tpl"}
{/if}
{/if}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -98,4 +98,4 @@
{include_js module="menus" file="admin/acp"}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -94,4 +94,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/news/index/delete"}" method="post">
......@@ -24,4 +24,4 @@
{redirect_message}
{include file="asset:system/datagrid.tpl" dataTable=$grid}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -92,4 +92,4 @@
{include_js module="news" file="admin/index.settings"}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<article>
......@@ -28,4 +28,4 @@
</section>
{/if}
</article>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<div class="navbar navbar-default">
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/newsletter/accounts/delete"}" method="post">
......@@ -22,4 +22,4 @@
{redirect_message}
{include file="asset:system/datagrid.tpl" dataTable=$grid}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -49,4 +49,4 @@
{include_js module="newsletter" file="admin/acp"}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
<form action="{uri args="acp/newsletter/index/delete"}" method="post">
......@@ -28,4 +28,4 @@
{include_js module="system" file="forms"}
{/javascripts}
</form>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -40,4 +40,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($newsletter)}
......@@ -18,4 +18,4 @@
<strong>{lang t="newsletter|select_newsletter"}</strong>
</div>
{/if}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if !empty($newsletters)}
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -46,4 +46,4 @@
{javascripts}
{include_js module="system" file="forms"}
{/javascripts}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT}
{if isset($error_msg)}
......@@ -22,4 +22,4 @@
{javascripts}