Merge branch 'franck' into admin

Conflicts:
	composer.lock
	core/lib/Thelia/Core/Thelia.php
This commit is contained in:
franck
2013-06-10 16:35:49 +02:00
10 changed files with 681 additions and 77 deletions

View File

@@ -5,10 +5,12 @@
* @file
* Functions needed for Thelia bootstrap
*/
define('THELIA_ROOT', realpath(__DIR__ .'/../') . "/");
define('THELIA_CONF_DIR', THELIA_ROOT . '/local/config');
define('THELIA_MODULE_DIR', THELIA_ROOT . '/local/modules');
define('THELIA_TEMPLATE_DIR', THELIA_ROOT . 'templates/');
define('THELIA_ROOT' , rtrim(realpath(__DIR__ .'/../'),'/') . "/");
define('THELIA_LOCAL_DIR' , THELIA_ROOT . '/local/');
define('THELIA_CONF_DIR' , THELIA_LOCAL_DIR . 'config/');
define('THELIA_MODULE_DIR' , THELIA_LOCAL_DIR . 'modules/');
define('THELIA_TEMPLATE_DIR' , THELIA_ROOT . '/web/templates/');
$loader = require __DIR__ . "/vendor/autoload.php";

View File

@@ -44,7 +44,7 @@
<service id="router.admin" class="%router.class%">
<argument type="service" id="router.admin.xmlLoader"/>
<argument>routing.xml</argument>
<argument>admin.xml</argument>
<argument type="collection">
<argument key="cache_dir">%kernel.cache_dir%</argument>
<argument key="debug">%kernel.debug%</argument>
@@ -56,10 +56,12 @@
<call method="setContext">
<argument type="service" id="request.context"/>
</call>
<!--
<call method="add">
<argument type="service" id="router.default_route"/>
<argument>-255</argument>
</call>
-->
<call method="add">
<argument type="service" id="router.admin"/>
<argument>0</argument>

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="blog" path="/">
<default key="_controller">Thelia\Controller\Admin</default>
</route>
</routes>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<import resource="admin_routing.xml" prefix="/admin" />
</routes>

View File

@@ -79,19 +79,19 @@ class ViewListener implements EventSubscriberInterface
} catch(ResourceNotFoundException $e) {
$event->setResponse(new Response($e->getMessage(), 404));
}
}
public function beforeKernelView(GetResponseForControllerResultEvent $event)
{
$request = $this->container->get('request');
if (!$view = $request->attributes->get('_view')) {
$request->attributes->set('_view', $this->findView($request));
}
}
public function findView(Request $request)
{
if (! $view = $request->query->get('view')) {
@@ -100,7 +100,7 @@ class ViewListener implements EventSubscriberInterface
$view = $request->request->get('view');
}
}
return $view;
}
@@ -117,7 +117,7 @@ class ViewListener implements EventSubscriberInterface
KernelEvents::VIEW =>array(
array('onKernelView', 0),
array('beforeKernelView', 5)
)
)
);
}
}

View File

@@ -60,7 +60,7 @@ class Thelia extends Kernel
const THELIA_VERSION = 0.1;
protected $tpexConfig;
public function init()
{
parent::init();
@@ -69,7 +69,7 @@ class Thelia extends Kernel
}
$this->initPropel();
}
protected function initPropel()
{
if (file_exists(THELIA_ROOT . '/local/config/database.yml') === false) {
@@ -106,10 +106,10 @@ class Thelia extends Kernel
}
/**
*
* Load some configuration
*
* Load some configuration
* Initialize all plugins
*
*
*/
protected function loadConfiguration(ContainerBuilder $container)
{
@@ -123,23 +123,23 @@ class Thelia extends Kernel
foreach ($modules as $module) {
try {
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config"));
$loader->load("config.xml");
} catch(\InvalidArgumentException $e) {
}
try {
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config"));
$loader->load("config.xml");
}
catch(\InvalidArgumentException $e) {
// FIXME: process module configuration exception
}
}
}
/**
*
*
* initialize session in Request object
*
*
* All param must be change in Config table
*
*
* @param \Symfony\Component\HttpFoundation\Request $request
*/
@@ -229,7 +229,7 @@ class Thelia extends Kernel
{
$bundles = array(
/* TheliaBundle contain all the dependency injection description */
new Bundle\TheliaBundle()
new Bundle\TheliaBundle(),
);
/**