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:
Benjamin Perche
2014-07-11 16:06:15 +02:00
parent 33695a7886
commit b6937ab421
16 changed files with 453 additions and 127 deletions

View File

@@ -17,6 +17,7 @@
{assign url_export "export_order="|cat:$export_order}
{/if}
<div id="export-modal"></div>
<div class="configuration">
@@ -33,17 +34,18 @@
{module_include location='tools_top'}
{loop name="export-category" type="export-category" order=$category_order}
{assign category_title $TITLE}
<div class="row">
<div class="col-md-12">
<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">
<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>
</a>
{$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>
</a>
{$TITLE}
@@ -51,17 +53,32 @@
<thead>
<tr>
<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"}
</a>
</th>
<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"}
</a>
</th>
<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"}
</a>
</th>
@@ -77,20 +94,20 @@
{$ID}
</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>
<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>
</a>
{$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>
</a>
</td>
<td>
<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>
</a>
</div>
@@ -115,4 +132,59 @@
{module_include location='configuration_bottom'}
</div>
</div>
{/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}