Merge remote-tracking branch 'upstream/master' into typo

Conflicts:
	templates/backOffice/default/I18n/fr_FR.php
This commit is contained in:
Boyquotes
2014-03-25 11:27:29 +01:00
9 changed files with 1046 additions and 974 deletions

View File

@@ -42,6 +42,10 @@ abstract class BaseModuleGenerate extends ContainerAwareCommand
'Config', 'Config',
'Model', 'Model',
'Loop', 'Loop',
'Command',
'Controller',
'EventListeners',
'I18n',
'AdminIncludes', 'AdminIncludes',
'templates', 'templates',
); );

View File

@@ -88,6 +88,7 @@ class ModuleGenerateCommand extends BaseModuleGenerate
try { try {
$skeletonDir = str_replace("/", DIRECTORY_SEPARATOR, THELIA_ROOT . "/core/lib/Thelia/Command/Skeleton/Module/"); $skeletonDir = str_replace("/", DIRECTORY_SEPARATOR, THELIA_ROOT . "/core/lib/Thelia/Command/Skeleton/Module/");
// config.xml file
$fs->copy($skeletonDir . "config.xml", $this->moduleDirectory . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.xml"); $fs->copy($skeletonDir . "config.xml", $this->moduleDirectory . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.xml");
$moduleContent = file_get_contents($skeletonDir . "module.xml"); $moduleContent = file_get_contents($skeletonDir . "module.xml");
@@ -97,6 +98,7 @@ class ModuleGenerateCommand extends BaseModuleGenerate
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "module.xml", $moduleContent); file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "module.xml", $moduleContent);
// PHP Class template
$classContent = file_get_contents($skeletonDir . "Class.php.template"); $classContent = file_get_contents($skeletonDir . "Class.php.template");
$classContent = str_replace("%%CLASSNAME%%", $this->module, $classContent); $classContent = str_replace("%%CLASSNAME%%", $this->module, $classContent);
@@ -104,11 +106,31 @@ class ModuleGenerateCommand extends BaseModuleGenerate
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . $this->module.".php", $classContent); file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . $this->module.".php", $classContent);
// schema.xml file
$schemaContent = file_get_contents($skeletonDir . "schema.xml"); $schemaContent = file_get_contents($skeletonDir . "schema.xml");
$schemaContent = str_replace("%%NAMESPACE%%", $this->module, $schemaContent); $schemaContent = str_replace("%%NAMESPACE%%", $this->module, $schemaContent);
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent); file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent);
// routing.xml file
$routingContent = file_get_contents($skeletonDir . "routing.xml");
$routingContent = str_replace("%%NAMESPACE%%", $this->module, $routingContent);
$routingContent = str_replace("%%CLASSNAME_LOWER%%", strtolower($this->module), $routingContent);
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "routing.xml", $routingContent);
// I18n sample files
$fs->copy(
$skeletonDir . DIRECTORY_SEPARATOR . "I18n" . DIRECTORY_SEPARATOR . "fr_FR.php",
$this->moduleDirectory . DIRECTORY_SEPARATOR . "I18n" . DIRECTORY_SEPARATOR . "fr_FR.php"
);
$fs->copy(
$skeletonDir . DIRECTORY_SEPARATOR . "I18n" . DIRECTORY_SEPARATOR . "en_US.php",
$this->moduleDirectory . DIRECTORY_SEPARATOR . "I18n" . DIRECTORY_SEPARATOR . "en_US.php"
);
} catch (\Exception $ex) { } catch (\Exception $ex) {
$fs->remove($this->moduleDirectory); $fs->remove($this->moduleDirectory);

View File

@@ -0,0 +1,4 @@
<?php
return array(
// 'an english string' => 'The displayed english string',
);

View File

@@ -0,0 +1,4 @@
<?php
return array(
// 'an english string' => 'La traduction française de la chaine',
);

View File

@@ -0,0 +1,31 @@
<?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">
<!--
if a /admin/module/%%CLASSNAME_LOWER%%/ route is provided, a "Configuration" button will be displayed
for the module in the module list. Clicking this button will invoke this route.
<route id="my_route_id" path="/admin/module/%%CLASSNAME_LOWER%%">
<default key="_controller">%%NAMESPACE%%\Full\Class\Name\Of\YourConfigurationController::methodName</default>
</route>
<route id="my_route_id" path="/admin/module/%%CLASSNAME_LOWER%%/route-name">
<default key="_controller">%%NAMESPACE%%\Full\Class\Name\Of\YourAdminController::methodName</default>
</route>
<route id="my_route_id" path="/my/route/name">
<default key="_controller">%%NAMESPACE%%\Full\Class\Name\Of\YourOtherController::methodName</default>
</route>
...add as many routes as required.
<route>
...
</route>
-->
</routes>

View File

@@ -335,15 +335,17 @@ abstract class AbstractCrudController extends BaseAdminController
$error_msg = $ex->getMessage(); $error_msg = $ex->getMessage();
} }
$this->setupFormErrorContext( if (false !== $error_msg) {
$this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)), $this->setupFormErrorContext(
$error_msg, $this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)),
$creationForm, $error_msg,
$ex $creationForm,
); $ex
);
// At this point, the form has error, and should be redisplayed. // At this point, the form has error, and should be redisplayed.
return $this->renderList(); return $this->renderList();
}
} }
/** /**
@@ -435,15 +437,17 @@ abstract class AbstractCrudController extends BaseAdminController
$error_msg = $ex->getMessage();*/ $error_msg = $ex->getMessage();*/
} }
// At this point, the form has errors, and should be redisplayed. if (false !== $error_msg) {
$this->setupFormErrorContext( // At this point, the form has errors, and should be redisplayed.
$this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)), $this->setupFormErrorContext(
$error_msg, $this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)),
$changeForm, $error_msg,
$ex $changeForm,
); $ex
);
return $this->renderEditionTemplate(); return $this->renderEditionTemplate();
}
} }
/** /**

View File

@@ -221,15 +221,17 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
// Pass it to the parser // Pass it to the parser
$this->getParserContext()->addForm($changeForm); $this->getParserContext()->addForm($changeForm);
} }
$this->setupFormErrorContext( if (false !== $error_msg) {
$this->getTranslator()->trans("%obj SEO modification", array('%obj' => $this->objectName)), $this->setupFormErrorContext(
$error_msg, $this->getTranslator()->trans("%obj SEO modification", array('%obj' => $this->objectName)),
$updateSeoForm, $error_msg,
$ex $updateSeoForm,
); $ex
);
// At this point, the form has errors, and should be redisplayed.
return $this->renderEditionTemplate(); // At this point, the form has errors, and should be redisplayed.
return $this->renderEditionTemplate();
}
} }
} }

View File

@@ -45,7 +45,7 @@ class HomeController extends BaseAdminController
$data = new \stdClass(); $data = new \stdClass();
$data->title = "Stats on " . $this->getRequest()->query->get('month', date('m')) . "/" . $this->getRequest()->query->get('year', date('Y')); $data->title = $this->getTranslator()->trans("Stats on %month/%year", array('%month' => $this->getRequest()->query->get('month', date('m')), '%year' => $this->getRequest()->query->get('year', date('Y'))));
/* sales */ /* sales */
$saleSeries = new \stdClass(); $saleSeries = new \stdClass();

File diff suppressed because it is too large Load Diff