WIP : Setting Folders management

This commit is contained in:
mespeche
2013-09-18 15:38:08 +02:00
parent 742b90b24c
commit 25becbe0cc
10 changed files with 1248 additions and 3 deletions

View File

@@ -63,6 +63,12 @@
<form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/>
<form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/>
<form name="thelia.admin.folder.creation" class="Thelia\Form\FolderCreationForm"/>
<form name="thelia.admin.folder.modification" class="Thelia\Form\FolderModificationForm"/>
<form name="thelia.admin.content.creation" class="Thelia\Form\ContentCreationForm"/>
<form name="thelia.admin.content.modification" class="Thelia\Form\ContentModificationForm"/>
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
<form name="thelia.order.delivery" class="Thelia\Form\OrderDelivery"/>

View File

@@ -156,7 +156,20 @@
<default key="_controller">Thelia\Controller\Admin\ProductController::getAvailableRelatedContentAction</default>
<requirement key="_format">xml|json</requirement>
</route>
<!-- Folder routes management -->
<route id="admin.folders.default" path="/admin/folders">
<default key="_controller">Thelia\Controller\Admin\FolderController::indexAction</default>
</route>
<route id="admin.folders.create" path="/admin/folders/create">
<default key="_controller">Thelia\Controller\Admin\FolderController::createAction</default>
</route>
<route id="admin.folders.update" path="/admin/folders/update/{folder_id}" methods="get">
<default key="_controller">Thelia\Controller\Admin\FolderController::updateAction</default>
<requirement key="folder_id">\d+</requirement>
</route>
<!-- Route to the Coupon controller (process Coupon browsing) -->

View File

@@ -0,0 +1,46 @@
<?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\Controller\Admin;
/**
* Class FolderController
* @package Thelia\Controller\Admin
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class FolderController extends BaseAdminController
{
public function indexAction()
{
if (null !== $response = $this->checkAuth("admin.folder.view")) return $response;
return $this->render("folders", array("display_folder" => 20));
}
public function updateAction($folder_id)
{
return $this->render("folder-edit", array(
"folder_id" => $folder_id
));
}
}

View File

@@ -0,0 +1,63 @@
<?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\NotBlank;
use Thelia\Core\Translation\Translator;
class ContentCreationForm extends BaseForm
{
protected function buildForm($change_mode = false)
{
$this->formBuilder
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => "Content title *",
"label_attr" => array(
"for" => "title"
)
))
->add("default_folder", "integer", array(
"constraints" => array(
new NotBlank()
)
))
->add("locale", "text", array(
"constraints" => array(
new NotBlank()
)
))
->add("visible", "integer", array(
"label" => Translator::getInstance()->trans("This content is online."),
"label_attr" => array("for" => "visible_create")
))
;
}
public function getName()
{
return "thelia_content_creation";
}
}

View File

@@ -0,0 +1,66 @@
<?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\NotBlank;
use Thelia\Core\Translation\Translator;
class FolderCreationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Folder title *"),
"label_attr" => array(
"for" => "title"
)
))
->add("parent", "text", array(
"label" => Translator::getInstance()->trans("Parent folder *"),
"constraints" => array(
new NotBlank()
),
"label_attr" => array("for" => "parent_create")
))
->add("locale", "text", array(
"constraints" => array(
new NotBlank()
),
"label_attr" => array("for" => "locale_create")
))
->add("visible", "integer", array(
"label" => Translator::getInstance()->trans("This folder is online."),
"label_attr" => array("for" => "visible_create")
))
;
}
public function getName()
{
return "thelia_folder_creation";
}
}

View File

@@ -0,0 +1,55 @@
<?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\GreaterThan;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\NotBlank;
class FolderModificationForm extends FolderCreationForm
{
use StandardDescriptionFieldsTrait;
protected function buildForm()
{
parent::buildForm(true);
$this->formBuilder
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
->add("url", "text", array(
"label" => Translator::getInstance()->trans("Rewriten URL *"),
"constraints" => array(new NotBlank()),
"label_attr" => array("for" => "rewriten_url")
))
;
// Add standard description fields, excluding title and locale, which a re defined in parent class
$this->addStandardDescFields(array('title', 'locale'));
}
public function getName()
{
return "thelia_folder_modification";
}
}