Finish export forms
modifié: core/lib/Thelia/Config/Resources/config.xml modifié: core/lib/Thelia/Config/Resources/form.xml modifié: core/lib/Thelia/Controller/Admin/ExportController.php modifié: core/lib/Thelia/Controller/Admin/ImportExportController.php modifié: core/lib/Thelia/Core/Template/Loop/Formatter.php modifié: core/lib/Thelia/Core/Template/Loop/ImportExportType.php modifié: core/lib/Thelia/Form/ExportForm.php modifié: core/lib/Thelia/ImportExport/Both/NewsletterImportExport.php modifié: core/lib/Thelia/ImportExport/Export/MailingExport.php renommé: core/lib/Thelia/ImportExport/ExportHandlerInterface.php -> core/lib/Thelia/ImportExport/ExportHandler.php modifié: core/lib/Thelia/Model/Export.php modifié: core/lib/Thelia/Model/Import.php nouveau fichier: core/lib/Thelia/Tests/ImportExport/Export/MailingExportTest.php nouveau fichier: templates/backOffice/default/ajax/export-modal.html modifié: templates/backOffice/default/export-page.html modifié: templates/backOffice/default/export.html
This commit is contained in:
@@ -146,7 +146,7 @@
|
|||||||
|
|
||||||
<!-- zip -->
|
<!-- zip -->
|
||||||
<service id="thelia.archive_builder.zip" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\ZipArchiveBuilder">
|
<service id="thelia.archive_builder.zip" class="Thelia\Core\FileFormat\Archive\ArchiveBuilder\ZipArchiveBuilder">
|
||||||
<tag name="thelia.manager.archive_builder" />
|
<tag name="thelia.archive_builder" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<!-- tar -->
|
<!-- tar -->
|
||||||
|
|||||||
@@ -133,7 +133,7 @@
|
|||||||
<form name="thelia.assets.flush" class="Thelia\Form\Cache\AssetsFlushForm"/>
|
<form name="thelia.assets.flush" class="Thelia\Form\Cache\AssetsFlushForm"/>
|
||||||
<form name="thelia.images-and-documents-cache.flush" class="Thelia\Form\Cache\ImagesAndDocumentsCacheFlushForm"/>
|
<form name="thelia.images-and-documents-cache.flush" class="Thelia\Form\Cache\ImagesAndDocumentsCacheFlushForm"/>
|
||||||
|
|
||||||
<form name="thelia.admin.export" class="Thelia\Form\ExportForm" />
|
<form name="thelia.export" class="Thelia\Form\ExportForm" />
|
||||||
|
|
||||||
</forms>
|
</forms>
|
||||||
|
|
||||||
|
|||||||
@@ -108,11 +108,11 @@ class ExportController extends BaseAdminController
|
|||||||
protected function setOrders($category = null, $export = null)
|
protected function setOrders($category = null, $export = null)
|
||||||
{
|
{
|
||||||
if ($category === null) {
|
if ($category === null) {
|
||||||
$category = $this->getRequest()->query->get("category_order");
|
$category = $this->getRequest()->query->get("category_order", "manual");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($export === null) {
|
if ($export === null) {
|
||||||
$export = $this->getRequest()->query->get("export_order");
|
$export = $this->getRequest()->query->get("export_order", "manual");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getParserContext()
|
$this->getParserContext()
|
||||||
|
|||||||
@@ -11,7 +11,9 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
use Thelia\Core\HttpFoundation\Response;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
|
use Thelia\Core\Template\Loop\Export as ExportLoop;
|
||||||
|
use Thelia\Core\Template\Loop\Import as ImportLoop;
|
||||||
use Thelia\Model\ExportQuery;
|
use Thelia\Model\ExportQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +39,37 @@ class ImportExportController extends BaseAdminController
|
|||||||
return $this->render("404");
|
return $this->render("404");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render("import-page");
|
/**
|
||||||
|
* Use the loop to inject the same vars in Smarty
|
||||||
|
*/
|
||||||
|
$loop = new ImportLoop($this->container);
|
||||||
|
|
||||||
|
$loop->initializeArgs([
|
||||||
|
"export" => $export->getId()
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query = $loop->buildModelCriteria();
|
||||||
|
$result= $query->find();
|
||||||
|
|
||||||
|
$results = $loop->parseResults(
|
||||||
|
new LoopResult($result)
|
||||||
|
);
|
||||||
|
|
||||||
|
$parserContext = $this->getParserContext();
|
||||||
|
|
||||||
|
/** @var \Thelia\Core\Template\Element\LoopResultRow $row */
|
||||||
|
foreach ($results as $row) {
|
||||||
|
foreach ($row->getVarVal() as $name=>$value) {
|
||||||
|
$parserContext->set($name, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Then render the form */
|
||||||
|
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||||
|
return $this->render("ajax/import-modal");
|
||||||
|
} else {
|
||||||
|
return $this->render("import-page");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function exportView($id)
|
public function exportView($id)
|
||||||
@@ -46,12 +78,37 @@ class ImportExportController extends BaseAdminController
|
|||||||
return $this->render("404");
|
return $this->render("404");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getParserContext()
|
/**
|
||||||
->set("ID", $export->getId())
|
* Use the loop to inject the same vars in Smarty
|
||||||
->set("TITLE", $export->getTitle())
|
*/
|
||||||
;
|
$loop = new ExportLoop($this->container);
|
||||||
|
|
||||||
return $this->render("export-page");
|
$loop->initializeArgs([
|
||||||
|
"export" => $export->getId()
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query = $loop->buildModelCriteria();
|
||||||
|
$result= $query->find();
|
||||||
|
|
||||||
|
$results = $loop->parseResults(
|
||||||
|
new LoopResult($result)
|
||||||
|
);
|
||||||
|
|
||||||
|
$parserContext = $this->getParserContext();
|
||||||
|
|
||||||
|
/** @var \Thelia\Core\Template\Element\LoopResultRow $row */
|
||||||
|
foreach ($results as $row) {
|
||||||
|
foreach ($row->getVarVal() as $name=>$value) {
|
||||||
|
$parserContext->set($name, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Then render the form */
|
||||||
|
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||||
|
return $this->render("ajax/export-modal");
|
||||||
|
} else {
|
||||||
|
return $this->render("export-page");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getExport($id)
|
protected function getExport($id)
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class Formatter extends BaseLoop implements ArraySearchLoopInterface
|
|||||||
|
|
||||||
$exportId = $this->getExport();
|
$exportId = $this->getExport();
|
||||||
$formatters = [];
|
$formatters = [];
|
||||||
|
|
||||||
if ($exportId !== null) {
|
if ($exportId !== null) {
|
||||||
$export = ExportQuery::create()->findPk($exportId);
|
$export = ExportQuery::create()->findPk($exportId);
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Template\Loop;
|
namespace Thelia\Core\Template\Loop;
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||||
|
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||||
use Thelia\Core\Template\Element\BaseLoop;
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
@@ -27,7 +29,7 @@ use Thelia\Type\TypeCollection;
|
|||||||
* @package Thelia\Core\Template\Loop
|
* @package Thelia\Core\Template\Loop
|
||||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
abstract class ImportExportType extends BaseLoop implements PropelSearchLoopInterface
|
abstract class ImportExportType extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||||
{
|
{
|
||||||
const DEFAULT_ORDER = "manual";
|
const DEFAULT_ORDER = "manual";
|
||||||
|
|
||||||
@@ -49,8 +51,8 @@ abstract class ImportExportType extends BaseLoop implements PropelSearchLoopInte
|
|||||||
|
|
||||||
$loopResultRow
|
$loopResultRow
|
||||||
->set("ID", $type->getId())
|
->set("ID", $type->getId())
|
||||||
->set("TITLE", $type->getTitle())
|
->set("TITLE", $type->getVirtualColumn("i18n_TITLE"))
|
||||||
->set("DESCRIPTION", $type->getDescription())
|
->set("DESCRIPTION", $type->getVirtualColumn("i18n_DESCRIPTION"))
|
||||||
->set("URL", $url)
|
->set("URL", $url)
|
||||||
->set("POSITION", $type->getPosition())
|
->set("POSITION", $type->getPosition())
|
||||||
->set("CATEGORY_ID", $type->getByName($this->getCategoryName()))
|
->set("CATEGORY_ID", $type->getByName($this->getCategoryName()))
|
||||||
@@ -69,8 +71,12 @@ abstract class ImportExportType extends BaseLoop implements PropelSearchLoopInte
|
|||||||
*/
|
*/
|
||||||
public function buildModelCriteria()
|
public function buildModelCriteria()
|
||||||
{
|
{
|
||||||
|
/** @var ModelCriteria $query */
|
||||||
$query = $this->getQueryModel();
|
$query = $this->getQueryModel();
|
||||||
|
|
||||||
|
$this->configureI18nProcessing($query, array('TITLE', 'DESCRIPTION'));
|
||||||
|
|
||||||
|
|
||||||
if (null !== $ids = $this->getId()) {
|
if (null !== $ids = $this->getId()) {
|
||||||
$query->filterById($ids);
|
$query->filterById($ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ class ExportForm extends BaseForm
|
|||||||
"multiple" => false,
|
"multiple" => false,
|
||||||
"choices" => $this->formattersNames,
|
"choices" => $this->formattersNames,
|
||||||
))
|
))
|
||||||
|
->add("do_compress", "checkbox", array(
|
||||||
|
"label" => $this->translator->trans("Do compress"),
|
||||||
|
"label_attr" => ["for" => "do_compress"],
|
||||||
|
"required" => false,
|
||||||
|
))
|
||||||
->add("archive_builder", "choice", array(
|
->add("archive_builder", "choice", array(
|
||||||
"label" => $this->translator->trans("Archive Format"),
|
"label" => $this->translator->trans("Archive Format"),
|
||||||
"label_attr" => ["for" => "archive_builder"],
|
"label_attr" => ["for" => "archive_builder"],
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
namespace Thelia\ImportExport\Both;
|
namespace Thelia\ImportExport\Both;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||||
use Thelia\ImportExport\ExportHandlerInterface;
|
use Thelia\ImportExport\ExportHandler;
|
||||||
use Thelia\ImportExport\ImportHandlerInterface;
|
use Thelia\ImportExport\ImportHandlerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +21,7 @@ use Thelia\ImportExport\ImportHandlerInterface;
|
|||||||
* @package Thelia\ImportExport\Both
|
* @package Thelia\ImportExport\Both
|
||||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
class NewsletterImportExport implements ExportHandlerInterface, ImportHandlerInterface
|
class NewsletterImportExport implements ExportHandler, ImportHandlerInterface
|
||||||
{
|
{
|
||||||
protected $container;
|
protected $container;
|
||||||
|
|
||||||
|
|||||||
@@ -13,27 +13,20 @@
|
|||||||
namespace Thelia\ImportExport\Export;
|
namespace Thelia\ImportExport\Export;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
use Thelia\Core\FileFormat\Formatting\FormatterData;
|
||||||
use Thelia\ImportExport\ExportHandlerInterface;
|
use Thelia\Core\Translation\Translator;
|
||||||
|
use Thelia\ImportExport\ExportHandler;
|
||||||
|
use Thelia\Model\CustomerQuery;
|
||||||
|
use Thelia\Model\Map\CustomerTableMap;
|
||||||
|
use Thelia\Model\Map\NewsletterTableMap;
|
||||||
|
use Thelia\Model\NewsletterQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MailingExport
|
* Class MailingExport
|
||||||
* @package Thelia\ImportExport\Export
|
* @package Thelia\ImportExport\Export
|
||||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
class MailingExport implements ExportHandlerInterface
|
class MailingExport extends ExportHandler
|
||||||
{
|
{
|
||||||
protected $container;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ContainerInterface $container
|
|
||||||
*
|
|
||||||
* Dependency injection: load the container to be able to get parameters and services
|
|
||||||
*/
|
|
||||||
public function __construct(ContainerInterface $container)
|
|
||||||
{
|
|
||||||
$this->container = $container;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
||||||
*
|
*
|
||||||
@@ -41,7 +34,49 @@ class MailingExport implements ExportHandlerInterface
|
|||||||
*/
|
*/
|
||||||
public function buildFormatterData()
|
public function buildFormatterData()
|
||||||
{
|
{
|
||||||
$data = new FormatterData();
|
$translator = Translator::getInstance();
|
||||||
|
|
||||||
|
$email = $translator->trans("email");
|
||||||
|
$lastName = $translator->trans("last name");
|
||||||
|
$firstName = $translator->trans("first name");
|
||||||
|
|
||||||
|
|
||||||
|
$aliases = [
|
||||||
|
NewsletterTableMap::EMAIL => $email,
|
||||||
|
CustomerTableMap::EMAIL => $email,
|
||||||
|
|
||||||
|
NewsletterTableMap::LASTNAME => $lastName,
|
||||||
|
CustomerTableMap::LASTNAME => $lastName,
|
||||||
|
|
||||||
|
NewsletterTableMap::FIRSTNAME => $firstName,
|
||||||
|
CustomerTableMap::FIRSTNAME => $firstName,
|
||||||
|
];
|
||||||
|
|
||||||
|
$data = new FormatterData($aliases);
|
||||||
|
|
||||||
|
$newsletter = NewsletterQuery::create()
|
||||||
|
->select([
|
||||||
|
NewsletterTableMap::EMAIL,
|
||||||
|
NewsletterTableMap::LASTNAME,
|
||||||
|
NewsletterTableMap::FIRSTNAME,
|
||||||
|
])
|
||||||
|
->find()
|
||||||
|
->toArray()
|
||||||
|
;
|
||||||
|
|
||||||
|
$customers = CustomerQuery::create()
|
||||||
|
->select([
|
||||||
|
CustomerTableMap::EMAIL,
|
||||||
|
CustomerTableMap::LASTNAME,
|
||||||
|
CustomerTableMap::FIRSTNAME,
|
||||||
|
])
|
||||||
|
->find()
|
||||||
|
->toArray()
|
||||||
|
;
|
||||||
|
|
||||||
|
$both = $newsletter + $customers;
|
||||||
|
|
||||||
|
return $data->setData($both);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,25 +14,29 @@ namespace Thelia\ImportExport;
|
|||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface ExportHandlerInterface
|
* Interface ExportHandler
|
||||||
* @package Thelia\ImportExport
|
* @package Thelia\ImportExport
|
||||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
interface ExportHandlerInterface
|
abstract class ExportHandler
|
||||||
{
|
{
|
||||||
|
protected $container;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ContainerInterface $container
|
* @param ContainerInterface $container
|
||||||
*
|
*
|
||||||
* Dependency injection: load the container to be able to get parameters and services
|
* Dependency injection: load the container to be able to get parameters and services
|
||||||
*/
|
*/
|
||||||
public function __construct(ContainerInterface $container);
|
public function __construct(ContainerInterface $container) {
|
||||||
|
$this->container = $container;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
|
||||||
*
|
*
|
||||||
* The method builds
|
* The method builds the FormatterData for the formatter
|
||||||
*/
|
*/
|
||||||
public function buildFormatterData();
|
abstract public function buildFormatterData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string|array
|
* @return string|array
|
||||||
@@ -49,5 +53,5 @@ interface ExportHandlerInterface
|
|||||||
* ExportType::EXPORT_UNBOUNDED,
|
* ExportType::EXPORT_UNBOUNDED,
|
||||||
* );
|
* );
|
||||||
*/
|
*/
|
||||||
public function getHandledType();
|
abstract public function getHandledType();
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ namespace Thelia\Model;
|
|||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
use Thelia\ImportExport\ExportHandlerInterface;
|
use Thelia\ImportExport\ExportHandler;
|
||||||
use Thelia\Model\Base\Export as BaseExport;
|
use Thelia\Model\Base\Export as BaseExport;
|
||||||
use Thelia\Model\Map\ExportTableMap;
|
use Thelia\Model\Map\ExportTableMap;
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ class Export extends BaseExport
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ContainerInterface $container
|
* @param ContainerInterface $container
|
||||||
* @return ExportHandlerInterface
|
* @return ExportHandler
|
||||||
* @throws \ErrorException
|
* @throws \ErrorException
|
||||||
*/
|
*/
|
||||||
public function getHandleClassInstance(ContainerInterface $container)
|
public function getHandleClassInstance(ContainerInterface $container)
|
||||||
@@ -101,13 +101,13 @@ class Export extends BaseExport
|
|||||||
|
|
||||||
$instance = new $class($container);
|
$instance = new $class($container);
|
||||||
|
|
||||||
if (!$instance instanceof ExportHandlerInterface) {
|
if (!$instance instanceof ExportHandler) {
|
||||||
throw new \ErrorException(
|
throw new \ErrorException(
|
||||||
Translator::getInstance()->trans(
|
Translator::getInstance()->trans(
|
||||||
"The class \"%class\" must implement %interface",
|
"The class \"%class\" must implement %interface",
|
||||||
[
|
[
|
||||||
"%class" => $class,
|
"%class" => $class,
|
||||||
"%interface" => "\\Thelia\\ImportExport\\ExportHandlerInterface",
|
"%interface" => "\\Thelia\\ImportExport\\ExportHandler",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace Thelia\Model;
|
|||||||
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Thelia\ImportExport\ExportHandlerInterface;
|
use Thelia\ImportExport\ExportHandler;
|
||||||
use Thelia\Model\Base\Import as BaseImport;
|
use Thelia\Model\Base\Import as BaseImport;
|
||||||
use Thelia\Model\Map\ImportTableMap;
|
use Thelia\Model\Map\ImportTableMap;
|
||||||
|
|
||||||
@@ -89,12 +89,12 @@ class Import extends BaseImport
|
|||||||
|
|
||||||
$instance = new $class($container);
|
$instance = new $class($container);
|
||||||
|
|
||||||
if (!$class instanceof ExportHandlerInterface) {
|
if (!$class instanceof ExportHandler) {
|
||||||
throw new \ErrorException(
|
throw new \ErrorException(
|
||||||
"The class \"%class\" must implement %interface",
|
"The class \"%class\" must implement %interface",
|
||||||
[
|
[
|
||||||
"%class" => $class,
|
"%class" => $class,
|
||||||
"%interface" => "\\Thelia\\ImportExport\\ExportHandlerInterface",
|
"%interface" => "\\Thelia\\ImportExport\\ExportHandler",
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* This file is part of the Thelia package. */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : dev@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||||
|
/* file that was distributed with this source code. */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Tests\ImportExport\Export;
|
||||||
|
use Symfony\Component\DependencyInjection\Container;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
use Thelia\ImportExport\Export\ExportType;
|
||||||
|
use Thelia\ImportExport\Export\MailingExport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MailingExportTest
|
||||||
|
* @package Thelia\Tests\ImportExport\Export
|
||||||
|
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class MailingExportTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
/** @var MailingExport $handler */
|
||||||
|
protected $handler;
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
$container = new Container();
|
||||||
|
|
||||||
|
new Translator($container);
|
||||||
|
|
||||||
|
$this->handler = new MailingExport($container);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testExport()
|
||||||
|
{
|
||||||
|
$data = $this->handler->buildFormatterData();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testType()
|
||||||
|
{
|
||||||
|
$this->assertEquals(
|
||||||
|
[ExportType::EXPORT_TABLE, ExportType::EXPORT_UNBOUNDED],
|
||||||
|
$this->handler->getHandledType()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
93
templates/backOffice/default/ajax/export-modal.html
Normal file
93
templates/backOffice/default/ajax/export-modal.html
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
{form name="thelia.export"}
|
||||||
|
<form action="{$URL}" method="post" {form_enctype form=$form}>
|
||||||
|
<div class="modal fade" id="real-export-modal" tabindex="-1" role="dialog" aria-labelledby="export-modal-label" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||||||
|
<h4 class="modal-title" id="export-modal-label">Export: {$TITLE}</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
{ifloop rel="export-formatters"}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
{custom_render_form_field form=$form field="formatter"}
|
||||||
|
<select>
|
||||||
|
{loop name="export-formatters" type="formatter" export=$ID}
|
||||||
|
<option value="{$NAME}" {if $value == $NAME}selected{/if}>
|
||||||
|
{$NAME} (.{$EXTENSION})
|
||||||
|
</option>
|
||||||
|
{/loop}
|
||||||
|
</select>
|
||||||
|
{/custom_render_form_field}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
{form_field form=$form field="do_compress"}
|
||||||
|
<label for="{$label_attr.for}">
|
||||||
|
{$label}
|
||||||
|
</label>
|
||||||
|
<div data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-on="success" class="make-switch switch-small" id="export-compression-switch">
|
||||||
|
<input type="checkbox" name="{$name}" id="{$label_attr.for}"/>
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row export-compression-selection-row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
{custom_render_form_field form=$form field="archive_builder"}
|
||||||
|
<select name="{$name}">
|
||||||
|
{loop name="export-archive-builder" type="archive-builder"}
|
||||||
|
<option value="{$NAME}" {if $value == $NAME}selected{/if}>
|
||||||
|
{$NAME} (.{$EXTENSION})
|
||||||
|
</option>
|
||||||
|
{/loop}
|
||||||
|
</select>
|
||||||
|
{/custom_render_form_field}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
{form_field form=$form field="images"}
|
||||||
|
<label for="{$label_attr.for}">
|
||||||
|
{$label}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-on="success" class="make-switch switch-small">
|
||||||
|
<input type="checkbox" name="{$name}" id="{$label_attr.for}" />
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
{form_field form=$form field="documents"}
|
||||||
|
<label for="{$label_attr.for}">
|
||||||
|
{$label}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-on="success" class="make-switch switch-small">
|
||||||
|
<input type="checkbox" name="{$name}" id="{$label_attr.for}" />
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/ifloop}
|
||||||
|
{elseloop rel="export-formatters"}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
{intl l="You can't do exports, you don't have any formatter that handles this."}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/elseloop}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">{intl l="Close"}</button>
|
||||||
|
<button type="submit" class="btn btn-primary">{intl l="Export"}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{/form}
|
||||||
@@ -1,41 +1,41 @@
|
|||||||
{extends file="admin-layout.tpl"}
|
{extends file="admin-layout.tpl"}
|
||||||
|
|
||||||
{block name="no-return-functions"}
|
{block name="no-return-functions"}
|
||||||
{$admin_current_location = 'tools'}
|
{$admin_current_location = 'modules'}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="page-title"}{intl l='Export: %title' title=$TITLE}{/block}
|
{block name="page-title"}{intl l='Export'}: {$TITLE}{/block}
|
||||||
|
|
||||||
{block name="check-resource"}admin.export{/block}
|
{block name="check-resource"}admin.export{/block}
|
||||||
{block name="check-access"}view{/block}
|
{block name="check-access"}view{/block}
|
||||||
|
|
||||||
{block name="main-content"}
|
{block name="main-content"}
|
||||||
{form name="thelia.admin.export"}
|
<div class="container" id="wrapper">
|
||||||
<form method="post" {form_enctype form=$form}>
|
|
||||||
<div class="configuration">
|
|
||||||
<div id="wrapper" class="container">
|
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
<li><a href="{url path='admin/home'}">{intl l='Home'}</a></li>
|
||||||
<li><a href="{url path='admin/tools'}">{intl l='Tools'}</a></li>
|
<li><a href="{url path='admin/tools'}">{intl l='Tools'}</a></li>
|
||||||
<li><a href="{url path='admin/export'}">{intl l="Exports"}</a></li>
|
<li><a href="{url path='admin/export'}">{intl l="Exports"}</a></li>
|
||||||
<li>{intl l='Export: %title' title=$TITLE}</li>
|
<li>{intl l="Export"}: {$TITLE}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-6">
|
||||||
<div class="general-block-decorator">
|
<div class="general-block-decorator">
|
||||||
<div class="title block-title">
|
|
||||||
{intl l="Export"}
|
<div class="title title-without-tabs">
|
||||||
</div>
|
{intl l='Export: '}{$TITLE}
|
||||||
<div class="block-content">
|
</div>
|
||||||
|
|
||||||
|
{form name="thelia.export"}
|
||||||
|
<form action="{$URL}" method="post" {form_enctype form=$form}>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
{ifloop rel="export-formatters"}
|
{ifloop rel="export-formatters"}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="col-md-3">
|
|
||||||
{custom_render_form_field form=$form field="formatter"}
|
{custom_render_form_field form=$form field="formatter"}
|
||||||
<select>
|
<select>
|
||||||
{loop name="export-formatters" type="formatter" export=$ID}
|
{loop name="export-formatters" type="formatter" export=$ID}
|
||||||
@@ -46,75 +46,72 @@
|
|||||||
</select>
|
</select>
|
||||||
{/custom_render_form_field}
|
{/custom_render_form_field}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
<div class="col-md-3">
|
{form_field form=$form field="do_compress"}
|
||||||
<div class="row">
|
<label for="{$label_attr.for}">
|
||||||
<div class="col-md-12">
|
{$label}
|
||||||
<label>
|
</label>
|
||||||
{intl l="Do compress"}
|
<div data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-on="success" class="make-switch switch-small" id="export-compression-switch">
|
||||||
</label>
|
<input type="checkbox" name="{$name}" id="{$label_attr.for}"/>
|
||||||
<div data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-on="success" class="make-switch switch-small export-compression-switch">
|
|
||||||
<input type="checkbox" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{/form_field}
|
||||||
<div class="row export-compression-selection-row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
{custom_render_form_field form=$form field="archive_builder"}
|
|
||||||
<select name="{$name}">
|
|
||||||
{loop name="export-archive-builder" type="archive-builder"}
|
|
||||||
<option value="{$NAME}" {if $value == $NAME}selected{/if}>
|
|
||||||
{$NAME} (.{$EXTENSION})
|
|
||||||
</option>
|
|
||||||
{/loop}
|
|
||||||
</select>
|
|
||||||
{/custom_render_form_field}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="row export-compression-selection-row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
{custom_render_form_field form=$form field="archive_builder"}
|
||||||
|
<select name="{$name}">
|
||||||
|
{loop name="export-archive-builder" type="archive-builder"}
|
||||||
|
<option value="{$NAME}" {if $value == $NAME}selected{/if}>
|
||||||
|
{$NAME} (.{$EXTENSION})
|
||||||
|
</option>
|
||||||
|
{/loop}
|
||||||
|
</select>
|
||||||
|
{/custom_render_form_field}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
{form_field form=$form field="images"}
|
{form_field form=$form field="images"}
|
||||||
<label for="{$label_attr.for}">
|
<label for="{$label_attr.for}">
|
||||||
{$label}
|
{$label}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-on="success" class="make-switch switch-small ">
|
<div data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-on="success" class="make-switch switch-small">
|
||||||
<input type="checkbox" name="{$name}" id="{$label_attr.for}"/>
|
<input type="checkbox" name="{$name}" id="{$label_attr.for}" />
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-4">
|
||||||
{form_field form=$form field="documents"}
|
{form_field form=$form field="documents"}
|
||||||
<label for="{$label_attr.for}">
|
<label for="{$label_attr.for}">
|
||||||
{$label}
|
{$label}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-on="success" class="make-switch switch-small ">
|
<div data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-on="success" class="make-switch switch-small">
|
||||||
<input type="checkbox" name="{$name}" id="{$label_attr.for}"/>
|
<input type="checkbox" name="{$name}" id="{$label_attr.for}" />
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{/ifloop}
|
||||||
</div>
|
{elseloop rel="export-formatters"}
|
||||||
{/ifloop}
|
<div class="row">
|
||||||
{elseloop rel="export-formatters"}
|
<div class="col-md-12">
|
||||||
<div class="row">
|
<div class="alert alert-warning">
|
||||||
<div class="col-md-12">
|
{intl l="You can't do exports, you don't have any formatter that handles this."}
|
||||||
<div class="alert alert-warning">
|
</div>
|
||||||
{intl l="You can't do exports, you don't have any formatter that handles this."}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{/elseloop}
|
||||||
{/elseloop}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<button type="submit" class="btn btn-primary">{intl l="Export"}</button>
|
||||||
|
</form>
|
||||||
|
{/form}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
{/form}
|
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="javascript-initialization"}
|
{block name="javascript-initialization"}
|
||||||
@@ -124,19 +121,19 @@
|
|||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="javascript-last-call"}
|
{block name="javascript-last-call"}
|
||||||
<!-- -->
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var compression_switch = $(".export-compression-switch");
|
|
||||||
|
var compression_switch = $("#export-compression-switch");
|
||||||
var compression_row = $(".export-compression-selection-row");
|
var compression_row = $(".export-compression-selection-row");
|
||||||
|
|
||||||
compression_switch.on("switch-change", function(e, data) {
|
compression_switch.on("switch-change", function(e, data) {
|
||||||
var is_checked = data.value;
|
var is_checked = data.value;
|
||||||
|
|
||||||
if (is_checked) {
|
if (is_checked) {
|
||||||
compression_row.show();
|
compression_row.show("slow");
|
||||||
} else {
|
} else {
|
||||||
compression_row.hide();
|
compression_row.hide("slow");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -145,6 +142,10 @@
|
|||||||
} else {
|
} else {
|
||||||
compression_row.hide();
|
compression_row.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(".make-switch", export_modal).bootstrapSwitch();
|
||||||
|
$("#real-export-modal").modal();
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{module_include location='configuration-js'}
|
{module_include location='configuration-js'}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
{assign url_export "export_order="|cat:$export_order}
|
{assign url_export "export_order="|cat:$export_order}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<div id="export-modal"></div>
|
||||||
|
|
||||||
<div class="configuration">
|
<div class="configuration">
|
||||||
|
|
||||||
@@ -33,17 +34,18 @@
|
|||||||
{module_include location='tools_top'}
|
{module_include location='tools_top'}
|
||||||
|
|
||||||
{loop name="export-category" type="export-category" order=$category_order}
|
{loop name="export-category" type="export-category" order=$category_order}
|
||||||
|
{assign category_title $TITLE}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="general-block-decorator">
|
<div class="general-block-decorator">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive" id="category_{$category_title}">
|
||||||
<table class="table table-striped table-condensed table-left-aligned">
|
<table class="table table-striped table-condensed table-left-aligned">
|
||||||
<caption class="clearfix">
|
<caption class="clearfix">
|
||||||
<a href="{url path="/admin/export/position/category/up/{$ID}{if $url_export}?{$url_export}{/if}"}">
|
<a href="{url path="/admin/export/position/category/up/{$ID}{if $url_export}?{$url_export}{/if}#category_{$category_title}"}">
|
||||||
<span class="glyphicon glyphicon-arrow-up"></span>
|
<span class="glyphicon glyphicon-arrow-up"></span>
|
||||||
</a>
|
</a>
|
||||||
{$POSITION}
|
{$POSITION}
|
||||||
<a href="{url path="/admin/export/position/category/down/{$ID}{if $url_export}?{$url_export}{/if}"}">
|
<a href="{url path="/admin/export/position/category/down/{$ID}{if $url_export}?{$url_export}{/if}#category_{$category_title}"}">
|
||||||
<span class="glyphicon glyphicon-arrow-down"></span>
|
<span class="glyphicon glyphicon-arrow-down"></span>
|
||||||
</a>
|
</a>
|
||||||
{$TITLE}
|
{$TITLE}
|
||||||
@@ -51,17 +53,32 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-md-1">
|
<th class="col-md-1">
|
||||||
<a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=id{if $export_order == "id"}_reverse{/if}">
|
{if $export_order == "id"}
|
||||||
|
<i class="glyphicon glyphicon-chevron-up"></i>
|
||||||
|
{elseif $export_order == "id_reverse"}
|
||||||
|
<i class="glyphicon glyphicon-chevron-down"></i>
|
||||||
|
{/if}
|
||||||
|
<a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=id{if $export_order == "id"}_reverse{/if}#category_{$category_title}">
|
||||||
{intl l="ID"}
|
{intl l="ID"}
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th class="col-md-8">
|
<th class="col-md-8">
|
||||||
<a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=alpha{if $export_order == "alpha"}_reverse{/if}">
|
{if $export_order == "alpha"}
|
||||||
|
<i class="glyphicon glyphicon-chevron-up"></i>
|
||||||
|
{elseif $export_order == "alpha_reverse"}
|
||||||
|
<i class="glyphicon glyphicon-chevron-down"></i>
|
||||||
|
{/if}
|
||||||
|
<a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=alpha{if $export_order == "alpha"}_reverse{/if}#category_{$category_title}">
|
||||||
{intl l="Name"}
|
{intl l="Name"}
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<th class="col-md-2">
|
<th class="col-md-2">
|
||||||
<a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=manual{if $export_order == "manual"}_reverse{/if}">
|
{if $export_order == "manual"}
|
||||||
|
<i class="glyphicon glyphicon-chevron-up"></i>
|
||||||
|
{elseif $export_order == "manual_reverse"}
|
||||||
|
<i class="glyphicon glyphicon-chevron-down"></i>
|
||||||
|
{/if}
|
||||||
|
<a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=manual{if $export_order == "manual"}_reverse{/if}#category_{$category_title}">
|
||||||
{intl l="Position"}
|
{intl l="Position"}
|
||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
@@ -77,20 +94,20 @@
|
|||||||
{$ID}
|
{$ID}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{$URL}">{$TITLE}</a>
|
<a href="#category_{$category_title}" class="btn-show-export-modal" data-id="{$ID}" data-url="{$URL}">{$TITLE}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{url path="/admin/export/position/up/{if $url_category}?{$url_category}{/if}{$ID}"}">
|
<a href="{url path="/admin/export/position/up/{if $url_category}?{$url_category}{/if}{$ID}#category_{$category_title}"}">
|
||||||
<span class="glyphicon glyphicon-arrow-up"></span>
|
<span class="glyphicon glyphicon-arrow-up"></span>
|
||||||
</a>
|
</a>
|
||||||
{$POSITION}
|
{$POSITION}
|
||||||
<a href="{url path="/admin/export/position/down/{$ID}{if $url_category}?{$url_category}{/if}"}">
|
<a href="{url path="/admin/export/position/down/{$ID}{if $url_category}?{$url_category}{/if}#category_{$category_title}"}">
|
||||||
<span class="glyphicon glyphicon-arrow-down"></span>
|
<span class="glyphicon glyphicon-arrow-down"></span>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a class="btn btn-default btn-xs" href="{$URL}" title="{intl l="Do this export"}">
|
<a class="btn btn-default btn-xs btn-show-export-modal" data-id="{$ID}" data-url="{$URL}" title="{intl l="Do this export"}">
|
||||||
<span class="glyphicon glyphicon-open"></span>
|
<span class="glyphicon glyphicon-open"></span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -116,3 +133,58 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
|
{block name="javascript-initialization"}
|
||||||
|
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||||
|
<script src="{$asset_url}"></script>
|
||||||
|
{/javascripts}
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="javascript-last-call"}
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var export_modal = $("#export-modal");
|
||||||
|
|
||||||
|
$(".btn-show-export-modal").click(function() {
|
||||||
|
|
||||||
|
var export_id = $(this).data("id");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If we can't load the modal form, redirect to a page where the form is too.
|
||||||
|
*/
|
||||||
|
$.ajax(
|
||||||
|
$(this).data("url")
|
||||||
|
).success(function(data) {
|
||||||
|
export_modal.html(data);
|
||||||
|
|
||||||
|
var compression_switch = $("#export-compression-switch", export_modal);
|
||||||
|
var compression_row = $(".export-compression-selection-row", export_modal);
|
||||||
|
|
||||||
|
compression_switch.on("switch-change", function(e, data) {
|
||||||
|
var is_checked = data.value;
|
||||||
|
|
||||||
|
if (is_checked) {
|
||||||
|
compression_row.show("slow");
|
||||||
|
} else {
|
||||||
|
compression_row.hide("slow");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($("input[type=checkbox]", compression_switch).is(":checked")) {
|
||||||
|
compression_row.show();
|
||||||
|
} else {
|
||||||
|
compression_row.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$(".make-switch", export_modal).bootstrapSwitch();
|
||||||
|
$("#real-export-modal").modal();
|
||||||
|
|
||||||
|
}).fail(function() {
|
||||||
|
window.location.replace("{url path='/admin/export/'}"+export_id);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{module_include location='configuration-js'}
|
||||||
|
{/block}
|
||||||
Reference in New Issue
Block a user