diff --git a/composer.json b/composer.json
index dd87d7117..37586084b 100644
--- a/composer.json
+++ b/composer.json
@@ -21,6 +21,8 @@
"symfony/routing" : "2.2.*",
"symfony/filesystem" : "2.2.*",
"symfony/yaml" : "2.2.*",
+ "symfony/translation" : "2.2.*",
+
"symfony-cmf/routing": "1.0.0",
"symfony/form": "2.2.*",
@@ -30,7 +32,8 @@
"smarty/smarty": "v3.1.13",
"kriswallsmith/assetic": "1.2.*@dev",
- "leafo/lessphp": "0.3.*@dev"
+ "leafo/lessphp": "0.3.*@dev",
+ "ptachoire/cssembed": "dev-master"
},
"require-dev" : {
"fzaninotto/faker": "dev-master"
diff --git a/core/lib/Thelia/Admin/Controller/BaseAdminController.php b/core/lib/Thelia/Admin/Controller/BaseAdminController.php
index edd6a81dd..7812057cc 100644
--- a/core/lib/Thelia/Admin/Controller/BaseAdminController.php
+++ b/core/lib/Thelia/Admin/Controller/BaseAdminController.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Admin\Controller;
@@ -25,6 +25,9 @@ namespace Thelia\Admin\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Thelia\Admin\Templating\Template;
+use Thelia\Core\Template\SmartyParser;
+use Symfony\Component\Routing\RequestContext;
+use Symfony\Component\DependencyInjection\ContainerAware;
/**
*
@@ -34,24 +37,23 @@ use Thelia\Admin\Templating\Template;
* @author Franck Allimant
*/
-class BaseAdminController
+class BaseAdminController extends ContainerAware
{
protected function render($templateName, $args = array()) {
- $tpl = new Template();
+ $parser = $this->container->get('thelia.admin.parser');
- $data = $tpl->render($templateName, $args);
+ $args = array('lang' => 'fr');
- return $data;
+ return $parser->render($templateName, $args);
}
public function indexAction()
{
- $rep = new Response();
+ $resp = new Response();
- $rep->setContent($this->render('login'));
+ $resp->setContent($this->render('login.html'));
- return $rep;
+ return $resp;
}
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Admin/Template/AdminSmartyParser.php b/core/lib/Thelia/Admin/Template/AdminSmartyParser.php
new file mode 100644
index 000000000..ac2ba53b0
--- /dev/null
+++ b/core/lib/Thelia/Admin/Template/AdminSmartyParser.php
@@ -0,0 +1,46 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Admin\Template;
+
+use Thelia\Core\Template\SmartyParser;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+// smarty configuration
+class AdminSmartyParser extends SmartyParser
+{
+ public function __construct(ContainerInterface $container, $template = false)
+ {
+ $this->template = $template == false ? 'admin/default' : $template;
+
+ parent::__construct($container, $template);
+ }
+
+ public function render($realTemplateName, $parameters) {
+
+ $this->assign($parameters);
+
+ return $this->fetch($realTemplateName);
+ }
+}
+?>
\ No newline at end of file
diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml
index bcfc0bcf0..bb6da1057 100644
--- a/core/lib/Thelia/Config/Resources/config.xml
+++ b/core/lib/Thelia/Config/Resources/config.xml
@@ -18,6 +18,7 @@
+
@@ -26,9 +27,23 @@
-
+
+
+
+
-
+
+
+
+ %tpex.loop%
+
+
+
+
%tpex.loop%
diff --git a/core/lib/Thelia/Config/Resources/routing.xml b/core/lib/Thelia/Config/Resources/routing.xml
index 78a5ff5d4..8f9a335d3 100644
--- a/core/lib/Thelia/Config/Resources/routing.xml
+++ b/core/lib/Thelia/Config/Resources/routing.xml
@@ -20,6 +20,10 @@
+
+
+
+
diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml
index 8a76ba906..8ef577f13 100644
--- a/core/lib/Thelia/Config/Resources/routing/admin.xml
+++ b/core/lib/Thelia/Config/Resources/routing/admin.xml
@@ -5,6 +5,6 @@
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
- \Thelia\Admin\Controller\BaseAdminController::indexAction
+ Thelia\Admin\Controller\BaseAdminController::indexAction
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Controller/ControllerResolver.php b/core/lib/Thelia/Core/Controller/ControllerResolver.php
new file mode 100644
index 000000000..deb23b1b7
--- /dev/null
+++ b/core/lib/Thelia/Core/Controller/ControllerResolver.php
@@ -0,0 +1,74 @@
+
+ * @author Franck Allimant
+ */
+class ControllerResolver extends BaseControllerResolver
+{
+ protected $container;
+
+ /**
+ * Constructor.
+ *
+ * @param ContainerInterface $container A ContainerInterface instance
+ * @param LoggerInterface $logger A LoggerInterface instance
+ */
+ public function __construct(ContainerInterface $container, LoggerInterface $logger = null)
+ {
+ $this->container = $container;
+
+ parent::__construct($logger);
+ }
+
+ /**
+ * Returns a callable for the given controller.
+ *
+ * @param string $controller A Controller string
+ *
+ * @return mixed A PHP callable
+ *
+ * @throws \LogicException When the name could not be parsed
+ * @throws \InvalidArgumentException When the controller class does not exist
+ */
+ protected function createController($controller)
+ {
+ if (false === strpos($controller, '::')) {
+ $count = substr_count($controller, ':');
+ if (2 == $count) {
+ // controller in the a:b:c notation then
+ $controller = $this->parser->parse($controller);
+ } elseif (1 == $count) {
+ // controller in the service:method notation
+ list($service, $method) = explode(':', $controller, 2);
+
+ return array($this->container->get($service), $method);
+ } else {
+ throw new \LogicException(sprintf('Unable to parse the controller name "%s".', $controller));
+ }
+ }
+
+ list($class, $method) = explode('::', $controller, 2);
+
+ if (!class_exists($class)) {
+ throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
+ }
+
+ $controller = new $class();
+ if ($controller instanceof ContainerAwareInterface) {
+ $controller->setContainer($this->container);
+ }
+
+ return array($controller, $method);
+ }
+}
diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php
index 594840b77..0f9341d4b 100644
--- a/core/lib/Thelia/Core/EventListener/ViewListener.php
+++ b/core/lib/Thelia/Core/EventListener/ViewListener.php
@@ -67,7 +67,7 @@ class ViewListener implements EventSubscriberInterface
*/
public function onKernelView(GetResponseForControllerResultEvent $event)
{
- $parser = $this->container->get('parser');
+ $parser = $this->container->get('thelia.parser');
try {
$content = $parser->getContent();
diff --git a/core/lib/Thelia/Core/Template/Assets/AsseticManager.php b/core/lib/Thelia/Core/Template/Assets/AsseticManager.php
index 6a935355f..e2976362f 100644
--- a/core/lib/Thelia/Core/Template/Assets/AsseticManager.php
+++ b/core/lib/Thelia/Core/Template/Assets/AsseticManager.php
@@ -34,13 +34,6 @@ use Assetic\Cache\FilesystemCache;
class AsseticManager {
- protected $options;
-
- public function __construct($_options = array()) {
-
- $this->options = $_options;
- }
-
/**
* Generates assets from $asset_path in $output_path, using $filters.
*
diff --git a/core/lib/Thelia/Core/Template/Assets/SmartyAssetsManager.php b/core/lib/Thelia/Core/Template/Assets/SmartyAssetsManager.php
new file mode 100644
index 000000000..50a5e3ae2
--- /dev/null
+++ b/core/lib/Thelia/Core/Template/Assets/SmartyAssetsManager.php
@@ -0,0 +1,85 @@
+. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Core\Template\Assets;
+
+use Thelia\Core\Template\Assets\AsseticManager;
+
+class SmartyAssetsManager {
+
+ const ASSET_TYPE_AUTO = '';
+
+ private $assetic_manager;
+
+ private $web_root;
+ private $path_relative_to_web_root;
+
+ /**
+ *
+ * @param string $web_root the disk path to the web root
+ * @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated
+ */
+ public function __construct($web_root, $path_relative_to_web_root) {
+
+ $this->web_root = $web_root;
+ $this->path_relative_to_web_root = $path_relative_to_web_root;
+
+ $this->assetic_manager = new AsseticManager();
+ }
+
+ public function processSmartyPluginCall($assetType, $params, $content, \Smarty_Internal_Template $template, &$repeat) {
+
+ // Opening tag (first call only)
+ if ($repeat) {
+ $file = $params['file'];
+ $filters = isset($params['filters']) ? $params['filters'] : '';
+ $debug = isset($params['debug']) ? trim(strtolower($params['debug'])) == 'true' : false;
+
+ // Get template base path
+ $tpl_path = $template->source->filepath;
+
+ // Get basedir
+ $tpl_dir = dirname($tpl_path);
+
+ // Create absolute dir path
+ $asset_dir = realpath($tpl_dir.'/'.dirname($file));
+ $asset_file = basename($file);
+
+ if ($asset_dir === false) throw new \Exception("Failed to get real path of '".$tpl_dir.'/'.dirname($file)."'");
+
+ $url = $this->assetic_manager->asseticize(
+ $asset_dir.'/'.$asset_file,
+ $this->web_root."/".$this->path_relative_to_web_root,
+ $this->path_relative_to_web_root,
+ $assetType,
+ $filters,
+ $debug
+ );
+
+ $template->assign('asset_url', $url);
+ }
+ else if (isset($content)) {
+ return $content;
+ }
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Template/SmartyParser.php b/core/lib/Thelia/Core/Template/SmartyParser.php
index cbec6e77c..4cbb48862 100644
--- a/core/lib/Thelia/Core/Template/SmartyParser.php
+++ b/core/lib/Thelia/Core/Template/SmartyParser.php
@@ -3,15 +3,20 @@
namespace Thelia\Core\Template;
use Symfony\Component\DependencyInjection\ContainerInterface;
-use Thelia\Core\Template\ParserInterface;
-use \Smarty;
-use Thelia\Core\Template\Loop\Category;
+use \Smarty;
+
+use Thelia\Core\Template\ParserInterface;
+use Thelia\Core\Template\Loop\Category;
+use Thelia\Tpex\Element\Loop\BaseLoop;
+use Thelia\Core\Template\Assets\SmartyAssetsManager;
+
+/**
+ *
+ * @author Franck Allimant
+ */
class SmartyParser extends Smarty implements ParserInterface {
- /**
- * @var Symfony\Component\DependencyInjection\ContainerInterface
- */
protected $container;
protected $template = "smarty-sample";
@@ -20,37 +25,271 @@ class SmartyParser extends Smarty implements ParserInterface {
protected $loopDefinition = array();
- public function __construct(ContainerInterface $container)
+ protected $asset_manager = null; // Lazy loading
+
+ /**
+ * @var Symfony\Component\DependencyInjection\ContainerInterface
+ */
+ public function __construct(ContainerInterface $container, $template = false)
{
parent::__construct();
$this->container = $container;
+ // Configure basic Smarty parameters
+
$compile_dir = THELIA_ROOT . 'cache/smarty/compile';
if (! is_dir($compile_dir)) @mkdir($compile_dir, 0777, true);
$cache_dir = THELIA_ROOT . 'cache/smarty/cache';
if (! is_dir($cache_dir)) @mkdir($cache_dir, 0777, true);
+ if ($template != false) $this->template = $template;
+
$this->setTemplateDir(THELIA_TEMPLATE_DIR.$this->template);
$this->setCompileDir($compile_dir);
$this->setCacheDir($cache_dir);
- $this->registerPlugin('block', 'loop', array($this, 'theliaLoop'));
- $this->registerPlugin('block', 'empty', array($this, 'theliaEmpty'));
- $this->registerPlugin('block', 'notempty', array($this, 'theliaNotEmpty'));
-
-
- // Prevent ErrorException: Notice: Undefined index
+ // Prevent smarty ErrorException: Notice: Undefined index bla bla bla...
$this->error_reporting = E_ALL ^ E_NOTICE;
+ // The default HTTP status
$this->status = 200;
+
+ // Register Thelia base block plugins
+ $this->registerPlugin('block', 'loop' , array($this, 'theliaLoop'));
+ $this->registerPlugin('block', 'elseloop' , array($this, 'theliaElseloop'));
+ $this->registerPlugin('block', 'ifloop' , array($this, 'theliaIfLoop'));
+
+ // Register translation function 'intl'
+ $this->registerPlugin('function', 'intl', array($this, 'theliaTranslate'));
+
+ // Register Thelia modules inclusion function 'thelia_module'
+ $this->registerPlugin('function', 'thelia_module', array($this, 'theliaModule'));
+
+ // Register asset management block plugins
+ $this->registerPlugin('block', 'stylesheets', array($this, 'theliaBlockStylesheets'));
+ $this->registerPlugin('block', 'javascripts', array($this, 'theliaBlockJavascripts'));
+ $this->registerPlugin('block', 'images' , array($this, 'theliaBlockImages'));
}
/**
+ * Process {loop name="loop name" type="loop type" ... } ... {/loop} block
*
- * associative array containing information for loop execution
+ * @param unknown $params
+ * @param unknown $content
+ * @param unknown $template
+ * @param unknown $repeat
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function theliaLoop($params, $content, $template, &$repeat) {
+
+ if (empty($params['name']))
+ throw new \InvalidArgumentException("Missing 'name' parameter in loop arguments");
+
+ if (empty($params['type']))
+ throw new \InvalidArgumentException("Missing 'type' parameter in loop arguments");
+
+ $name = $params['name'];
+
+ if ($content === null) {
+
+ $loop = $this->createLoopInstance(strtolower($params['type']));
+
+ $this->getLoopArgument($loop, $params);
+
+ $loopResults = $loop->exec();
+
+ $template->assignByRef($name, $loopResults);
+ }
+ else {
+
+ $loopResults = $template->getTemplateVars($name);
+
+ $loopResults->next();
+ }
+
+ if ($loopResults->valid()) {
+
+ $loopResultRow = $loopResults->current();
+
+ foreach($loopResultRow->getVarVal() as $var => $val) {
+
+ $template->assign(substr($var, 1), $val);
+
+ $template->assign('__COUNT__', 1 + $loopResults->key());
+ $template->assign('__TOTAL__', $loopResults->getCount());
+ }
+
+ $repeat = $loopResults->valid();
+ }
+
+ if ($content !== null) {
+
+ if ($loopResults->isEmpty()) $content = "";
+
+ return $content;
+ }
+ }
+
+
+ /**
+ * Process {elseloop rel="loopname"} ... {/elseloop} block
+ *
+ * @param unknown $params
+ * @param unknown $content
+ * @param unknown $template
+ * @param unknown $repeat
+ * @return Ambigous
+ */
+ public function theliaElseloop($params, $content, $template, &$repeat) {
+
+ // When encoutering close tag, check if loop has results.
+ if ($repeat === false) {
+ return $this->checkEmptyLoop($params, $template) ? $content : '';
+ }
+ }
+
+
+ /**
+ * Process {ifloop rel="loopname"} ... {/ifloop} block
+ *
+ * @param unknown $params
+ * @param unknown $content
+ * @param unknown $template
+ * @param unknown $repeat
+ * @return Ambigous
+ */
+ public function theliaIfLoop($params, $content, $template, &$repeat) {
+
+ // When encountering close tag, check if loop has results.
+ if ($repeat === false) {
+ return $this->checkEmptyLoop($params, $template) ? '' : $content;
+ }
+ }
+
+ /**
+ * Process translate function
+ *
+ * @param unknown $params
+ * @param unknown $smarty
+ * @return string
+ */
+ public function theliaTranslate($params, &$smarty)
+ {
+ if (isset($params['l'])) {
+ $string = str_replace('\'', '\\\'', $params['l']);
+ }
+ else {
+ $string = '';
+ }
+
+ // TODO
+
+ return "[$string]";
+ }
+
+
+ /**
+ * Process theliaModule template inclusion function
+ *
+ * @param unknown $params
+ * @param unknown $smarty
+ * @return string
+ */
+ public function theliaModule($params, &$smarty)
+ {
+ // TODO
+ return "";
+ }
+
+
+ public function theliaBlockJavascripts($params, $content, \Smarty_Internal_Template $template, &$repeat)
+ {
+ return $this->getAssetManager()->processSmartyPluginCall('js', $params, $content, $template, $repeat);
+ }
+
+ public function theliaBlockImages($params, $content, \Smarty_Internal_Template $template, &$repeat)
+ {
+ return $this->getAssetManager()->processSmartyPluginCall(SmartyAssetsManager::ASSET_TYPE_AUTO, $params, $content, $template, $repeat);
+ }
+
+ public function theliaBlockStylesheets($params, $content, \Smarty_Internal_Template $template, &$repeat)
+ {
+ return $this->getAssetManager()->processSmartyPluginCall('css', $params, $content, $template, $repeat);
+ }
+
+ /**
+ *
+ * This method must return a Symfony\Component\HttpFoudation\Response instance or the content of the response
+ *
+ */
+ public function getContent()
+ {
+ return $this->fetch($this->getTemplateFilePath());
+ }
+
+ /**
+ *
+ * set $content with the body of the response or the Response object directly
+ *
+ * @param string|Symfony\Component\HttpFoundation\Response $content
+ */
+ public function setContent($content)
+ {
+ $this->content = $content;
+ }
+
+ /**
+ *
+ * @return type the status of the response
+ */
+ public function getStatus()
+ {
+ return $this->status;
+ }
+
+ /**
+ *
+ * status HTTP of the response
+ *
+ * @param int $status
+ */
+ public function setStatus($status)
+ {
+ $this->status = $status;
+ }
+
+ /**
+ * Check if a loop has returned results. The loop shoud have been executed before, or an
+ * InvalidArgumentException is thrown
+ *
+ * @param unknown $params
+ * @param unknown $template
+ * @throws \InvalidArgumentException
+ */
+ protected function checkEmptyLoop($params, $template) {
+ if (empty($params['rel']))
+ throw new \InvalidArgumentException("Missing 'rel' parameter in ifloop/elseloop arguments");
+
+ $loopName = $params['rel'];
+
+ // Find loop results in the current template vars
+ $loopResults = $template->getTemplateVars($loopName);
+
+ if (empty($loopResults)) {
+ throw new \InvalidArgumentException("Loop $loopName is not defined.");
+ }
+
+ return $loopResults->isEmpty();
+ }
+
+
+ /**
+ *
+ * Injects an associative array containing information for loop execution
*
* key is loop name
* value is the class implementing/extending base loop classes
@@ -77,16 +316,23 @@ class SmartyParser extends Smarty implements ParserInterface {
}
}
- private function extractParam($loop, $smartyParam)
+ /**
+ * Returns the value of a loop argument.
+ *
+ * @param unknown $loop a BaseLoop instance
+ * @param unknown $smartyParam
+ * @throws \InvalidArgumentException
+ */
+ protected function getLoopArgument(BaseLoop $loop, $smartyParam)
{
$defaultItemsParams = array('required' => true);
- $shortcutItemParams = array(
- 'optional' => array('required' => false)
- );
+
+ $shortcutItemParams = array('optional' => array('required' => false));
$errorCode = 0;
$faultActor = array();
$faultDetails = array();
+
foreach($loop->defineArgs() as $name => $param){
if(is_integer($name)){
$name = $param;
@@ -124,88 +370,6 @@ class SmartyParser extends Smarty implements ParserInterface {
}
}
- public function theliaEmpty($params, $content, $template, &$repeat) {
-
- // When encoutering close tag, check if loop has results.
- if ($repeat === false) {
- return $this->checkEmptyLoop($params, $template) ? $content : '';
- }
- }
-
- public function theliaNotEmpty($params, $content, $template, &$repeat) {
-
- // When encoutering close tag, check if loop has results.
- if ($repeat === false) {
- return $this->checkEmptyLoop($params, $template) ? '' : $content;
- }
- }
-
- private function checkEmptyLoop($params, $template) {
- if (empty($params['name']))
- throw new \InvalidArgumentException("Missing 'name' parameter in conditional loop arguments");
-
- $loopName = $params['name'];
-
- // Find loop results in the current template vars
- $loopResults = $template->getTemplateVars($loopName);
-
- if (empty($loopResults)) {
- throw new \InvalidArgumentException("Loop $loopName is not dfined.");
- }
-
- return $loopResults->isEmpty();
- }
-
- public function theliaLoop($params, $content, $template, &$repeat) {
-
- if (empty($params['name']))
- throw new \InvalidArgumentException("Missing 'name' parameter in loop arguments");
-
- if (empty($params['type']))
- throw new \InvalidArgumentException("Missing 'type' parameter in loop arguments");
-
- $name = $params['name'];
-
- if ($content === null) {
-
- $loop = $this->createLoopInstance(strtolower($params['type']));
-
- $this->extractParam($loop, $params);
-
- $loopResults = $loop->exec();
-
- $template->assignByRef($name, $loopResults);
- }
- else {
-
- $loopResults = $template->getTemplateVars($name);
-
- $loopResults->next();
- }
-
- if ($loopResults->valid()) {
-
- $loopResultRow = $loopResults->current();
-
- foreach($loopResultRow->getVarVal() as $var => $val) {
-
- $template->assign(substr($var, 1), $val);
-
- $template->assign('__COUNT__', 1 + $loopResults->key());
- $template->assign('__TOTAL__', $loopResults->getCount());
- }
-
- $repeat = $loopResults->valid();
- }
-
- if ($content !== null) {
-
- if ($loopResults->isEmpty()) $content = "";
-
- return $content;
- }
- }
-
/**
*
* find the loop class with his name and construct an instance of this class
@@ -235,57 +399,6 @@ class SmartyParser extends Smarty implements ParserInterface {
);
}
- /**
- *
- * This method must return a Symfony\Component\HttpFoudation\Response instance or the content of the response
- *
- */
- public function getContent()
- {
- return $this->fetch($this->getTemplateFilePath());
- }
-
- /**
- *
- * set $content with the body of the response or the Response object directly
- *
- * @param string|Symfony\Component\HttpFoundation\Response $content
- */
- public function setContent($content)
- {
- $this->content = $content;
- }
-
- /**
- *
- * @return type the status of the response
- */
- public function getStatus()
- {
- return $this->status;
- }
-
- /**
- *
- * status HTTP of the response
- *
- * @param int $status
- */
- public function setStatus($status)
- {
- $this->status = $status;
- }
-
- /**
- * Main parser function, load the parser
- */
- public function loadParser()
- {
- $file = $this->getTemplateFilePath();
-
- echo "f=$file";
- }
-
protected function getTemplateFilePath()
{
$request = $this->container->get('request');
@@ -299,4 +412,11 @@ class SmartyParser extends Smarty implements ParserInterface {
throw new ResourceNotFoundException(sprintf("%s file not found in %s template", $file, $this->template));
}
-}
+ protected function getAssetManager() {
+
+ if ($this->asset_manager == null)
+ $this->asset_manager = new SmartyAssetsManager(THELIA_WEB_DIR, "assets/$this->template");
+
+ return $this->asset_manager;
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/TheliaHttpKernel.php b/core/lib/Thelia/Core/TheliaHttpKernel.php
index c19b2b258..e8d78751d 100644
--- a/core/lib/Thelia/Core/TheliaHttpKernel.php
+++ b/core/lib/Thelia/Core/TheliaHttpKernel.php
@@ -4,7 +4,7 @@
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
-/* email : info@thelia.net */
+/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,7 +17,7 @@
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with this program. If not, see . */
+/* along with this program. If not, see . */
/* */
/*************************************************************************************/
namespace Thelia\Core;
@@ -121,32 +121,32 @@ class TheliaHttpKernel extends HttpKernel
{
}
-
+
protected function initSession(Request $request)
{
-
+
$storage = new Session\Storage\NativeSessionStorage();
-
+
if (Model\ConfigQuery::read("session_config.default")) {
$storage->setSaveHandler(new Session\Storage\Handler\NativeFileSessionHandler(Model\ConfigQuery::read("session_config.save_path", THELIA_ROOT . '/local/session/')));
} else {
$handlerString = Model\ConfigQuery::read("session_config.handlers");
-
+
$handler = new $handlerString;
-
+
$storage->setSaveHandler($handler);
}
-
+
if (Model\ConfigQuery::read("session_config.config", null)) {
- $storage->setOptions(json_decode(Model\ConfigQuery::read("session_config.config")));
+ $storage->setOptions(json_decode(Model\ConfigQuery::read("session_config.config")));
}
-
-
+
+
$session = new Session\Session($storage);
$session->start();
-
+
$request->setSession($session);
-
+
return $request;
}
-}
+}
\ No newline at end of file
diff --git a/templates/admin/default/assets/css/admin.less b/templates/admin/default/assets/css/admin.less
index b3fee1b84..a4ff763cd 100644
--- a/templates/admin/default/assets/css/admin.less
+++ b/templates/admin/default/assets/css/admin.less
@@ -54,12 +54,37 @@ a {
font-weight: bold;
}
+// Bootstrap Adjustements ------------------------------------------------------
+
+.btn-primary, .row h3 .btn-large, .row-fluid h3 .btn-large, .row-fluid h4 .btn-large {
+ background: -moz-linear-gradient(center bottom , #E3530B 0%, #F39922 100%) repeat scroll 0 0 #E9730F;
+ box-shadow: 0 0 2px rgba(250, 250, 250, 0.5) inset, 0 1px 3px rgba(0, 0, 0, 0.2);
+ color: white;
+}
+
// -- Brandbar ----------------------------------------------------------------
/* --- BRAND BAR ---*/
+
+.loginpage {
+ .brandbar {
+ width: 100%;
+ }
+
+ .hero-unit {
+ background-color: transparent !important;
+ }
+
+ .well {
+ background-color: #E4E3DE;
+ border: 1px solid rgba(0, 0, 0, 0.2);
+ box-shadow: 0 -4px 0 rgba(0, 0, 0, 0.05) inset;
+ }
+}
+
.brandbar {
- background: url("images/header.jpg") repeat-x;
+ background: url("img/header.jpg") repeat-x;
height: 90px;
a.brand {
@@ -67,7 +92,7 @@ a {
display: block;
float: left;
margin-right: 20px;
- background: url("images/logo.png") 0px 12px no-repeat;
+ background: url("img/logo.png") 0px 12px no-repeat;
width: 124px;
height: 63px;
}
@@ -75,7 +100,7 @@ a {
.breadcrumb {
border-radius: 0px;
padding: 25px 0px 25px 30px;
- background: url("images/logo-light.png") left center no-repeat;
+ background: url("img/logo-light.png") left center no-repeat;
float: left;
margin: 12px 0px 0px 0px;
@@ -114,7 +139,7 @@ a {
a {
text-indent: -13337px;
display: block;
- background: url("images/deconnexion.png") no-repeat;
+ background: url("img/deconnexion.png") no-repeat;
width: 23px;
height: 24px;
}
diff --git a/templates/admin/default/assets/css/img/bg.jpg b/templates/admin/default/assets/css/img/bg.jpg
new file mode 100644
index 000000000..76304b5cf
Binary files /dev/null and b/templates/admin/default/assets/css/img/bg.jpg differ
diff --git a/templates/admin/default/assets/css/img/deconnexion.png b/templates/admin/default/assets/css/img/deconnexion.png
new file mode 100644
index 000000000..af5e214cb
Binary files /dev/null and b/templates/admin/default/assets/css/img/deconnexion.png differ
diff --git a/templates/admin/default/assets/css/img/header.jpg b/templates/admin/default/assets/css/img/header.jpg
new file mode 100644
index 000000000..6a583774f
Binary files /dev/null and b/templates/admin/default/assets/css/img/header.jpg differ
diff --git a/templates/admin/default/assets/css/img/logo-light.png b/templates/admin/default/assets/css/img/logo-light.png
new file mode 100644
index 000000000..bff981900
Binary files /dev/null and b/templates/admin/default/assets/css/img/logo-light.png differ
diff --git a/templates/admin/default/assets/css/img/logo.png b/templates/admin/default/assets/css/img/logo.png
new file mode 100644
index 000000000..4bf7fa9f1
Binary files /dev/null and b/templates/admin/default/assets/css/img/logo.png differ
diff --git a/templates/admin/default/assets/img/favicon.ico b/templates/admin/default/assets/img/favicon.ico
new file mode 100644
index 000000000..24c27fefd
Binary files /dev/null and b/templates/admin/default/assets/img/favicon.ico differ
diff --git a/templates/admin/default/assets/img/logo-thelia-34px.png b/templates/admin/default/assets/img/logo-thelia-34px.png
new file mode 100644
index 000000000..cd8f07685
Binary files /dev/null and b/templates/admin/default/assets/img/logo-thelia-34px.png differ
diff --git a/templates/admin/default/home.html b/templates/admin/default/home.html
new file mode 100644
index 000000000..e69de29bb
diff --git a/templates/admin/default/includes/footer.inc.html b/templates/admin/default/includes/footer.inc.html
new file mode 100644
index 000000000..3d0e58427
--- /dev/null
+++ b/templates/admin/default/includes/footer.inc.html
@@ -0,0 +1,13 @@
+ {* Include required JS files *}
+
+ {javascripts file='../assets/js/jquery.min.js'}
+
+ {/javascripts}
+
+ {javascripts file='../assets/bootstrap/js/bootstrap.min.js'}
+
+ {/javascripts}
+
+ {* TODO allow modules to include JS here *}
+