resolve conflict

This commit is contained in:
mike-esokia
2018-05-21 11:11:50 +04:00
committed by Mike Ng
5 changed files with 13 additions and 38 deletions

View File

@@ -220,13 +220,13 @@ class XmlStatusStructureProvider implements StatusStructureProviderInterface
$status['searchable'] = (Boolean) $properties['searchable']; $status['searchable'] = (Boolean) $properties['searchable'];
$status['printable'] = (Boolean) $properties['printable']; $status['printable'] = (Boolean) $properties['printable'];
if (!isset($properties['img_on'])) { // if (!isset($properties['img_on'])) {
$status['img_on'] = null; // $status['img_on'] = null;
} // }
//
if (!isset($properties['img_off'])) { // if (!isset($properties['img_off'])) {
$status['img_off'] = null; // $status['img_off'] = null;
} // }
$statusStructure->setStatus($bit, $status); $statusStructure->setStatus($bit, $status);

View File

@@ -47,37 +47,12 @@ class PhraseanetExtension extends \Twig_Extension
new \Twig_SimpleFunction('record_flags', array($this, 'getRecordFlags')), new \Twig_SimpleFunction('record_flags', array($this, 'getRecordFlags')),
new \Twig_SimpleFunction('border_checker_from_fqcn', array($this, 'getCheckerFromFQCN')), new \Twig_SimpleFunction('border_checker_from_fqcn', array($this, 'getCheckerFromFQCN')),
new \Twig_SimpleFunction('caption_field', array($this, 'getCaptionField')), new \Twig_SimpleFunction('caption_field', array($this, 'getCaptionField')),
new \Twig_SimpleFunction('caption_field_label', array($this, 'getCaptionFieldLabel')),
new \Twig_SimpleFunction('caption_field_order', array($this, 'getCaptionFieldOrder')), new \Twig_SimpleFunction('caption_field_order', array($this, 'getCaptionFieldOrder')),
new \Twig_SimpleFunction('flag_slugify', array(Flag::class, 'normalizeName')), new \Twig_SimpleFunction('flag_slugify', array(Flag::class, 'normalizeName')),
); );
} }
/**
* get localized field's label
* @param RecordInterface $record
* @param $fieldName
* @return string - the name label
*/
public function getCaptionFieldLabel(RecordInterface $record, $fieldName)
{
if ($record) {
/** @var \appbox $appbox */
$appbox = $this->app['phraseanet.appbox'];
$databox = $appbox->get_databox($record->getDataboxId());
foreach ($databox->get_meta_structure() as $meta) {
/** @var \databox_field $meta */
if ($meta->get_name() === $fieldName) {
return $meta->get_label($this->app['locale']);
}
}
}
return '';
}
public function getCaptionField(RecordInterface $record, $field, $value) public function getCaptionField(RecordInterface $record, $field, $value)
{ {
if ($record instanceof ElasticsearchRecord) { if ($record instanceof ElasticsearchRecord) {

View File

@@ -126,10 +126,10 @@
{% macro caption(record, can_see_business, display_exif, limitedWidth = false) %} {% macro caption(record, can_see_business, display_exif, limitedWidth = false) %}
<dl class="{% if limitedWidth %}{% else %}dl-horizontal{% endif %}"> <dl class="{% if limitedWidth %}{% else %}dl-horizontal{% endif %}">
{% for name, value in record.getCaption(caption_field_order(record, can_see_business)) %} {% for field in record.get_caption().get_highlight_fields(null, can_see_business) %}
<dt>{{ caption_field_label(record, name) }}</dt> <dt>{{ field.label_name }}</dt>
<dd>{{ caption_field(record, name, value)|e|highlight|parseColor }}</dd> <dd>{{ _self.caption_value(field, bounceable|default(true))|highlight|linkify|parseColor }}</dd>
{% endfor %} {% endfor %}
</dl> </dl>
{% if display_exif|default(true) and app.getAuthenticator().user is not none and user_setting('technical_display') == 'group' %} {% if display_exif|default(true) and app.getAuthenticator().user is not none and user_setting('technical_display') == 'group' %}
<hr/> <hr/>

View File

@@ -39,7 +39,7 @@
{% macro checkboxInput(field, label = '') %} {% macro checkboxInput(field, label = '') %}
<label for="{{ field.vars.id }}" class="checkbox"> <label for="{{ field.vars.id }}" class="checkbox">
{{ form_widget(field) }} {{ form_widget(field) }}
{{ label | default(field.vars.label) }} {{ label | default(field.vars.label) | trans }}
</label> </label>
<div class="error-view"></div> <div class="error-view"></div>
{{ form_errors(field) }} {{ form_errors(field) }}

View File

@@ -24,7 +24,7 @@
{% set can_see_business = granted_on_collection(record.baseId, [constant('\\ACL::CANMODIFRECORD')]) %} {% set can_see_business = granted_on_collection(record.baseId, [constant('\\ACL::CANMODIFRECORD')]) %}
<div class="thumb captionTips" <div class="thumb captionTips"
{% if settings.rollover_thumbnail == 'caption' %}title="{{ macro.caption(record, can_see_business, false) | e }}"{% endif %} {% if settings.rollover_thumbnail == 'caption' %}tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId, 'context' : 'answer', 'number' : record.position|default(0) }) }}"{% endif %}
{% if settings.rollover_thumbnail == 'preview' %}tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) }}"{% endif %} {% if settings.rollover_thumbnail == 'preview' %}tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) }}"{% endif %}
style="height:{{ settings.images_size }}px; z-index:90;"> style="height:{{ settings.images_size }}px; z-index:90;">
<div class="doc_infos"> <div class="doc_infos">