Finish Import / Export categories management

modifié:         core/lib/Thelia/Config/Resources/routing/admin.xml
	modifié:         core/lib/Thelia/Controller/Admin/ExportController.php
	modifié:         core/lib/Thelia/Controller/Admin/ImportExportController.php
	modifié:         core/lib/Thelia/Core/FileFormat/Formatting/Formatter/JsonFormatter.php
	modifié:         core/lib/Thelia/Core/FileFormat/Formatting/Formatter/XMLFormatter.php
	modifié:         core/lib/Thelia/Core/FileFormat/Formatting/FormatterInterface.php
	modifié:         core/lib/Thelia/Core/Template/Loop/Export.php
	modifié:         core/lib/Thelia/Core/Template/Loop/Formatter.php
	nouveau fichier: core/lib/Thelia/ImportExport/Both/NewsletterImportExport.php
	nouveau fichier: core/lib/Thelia/ImportExport/Export/ExportType.php
	nouveau fichier: core/lib/Thelia/ImportExport/Export/MailingExport.php
	modifié:         core/lib/Thelia/ImportExport/ExportHandlerInterface.php
	modifié:         core/lib/Thelia/Model/Export.php
	modifié:         core/lib/Thelia/Model/ExportCategory.php
	modifié:         core/lib/Thelia/Model/ImportCategory.php
	modifié:         templates/backOffice/default/export-page.html
	modifié:         templates/backOffice/default/export.html
	modifié:         templates/backOffice/default/import.html
	modifié:         templates/backOffice/default/includes/export-form-definition.html
This commit is contained in:
Benjamin Perche
2014-07-11 09:56:06 +02:00
parent 4e5bbd7f60
commit 6bc3ed214b
19 changed files with 610 additions and 135 deletions

View File

@@ -1158,7 +1158,7 @@
<default key="_controller">Thelia\Controller\Admin\TranslationsController::updateAction</default> <default key="_controller">Thelia\Controller\Admin\TranslationsController::updateAction</default>
</route> </route>
<!-- export management --> <!-- import and export management -->
<route id="export.list" path="/admin/export"> <route id="export.list" path="/admin/export">
<default key="_controller">Thelia\Controller\Admin\ExportController::indexAction</default> <default key="_controller">Thelia\Controller\Admin\ExportController::indexAction</default>
@@ -1176,6 +1176,18 @@
<requirement key="value">\d+</requirement> <requirement key="value">\d+</requirement>
</route> </route>
<route id="export.category.position" path="/admin/export/position/category/{action}/{id}">
<default key="_controller">Thelia\Controller\Admin\ExportController::changeCategoryPosition</default>
<requirement key="action">up|down</requirement>
<requirement key="id">\d+</requirement>
</route>
<route id="export.category.position.update" path="/admin/export/position/category/update/{id}/{value}">
<default key="_controller">Thelia\Controller\Admin\ExportController::updateCategoryPosition</default>
<requirement key="id">\d+</requirement>
<requirement key="value">\d+</requirement>
</route>
<route id="export.action" path="/admin/export/{id}" methods="post"> <route id="export.action" path="/admin/export/{id}" methods="post">
<default key="_controller">Thelia\Controller\Admin\ImportExportController::export</default> <default key="_controller">Thelia\Controller\Admin\ImportExportController::export</default>
<requirement key="id">\d+</requirement> <requirement key="id">\d+</requirement>

View File

@@ -16,6 +16,7 @@ use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Template\Loop\ImportExportType; use Thelia\Core\Template\Loop\ImportExportType;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
use Thelia\Model\ExportCategoryQuery;
use Thelia\Model\ExportQuery; use Thelia\Model\ExportQuery;
/** /**
@@ -31,15 +32,7 @@ class ExportController extends BaseAdminController
return $response; return $response;
} }
$export_order = $this->getRequest()->query->get("export_order"); $this->setOrders();
if (!in_array($export_order, ImportExportType::getAllowedOrders())) {
$export_order = ImportExportType::DEFAULT_ORDER;
}
$this->getParserContext()
->set("export_order", $export_order)
;
return $this->render('export'); return $this->render('export');
} }
@@ -58,9 +51,7 @@ class ExportController extends BaseAdminController
$export->downPosition(); $export->downPosition();
} }
$this->getParserContext() $this->setOrders(null, "manual");
->set("export_order", "manual")
;
return $this->render('export'); return $this->render('export');
} }
@@ -75,13 +66,63 @@ class ExportController extends BaseAdminController
$export->updatePosition($value); $export->updatePosition($value);
$this->getParserContext() $this->setOrders(null, "manual");
->set("export_order", "manual")
;
return $this->render('export'); return $this->render('export');
} }
public function changeCategoryPosition($action, $id)
{
if (null !== $response = $this->checkAuth([AdminResources::EXPORT], [], [AccessManager::UPDATE])) {
return $response;
}
$category = $this->getCategory($id);
if ($action === "up") {
$category->upPosition();
} elseif ($action === "down") {
$category->downPosition();
}
$this->setOrders("manual");
return $this->render('export');
}
public function updateCategoryPosition($id, $value)
{
if (null !== $response = $this->checkAuth([AdminResources::EXPORT], [], [AccessManager::UPDATE])) {
return $response;
}
$category = $this->getCategory($id);
$category->updatePosition($value);
$this->setOrders("manual");
return $this->render('export');
}
protected function setOrders($category = null, $export = null)
{
if ($category === null) {
$category = $this->getRequest()->query->get("category_order");
}
if ($export === null) {
$export = $this->getRequest()->query->get("export_order");
}
$this->getParserContext()
->set("category_order", $category)
;
$this->getParserContext()
->set("export_order", $export)
;
}
protected function getExport($id) protected function getExport($id)
{ {
@@ -99,4 +140,21 @@ class ExportController extends BaseAdminController
} }
return $export; return $export;
} }
protected function getCategory($id)
{
$category = ExportCategoryQuery::create()->findPk($id);
if (null === $category) {
throw new \ErrorException(
Translator::getInstance()->trans(
"There is no id \"%id\" in the export categories",
[
"%id" => $id
]
)
);
}
return $category;
}
} }

View File

@@ -12,6 +12,7 @@
namespace Thelia\Controller\Admin; namespace Thelia\Controller\Admin;
use Thelia\Core\HttpFoundation\Response; use Thelia\Core\HttpFoundation\Response;
use Thelia\Model\ExportQuery;
/** /**
* Class ImportExportController * Class ImportExportController
@@ -20,23 +21,40 @@ use Thelia\Core\HttpFoundation\Response;
*/ */
class ImportExportController extends BaseAdminController class ImportExportController extends BaseAdminController
{ {
public function import() public function import($id)
{ {
} }
public function export() public function export($id)
{ {
} }
public function importView() public function importView($id)
{ {
if (null === $export = $this->getExport($id)) {
return $this->render("404");
}
return $this->render("import-page"); return $this->render("import-page");
} }
public function exportView() public function exportView($id)
{ {
if (null === $export = $this->getExport($id)) {
return $this->render("404");
}
return $this->render("export-page"); return $this->render("export-page");
} }
protected function getExport($id)
{
$export = ExportQuery::create()
->findPk($id)
;
return $export;
}
} }

View File

@@ -13,6 +13,7 @@
namespace Thelia\Core\FileFormat\Formatting\Formatter; namespace Thelia\Core\FileFormat\Formatting\Formatter;
use Thelia\Core\FileFormat\Formatting\AbstractFormatter; use Thelia\Core\FileFormat\Formatting\AbstractFormatter;
use Thelia\Core\FileFormat\Formatting\FormatterData; use Thelia\Core\FileFormat\Formatting\FormatterData;
use Thelia\ImportExport\Export\ExportType;
/** /**
* Class JsonFormatter * Class JsonFormatter
@@ -87,4 +88,11 @@ class JsonFormatter extends AbstractFormatter
); );
} }
public function getExportType()
{
return array(
ExportType::EXPORT_TABLE,
ExportType::EXPORT_UNBOUNDED,
);
}
} }

View File

@@ -14,6 +14,7 @@ namespace Thelia\Core\FileFormat\Formatting\Formatter;
use Thelia\Core\FileFormat\Formatter\Exception\BadFormattedStringException; use Thelia\Core\FileFormat\Formatter\Exception\BadFormattedStringException;
use Thelia\Core\FileFormat\Formatting\AbstractFormatter; use Thelia\Core\FileFormat\Formatting\AbstractFormatter;
use Thelia\Core\FileFormat\Formatting\FormatterData; use Thelia\Core\FileFormat\Formatting\FormatterData;
use Thelia\ImportExport\Export\ExportType;
/** /**
* Class XMLFormatter * Class XMLFormatter
@@ -141,4 +142,12 @@ class XMLFormatter extends AbstractFormatter
$data = new FormatterData($this->getAliases()); $data = new FormatterData($this->getAliases());
return $data->setData($array); return $data->setData($array);
} }
public function getExportType()
{
return array(
ExportType::EXPORT_TABLE,
ExportType::EXPORT_UNBOUNDED,
);
}
} }

View File

@@ -36,4 +36,17 @@ interface FormatterInterface
* a FormatterData object. * a FormatterData object.
*/ */
public function decode($rawData); public function decode($rawData);
/**
* @return string
*
* return a string that defines the handled format type.
*
* Thelia types are defined in \Thelia\ImportExport\Export\ExportType
*
* examples:
* return ExportType::EXPORT_TABLE;
* return ExportType::EXPORT_UNBOUNDED;
*/
public function getExportType();
} }

View File

@@ -12,7 +12,6 @@
namespace Thelia\Core\Template\Loop; namespace Thelia\Core\Template\Loop;
use Thelia\Model\ExportQuery; use Thelia\Model\ExportQuery;
use Thelia\Model\Map\ExportTableMap;
/** /**
* Class Export * Class Export

View File

@@ -17,6 +17,7 @@ use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\ExportQuery;
use Thelia\Type\EnumType; use Thelia\Type\EnumType;
use Thelia\Type\TypeCollection; use Thelia\Type\TypeCollection;
@@ -39,19 +40,27 @@ class Formatter extends BaseLoop implements ArraySearchLoopInterface
$rawFormatters = array_change_key_case($service->getAll()); $rawFormatters = array_change_key_case($service->getAll());
$allowedFormatter = $this->getAllowed_formatter(); $exportId = $this->getExport();
$formatters = []; $formatters = [];
if ($allowedFormatter !== null) { if ($exportId !== null) {
$allowedFormatter = explode(",", $allowedFormatter); $export = ExportQuery::create()->findPk($exportId);
if (null !== $export) {
$types = $export->getHandleClassInstance($this->container)
->getHandledType();
foreach($allowedFormatter as $formatter) { if (is_scalar($types)) {
$formatter = trim(strtolower($formatter)); $types = [$types];
}
if (isset($rawFormatters[$formatter])) { /** @var \Thelia\Core\FileFormat\Formatting\AbstractFormatter $formatter */
$formatters[$formatter] = $rawFormatters[$formatter]; foreach ($rawFormatters as $key=>$formatter) {
if (in_array($formatter->getExportType(), $types)) {
$formatters[$key] = $formatter;
}
} }
} }
} else { } else {
$formatters = $rawFormatters; $formatters = $rawFormatters;
} }
@@ -118,7 +127,7 @@ class Formatter extends BaseLoop implements ArraySearchLoopInterface
protected function getArgDefinitions() protected function getArgDefinitions()
{ {
return new ArgumentCollection( return new ArgumentCollection(
Argument::createAnyTypeArgument("allowed_formatter"), Argument::createIntTypeArgument("export"),
new Argument( new Argument(
"order", "order",
new TypeCollection( new TypeCollection(

View File

@@ -0,0 +1,58 @@
<?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\ImportExport\Both;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Thelia\Core\FileFormat\Formatting\FormatterData;
use Thelia\ImportExport\ExportHandlerInterface;
use Thelia\ImportExport\ImportHandlerInterface;
/**
* Class NewsletterImportExport
* @package Thelia\ImportExport\Both
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class NewsletterImportExport implements ExportHandlerInterface, ImportHandlerInterface
{
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
*
* The method builds
*/
public function buildFormatterData()
{
// TODO: Implement buildFormatterData() method.
}
/**
* @return \Thelia\Core\FileFormat\Formatting\FormatterData
*
* The method builds
*/
public function importFromFormatterData(FormatterData $data)
{
// TODO: Implement importFromFormatterData() method.
}
}

View File

@@ -0,0 +1,33 @@
<?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\ImportExport\Export;
/**
* Class ExportType
* @package Thelia\ImportExport\Export
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class ExportType
{
/**
* This type is for unbounded formats, in general serialization formats
* example: XML, json, yaml
*/
const EXPORT_UNBOUNDED = "export.unbounded";
/**
* This type is for tabled format ( matrix ), most used by spreadsheet application.
* example: CSV, ODS, XLS
*/
const EXPORT_TABLE = "export.table";
}

View File

@@ -0,0 +1,47 @@
<?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\ImportExport\Export;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Thelia\Core\FileFormat\Formatting\FormatterData;
use Thelia\ImportExport\ExportHandlerInterface;
/**
* Class MailingExport
* @package Thelia\ImportExport\Export
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class MailingExport implements ExportHandlerInterface
{
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
*
* The method builds
*/
public function buildFormatterData()
{
$data = new FormatterData();
}
}

View File

@@ -33,4 +33,21 @@ interface ExportHandlerInterface
* The method builds * The method builds
*/ */
public function buildFormatterData(); public function buildFormatterData();
/**
* @return string|array
*
* Define all the type of export/formatters that this can handle
* return a string if it handle a single type ( specific exports ),
* or an array if multiple.
*
* Thelia types are defined in \Thelia\ImportExport\Export\ExportType
*
* example:
* return array(
* ExportType::EXPORT_TABLE,
* ExportType::EXPORT_UNBOUNDED,
* );
*/
public function getHandledType();
} }

View File

@@ -74,6 +74,11 @@ class Export extends BaseExport
$this->setPosition($position)->save(); $this->setPosition($position)->save();
} }
/**
* @param ContainerInterface $container
* @return ExportHandlerInterface
* @throws \ErrorException
*/
public function getHandleClassInstance(ContainerInterface $container) public function getHandleClassInstance(ContainerInterface $container)
{ {
$class = $this->getHandleClass(); $class = $this->getHandleClass();

View File

@@ -2,9 +2,73 @@
namespace Thelia\Model; namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Model\Base\CategoryQuery;
use Thelia\Model\Base\ExportCategory as BaseExportCategory; use Thelia\Model\Base\ExportCategory as BaseExportCategory;
use Thelia\Model\Map\ExportCategoryTableMap;
class ExportCategory extends BaseExportCategory class ExportCategory extends BaseExportCategory
{ {
public function upPosition()
{
if (($position = $this->getPosition()) > 1) {
$previous = ExportCategoryQuery::create()
->findOneByPosition($position - 1)
;
if (null !== $previous) {
$previous->setPosition($position)->save();
}
$this->setPosition($position - 1)->save();
}
return $this;
}
public function downPosition()
{
$max = CategoryQuery::create()
->orderByPosition(Criteria::DESC)
->select(ExportCategoryTableMap::POSITION)
->findOne()
;
$count = CategoryQuery::create()->count();
if ($count > $max) {
$max = $count;
}
$position = $this->getPosition();
if ($position < $max) {
$next = ExportCategoryQuery::create()
->findOneByPosition($position + 1)
;
if (null !== $next) {
$next->setPosition($position)->save();
}
$this->setPosition($position + 1)->save();
}
return $this;
}
public function updatePosition($position)
{
$reverse = ExportCategoryQuery::create()
->findOneByPosition($position)
;
if (null !== $reverse) {
$reverse->setPosition($this->getPosition())->save();
}
$this->setPosition($position)->save();
}
} }

View File

@@ -2,9 +2,72 @@
namespace Thelia\Model; namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Model\Base\ImportCategory as BaseImportCategory; use Thelia\Model\Base\ImportCategory as BaseImportCategory;
use Thelia\Model\Map\ImportCategoryTableMap;
class ImportCategory extends BaseImportCategory class ImportCategory extends BaseImportCategory
{ {
public function upPosition()
{
if (($position = $this->getPosition()) > 1) {
$previous = ImportCategoryQuery::create()
->findOneByPosition($position - 1)
;
if (null !== $previous) {
$previous->setPosition($position)->save();
}
$this->setPosition($position - 1)->save();
}
return $this;
}
public function downPosition()
{
$max = CategoryQuery::create()
->orderByPosition(Criteria::DESC)
->select(ImportCategoryTableMap::POSITION)
->findOne()
;
$count = CategoryQuery::create()->count();
if ($count > $max) {
$max = $count;
}
$position = $this->getPosition();
if ($position < $max) {
$next = ImportCategoryQuery::create()
->findOneByPosition($position + 1)
;
if (null !== $next) {
$next->setPosition($position)->save();
}
$this->setPosition($position + 1)->save();
}
return $this;
}
public function updatePosition($position)
{
$reverse = ImportCategoryQuery::create()
->findOneByPosition($position)
;
if (null !== $reverse) {
$reverse->setPosition($this->getPosition())->save();
}
$this->setPosition($position)->save();
}
} }

View File

@@ -0,0 +1,46 @@
{extends file="admin-layout.tpl"}
{block name="no-return-functions"}
{$admin_current_location = 'tools'}
{/block}
{block name="page-title"}{intl l='Export: %name' name=$NAME}{/block}
{block name="check-resource"}admin.export{/block}
{block name="check-access"}view{/block}
{block name="main-content"}
{/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 compression_switch = $(".export-compression-switch");
var compression_row = $(".export-compression-selection-row");
compression_switch.on("switch-change", function(e, data) {
var is_checked = data.value;
if (is_checked) {
compression_row.show();
} else {
compression_row.hide();
}
});
if ($("input[type=checkbox]", compression_switch).is(":checked")) {
compression_row.show();
} else {
compression_row.hide();
}
});
</script>
{module_include location='configuration-js'}
{/block}

View File

@@ -10,6 +10,14 @@
{block name="check-access"}view{/block} {block name="check-access"}view{/block}
{block name="main-content"} {block name="main-content"}
{if $category_order != "manual"}
{assign url_category "category_order="|cat:$category_order}
{/if}
{if $export_order != "manual"}
{assign url_export "export_order="|cat:$export_order}
{/if}
<div class="configuration"> <div class="configuration">
<div id="wrapper" class="container"> <div id="wrapper" class="container">
@@ -24,36 +32,42 @@
{module_include location='tools_top'} {module_include location='tools_top'}
{loop name="export-category" type="export-category"} {loop name="export-category" type="export-category" order=$category_order}
{if $LOOP_COUNT % 3}
<div class="row"> <div class="row">
{/if} <div class="col-md-12">
<div class="general-block-decorator">
<div class="col-md-4">
<div class="menu-list-table general-block-decorator">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-condensed"> <table class="table table-striped table-condensed table-left-aligned">
<caption> <caption class="clearfix">
<!-- add up and down arrows --> <a href="{url path="/admin/export/position/category/up/{$ID}{if $url_export}?{$url_export}{/if}"}">
<span class="glyphicon glyphicon-arrow-up"></span>
</a>
{$POSITION}
<a href="{url path="/admin/export/position/category/down/{$ID}{if $url_export}?{$url_export}{/if}"}">
<span class="glyphicon glyphicon-arrow-down"></span>
</a>
{$TITLE} {$TITLE}
</caption> </caption>
<thead> <thead>
<tr> <tr>
<th class="col-md-1"> <th class="col-md-1">
<a href="{url path="/admin/export"}?export_order=id{if $export_order == "id"}_reverse{/if}"> <a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=id{if $export_order == "id"}_reverse{/if}">
{intl l="ID"} {intl l="ID"}
</a> </a>
</th> </th>
<th class="col-md-9"> <th class="col-md-8">
<a href="{url path="/admin/export"}?export_order=alpha{if $export_order == "alpha"}_reverse{/if}"> <a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=alpha{if $export_order == "alpha"}_reverse{/if}">
{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"}?export_order=manual{if $export_order == "manual"}_reverse{/if}"> <a href="{url path="/admin/export"}?{if $url_category}{$url_category}&{/if}export_order=manual{if $export_order == "manual"}_reverse{/if}">
{intl l="Position"} {intl l="Position"}
</a> </a>
</th> </th>
<th class="col-md-1">
{intl l="Actions"}
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -66,14 +80,21 @@
<a href="{$URL}">{$TITLE}</a> <a href="{$URL}">{$TITLE}</a>
</td> </td>
<td> <td>
<a href="{url path="/admin/export"}/position/up/{$ID}"> <a href="{url path="/admin/export/position/up/{if $url_category}?{$url_category}{/if}{$ID}"}">
<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}"> <a href="{url path="/admin/export/position/down/{$ID}{if $url_category}?{$url_category}{/if}"}">
<span class="glyphicon glyphicon-arrow-down"></span> <span class="glyphicon glyphicon-arrow-down"></span>
</a> </a>
</td> </td>
<td>
<div class="btn-group">
<a class="btn btn-default btn-xs" href="{$URL}" title="{intl l="Do this export"}">
<span class="glyphicon glyphicon-open"></span>
</a>
</div>
</td>
</tr> </tr>
{/loop} {/loop}
</tbody> </tbody>
@@ -82,46 +103,16 @@
</div> </div>
</div> </div>
{if $LOOP_COUNT % 3}
</div> </div>
{/if}
{/loop} {/loop}
{elseloop rel="export-category"}
<div class="alert alert-info">
{intl l="You don't have any export"}
</div>
{/elseloop}
{module_include location='configuration_bottom'} {module_include location='configuration_bottom'}
</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 compression_switch = $(".export-compression-switch");
var compression_row = $(".export-compression-selection-row");
compression_switch.on("switch-change", function(e, data) {
var is_checked = data.value;
if (is_checked) {
compression_row.show();
} else {
compression_row.hide();
}
});
if ($("input[type=checkbox]", compression_switch).is(":checked")) {
compression_row.show();
} else {
compression_row.hide();
}
});
</script>
{module_include location='configuration-js'}
{/block}

View File

@@ -10,6 +10,14 @@
{block name="check-access"}view{/block} {block name="check-access"}view{/block}
{block name="main-content"} {block name="main-content"}
{if $category_order != "manual"}
{assign url_category "category_order="|cat:$category_order}
{/if}
{if $import_order != "manual"}
{assign url_import "import_order="|cat:$import_order}
{/if}
<div class="configuration"> <div class="configuration">
<div id="wrapper" class="container"> <div id="wrapper" class="container">
@@ -24,69 +32,86 @@
{module_include location='tools_top'} {module_include location='tools_top'}
{loop name="import-category" type="import-category"} {loop name="import-category" type="import-category" order=$category_order}
{if $LOOP_COUNT % 3}
<div class="row"> <div class="row">
{/if} <div class="col-md-12">
<div class="general-block-decorator">
<div class="col-md-4">
<div class="menu-list-table general-block-decorator">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-condensed"> <table class="table table-striped table-condensed table-left-aligned">
<caption> <caption class="clearfix">
<!-- add up and down arrows --> <a href="{url path="/admin/import/position/category/up/{$ID}{if $url_import}?{$url_import}{/if}"}">
<span class="glyphicon glyphicon-arrow-up"></span>
</a>
{$POSITION}
<a href="{url path="/admin/import/position/category/down/{$ID}{if $url_import}?{$url_import}{/if}"}">
<span class="glyphicon glyphicon-arrow-down"></span>
</a>
{$TITLE} {$TITLE}
</caption> </caption>
<thead> <thead>
<tr> <tr>
<th class="col-md-1"> <th class="col-md-1">
<a href="{url path="/admin/import"}?import_order=id{if $import_order == "id"}_reverse{/if}"> <a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=id{if $import_order == "id"}_reverse{/if}">
{intl l="ID"} {intl l="ID"}
</a> </a>
</th> </th>
<th class="col-md-9"> <th class="col-md-8">
<a href="{url path="/admin/import"}?import_order=alpha{if $import_order == "alpha"}_reverse{/if}"> <a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=alpha{if $import_order == "alpha"}_reverse{/if}">
{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/import"}?import_order=manual{if $import_order == "manual"}_reverse{/if}"> <a href="{url path="/admin/import"}?{if $url_category}{$url_category}&{/if}import_order=manual{if $import_order == "manual"}_reverse{/if}">
{intl l="Position"} {intl l="Position"}
</a> </a>
</th> </th>
</tr> <th class="col-md-1">
{intl l="Actions"}
</th>
</tr>
</thead> </thead>
<tbody> <tbody>
{loop name="import-categ-list" type="import" order=$import_order category=$ID} {loop name="import-categ-list" type="import" order=$import_order category=$ID}
<tr> <tr>
<td> <td>
{$ID} {$ID}
</td> </td>
<td> <td>
<a href="{$URL}">{$TITLE}</a> <a href="{$URL}">{$TITLE}</a>
</td> </td>
<td> <td>
<a href="{url path="/admin/import"}/position/up/{$ID}"> <a href="{url path="/admin/import/position/up/{if $url_category}?{$url_category}{/if}{$ID}"}">
<span class="glyphicon glyphicon-arrow-up"></span> <span class="glyphicon glyphicon-arrow-up"></span>
</a>
{$POSITION}
<a href="{url path="/admin/import/position/down/{$ID}{if $url_category}?{$url_category}{/if}"}">
<span class="glyphicon glyphicon-arrow-down"></span>
</a>
</td>
<td>
<div class="btn-group">
<a class="btn btn-default btn-xs" href="{$URL}" title="{intl l="Do this import"}">
<span class="glyphicon glyphicon-open"></span>
</a> </a>
{$POSITION} </div>
<a href="{url path="/admin/import/position/down"}/{$ID}"> </td>
<span class="glyphicon glyphicon-arrow-down"></span> </tr>
</a> {/loop}
</td>
</tr>
{/loop}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
{if $LOOP_COUNT % 3}
</div> </div>
{/if}
{/loop} {/loop}
{elseloop rel="import-category"}
<div class="alert alert-info">
{intl l="You don't have any import"}
</div>
{/elseloop}
{module_include location='configuration_bottom'} {module_include location='configuration_bottom'}
</div> </div>
</div> </div>
@@ -107,14 +132,14 @@
var compression_row = $(".import-compression-selection-row"); var compression_row = $(".import-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();
} else { } else {
compression_row.hide(); compression_row.hide();
} }
}); });
if ($("input[type=checkbox]", compression_switch).is(":checked")) { if ($("input[type=checkbox]", compression_switch).is(":checked")) {
compression_row.show(); compression_row.show();

View File

@@ -21,7 +21,7 @@
<div class="col-md-3"> <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"} {loop name="export-formatters" type="formatter" export=$ID}
<option value="{$NAME}" {if $value == $NAME}selected{/if}> <option value="{$NAME}" {if $value == $NAME}selected{/if}>
{$NAME} (.{$EXTENSION}) {$NAME} (.{$EXTENSION})
</option> </option>