mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 23:43:12 +00:00
Porting refactor trash to 4.1
This commit is contained in:
@@ -41,6 +41,7 @@ class LanguageController
|
|||||||
'cancel' => $translator->trans('boutton::annuler'),
|
'cancel' => $translator->trans('boutton::annuler'),
|
||||||
'deleteTitle' => $translator->trans('boutton::supprimer'),
|
'deleteTitle' => $translator->trans('boutton::supprimer'),
|
||||||
'deleteRecords' => $translator->trans('Delete records'),
|
'deleteRecords' => $translator->trans('Delete records'),
|
||||||
|
'moveToTrash' => $translator->trans('prod:app trash: title-trash'),
|
||||||
'edit_hetero' => $translator->trans('prod::editing valeurs heterogenes, choisir \'remplacer\', \'ajouter\' ou \'annuler\''),
|
'edit_hetero' => $translator->trans('prod::editing valeurs heterogenes, choisir \'remplacer\', \'ajouter\' ou \'annuler\''),
|
||||||
'confirm_abandon' => $translator->trans('prod::editing::annulation: abandonner les modification ?'),
|
'confirm_abandon' => $translator->trans('prod::editing::annulation: abandonner les modification ?'),
|
||||||
'loading' => $translator->trans('phraseanet::chargement'),
|
'loading' => $translator->trans('phraseanet::chargement'),
|
||||||
|
@@ -271,9 +271,46 @@ class RecordController extends Controller
|
|||||||
[\ACL::CANDELETERECORD]
|
[\ACL::CANDELETERECORD]
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->render('prod/actions/delete_records_confirm.html.twig', [
|
$filteredRecord = $this->filterRecordToDelete($records);
|
||||||
|
|
||||||
|
return $this->app->json([
|
||||||
|
'renderView' => $this->render('prod/actions/delete_records_confirm.html.twig', [
|
||||||
'records' => $records,
|
'records' => $records,
|
||||||
|
'filteredRecord' => $filteredRecord
|
||||||
|
]),
|
||||||
|
'filteredRecord' => $filteredRecord
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function filterRecordToDelete(RecordsRequest $records)
|
||||||
|
{
|
||||||
|
$trashCollectionsBySbasId = [];
|
||||||
|
$goingToTrash = [];
|
||||||
|
$delete = [];
|
||||||
|
foreach ($records as $record) {
|
||||||
|
$sbasId = $record->getDatabox()->get_sbas_id();
|
||||||
|
if (!array_key_exists($sbasId, $trashCollectionsBySbasId)) {
|
||||||
|
$trashCollectionsBySbasId[$sbasId] = $record->getDatabox()->getTrashCollection();
|
||||||
|
}
|
||||||
|
if ($trashCollectionsBySbasId[$sbasId] !== null) {
|
||||||
|
if ($record->getCollection()->get_coll_id() == $trashCollectionsBySbasId[$sbasId]->get_coll_id()) {
|
||||||
|
// record is already in trash
|
||||||
|
$delete[] = $record;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// will be moved to trash
|
||||||
|
$goingToTrash[] = $record;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// trash does not exist
|
||||||
|
$delete[] = $record;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//check if all values in array are true
|
||||||
|
//return (!in_array(false, $goingToTrash, true));
|
||||||
|
return ['trash' => $goingToTrash, 'delete' => $delete];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2018-02-12T07:27:14Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
|
<file date="2018-03-01T11:11:11Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2018-02-12T07:27:57Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
|
<file date="2018-03-01T11:11:56Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2018-02-12T07:28:51Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
|
<file date="2018-03-01T11:12:49Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2018-02-12T07:29:44Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
|
<file date="2018-03-01T11:13:48Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
{% set nbReceived = records.received().count() %}
|
{% set nbReceived = records.received().count() %}
|
||||||
{% set nbEligibleDocuments = records.count() %}
|
{% set nbEligibleDocuments = records.count() %}
|
||||||
|
|
||||||
|
{% set nbTrash = filteredRecord.trash|length %}
|
||||||
|
{% set nbDelete = filteredRecord.delete|length %}
|
||||||
|
|
||||||
{% if nbEligibleDocuments > 0 %}
|
{% if nbEligibleDocuments > 0 %}
|
||||||
{% if nbReceived != records.count() %}
|
{% if nbReceived != records.count() %}
|
||||||
<div class="well-small" style="text-align:center;">
|
<div class="well-small" style="text-align:center;">
|
||||||
@@ -8,25 +11,51 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form method="POST" action="{{ path('record_delete') }}">
|
<form id="delete-record-form" style="margin: 0;" method="POST" action="{{ path('record_delete') }}">
|
||||||
<input type="hidden" value="{{ records.serializedList() }}" name="lst" />
|
<input type="hidden" value="{{ records.serializedList() }}" name="lst" />
|
||||||
<div class="well-small label-important" style="background-color: red;color:#000;padding:5px;display:block;word-wrap:break-word;font-weight: bold;">
|
{% if nbTrash > 0 %}
|
||||||
<span class="ui-icon ui-icon-alert" ></span>
|
<div class="well-small label-important"
|
||||||
{{ "These records will be definitely deleted and can not be recovered" | trans }}
|
style="background-color: #ffef22;">
|
||||||
|
<div class="dialog-left-section">
|
||||||
|
<img src="/assets/common/images/icons/icon_collection_bin.png"/>
|
||||||
|
</div>
|
||||||
|
<div class="dialog-right-section" style="margin-top: 8px;">
|
||||||
|
<span>{{ nbTrash }} {{ "prod:app trash: record-move-to-trash" | trans }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% if records.stories().count() %}
|
{% if records.stories().count() %}
|
||||||
<label class="checkbox">
|
<label class="checkbox story">
|
||||||
<input type="checkbox" id="del_children" name="del_children" value="1"> {{ "Also delete records that rely on groupings." | trans }}
|
<input type="checkbox" id="del_children" name="del_children"
|
||||||
|
value="1"> {{ "prod:app trash: also-move-record" | trans }}
|
||||||
</label>
|
</label>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if nbDelete > 0 %}
|
||||||
|
<div class="well-small label-important"
|
||||||
|
style="background-color: #ed1c24;">
|
||||||
|
<div class="dialog-left-section">
|
||||||
|
<img src="/assets/common/images/icons/icon_empty_bin.png"/>
|
||||||
|
</div>
|
||||||
|
<div class="dialog-right-section">
|
||||||
|
<span>{{ nbDelete }} {{ "prod:app trash: record-delete" | trans }}</span>
|
||||||
|
</div>
|
||||||
|
{% if records.stories().count() %}
|
||||||
|
<label class="checkbox story">
|
||||||
|
<input type="checkbox" id="del_children" name="del_children"
|
||||||
|
value="1"> {{ "Also delete records that rely on groupings." | trans }}
|
||||||
|
</label>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="form-actions" style="background-color:transparent;">
|
<div class="form-actions" style="background-color:transparent;">
|
||||||
<button type="button" class="btn btn-danger submiter">{{ "Delete" | trans }} ({{ nbEligibleDocuments }})</button>
|
<button type="button" class="btn btn-danger submiter">{{ "Ok" | trans }}</button>
|
||||||
<button type="button" class="btn cancel">{{ "Cancel" | trans }}</button>
|
<button type="button" class="btn cancel">{{ "Cancel" | trans }}</button>
|
||||||
<span class="form-action-loader" style="display:none;">
|
<span class="form-action-loader" style="display:none;">
|
||||||
<img src="/assets/common/images/icons/loader000.gif" />
|
<img src="/assets/common/images/icons/loader000.gif"/>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% elseif nbReceived == 0 %}
|
{% elseif nbReceived == 0 %}
|
||||||
<div class="well-small" style="text-align:center;">
|
<div class="well-small" style="text-align:center;">
|
||||||
<span class="label label-important">{{ "No document selected" | trans }}</span>
|
<span class="label label-important">{{ "No document selected" | trans }}</span>
|
||||||
|
Reference in New Issue
Block a user