Files
Phraseanet/templates/web/prod/actions/Tools/index.html.twig
Florian BLOUET 7534e26661 Bump Phraseanet Production Client
update video tools features
- add range reordering via drag n drop
- add configurable rewind/forward steps
2016-06-30 11:31:48 +02:00

437 lines
20 KiB
Twig

{% set selectionLength = records|length %}
{% set nbHdSubstitute = 0 %}
{% set nbSubdefSubstitute = 0 %}
{% for record in records %}
{% set subdefs = record.get_subdefs() %}
{% if subdefs|length > 0 %}
{% for key, subdef in subdefs if subdef.is_substituted() %}
{% if key == 'document' %}
{% set nbHdSubstitute = nbHdSubstitute + 1 %}
{% else %}
{% set nbSubdefSubstitute = nbSubdefSubstitute + 1 %}
{% endif%}
{% endfor %}
{% endif %}
{% endfor %}
<div id='prod-tool-box' class="PNB10">
{# jquery Tabs #}
<div id="tool-tabs" class="tabs">
{# jquery menu #}
<div>
<ul>
<li>
<a href="#subdefs">
{{ "regeneration of sub-definitions" | trans }}
</a>
</li>
{% if selectionLength == 1%}
{% for record in records %}
{% if record.get_type() == 'video' %}
<li>
<a href="#thumbExtractor">
{{ "video tool" | trans }}
</a>
</li>
<li>
<a href="#rangeExtractor">
{{ "video range extractor" | trans }}
</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
<li>
<a href="#image">
{{ "image tool" | trans }}
</a>
</li>
{% if selectionLength == 1 and (app['conf'].get(['registry', 'modules', 'doc-substitution']) or app['conf'].get(['registry', 'modules', 'thumb-substitution'])) %}
<li>
<a href="#substitution">
{{ "substitution" | trans }}
</a>
</li>
{% endif %}
{% if metadatas %}
<li>
<a href="#exiftool">
{{ "meta-datas" | trans }}
</a>
</li>
{% endif %}
{% if selectionLength == 1%}
{% if recordSubdefs %}
<li>
<a href="#tools-sharing">
{{ "Document Type Sharing" | trans }}
</a>
</li>
{% endif %}
{% endif %}
</ul>
</div>
{# subdef section #}
<div id="subdefs" class="tabBox">
<form id="new-img-form" action="{{ path('prod_tools_image') }}" method="post">
<fieldset style='border:1px solid #999; padding:20px;'>
<legend>&nbsp;<b>{{ "Reconstruire les sous definitions" | trans }}</b>&nbsp;</legend>
{% if nbSubdefSubstitute > 0 %}
<div style="color:#A00;">
{{ "Attention, certain documents ont des sous-definitions substituees" | trans }}
</div>
<label for="FTS" class="checkbox">
<input type="checkbox" name="force_substitution" value="1" id="FTS" />
{{ "Forcer la reconstruction sur les enregistrements ayant des thumbnails substituees" | trans }}
</label>
<br/>
{% else %}
<input type="hidden" name="force_substitution" value="1">
{% endif %}
<div>
<p>
{{ 'Are you sure you want to rebuild the sub-definitions of selected records?' | trans }}
</p>
</div>
<input type="hidden" name="ACT" value="SEND" />
<input type="hidden" name="lst" value="{{records.serializedList()}}" />
</fieldset>
<div style='text-align:right;padding-top:10px;'>
<button class="action_submiter btn btn-inverse" type="button">{{ "validate" | trans }}</button>
<button class="action_cancel btn btn-inverse" type="button">{{ "cancel" | trans }}</button>
</div>
</form>
</div>
{% if selectionLength == 1 %}
{% for record in records %}
{% if record.get_type() == 'video' %}
<div id="thumbExtractor" class="tabBox">
<div class="PNB10 main_title">
<img src='/assets/prod/images/ThumbExtractor/camera_title.png'/>
{{ "screenshot video" | trans }}
</div>
<hr style='margin-top:25px;'/>
<div class="PNB part_title_left"></div>
<div class="PNB frame_video">
{% set outputFormats = record.getSubdfefByDeviceAndMime(null, ['image/jpeg', 'image/png']) %}
{% set previewHtml5 = record.getSubdfefByDeviceAndMime(constant('\\databox_subdef::DEVICE_SCREEN'), ['video/ogg', 'video/mp4', 'video/webm']) %}
{% set dataW = constant('media_subdef::TC_DATA_WIDTH') %}
{% set dataH = constant('media_subdef::TC_DATA_HEIGHT') %}
{% set technical_info = record.get_technical_infos %}
{% set width = technical_info[dataW].value %}
{% set height = technical_info[dataH].value %}
{% if width and height %}
{% set rawRatio = (width / height)|number_format(3, '.') %}
{% set rawRatioLength = rawRatio|length %}
{% set ratio = rawRatio|slice(0,rawRatioLength-1) %}
{% else %}
{% set ratio = '' %}
{% endif %}
<video id="thumb_video" controls="" preload="auto" data-ratio="{{ ratio }}">
{% for subdef in previewHtml5 %}
<source type="{{ subdef.get_mime() }}" src="{{ subdef.get_url() }}" />
{% endfor %}
{{ 'No preview available' | trans }}
</video>
</div>
<div class="PNB action_bar_left">
</div>
<div id="thumb_camera_button" class="PNB">
<img src="/assets/prod/images/ThumbExtractor/camera_button.png" alt="{{ 'take a screenshot' | trans }}" />
</div>
<div class="PNB part_title_right">
</div>
<div class="PNB frame_canva">
<div id="thumb_delete_button">
<img src="/assets/prod/images/ThumbExtractor/delete.png" />
</div>
<p id='thumb_info'>{{ 'To take a screenshot click on camera' | trans }}</p>
<canvas id="thumb_canvas"></canvas>
<div id="alt_canvas_container" style="position:absolute;overflow:hidden;top:-1200px;visibility: hidden; width:0!important;height:0!important">
{% for subdef in outputFormats %}
<canvas data-width="{{ subdef.get_width() }}" data-name="{{ subdef.get_name() }}" class="alt_canvas" id="{{ subdef.get_name() }}"></canvas>
{% endfor %}
</div>
</div>
<div id="thumb_slider" class="PNB">
<div id="thumb_wrapper">
</div>
</div>
<div class="thumb_submit_action PNB">
<input type="hidden" value='{{record.get_sbas_id()}}' name='sbas_id'>
<input type="hidden" value='{{record.get_record_id()}}' name='record_id'>
<button id="thumb_validate_button" class="btn btn-inverse" type="button">{{ "validate" | trans }}</button>
</div>
</div>
<div id="rangeExtractor" class="">
<div class="main_title">
<img src='/assets/prod/images/ThumbExtractor/camera_title.png'/>
{{ "video range extractor" | trans }}
</div>
<div class="video-range-editor-container"></div>
<div class="video-data-container">
<dl class="dl-horizontal">
<dt>Ratio</dt><dd>{{ ratio }}</dd>
<dt>Type</dt><dd>{{ record.get_mime() }}</dd>
{% if record.exif[constant('media_subdef::TC_DATA_FRAMERATE')] is defined %}
<dt>{{ 'Images par secondes' | trans }}</dt>
<dd>{{ record.exif[constant('media_subdef::TC_DATA_FRAMERATE')] | round(2) }} ips</dd>
{% endif %}
{% if record.exif[constant('media_subdef::TC_DATA_AUDIOCODEC')] is defined %}
<dt>{{ 'Codec Audio' | trans }}</dt>
<dd>{{ record.exif[constant('media_subdef::TC_DATA_AUDIOCODEC')] }}</dd>
{% endif %}
<dt>{{ 'Size' | trans }}</dt><dd>{% set width = record.exif[constant('media_subdef::TC_DATA_WIDTH')]|default
(null) %}
{% set height = record.exif[constant('media_subdef::TC_DATA_HEIGHT')]|default(null) %}
{% if width is not none and height is not none %}
{{ width ~ " x " ~ height }}
{% endif %}</dd>
</dl>
</div>
</div>
{% endif %}
{% endfor %}
{% endif %}
<div id="image" class="tabBox">
<div class="text-info">
<i class=" icon-info-sign"></i> {% trans %}Changes for rotation will be applied only on the sub-definitions of "image" type.{% endtrans %}
</div>
<form name="formpushdoc" action="{{ path('prod_tools_rotate') }}" method="post">
<fieldset style='border:1px solid #999;padding:20px;'>
<legend>&nbsp;<b>{{ "image rotation" | trans }}</b>&nbsp;</legend>
<label for="ROTA_90" class="radio">
<input type="radio" name="rotation" id="ROTA_90" value="90" checked="checked">
{{ "rotation 90 degres horaire" | trans }}
</label>
<br />
<label for="ROTA_C90" class="radio">
<input type="radio" name="rotation" id="ROTA_C90" value="-90">
{{ "rotation 90 degres anti-horaires" | trans }}
</label>
<input type="hidden" name="lst" value="{{records.serializedList()}}" />
<input type="hidden" name="element" value="" />
<input type="hidden" name="cchd" value="" />
</fieldset>
<div style='text-align:right;padding-top:10px;'>
<button class="action_submiter btn btn-inverse">{{ "validate"|trans }}</button>
<button class="action_cancel btn btn-inverse">{{ "cancel"|trans }}</button>
</div>
</form>
</div>
{# hd sub section #}
{% if selectionLength == 1 and (app['conf'].get(['registry', 'modules', 'doc-substitution']) or app['conf'].get(['registry', 'modules', 'thumb-substitution'])) %}
{% for record in records %}
<div id="substitution" class="tabBox">
{% if "unknown" == record.get_type() %}
<i class="icon-warning-sign icon-white"></i>{{ "Substitution is not possible for this kind of record" | trans }}
{% else %}
{% if app['conf'].get(['registry', 'modules', 'doc-substitution']) %}
<div id="substitution-hd">
<form
name ="formchgHD"
action="{{ path('prod_tools_hd_substitution') }}"
enctype="multipart/form-data"
method="post"
target="uploadHdsub">
<fieldset style='border:1px solid #999;padding:20px;'>
<legend>&nbsp;<b>{{ "substitution HD" | trans }}</b>&nbsp;</legend>
<div>
<input id='new-hd-file' name="newHD" type="file"/>
<br />
<label for="CCFNALP" class="checkbox">
<input type="checkbox" name="ccfilename" id="CCFNALP" value="1">
{{ "mettre a jour le nom original de fichier apres substitution" | trans }}
</label>
<input type="hidden" name="ACT" value="SEND" />
<input type="hidden" name="sbas_id" value="{{record.get_sbas_id()}}"/>
<input type="hidden" name="record_id" value="{{record.get_record_id()}}" />
<div class="load"></div>
</div>
</fieldset>
<div style='text-align:right;padding-top:10px;'>
<button class="iframe_submiter btn btn-inverse">{{ "validate" | trans }}</button>
<button class="action_cancel btn btn-inverse">{{ "cancel" | trans }}</button>
</div>
</form>
<div class='resultAction'></div>
</div>
{% endif %}
{% if app['conf'].get(['registry', 'modules', 'thumb-substitution']) %}
<div id="substitution-sd">
<form
name="formchgHD"
action="{{ path('prod_tools_thumbnail_substitution') }}"
enctype="multipart/form-data"
method="post"
target="uploadHdsub">
<fieldset style='border:1px solid #999;padding:20px;'>
<legend>&nbsp;<b>{{ "substitution SD" | trans }}</b>&nbsp;</legend>
<div>
<input id='new-sd-file' name="newThumb" type="file" />
<input type="hidden" name="sbas_id" value="{{record.get_sbas_id()}}" />
<input type="hidden" name="record_id" value="{{record.get_record_id()}}" />
<div class="load"></div>
</div>
</fieldset>
<div style='text-align:right;padding-top:10px;'>
<button class="iframe_submiter btn btn-inverse">{{ "validate" | trans }}</button>
<button class="action_cancel btn btn-inverse">{{ "cancel" | trans }}</button>
</div>
</form>
<div class='resultAction'></div>
</div>
{% endif %}
{% endif %}
</div>
{% endfor %}
{% endif %}
{# exiftool section #}
{% if metadatas %}
{% for record in records %}
<div id="exiftool" class="tabBox">
{% set thumbnail = record.get_thumbnail() %}
<img style='float:left; margin-right:15px'
src="{{thumbnail.get_url()}}"
width="{{thumbnail.get_width()}}"
height="{{thumbnail.get_height()}}" />
<div>
<h1><b>Metadatas</b></h1>
<hr>
<table>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
{% for metadata in metadatas %}
<tr>
<td>
{{ metadata.getTag().getTagname() }}
</td>
<td>
{{ metadata.getValue().asString() }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endfor %}
{% endif %}
{% if selectionLength == 1 and recordSubdefs is not empty %}
<div id="tools-sharing" class="tabBox">
<div class="well-large">
{% for subdef in recordSubdefs %}
<div class="row-fluid">
<div class="span6">
<span class="status-marker {{ subdef.state ? 'status-active' : 'status-inactive' }}"></span>{{ subdef.label }}
</div>
<div class="span6">
<p class="text-right">
<button type="button" class="stateChange_button btn btn-inverse text-right"
data-name="{{ subdef.name }}" data-state="{{ subdef.state }}">
{% if subdef.state %}
{{- "Disable document type sharing"|trans -}}
{% else %}
{{- "Enable document type sharing"|trans -}}
{% endif %}
</button>
</p>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{# hidden iframe to handle upload #}
<iframe
id="uploadHdsub"
name="uploadHdsub"
height="0"
width="0"
border="0"
>
</iframe>
</div>
<script type="text/javascript">
var toolsConfig = {
selectionLength: {{ selectionLength }},
databaseId: {% if selectionLength == 1%}{{record.get_base_id}}{% else %}0{% endif %},
recordId: {% if selectionLength == 1%}{{record.get_record_id}}{% else %}0{% endif %},
translations: {
alertTitle: '{{ "alert" | trans }}',
noImgSelected: '{{ "no image selected" | trans }}',
processing: '{{ "processing" | trans }}',
thumbnailTitle: '{{ 'thumbnail validation' | trans }}'
},
videoEditorConfig: {% if videoEditorConfig is not null %}{{ videoEditorConfig|json_encode()|raw }}{% else %}{}{% endif %},
records: [
{% for record in records %}
{
id: {{ record.get_record_id }},
type: "{{ record.get_type() }}",
{% if record.get_type() == 'video' %}
{% if selectionLength == 1 %}
{% set outputFormats = record.getSubdfefByDeviceAndMime(null, ['image/jpeg', 'image/png']) %}
{% set previewHtml5 = record.getSubdfefByDeviceAndMime(constant('\\databox_subdef::DEVICE_SCREEN'), ['video/ogg', 'video/mp4', 'video/webm']) %}
{% set dataW = constant('media_subdef::TC_DATA_WIDTH') %}
{% set dataH = constant('media_subdef::TC_DATA_HEIGHT') %}
{% set technical_info = record.get_technical_infos %}
{% set width = technical_info[dataW].value %}
{% set height = technical_info[dataH].value %}
{% if width and height %}
{% set ratio = (width / height)|number_format(2, '.') %}
{% else %}
{% set ratio = '' %}
{% endif %}
sources: [
{% for subdef in previewHtml5 %}
{
ratio: '{{ ratio }}',
framerate: {{ record.exif[constant('media_subdef::TC_DATA_FRAMERATE')] | round(2) }},
type: "{{ subdef.get_mime() }}",
src: "{{ subdef.get_url() }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
]
{% endif %}
{% endif %}
}{% if not loop.last %},{% endif %}
{% endfor %}
]
};
</script>