Merge branch 'master' of github.com:thelia/thelia

This commit is contained in:
Etienne Roudeix
2013-09-20 16:32:32 +02:00
28 changed files with 716 additions and 186 deletions

View File

@@ -18,7 +18,7 @@
<loop class="Thelia\Core\Template\Loop\Currency" name="currency"/>
<loop class="Thelia\Core\Template\Loop\Customer" name="customer"/>
<loop class="Thelia\Core\Template\Loop\Feature" name="feature"/>
<loop class="Thelia\Core\Template\Loop\FeatureAvailability" name="feature_availability"/>
<loop class="Thelia\Core\Template\Loop\FeatureAvailability" name="feature-availability"/>
<loop class="Thelia\Core\Template\Loop\FeatureValue" name="feature_value"/>
<loop class="Thelia\Core\Template\Loop\Folder" name="folder"/>
<loop class="Thelia\Core\Template\Loop\Order" name="order"/>
@@ -102,6 +102,8 @@
<form name="thelia.admin.country.creation" class="Thelia\Form\CountryCreationForm"/>
<form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/>
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
</forms>

View File

@@ -184,6 +184,12 @@
<default key="_controller">Thelia\Controller\Admin\ProductController::updateAccessoryPositionAction</default>
</route>
<!--Features and attributes -->
<route id="admin.products.update-attributes-and-features" path="/admin/product/{productId}/update-attributes-and-features">
<default key="_controller">Thelia\Controller\Admin\ProductController::updateAttributesAndFeaturesAction</default>
</route>
<!-- Folder routes management -->
<route id="admin.folders.default" path="/admin/folders">

View File

@@ -206,7 +206,8 @@ class Category extends BaseI18nLoop
->set("POSTSCRIPTUM", $category->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("PARENT", $category->getParent())
->set("URL", $category->getUrl($locale))
->set("PRODUCT_COUNT", $category->countChild())
->set("PRODUCT_COUNT", $category->countAllProducts())
->set("CHILD_COUNT", $category->countChild())
->set("VISIBLE", $category->getVisible() ? "1" : "0")
->set("POSITION", $category->getPosition())

View File

@@ -59,7 +59,7 @@ class CategoryTree extends BaseI18nLoop
}
// changement de rubrique
protected function buildCategoryTree($parent, $visible, $level, $max_level, $exclude, LoopResult &$loopResult)
protected function buildCategoryTree($parent, $visible, $level, $previousLevel, $max_level, $exclude, LoopResult &$loopResult)
{
if ($level > $max_level) return;
@@ -87,11 +87,12 @@ class CategoryTree extends BaseI18nLoop
->set("ID", $result->getId())->set("TITLE", $result->getVirtualColumn('i18n_TITLE'))
->set("PARENT", $result->getParent())->set("URL", $result->getUrl($locale))
->set("VISIBLE", $result->getVisible() ? "1" : "0")->set("LEVEL", $level)
->set('CHILD_COUNT', $result->countChild())->set('PREV_LEVEL', $previousLevel)
;
$loopResult->addRow($loopResultRow);
$this->buildCategoryTree($result->getId(), $visible, 1 + $level, $max_level, $exclude, $loopResult);
$this->buildCategoryTree($result->getId(), $visible, 1 + $level, $level, $max_level, $exclude, $loopResult);
}
}
@@ -109,7 +110,7 @@ class CategoryTree extends BaseI18nLoop
$loopResult = new LoopResult();
$this->buildCategoryTree($id, $visible, 0, $depth, $exclude, $loopResult);
$this->buildCategoryTree($id, $visible, 0, 0, $depth, $exclude, $loopResult);
return $loopResult;
}

View File

@@ -162,7 +162,8 @@ class Folder extends BaseI18nLoop
->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("PARENT", $folder->getParent())
->set("URL", $folder->getUrl($locale))
->set("CONTENT_COUNT", $folder->countChild())
->set("CHILD_COUNT", $folder->countChild())
->set("CONTENT_COUNT", $folder->countAllContents())
->set("VISIBLE", $folder->getVisible() ? "1" : "0")
->set("POSITION", $folder->getPosition())
;

View File

@@ -186,7 +186,8 @@ class UrlGenerator extends AbstractSmartyPlugin
protected function getCurrentUrl()
{
return URL::getInstance()->retrieveCurrent($this->request)->toString();
//return URL::getInstance()->retrieveCurrent($this->request)->toString();
return $this->request->getUri();
}
protected function getReturnToUrl()

View File

@@ -0,0 +1,119 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* 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 <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ConfigQuery;
/**
* Class ProfileModification
* @package Thelia\Form
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class ProfileModificationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("firstname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("First Name"),
"label_attr" => array(
"for" => "firstname"
)
))
->add("lastname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Last Name"),
"label_attr" => array(
"for" => "lastname"
)
))
->add("default_language", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Default language"),
"label_attr" => array(
"for" => "default_language"
)
))
->add("editing_language_default", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Editing language default"),
"label_attr" => array(
"for" => "editing_language_default"
)
))
->add("old_password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => Translator::getInstance()->trans("Old password"),
"label_attr" => array(
"for" => "old_password"
)
))
->add("password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => Translator::getInstance()->trans("Password"),
"label_attr" => array(
"for" => "password"
)
))
->add("password_confirm", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4))),
new Constraints\Callback(array("methods" => array(
array($this, "verifyPasswordField")
)))
),
"label" => "Password confirmation",
"label_attr" => array(
"for" => "password_confirmation"
)
))
;
}
public function getName()
{
return "thelia_profile_modification";
}
}

View File

@@ -44,8 +44,8 @@ class Folder extends BaseFolder
foreach($children as $child)
{
$contentsCount += ProductQuery::create()
->filterByCategory($child)
$contentsCount += ContentQuery::create()
->filterByFolder($child)
->count();
}

View File

@@ -44,8 +44,11 @@ trait UrlRewritingTrait {
*
* @param string $locale a valid locale (e.g. en_US)
*/
public function getUrl($locale)
public function getUrl($locale = null)
{
if(null === $locale) {
$locale = $this->getLocale();
}
return URL::getInstance()->retrieve($this->getRewrittenUrlViewName(), $this->getId(), $locale)->toString();
}