mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Update /download/controller/
This commit is contained in:
@@ -51,13 +51,13 @@ class DoDownload implements ControllerProviderInterface
|
|||||||
*
|
*
|
||||||
* description : Prepare a set of documents for download
|
* description : Prepare a set of documents for download
|
||||||
*
|
*
|
||||||
* method : POST
|
* method : GET
|
||||||
*
|
*
|
||||||
* parameters : none
|
* parameters : none
|
||||||
*
|
*
|
||||||
* return : HTML Response
|
* return : HTML Response
|
||||||
*/
|
*/
|
||||||
$controllers->post('/{token}/prepare/', $this->call('prepareDownload'))
|
$controllers->get('/{token}/prepare/', $this->call('prepareDownload'))
|
||||||
->bind('prepare_download')
|
->bind('prepare_download')
|
||||||
->assert('token', '^[a-zA-Z0-9]{8,16}$');
|
->assert('token', '^[a-zA-Z0-9]{8,16}$');
|
||||||
|
|
||||||
@@ -128,12 +128,14 @@ class DoDownload implements ControllerProviderInterface
|
|||||||
$records[sprintf('%s_%s', $sbasId, $file['record_id'])] = new \record_adapter($app, $sbasId, $file['record_id']);
|
$records[sprintf('%s_%s', $sbasId, $file['record_id'])] = new \record_adapter($app, $sbasId, $file['record_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Reponse($app['twig']->render(
|
return $app['twig']->render(
|
||||||
'/prod/actions/Download/prepare.html.twig', array(
|
'/prod/actions/Download/prepare.html.twig', array(
|
||||||
'datas' => $list,
|
'module_name' => _('Export download'),
|
||||||
'records' => $records,
|
'module' => _('Export'),
|
||||||
'token' => $token
|
'list' => $list,
|
||||||
)));
|
'records' => $records,
|
||||||
|
'token' => $token
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,7 +170,7 @@ class DoDownload implements ControllerProviderInterface
|
|||||||
$mime = 'application/zip';
|
$mime = 'application/zip';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$app['file-system']->exists($exportFile)) {
|
if(!$app['filesystem']->exists($exportFile)) {
|
||||||
$app->abort(404);
|
$app->abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +186,7 @@ class DoDownload implements ControllerProviderInterface
|
|||||||
'attachment'
|
'attachment'
|
||||||
);
|
);
|
||||||
|
|
||||||
return $response;
|
$response->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,13 +2,12 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{% trans "Telechargement de documents" %}</h1>
|
<h1>{% trans "Telechargement de documents" %}</h1>
|
||||||
|
|
||||||
<div class="well-small">
|
<div class="well-small">
|
||||||
{% if list['complete'] is not defined or not list['complete']%}
|
{% if (list['complete'] is not defined or not list['complete']) and list['count'] > 1%}
|
||||||
<p>
|
<p>
|
||||||
{% trans "telechargement::Veuillez patienter, vos fichiers sont en train d\'etre rassembles pour le telechargement, cette operation peut prendre quelques minutes." %}
|
{% trans "telechargement::Veuillez patienter, vos fichiers sont en train d\'etre rassembles pour le telechargement, cette operation peut prendre quelques minutes." %}
|
||||||
</p>
|
</p>
|
||||||
{% else list['complete'] %}
|
{% elseif list['complete'] is defined and list['complete'] %}
|
||||||
<p>
|
<p>
|
||||||
{% set url = "/download/"~ token ~"/get/" %}
|
{% set url = "/download/"~ token ~"/get/" %}
|
||||||
{% trans %}
|
{% trans %}
|
||||||
@@ -29,7 +28,7 @@
|
|||||||
<th>{% trans "document:: nom" %}</th>
|
<th>{% trans "document:: nom" %}</th>
|
||||||
<th>{% trans "phrseanet:: sous definition" %}</th>
|
<th>{% trans "phrseanet:: sous definition" %}</th>
|
||||||
<th>{% trans "poids" %}</th>
|
<th>{% trans "poids" %}</th>
|
||||||
<th>{#thumbnail#}</th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@@ -37,7 +36,7 @@
|
|||||||
{% for file in list["files"] %}
|
{% for file in list["files"] %}
|
||||||
{% set size = 0 %}
|
{% set size = 0 %}
|
||||||
<tr valign="middle">
|
<tr valign="middle">
|
||||||
<td>{{ app|sbas_fom_bas(file['base_id'])|sbas_names(app) }} {{ file['base_id']|bas_names(app) }}</td>
|
<td>{{ app|sbas_from_bas(file['base_id'])|sbas_names(app) }} {{ file['base_id']|bas_names(app) }}</td>
|
||||||
<td>{{ file['original_name'] }}</td>
|
<td>{{ file['original_name'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% for subdef in file['subdefs'] %}
|
{% for subdef in file['subdefs'] %}
|
||||||
@@ -47,17 +46,17 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ size|formatOctets }}</td>
|
<td>{{ size|formatOctets }}</td>
|
||||||
<td style="text-align:center;">
|
<td style="text-align:center;">
|
||||||
{% set key = app|sbas_from_bas(file['base_id']) ~'_'~ file['record_id']%}
|
{% set record_key = app|sbas_from_bas(file['base_id']) ~'_'~ file['record_id']%}
|
||||||
|
|
||||||
{% if key in records|keys %}
|
{% if record_key in records|keys %}
|
||||||
{% set record = attribute(records, key) %}
|
{% set record = attribute(records, record_key) %}
|
||||||
{% set thumbnail = record.getThumbnail() %}
|
{% set thumbnail = record.get_thumbnail() %}
|
||||||
{% if thumbnail.is_paysage() %}
|
{% if thumbnail.is_paysage() %}
|
||||||
{% set w = 140 %}
|
{% set w = 140 %}
|
||||||
{% set h = (w / (thumbnail.get_widh() / thumbnail.get_height()))|round %}
|
{% set h = (w / (thumbnail.get_width() / thumbnail.get_height()))|round %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set h = 105 %}
|
{% set h = 105 %}
|
||||||
{% set w = (h * (thumbnail.get_widh() / thumbnail.get_height()))|round %}
|
{% set w = (h * (thumbnail.get_width() / thumbnail.get_height()))|round %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<img width="{{ w ~ 'px' }}" height="{{ h ~ 'px' }}" src="{{ thumbnail.get_url() }}" />
|
<img width="{{ w ~ 'px' }}" height="{{ h ~ 'px' }}" src="{{ thumbnail.get_url() }}" />
|
||||||
@@ -76,7 +75,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
{% if list['complete'] is not defined or and list['count'] > 1%}
|
{% if list['complete'] is not defined and list['count'] > 1 %}
|
||||||
$.post("/include/download_prepare.exe.php", {
|
$.post("/include/download_prepare.exe.php", {
|
||||||
token: "{{ token }}"
|
token: "{{ token }}"
|
||||||
}, function(data){
|
}, function(data){
|
||||||
@@ -85,8 +84,9 @@
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
{% elseif list['complete'] %}
|
{% elseif (list['complete'] is defined and list['complete']) or list['count'] == 1 %}
|
||||||
// Get files
|
// Get files
|
||||||
|
console.log("coucou");
|
||||||
$('form[name=download]').submit();
|
$('form[name=download]').submit();
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set time = (total_size / (1024 * 1024 * 3))|round %}
|
{% set time = (total_size / (1024 * 1024 * 3))|round %}
|
||||||
|
Reference in New Issue
Block a user