Commit ef37890f authored by Tino Goratsch's avatar Tino Goratsch

use the same approach for the installer

parent 1526c08a
......@@ -7,6 +7,7 @@
namespace ACP3\Installer\Core\Controller;
use ACP3\Core\Controller\ActionInterface;
use ACP3\Core\Controller\DisplayActionTrait;
use ACP3\Core\Filesystem;
use ACP3\Core\Redirect;
......@@ -16,7 +17,7 @@ use ACP3\Core\Redirect;
*/
abstract class AbstractInstallerAction implements ActionInterface
{
use \ACP3\Core\Controller\DisplayActionTrait;
use DisplayActionTrait;
/**
* @var \Symfony\Component\DependencyInjection\ContainerInterface
......@@ -46,6 +47,10 @@ abstract class AbstractInstallerAction implements ActionInterface
* @var \Symfony\Component\HttpFoundation\Response
*/
protected $response;
/**
* @var string
*/
private $layout = 'layout.tpl';
/**
* @param \ACP3\Installer\Core\Controller\Context\InstallerContext $context
......@@ -160,6 +165,26 @@ abstract class AbstractInstallerAction implements ActionInterface
$this->request->getModule(),
$this->request->getController() . '_' . $this->request->getAction())
);
$this->view->assign('LAYOUT', $this->request->isAjax() ? 'ajax.tpl' : $this->getLayout());
}
/**
* @return string
*/
public function getLayout()
{
return $this->layout;
}
/**
* @param string $layout
* @return $this
*/
public function setLayout($layout)
{
$this->layout = $layout;
return $this;
}
private function setLanguage()
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT prepend}
<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 prepend}
<div class="alert alert-warning text-center">
{lang t="errors|server_unavailable"}
</div>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT prepend}
<p>
......@@ -16,4 +16,4 @@
<div class="well well-sm text-center">
<a href="{uri args="install/index/licence"}" class="btn btn-default">{lang t="install|forward"}</a>
</div>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT prepend}
{stylesheets}
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT prepend}
<div class="row">
......@@ -75,4 +75,4 @@
{/if}
</div>
{/if}
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT prepend}
<p>
......@@ -7,4 +7,4 @@
<div class="well well-sm text-center">
<a href="{uri args="install"}" class="btn btn-default">{lang t="install|back"}</a>
</div>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT prepend}
{if isset($error_msg)}
......@@ -14,7 +14,7 @@
<div class="tab-content">
<div id="tabs-1" class="tab-pane fade in active">
<div class="form-group">
<label for="db-host" class="col-sm-2 control-label">{lang t="install|db_hostname"}</label>
<label for="db-host" class="col-sm-2 control-label required">{lang t="install|db_hostname"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="db_host" id="db-host" value="{$form.db_host}" required>
......@@ -23,7 +23,7 @@
</div>
</div>
<div class="form-group">
<label for="db-user" class="col-sm-2 control-label">{lang t="install|db_username"}</label>
<label for="db-user" class="col-sm-2 control-label required">{lang t="install|db_username"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="db_user" id="db-user" value="{$form.db_user}" required>
......@@ -36,7 +36,7 @@
<input class="form-control" type="password" name="db_password" id="db-password" value=""></div>
</div>
<div class="form-group">
<label for="db-name" class="col-sm-2 control-label">{lang t="install|db_name"}</label>
<label for="db-name" class="col-sm-2 control-label required">{lang t="install|db_name"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="db_name" id="db-name" value="{$form.db_name}" required>
......@@ -51,27 +51,27 @@
</div>
<div id="tabs-2" class="tab-pane fade">
<div class="form-group">
<label for="user-name" class="col-sm-2 control-label">{lang t="install|nickname"}</label>
<label for="user-name" class="col-sm-2 control-label required">{lang t="install|nickname"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="user_name" id="user-name" value="{$form.user_name}" required>
</div>
</div>
<div class="form-group">
<label for="user-pwd" class="col-sm-2 control-label">{lang t="install|pwd"}</label>
<label for="user-pwd" class="col-sm-2 control-label required">{lang t="install|pwd"}</label>
<div class="col-sm-10">
<input class="form-control" type="password" name="user_pwd" id="user-pwd" required></div>
</div>
<div class="form-group">
<label for="user-pwd-wdh" class="col-sm-2 control-label">{lang t="install|pwd_repeat"}</label>
<label for="user-pwd-wdh" class="col-sm-2 control-label required">{lang t="install|pwd_repeat"}</label>
<div class="col-sm-10">
<input class="form-control" type="password" name="user_pwd_wdh" id="user-pwd-wdh" required>
</div>
</div>
<div class="form-group">
<label for="mail" class="col-sm-2 control-label">{lang t="install|email"}</label>
<label for="mail" class="col-sm-2 control-label required">{lang t="install|email"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="mail" id="mail" value="{$form.mail}" required>
......@@ -80,14 +80,14 @@
</div>
<div id="tabs-3" class="tab-pane fade">
<div class="form-group">
<label for="title" class="col-sm-2 control-label">{lang t="install|site_title"}</label>
<label for="title" class="col-sm-2 control-label required">{lang t="install|site_title"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="title" id="title" value="{$form.title}" required>
</div>
</div>
<div class="form-group">
<label for="date-format-long" class="col-sm-2 control-label">{lang t="install|date_format_long"}</label>
<label for="date-format-long" class="col-sm-2 control-label required">{lang t="install|date_format_long"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="date_format_long" id="date-format-long" value="{$form.date_format_long}" maxlength="20" required>
......@@ -96,17 +96,17 @@
</div>
</div>
<div class="form-group">
<label for="date-format-short" class="col-sm-2 control-label">{lang t="install|date_format_short"}</label>
<label for="date-format-short" class="col-sm-2 control-label required">{lang t="install|date_format_short"}</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="date_format_short" id="date-format-short" value="{$form.date_format_short}" maxlength="20" required>
</div>
</div>
<div class="form-group">
<label for="date-time-zone" class="col-sm-2 control-label">{lang t="install|time_zone"}</label>
<label for="date-time-zone" class="col-sm-2 control-label required">{lang t="install|time_zone"}</label>
<div class="col-sm-10">
<select class="form-control" name="date_time_zone" id="date-time-zone">
<select class="form-control" name="date_time_zone" id="date-time-zone" required>
{foreach $time_zones as $key => $values}
<optgroup label="{$key}">
{foreach $values as $country => $value}
......
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT prepend}
<p>
......@@ -11,4 +11,4 @@
<a href="{$ROOT_DIR}" class="btn btn-default">{lang t="install|go_to_website"}</a>
<a href="{$ROOT_DIR}acp/" class="btn btn-default">{lang t="install|log_into_admin_panel"}</a>
</div>
{/block}
\ No newline at end of file
{/block}
{extends file="asset:layout.tpl"}
{extends file="asset:`$LAYOUT`"}
{block CONTENT prepend}
{if isset($results)}
......
......@@ -6,6 +6,12 @@
{/foreach}
</ul>
{if $error_box.non_integer_keys === true}
<script type="text/javascript" src="{$ROOT_DIR}ACP3/Modules/System/Resources/Assets/js/error_box.js"></script>
{if $IS_AJAX === true}
<script type="text/javascript" src="{$ROOT_DIR}ACP3/Modules/ACP3/System/Resources/Assets/js/error_box.js"></script>
{else}
{javascripts}
<script type="text/javascript" src="{$ROOT_DIR}ACP3/Modules/ACP3/System/Resources/Assets/js/error_box.js"></script>
{/javascripts}
{/if}
{/if}
</div>
\ No newline at end of file
</div>
{if $IS_AJAX === true}
{include file="asset:ajax.tpl" inline}
{else}
<!DOCTYPE html>
<html lang="{$LANG}" dir="{$LANG_DIRECTION}">
<head>
<title>{$TITLE} | {$PAGE_TITLE}</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{$ROOT_DIR}ACP3/Modules/ACP3/System/Resources/Assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{$DESIGN_PATH}Assets/css/style.css">
<!-- STYLESHEETS -->
<!--[if lt IE 9]>
<script src="{$ROOT_DIR}ACP3/Modules/ACP3/System/Resources/Assets/js/libs/html5shiv.js"></script>
<![endif]-->
</head>
<!DOCTYPE html>
<html lang="{$LANG}" dir="{$LANG_DIRECTION}">
<head>
<title>{$TITLE} | {$PAGE_TITLE}</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{$ROOT_DIR}ACP3/Modules/ACP3/System/Resources/Assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{$DESIGN_PATH}Assets/css/style.css">
<!-- STYLESHEETS -->
<!--[if lt IE 9]>
<script src="{$ROOT_DIR}ACP3/Modules/ACP3/System/Resources/Assets/js/libs/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<h1 id="logo" class="hidden-xs">
<img src="{$DESIGN_PATH}Assets/img/logo.png"
srcset="{$DESIGN_PATH}Assets/img/logo.png 1x, {$DESIGN_PATH}Assets/img/logo@2x.png 2x"
alt="{$PAGE_TITLE}">
</h1>
<nav id="main-navigation" class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
<span class="sr-only">{lang t="install|toggle_navigation"}</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand hidden-sm hidden-md hidden-lg">
<img src="{$DESIGN_PATH}Assets/img/logo.png"
srcset="{$DESIGN_PATH}Assets/img/logo.png 1x, {$DESIGN_PATH}Assets/img/logo@2x.png 2x"
alt="{$PAGE_TITLE}">
</span>
</div>
<div id="navbar-collapse" class="collapse navbar-collapse">
{if isset($navbar)}
<ul class="nav navbar-nav">
{foreach $navbar as $key => $value}
<li{if $value.active === true} class="active"{/if}><a href="#">{$value.lang}</a></li>
<body>
<div class="container">
<h1 id="logo" class="hidden-xs">
<img src="{$DESIGN_PATH}Assets/img/logo.png"
srcset="{$DESIGN_PATH}Assets/img/logo.png 1x, {$DESIGN_PATH}Assets/img/logo@2x.png 2x"
alt="{$PAGE_TITLE}">
</h1>
<nav id="main-navigation" class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
<span class="sr-only">{lang t="install|toggle_navigation"}</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand hidden-sm hidden-md hidden-lg">
<img src="{$DESIGN_PATH}Assets/img/logo.png"
srcset="{$DESIGN_PATH}Assets/img/logo.png 1x, {$DESIGN_PATH}Assets/img/logo@2x.png 2x"
alt="{$PAGE_TITLE}">
</span>
</div>
<div id="navbar-collapse" class="collapse navbar-collapse">
{if isset($navbar)}
<ul class="nav navbar-nav">
{foreach $navbar as $key => $value}
<li{if $value.active === true} class="active"{/if}><a href="#">{$value.lang}</a></li>
{/foreach}
</ul>
{/if}
<form action="{$REQUEST_URI}" method="post" id="languages" class="navbar-form navbar-right">
<div class="form-group">
<select name="lang"
id="lang"
class="form-control"
title="{lang t="install|select_language"}"
data-change-language-warning="{lang t="install|form_change_warning"}">
{foreach $LANGUAGES as $row}
<option value="{$row.language}"{$row.selected}>{$row.name}</option>
{/foreach}
</ul>
{/if}
<form action="{$REQUEST_URI}" method="post" id="languages" class="navbar-form navbar-right">
<div class="form-group">
<select name="lang"
id="lang"
class="form-control"
title="{lang t="install|select_language"}"
data-change-language-warning="{lang t="install|form_change_warning"}">
{foreach $LANGUAGES as $row}
<option value="{$row.language}"{$row.selected}>{$row.name}</option>
{/foreach}
</select>
</div>
<input type="submit" name="languages" value="{lang t="install|submit"}" class="btn btn-primary">
</form>
</div>
</nav>
<main role="main" id="content">
<h2>{$TITLE}</h2>
{block CONTENT}{/block}
</main>
</div>
<script type="text/javascript" src="{$ROOT_DIR}ACP3/Modules/ACP3/System/Resources/Assets/js/libs/jquery.min.js"></script>
<script type="text/javascript" src="{$ROOT_DIR}ACP3/Modules/ACP3/System/Resources/Assets/js/libs/bootstrap.min.js"></script>
<script type="text/javascript" src="{$DESIGN_PATH}Assets/js/language-switcher.js"></script>
<!-- JAVASCRIPTS -->
</body>
</html>
{/if}
</select>
</div>
<input type="submit" name="languages" value="{lang t="install|submit"}" class="btn btn-primary">
</form>
</div>
</nav>
<main role="main" id="content">
<h2>{$TITLE}</h2>
{block CONTENT}{/block}
</main>
</div>
<script type="text/javascript" src="{$ROOT_DIR}ACP3/Modules/ACP3/System/Resources/Assets/js/libs/jquery.min.js"></script>
<script type="text/javascript" src="{$ROOT_DIR}ACP3/Modules/ACP3/System/Resources/Assets/js/libs/bootstrap.min.js"></script>
<script type="text/javascript" src="{$DESIGN_PATH}Assets/js/language-switcher.js"></script>
<!-- JAVASCRIPTS -->
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment