Merge branch 'master' into template

This commit is contained in:
Manuel Raynaud
2013-09-11 15:28:38 +02:00
12 changed files with 784 additions and 49 deletions

View File

@@ -25,7 +25,6 @@ namespace Thelia\Controller\Admin;
use Symfony\Component\Routing\Exception\InvalidParameterException;
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\Router;
use Thelia\Controller\BaseController;
use Symfony\Component\HttpFoundation\Response;
use Thelia\Core\Security\Exception\AuthorizationException;
@@ -40,6 +39,7 @@ use Thelia\Model\LangQuery;
use Thelia\Form\BaseForm;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Log\Tlog;
use Symfony\Component\Routing\Router;
class BaseAdminController extends BaseController
{

View File

@@ -29,6 +29,7 @@ use Assetic\Filter;
use Assetic\Factory\AssetFactory;
use Assetic\Factory\Worker\CacheBustingWorker;
use Assetic\AssetWriter;
use Thelia\Model\ConfigQuery;
/**
* This class is a simple helper for generating assets using Assetic.
@@ -126,25 +127,28 @@ class AsseticHelper
//
if ($dev_mode == true || ! file_exists($target_file)) {
// Delete previous version of the file
list($commonPart, $dummy) = explode('-', $asset_target_path);
if (ConfigQuery::read('process_assets', true)) {
foreach (glob("$output_path/$commonPart-*") as $filename) {
@unlink($filename);
}
// Delete previous version of the file
list($commonPart, $dummy) = explode('-', $asset_target_path);
// Apply filters now
foreach ($filter_list as $filter) {
if ('?' != $filter[0]) {
$asset->ensureFilter($fm->get($filter));
} elseif (!$debug) {
$asset->ensureFilter($fm->get(substr($filter, 1)));
foreach (glob("$output_path/$commonPart-*") as $filename) {
@unlink($filename);
}
// Apply filters now
foreach ($filter_list as $filter) {
if ('?' != $filter[0]) {
$asset->ensureFilter($fm->get($filter));
} elseif (!$debug) {
$asset->ensureFilter($fm->get(substr($filter, 1)));
}
}
$writer = new AssetWriter($output_path);
$writer->writeAsset($asset);
}
$writer = new AssetWriter($output_path);
$writer->writeAsset($asset);
}
return rtrim($output_url, '/').'/'.$asset_target_path;

View File

@@ -23,6 +23,7 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
/**
* Class AddressCreateForm
@@ -59,65 +60,104 @@ class AddressCreateForm extends BaseForm
"constraints" => array(
new NotBlank()
),
"label" => "address name",
"label" => Translator::getInstance()->trans("Address label *"),
"label_attr" => array(
"for" => "label_create"
),
"required" => true
))
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "title"
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title_create"
)
))
->add("firstname", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "first name"
"label" => Translator::getInstance()->trans("Firstname"),
"label_attr" => array(
"for" => "firstname_create"
)
))
->add("lastname", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "last name"
"label" => Translator::getInstance()->trans("Lastname"),
"label_attr" => array(
"for" => "lastname_create"
)
))
->add("address1", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "address"
"label" => Translator::getInstance()->trans("Street Address"),
"label_attr" => array(
"for" => "address1_create"
)
))
->add("address2", "text", array(
"label" => "address (line 2)"
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Additional address"),
"label_attr" => array(
"for" => "address2_create"
)
))
->add("address3", "text", array(
"label" => "address (line 3)"
"label" => Translator::getInstance()->trans("Additional address"),
"label_attr" => array(
"for" => "address3_create"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "zipcode"
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode_create"
)
))
->add("city", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "city"
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city_create"
)
))
->add("country", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "country"
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country_create"
)
))
->add("phone", "text", array(
"label" => "phone"
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone_create"
)
))
->add("cellphone", "text", array(
"label" => "cellphone"
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone_create"
)
))
->add("company", "text", array(
"label" => "company"
"label" => Translator::getInstance()->trans("Compagny"),
"label_attr" => array(
"for" => "company_create"
)
))
;
}

View File

@@ -23,6 +23,7 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
/**
* Class AddressUpdateForm
@@ -55,6 +56,112 @@ class AddressUpdateForm extends AddressCreateForm
{
parent::buildForm();
$this->formBuilder
->add("label", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Address label *"),
"label_attr" => array(
"for" => "label_update"
),
"required" => true
))
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title_update"
)
))
->add("firstname", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Firstname"),
"label_attr" => array(
"for" => "firstname_update"
)
))
->add("lastname", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Lastname"),
"label_attr" => array(
"for" => "lastname_update"
)
))
->add("address1", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Street Address"),
"label_attr" => array(
"for" => "address1_update"
)
))
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Additional address"),
"label_attr" => array(
"for" => "address2_update"
)
))
->add("address3", "text", array(
"label" => Translator::getInstance()->trans("Additional address"),
"label_attr" => array(
"for" => "address3_update"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode_update"
)
))
->add("city", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city_update"
)
))
->add("country", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country_update"
)
))
->add("phone", "text", array(
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone_update"
)
))
->add("cellphone", "text", array(
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone_update"
)
))
->add("company", "text", array(
"label" => Translator::getInstance()->trans("Compagny"),
"label_attr" => array(
"for" => "company_update"
)
))
;
}
/**

View File

@@ -24,6 +24,7 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Core\Translation\Translator;
/**
* Class CustomerModification
@@ -56,60 +57,93 @@ class CustomerModification extends BaseForm
{
$this->formBuilder
->add('update_logged_in_user', 'boolean') // In a front office context, update the in-memory logged-in user data
->add('update_logged_in_user', 'integer') // In a front office context, update the in-memory logged-in user data
->add("firstname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "firstname"
"label" => Translator::getInstance()->trans("First Name"),
"label_attr" => array(
"for" => "firstname"
)
))
->add("lastname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "lastname"
"label" => Translator::getInstance()->trans("Last Name"),
"label_attr" => array(
"for" => "lastname"
)
))
->add("address1", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "address"
"label_attr" => array(
"for" => "address"
),
"label" => Translator::getInstance()->trans("Street Address")
))
->add("address2", "text", array(
"label" => "Address Line 2"
"label" => Translator::getInstance()->trans("Address Line 2"),
"label_attr" => array(
"for" => "address2"
)
))
->add("address3", "text", array(
"label" => "Address Line 3"
"label" => Translator::getInstance()->trans("Address Line 3"),
"label_attr" => array(
"for" => "address3"
)
))
->add("phone", "text", array(
"label" => "phone"
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone"
)
))
->add("cellphone", "text", array(
"label" => "cellphone"
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "zipcode"
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode"
)
))
->add("city", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "city"
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city"
)
))
->add("country", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "country"
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country"
)
))
->add("title", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "title"
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title"
)
))
;
}