mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Porting refactor trash to 4.1
This commit is contained in:
@@ -36,16 +36,17 @@ class LanguageController
|
|||||||
'serverTimeout' => $translator->trans('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible'),
|
'serverTimeout' => $translator->trans('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible'),
|
||||||
'serverDisconnected' => $translator->trans('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier'),
|
'serverDisconnected' => $translator->trans('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier'),
|
||||||
'hideMessage' => $translator->trans('phraseanet::Ne plus afficher ce message'),
|
'hideMessage' => $translator->trans('phraseanet::Ne plus afficher ce message'),
|
||||||
'confirmGroup' => $translator->trans('Supprimer egalement les documents rattaches a ces regroupements'),
|
'confirmGroup' => $translator->trans('Supprimer egalement les documents rattaches a ces regroupements'),
|
||||||
'confirmDelete' => $translator->trans('reponses:: Ces enregistrements vont etre definitivement supprimes et ne pourront etre recuperes. Etes vous sur ?'),
|
'confirmDelete' => $translator->trans('reponses:: Ces enregistrements vont etre definitivement supprimes et ne pourront etre recuperes. Etes vous sur ?'),
|
||||||
'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'),
|
||||||
'edit_hetero' => $translator->trans('prod::editing valeurs heterogenes, choisir \'remplacer\', \'ajouter\' ou \'annuler\''),
|
'moveToTrash' => $translator->trans('prod:app trash: title-trash'),
|
||||||
'confirm_abandon' => $translator->trans('prod::editing::annulation: abandonner les modification ?'),
|
'edit_hetero' => $translator->trans('prod::editing valeurs heterogenes, choisir \'remplacer\', \'ajouter\' ou \'annuler\''),
|
||||||
'loading' => $translator->trans('phraseanet::chargement'),
|
'confirm_abandon' => $translator->trans('prod::editing::annulation: abandonner les modification ?'),
|
||||||
'valider' => $translator->trans('boutton::valider'),
|
'loading' => $translator->trans('phraseanet::chargement'),
|
||||||
'annuler' => $translator->trans('boutton::annuler'),
|
'valider' => $translator->trans('boutton::valider'),
|
||||||
|
'annuler' => $translator->trans('boutton::annuler'),
|
||||||
'create' => $translator->trans('boutton::creer'),
|
'create' => $translator->trans('boutton::creer'),
|
||||||
'rechercher' => $translator->trans('boutton::rechercher'),
|
'rechercher' => $translator->trans('boutton::rechercher'),
|
||||||
'renewRss' => $translator->trans('boutton::renouveller'),
|
'renewRss' => $translator->trans('boutton::renouveller'),
|
||||||
|
@@ -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);
|
||||||
'records' => $records,
|
|
||||||
|
return $this->app->json([
|
||||||
|
'renderView' => $this->render('prod/actions/delete_records_confirm.html.twig', [
|
||||||
|
'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>
|
<div class="dialog-left-section">
|
||||||
{% if records.stories().count() %}
|
<img src="/assets/common/images/icons/icon_collection_bin.png"/>
|
||||||
<label class="checkbox">
|
</div>
|
||||||
<input type="checkbox" id="del_children" name="del_children" value="1"> {{ "Also delete records that rely on groupings." | trans }}
|
<div class="dialog-right-section" style="margin-top: 8px;">
|
||||||
</label>
|
<span>{{ nbTrash }} {{ "prod:app trash: record-move-to-trash" | trans }}</span>
|
||||||
|
</div>
|
||||||
|
{% if records.stories().count() %}
|
||||||
|
<label class="checkbox story">
|
||||||
|
<input type="checkbox" id="del_children" name="del_children"
|
||||||
|
value="1"> {{ "prod:app trash: also-move-record" | trans }}
|
||||||
|
</label>
|
||||||
|
{% 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 %}
|
{% 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>
|
||||||
@@ -35,4 +64,4 @@
|
|||||||
<div class="well-small" style="text-align:center;">
|
<div class="well-small" style="text-align:center;">
|
||||||
<span class="label label-info">{{ "You do not have rights to remove selected documents" | trans }}</span>
|
<span class="label label-info">{{ "You do not have rights to remove selected documents" | trans }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
Reference in New Issue
Block a user