mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
183 lines
8.7 KiB
Twig
183 lines
8.7 KiB
Twig
|
|
{% set nbReceivedDocuments = records.received().count() %}
|
|
{% set nbEditableDocuments = records.count() %}
|
|
|
|
<div id='tabs-records-property'>
|
|
|
|
{# if multi databox edit abort #}
|
|
{% if records.databoxes() | length > 1 %}
|
|
<div class="well-small">
|
|
{{ 'prod::Les enregistrements ne provienent pas tous de la meme base et ne peuvent donc etre traites ensemble' | trans }}
|
|
</div>
|
|
{% else %}
|
|
|
|
{% set databox = records.databoxes|first %}
|
|
{# This value is fetched when click on 2nd tab #}
|
|
<input type="hidden" name='original_selection' value="{{ app.request.query.get('lst') }}">
|
|
|
|
<ul>
|
|
<li><a href="#property-statut">{{ 'Records Statut' | trans }}</a></li>
|
|
{# <span> </span> element is required for the jQuery loading spinner appears && disappears properly #}
|
|
<li><a href="{{ path('display_type_property', { 'lst' : records.serializedList() } ) }}">{{ 'Records type' | trans }} <span> </span></a></li>
|
|
</ul>
|
|
|
|
<div id='property-statut'>
|
|
<p class="header">
|
|
<h4 style='text-align:center;'>
|
|
{% if nbReceivedDocuments == 1 %}
|
|
{% trans %}You have selected one record.{% endtrans %}
|
|
{% else %}
|
|
{% trans with {'%nbReceivedDocuments%' : nbReceivedDocuments} %}You have selected %nbReceivedDocuments% records.{% endtrans %}
|
|
{% endif %}
|
|
|
|
{% if nbEditableDocuments == 0 %}
|
|
{% trans %}None of the records can be modified.{% endtrans %}
|
|
{% else %}
|
|
{% if nbEditableDocuments < nbReceivedDocuments %}
|
|
{% if nbEditableDocuments == 1 %}
|
|
{% trans %}Only one record can be modified.{% endtrans %}
|
|
{% else %}
|
|
{% trans with {'%nbEditableDocuments%' : nbEditableDocuments} %}Only %nbEditableDocuments% records can be modified.{% endtrans %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
</h4>
|
|
</p>
|
|
|
|
<form style='padding:15px;' name="change-records-status" action="{{ path('change_status') }}" method="POST">
|
|
<input name="lst" type="hidden" value="{{ records.serializedList() }}"/>
|
|
{% set sbasId = databox.get_sbas_id() %}
|
|
|
|
<table style='width:auto;margin:0 auto'>
|
|
<thead>
|
|
<tr>
|
|
<th colspan="6">
|
|
{{ databox.get_label(app['locale'])|title }}
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr style='border-bottom:1px solid #FFF;'>
|
|
<td colspan="6" style='font-size:11px;text-align:center'>
|
|
{% trans %}Status edition{% endtrans %}</i>
|
|
</td>
|
|
</tr>
|
|
{% for bit,values in status %}
|
|
<tr>
|
|
<td style='text-align:right'>
|
|
{% if values['img_off'] is not empty %}
|
|
<label for="status-radio-{{ sbasId ~ "-" ~ bit ~ '-off'}}">
|
|
<img src="{{ values['img_off'] }}" width="16" height="16" />
|
|
</label>
|
|
{% endif %}
|
|
</td>
|
|
<td style='text-align:right'>
|
|
<label for="status-radio-{{ sbasId ~ "-" ~ bit ~ '-off'}}" {% if values['flag'] == 2 %}style='color:#FF3333'{% endif%}>
|
|
{{ values['labels_off_i18n'][app['locale']] }}
|
|
</label>
|
|
</td>
|
|
<td style='text-align:right'>
|
|
<input id="status-radio-{{ sbasId ~ "-" ~ bit ~ '-off'}}" type="radio" name="status[{{ sbasId }}][{{ bit }}]" {% if values['flag'] == 0 %}checked="checked"{% endif%} value="0"/>
|
|
</td>
|
|
<td style='text-align:left'>
|
|
<input id="status-radio-{{ sbasId ~ "-" ~ bit ~ '-on'}}" type="radio" name="status[{{ sbasId }}][{{ bit }}]" {% if values['flag'] == 1 %}checked="checked"{% endif%} value="1"/>
|
|
</td>
|
|
<td style='text-align:left'>
|
|
<label for="status-radio-{{ sbasId ~ "-" ~ bit ~ '-on'}}" {% if values['flag'] == 2 %}style='color:#FF3333'{% endif%}>
|
|
{{ values['labels_on_i18n'][app['locale']] }}
|
|
</label>
|
|
</td>
|
|
<td style='text-align:left'>
|
|
{% if values['img_on'] is not empty %}
|
|
<label for="status-radio-{{ sbasId ~ "-" ~ bit ~ '-on'}}">
|
|
<img src="{{ values['img_on'] }}" width="16" height="16" />
|
|
</label>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
<tfoot>
|
|
{% if records.stories.count > 0 %}
|
|
<tr>
|
|
<td colspan="6">
|
|
<input type="checkbox" name="apply_to_children[{{ sbasId }}]"/>
|
|
{% trans %}Apply status on story children.{% endtrans %}
|
|
</td>
|
|
</tr>
|
|
{% endif %}
|
|
</tfoot>
|
|
</table>
|
|
<div class="form-actions" style="background:transparent">
|
|
{% if nbEditableDocuments > 0 %}
|
|
<button type="button" class="btn btn-primary submiter">{{ "Apply changes" | trans }}</button>
|
|
{% endif %}
|
|
<button type="button" class="btn cancel">{{ "Cancel" | trans }}</button>
|
|
<span class="form-action-loader" style="display:none;">
|
|
<img src="/assets/common/images/icons/loader414141.gif" />
|
|
</span>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
$("#tabs-records-property").tabs({
|
|
beforeLoad: function( event, ui ) {
|
|
ui.ajaxSettings.data = {
|
|
lst: $("input[name=original_selection]", $(this)).val()
|
|
};
|
|
|
|
// load template only once
|
|
if ( ui.tab.data( "loaded" ) ) {
|
|
event.preventDefault();
|
|
return;
|
|
}
|
|
|
|
ui.jqXHR.success(function() {
|
|
ui.tab.data( "loaded", true );
|
|
});
|
|
|
|
ui.tab.find('span').html("<i>{{ 'Loading'|trans }}...</i>");
|
|
},
|
|
load: function(event, ui)
|
|
{
|
|
ui.tab.find('span').empty();
|
|
}
|
|
});
|
|
|
|
var $dialog = p4.Dialog.get(1);
|
|
var $dialogBox = $dialog.getDomElement();
|
|
|
|
$("button.cancel", $dialogBox).bind("click", function(){
|
|
$dialog.Close();
|
|
});
|
|
|
|
$("button.submiter", $dialogBox).bind("click", function(){
|
|
var $this = $(this);
|
|
var form = $(this).closest("form");
|
|
var loader = form.find("form-action-loader");
|
|
|
|
$.ajax({
|
|
type: form.attr("method"),
|
|
url: form.attr("action"),
|
|
data: form.serializeArray(),
|
|
dataType: 'json',
|
|
beforeSend:function(){
|
|
$this.attr("disabled", true);
|
|
loader.show();
|
|
},
|
|
success: function(data){
|
|
$dialog.Close();
|
|
},
|
|
complete: function(){
|
|
$this.attr("disabled", false);
|
|
loader.hide();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
{% endif %}
|