mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
PHRAS-2816 #comment add attribute gui_visible to show fields on roll over and detailled view #time 2h
This commit is contained in:
@@ -316,6 +316,7 @@ class FieldsController extends Controller
|
|||||||
->set_tbranch($data['tbranch'])
|
->set_tbranch($data['tbranch'])
|
||||||
->set_generate_cterms($data['generate_cterms'])
|
->set_generate_cterms($data['generate_cterms'])
|
||||||
->set_gui_editable($data['gui_editable'])
|
->set_gui_editable($data['gui_editable'])
|
||||||
|
->set_gui_visible($data['gui_visible'])
|
||||||
->set_report($data['report'])
|
->set_report($data['report'])
|
||||||
->setVocabularyControl(null)
|
->setVocabularyControl(null)
|
||||||
->setVocabularyRestricted(false);
|
->setVocabularyRestricted(false);
|
||||||
@@ -351,7 +352,7 @@ class FieldsController extends Controller
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name', 'multi', 'thumbtitle', 'tag', 'business', 'indexable', 'aggregable',
|
'name', 'multi', 'thumbtitle', 'tag', 'business', 'indexable', 'aggregable',
|
||||||
'required', 'separator', 'readonly', 'gui_editable', 'type', 'tbranch', 'generate_cterms', 'report',
|
'required', 'separator', 'readonly', 'gui_editable', 'gui_visible' , 'type', 'tbranch', 'generate_cterms', 'report',
|
||||||
'vocabulary-type', 'vocabulary-restricted', 'dces-element', 'labels'
|
'vocabulary-type', 'vocabulary-restricted', 'dces-element', 'labels'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@@ -596,6 +596,7 @@ class V1Controller extends Controller
|
|||||||
'thesaurus_branch' => $databox_field->get_tbranch(),
|
'thesaurus_branch' => $databox_field->get_tbranch(),
|
||||||
'generate_cterms' => $databox_field->get_generate_cterms(),
|
'generate_cterms' => $databox_field->get_generate_cterms(),
|
||||||
'gui_editable' => $databox_field->get_gui_editable(),
|
'gui_editable' => $databox_field->get_gui_editable(),
|
||||||
|
'gui_visible' => $databox_field->get_gui_visible(),
|
||||||
'type' => $databox_field->get_type(),
|
'type' => $databox_field->get_type(),
|
||||||
'indexable' => $databox_field->is_indexable(),
|
'indexable' => $databox_field->is_indexable(),
|
||||||
'multivalue' => $databox_field->is_multi(),
|
'multivalue' => $databox_field->is_multi(),
|
||||||
|
@@ -77,6 +77,7 @@ class EditController extends Controller
|
|||||||
'tbranch' => $meta->get_tbranch(),
|
'tbranch' => $meta->get_tbranch(),
|
||||||
'generate_cterms' => $meta->get_generate_cterms(),
|
'generate_cterms' => $meta->get_generate_cterms(),
|
||||||
'gui_editable' => $meta->get_gui_editable(),
|
'gui_editable' => $meta->get_gui_editable(),
|
||||||
|
'gui_visible' => $meta->get_gui_visible(),
|
||||||
'maxLength' => $meta->get_tag()
|
'maxLength' => $meta->get_tag()
|
||||||
->getMaxLength(),
|
->getMaxLength(),
|
||||||
'minLength' => $meta->get_tag()
|
'minLength' => $meta->get_tag()
|
||||||
|
@@ -16,7 +16,7 @@ class Version
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $number = '4.1.0-alpha.17a';
|
private $number = '4.1.0-alpha.18a';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
@@ -38,6 +38,7 @@ final class DbalDataboxFieldRepository implements DataboxFieldRepository
|
|||||||
'label_nl',
|
'label_nl',
|
||||||
'generate_cterms',
|
'generate_cterms',
|
||||||
'gui_editable',
|
'gui_editable',
|
||||||
|
'gui_visible',
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var DataboxFieldFactory */
|
/** @var DataboxFieldFactory */
|
||||||
|
@@ -48,7 +48,7 @@ class PhraseanetExtension extends \Twig_Extension
|
|||||||
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_label', array($this, 'getCaptionFieldLabel')),
|
||||||
new \Twig_SimpleFunction('caption_field_gui_editable', array($this, 'getCaptionFieldGuiEditable')),
|
new \Twig_SimpleFunction('caption_field_gui_visible', array($this, 'getCaptionFieldGuiVisible')),
|
||||||
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')),
|
||||||
@@ -79,12 +79,12 @@ class PhraseanetExtension extends \Twig_Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get localized field's gui_editable
|
* get localized field's gui_visible
|
||||||
* @param RecordInterface $record
|
* @param RecordInterface $record
|
||||||
* @param $fieldName
|
* @param $fieldName
|
||||||
* @return string - the name gui_editable
|
* @return string - the name gui_visible
|
||||||
*/
|
*/
|
||||||
public function getCaptionFieldGuiEditable(RecordInterface $record, $fieldName)
|
public function getCaptionFieldGuiVisible(RecordInterface $record, $fieldName)
|
||||||
{
|
{
|
||||||
if ($record) {
|
if ($record) {
|
||||||
/** @var \appbox $appbox */
|
/** @var \appbox $appbox */
|
||||||
@@ -93,7 +93,7 @@ class PhraseanetExtension extends \Twig_Extension
|
|||||||
foreach ($databox->get_meta_structure() as $meta) {
|
foreach ($databox->get_meta_structure() as $meta) {
|
||||||
/** @var \databox_field $meta */
|
/** @var \databox_field $meta */
|
||||||
if ($meta->get_name() === $fieldName) {
|
if ($meta->get_name() === $fieldName) {
|
||||||
return $meta->get_gui_editable($this->app['locale']);
|
return $meta->get_gui_visible($this->app['locale']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -464,6 +464,7 @@ class databox extends base implements ThumbnailedElement
|
|||||||
->set_tbranch(isset($field['tbranch']) ? (string) $field['tbranch'] : '')
|
->set_tbranch(isset($field['tbranch']) ? (string) $field['tbranch'] : '')
|
||||||
->set_generate_cterms((isset($field['generate_cterms']) && (string) $field['generate_cterms'] == 1))
|
->set_generate_cterms((isset($field['generate_cterms']) && (string) $field['generate_cterms'] == 1))
|
||||||
->set_gui_editable((isset($field['gui_editable']) && (string) $field['gui_editable'] == 1))
|
->set_gui_editable((isset($field['gui_editable']) && (string) $field['gui_editable'] == 1))
|
||||||
|
->set_gui_visible((isset($field['gui_editable']) && (string) $field['gui_visible'] == 1))
|
||||||
->set_thumbtitle(isset($field['thumbtitle']) ? (string) $field['thumbtitle'] : (isset($field['thumbTitle']) ? $field['thumbTitle'] : '0'))
|
->set_thumbtitle(isset($field['thumbtitle']) ? (string) $field['thumbtitle'] : (isset($field['thumbTitle']) ? $field['thumbTitle'] : '0'))
|
||||||
->set_report(isset($field['report']) ? (string) $field['report'] : '1')
|
->set_report(isset($field['report']) ? (string) $field['report'] : '1')
|
||||||
->save();
|
->save();
|
||||||
|
@@ -45,6 +45,7 @@ class databox_field implements cache_cacheableInterface
|
|||||||
protected $tbranch;
|
protected $tbranch;
|
||||||
protected $generate_cterms;
|
protected $generate_cterms;
|
||||||
protected $gui_editable;
|
protected $gui_editable;
|
||||||
|
protected $gui_visible;
|
||||||
protected $separator;
|
protected $separator;
|
||||||
protected $thumbtitle;
|
protected $thumbtitle;
|
||||||
|
|
||||||
@@ -170,6 +171,7 @@ class databox_field implements cache_cacheableInterface
|
|||||||
$this->tbranch = $row['tbranch'];
|
$this->tbranch = $row['tbranch'];
|
||||||
$this->generate_cterms = (bool)$row['generate_cterms'];
|
$this->generate_cterms = (bool)$row['generate_cterms'];
|
||||||
$this->gui_editable = (bool)$row['gui_editable'];
|
$this->gui_editable = (bool)$row['gui_editable'];
|
||||||
|
$this->gui_visible = (bool)$row['gui_visible'];
|
||||||
$this->VocabularyType = $row['VocabularyControlType'];
|
$this->VocabularyType = $row['VocabularyControlType'];
|
||||||
$this->VocabularyRestriction = (bool)$row['RestrictToVocabularyControl'];
|
$this->VocabularyRestriction = (bool)$row['RestrictToVocabularyControl'];
|
||||||
|
|
||||||
@@ -312,6 +314,7 @@ class databox_field implements cache_cacheableInterface
|
|||||||
`tbranch` = :tbranch,
|
`tbranch` = :tbranch,
|
||||||
`generate_cterms` = :generate_cterms,
|
`generate_cterms` = :generate_cterms,
|
||||||
`gui_editable` = :gui_editable,
|
`gui_editable` = :gui_editable,
|
||||||
|
`gui_visible` = :gui_visible,
|
||||||
`sorter` = :position,
|
`sorter` = :position,
|
||||||
`thumbtitle` = :thumbtitle,
|
`thumbtitle` = :thumbtitle,
|
||||||
`VocabularyControlType` = :VocabularyControlType,
|
`VocabularyControlType` = :VocabularyControlType,
|
||||||
@@ -337,6 +340,7 @@ class databox_field implements cache_cacheableInterface
|
|||||||
':tbranch' => $this->tbranch,
|
':tbranch' => $this->tbranch,
|
||||||
':generate_cterms' => $this->generate_cterms ? '1' : '0',
|
':generate_cterms' => $this->generate_cterms ? '1' : '0',
|
||||||
':gui_editable' => $this->gui_editable ? '1' : '0',
|
':gui_editable' => $this->gui_editable ? '1' : '0',
|
||||||
|
':gui_visible' => $this->gui_visible ? '1' : '0',
|
||||||
':position' => $this->position,
|
':position' => $this->position,
|
||||||
':thumbtitle' => $this->thumbtitle,
|
':thumbtitle' => $this->thumbtitle,
|
||||||
':VocabularyControlType' => $this->getVocabularyControl() ? $this->getVocabularyControl()->getType() : null,
|
':VocabularyControlType' => $this->getVocabularyControl() ? $this->getVocabularyControl()->getType() : null,
|
||||||
@@ -390,6 +394,7 @@ class databox_field implements cache_cacheableInterface
|
|||||||
$meta->setAttribute('tbranch', $this->tbranch);
|
$meta->setAttribute('tbranch', $this->tbranch);
|
||||||
$meta->setAttribute('generate_cterms', $this->generate_cterms ? '1' : '0');
|
$meta->setAttribute('generate_cterms', $this->generate_cterms ? '1' : '0');
|
||||||
$meta->setAttribute('gui_editable', $this->gui_editable ? '1' : '0');
|
$meta->setAttribute('gui_editable', $this->gui_editable ? '1' : '0');
|
||||||
|
$meta->setAttribute('gui_visible', $this->gui_visible ? '1' : '0');
|
||||||
if ($this->multi) {
|
if ($this->multi) {
|
||||||
$meta->setAttribute('separator', $this->separator);
|
$meta->setAttribute('separator', $this->separator);
|
||||||
}
|
}
|
||||||
@@ -743,6 +748,17 @@ class databox_field implements cache_cacheableInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param boolean $gui_visible
|
||||||
|
* @return databox_field
|
||||||
|
*/
|
||||||
|
public function set_gui_visible($gui_visible)
|
||||||
|
{
|
||||||
|
$this->gui_visible = $gui_visible;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $separator
|
* @param string $separator
|
||||||
@@ -845,6 +861,15 @@ class databox_field implements cache_cacheableInterface
|
|||||||
return $this->gui_editable;
|
return $this->gui_editable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function get_gui_visible()
|
||||||
|
{
|
||||||
|
return $this->gui_visible;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Boolean $all If set to false, returns a one-char separator to use for serialiation
|
* @param Boolean $all If set to false, returns a one-char separator to use for serialiation
|
||||||
*
|
*
|
||||||
@@ -957,6 +982,7 @@ class databox_field implements cache_cacheableInterface
|
|||||||
'tbranch' => $this->tbranch,
|
'tbranch' => $this->tbranch,
|
||||||
'generate_cterms' => $this->generate_cterms,
|
'generate_cterms' => $this->generate_cterms,
|
||||||
'gui_editable' => $this->gui_editable,
|
'gui_editable' => $this->gui_editable,
|
||||||
|
'gui_visible' => $this->gui_visible,
|
||||||
'separator' => $this->separator,
|
'separator' => $this->separator,
|
||||||
'required' => $this->required,
|
'required' => $this->required,
|
||||||
'report' => $this->report,
|
'report' => $this->report,
|
||||||
@@ -995,10 +1021,10 @@ class databox_field implements cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO metadatas_structure
|
$sql = "INSERT INTO metadatas_structure
|
||||||
(`id`, `name`, `src`, `readonly`, `gui_editable`, `required`, `indexable`, `type`, `tbranch`, `generate_cterms`,
|
(`id`, `name`, `src`, `readonly`, `gui_editable`,`gui_visible`, `required`, `indexable`, `type`, `tbranch`, `generate_cterms`,
|
||||||
`thumbtitle`, `multi`, `business`, `aggregable`,
|
`thumbtitle`, `multi`, `business`, `aggregable`,
|
||||||
`report`, `sorter`, `separator`)
|
`report`, `sorter`, `separator`)
|
||||||
VALUES (null, :name, '', 0, 1, 0, 1, 'string', '', 1,
|
VALUES (null, :name, '', 0, 1, 1, 0, 1, 'string', '', 1,
|
||||||
null, 0, 0, 0,
|
null, 0, 0, 0,
|
||||||
1, :sorter, '')";
|
1, :sorter, '')";
|
||||||
|
|
||||||
|
@@ -2049,6 +2049,14 @@
|
|||||||
<default>1</default>
|
<default>1</default>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
</field>
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>gui_visible</name>
|
||||||
|
<type>int(1) unsigned</type>
|
||||||
|
<null></null>
|
||||||
|
<extra></extra>
|
||||||
|
<default>1</default>
|
||||||
|
<comment></comment>
|
||||||
|
</field>
|
||||||
</fields>
|
</fields>
|
||||||
<indexes>
|
<indexes>
|
||||||
<index>
|
<index>
|
||||||
|
@@ -197,6 +197,14 @@
|
|||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="gui_visible" class="checkbox">
|
||||||
|
<input id="gui_visible" type="checkbox" <%= field.gui_visible ? "checked='checked'" : "" %> />
|
||||||
|
{% trans %}gui_visible{% endtrans %}
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<label for="business" class="checkbox">
|
<label for="business" class="checkbox">
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{% 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 name, value in record.getCaption(caption_field_order(record, can_see_business)) %}
|
||||||
{% if caption_field_gui_editable(record, name) == 1 %}
|
{% if caption_field_gui_visible(record, name) == 1 %}
|
||||||
<dt>{{ caption_field_label(record, name) }}</dt>
|
<dt>{{ caption_field_label(record, name) }}</dt>
|
||||||
<dd>{{ caption_field(record, name, value)|e|highlight|linkify|parseColor }}</dd>
|
<dd>{{ caption_field(record, name, value)|e|highlight|linkify|parseColor }}</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@@ -230,6 +230,7 @@ class FieldsTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
'vocabulary-type' => 'User',
|
'vocabulary-type' => 'User',
|
||||||
'vocabulary-restricted' => true,
|
'vocabulary-restricted' => true,
|
||||||
'gui_editable' => true,
|
'gui_editable' => true,
|
||||||
|
'gui_visible' => true,
|
||||||
'generate_cterms' => true,
|
'generate_cterms' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ define([
|
|||||||
"tbranch": "",
|
"tbranch": "",
|
||||||
"generate_cterms": false,
|
"generate_cterms": false,
|
||||||
"gui_editable": true,
|
"gui_editable": true,
|
||||||
|
"gui_visible": true,
|
||||||
"separator": "",
|
"separator": "",
|
||||||
"required": false,
|
"required": false,
|
||||||
"report": true,
|
"report": true,
|
||||||
|
@@ -52,6 +52,10 @@ define([
|
|||||||
this.field.get('gui_editable').should.equal("1");
|
this.field.get('gui_editable').should.equal("1");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should default gui_visible property to '1'", function () {
|
||||||
|
this.field.get('gui_visible').should.equal("1");
|
||||||
|
});
|
||||||
|
|
||||||
it("should default separator property to 'empty'", function () {
|
it("should default separator property to 'empty'", function () {
|
||||||
this.field.get('separator').should.equal("");
|
this.field.get('separator').should.equal("");
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user