Merge branch 'master' into PHRAS-2739-incorporate-subdefwebhook

This commit is contained in:
Nicolas Maillat
2019-11-08 18:32:07 +01:00
committed by GitHub
32 changed files with 979 additions and 398 deletions

403
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -314,6 +314,8 @@ class FieldsController extends Controller
->set_readonly($data['readonly']) ->set_readonly($data['readonly'])
->set_type($data['type']) ->set_type($data['type'])
->set_tbranch($data['tbranch']) ->set_tbranch($data['tbranch'])
->set_generate_cterms($data['generate_cterms'])
->set_gui_editable($data['gui_editable'])
->set_report($data['report']) ->set_report($data['report'])
->setVocabularyControl(null) ->setVocabularyControl(null)
->setVocabularyRestricted(false); ->setVocabularyRestricted(false);
@@ -349,7 +351,7 @@ class FieldsController extends Controller
{ {
return [ return [
'name', 'multi', 'thumbtitle', 'tag', 'business', 'indexable', 'aggregable', 'name', 'multi', 'thumbtitle', 'tag', 'business', 'indexable', 'aggregable',
'required', 'separator', 'readonly', 'type', 'tbranch', 'report', 'required', 'separator', 'readonly', 'gui_editable', 'type', 'tbranch', 'generate_cterms', 'report',
'vocabulary-type', 'vocabulary-restricted', 'dces-element', 'labels' 'vocabulary-type', 'vocabulary-restricted', 'dces-element', 'labels'
]; ];
} }

View File

@@ -594,6 +594,8 @@ class V1Controller extends Controller
], ],
'separator' => $databox_field->get_separator(), 'separator' => $databox_field->get_separator(),
'thesaurus_branch' => $databox_field->get_tbranch(), 'thesaurus_branch' => $databox_field->get_tbranch(),
'generate_cterms' => $databox_field->get_generate_cterms(),
'gui_editable' => $databox_field->get_gui_editable(),
'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(),

View File

@@ -75,6 +75,8 @@ class EditController extends Controller
'format' => '', 'format' => '',
'explain' => '', 'explain' => '',
'tbranch' => $meta->get_tbranch(), 'tbranch' => $meta->get_tbranch(),
'generate_cterms' => $meta->get_generate_cterms(),
'gui_editable' => $meta->get_gui_editable(),
'maxLength' => $meta->get_tag() 'maxLength' => $meta->get_tag()
->getMaxLength(), ->getMaxLength(),
'minLength' => $meta->get_tag() 'minLength' => $meta->get_tag()

View File

@@ -126,6 +126,16 @@ class LazaretController extends Controller
$ret = $lazaretManipulator->add($file_id, $keepAttributes, $attributesToKeep); $ret = $lazaretManipulator->add($file_id, $keepAttributes, $attributesToKeep);
try{
// get the new record
$record = \Collection::getByBaseId($this->app, $request->request->get('bas_id'))->get_databox()->get_record($ret['result']['record_id']);
$postStatus = (array) $request->request->get('status');
// update status
$this->updateRecordStatus($record, $postStatus);
}catch(\Exception $e){
$ret['message'] = $this->app->trans('An error occured when wanting to change status!');
}
return $this->app->json($ret); return $this->app->json($ret);
} }
@@ -216,6 +226,7 @@ class LazaretController extends Controller
return $this->app->json($ret); return $this->app->json($ret);
} }
$postStatus = (array) $request->request->get('status');
$path = $this->app['tmp.lazaret.path'] . '/'; $path = $this->app['tmp.lazaret.path'] . '/';
$lazaretFileName = $path .$lazaretFile->getFilename(); $lazaretFileName = $path .$lazaretFile->getFilename();
@@ -233,6 +244,9 @@ class LazaretController extends Controller
'' ''
); );
// update status
$this->updateRecordStatus($record, $postStatus);
//Delete lazaret file //Delete lazaret file
$manager = $this->getEntityManager(); $manager = $this->getEntityManager();
$manager->remove($lazaretFile); $manager->remove($lazaretFile);
@@ -278,6 +292,35 @@ class LazaretController extends Controller
); );
} }
/**
* @param Request $request
* @param $databox_id
* @param $record_id
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
public function getDestinationStatus(Request $request, $databox_id, $record_id)
{
if (!$request->isXmlHttpRequest()) {
$this->app->abort(400);
}
$record = new \record_adapter($this->app, (int) $databox_id, (int) $record_id);
$databox = $this->findDataboxById($databox_id);
$statusStructure = $databox->getStatusStructure();
$recordsStatuses = [];
foreach ($statusStructure as $status) {
// make the key as a string for the json usage in javascript
$bit = "'".$status['bit']."'";
if (!isset($recordsStatuses[$bit])) {
$recordsStatuses[$bit] = $status;
}
$statusSet = \databox_status::bitIsSet($record->getStatusBitField(), $status['bit']);
if (!isset($recordsStatuses[$bit]['flag'])) {
$recordsStatuses[$bit]['flag'] = (int) $statusSet;
}
}
return $this->app->json(['status' => $recordsStatuses]);
}
/** /**
* @return LazaretFileRepository * @return LazaretFileRepository
*/ */
@@ -293,4 +336,32 @@ class LazaretController extends Controller
{ {
return $this->app['border-manager']; return $this->app['border-manager'];
} }
/**
* Set new status to selected record
*
* @param \record_adapter $record
* @param array $postStatus
* @return array|null
*/
private function updateRecordStatus(\record_adapter $record, array $postStatus)
{
$sbasId = $record->getDataboxId();
if (isset($postStatus[$sbasId]) && is_array($postStatus[$sbasId])) {
$postStatus = $postStatus[$sbasId];
$currentStatus = strrev($record->getStatus());
$newStatus = '';
foreach (range(0, 31) as $i) {
$newStatus .= isset($postStatus[$i]) ? ($postStatus[$i] ? '1' : '0') : $currentStatus[$i];
}
$record->setStatus(strrev($newStatus));
$this->getDataboxLogger($record->getDatabox())
->log($record, \Session_Logger::EVENT_STATUS, '', '');
return [
'current_status' => $currentStatus,
'new_status' => $newStatus,
];
}
return null;
}
} }

View File

@@ -82,6 +82,11 @@ class Lazaret implements ControllerProviderInterface, ServiceProviderInterface
->assert('file_id', '\d+') ->assert('file_id', '\d+')
->bind('lazaret_thumbnail'); ->bind('lazaret_thumbnail');
$controllers->get('/{databox_id}/{record_id}/status', 'controller.prod.lazaret:getDestinationStatus')
->assert('databox_id', '\d+')
->assert('record_id', '\d+')
->bind('lazaret_destination_status');
return $controllers; return $controllers;
} }
} }

View File

@@ -16,7 +16,7 @@ class Version
/** /**
* @var string * @var string
*/ */
private $number = '4.1.0-alpha.15a'; private $number = '4.1.0-alpha.17a';
/** /**
* @var string * @var string

View File

@@ -36,6 +36,8 @@ final class DbalDataboxFieldRepository implements DataboxFieldRepository
'label_fr', 'label_fr',
'label_de', 'label_de',
'label_nl', 'label_nl',
'generate_cterms',
'gui_editable',
]; ];
/** @var DataboxFieldFactory */ /** @var DataboxFieldFactory */

View File

@@ -12,6 +12,7 @@
namespace Alchemy\Phrasea\Model\Entities; namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\Attribute\AttributeInterface;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\Mapping\Annotation as Gedmo;
use \record_adapter; use \record_adapter;
@@ -474,4 +475,32 @@ class LazaretFile
return $merged; return $merged;
} }
/**
* @param Application $app
* @return array|null
*/
public function getStatus(Application $app)
{
/**@var LazaretAttribute $atribute*/
foreach ($this->attributes as $atribute) {
if ($atribute->getName() == AttributeInterface::NAME_STATUS) {
$databox = $this->getCollection($app)->get_databox();
$statusStructure = $databox->getStatusStructure();
$recordsStatuses = [];
foreach ($statusStructure as $status) {
$bit = $status['bit'];
if (!isset($recordsStatuses[$bit])) {
$recordsStatuses[$bit] = $status;
}
$statusSet = \databox_status::bitIsSet(bindec($atribute->getValue()), $bit);
if (!isset($recordsStatuses[$bit]['flag'])) {
$recordsStatuses[$bit]['flag'] = (int) $statusSet;
}
}
return $recordsStatuses;
}
}
return null;
}
} }

View File

@@ -226,6 +226,8 @@ class LazaretManipulator
$this->entityManager->remove($lazaretFile); $this->entityManager->remove($lazaretFile);
$this->entityManager->flush(); $this->entityManager->flush();
$ret['result']['record_id'] = $record->getRecordId();
$ret['success'] = true; $ret['success'] = true;
} catch (\Exception $e) { } catch (\Exception $e) {
$ret['message'] = $this->app->trans('An error occured'); $ret['message'] = $this->app->trans('An error occured');

View File

@@ -58,6 +58,11 @@ class GeolocationKey implements Key
$this->key = $key; $this->key = $key;
} }
public function getFieldType(QueryContext $context)
{
return $this->type;
}
public function getIndexField(QueryContext $context, $raw = false) public function getIndexField(QueryContext $context, $raw = false)
{ {
return $this->key; return $this->key;

View File

@@ -42,7 +42,7 @@ class ThesaurusHydrator implements HydratorInterface
$fields = []; $fields = [];
$index_fields = []; $index_fields = [];
foreach ($structure as $name => $field) { foreach ($structure as $name => $field) {
$fields[$name] = $field->getThesaurusRoots(); $fields[$name] = $field; // ->getThesaurusRoots();
$index_fields[$name] = $field->getIndexField(); $index_fields[$name] = $field->getIndexField();
} }
// Hydrate records with concepts // Hydrate records with concepts
@@ -51,7 +51,13 @@ class ThesaurusHydrator implements HydratorInterface
} }
} }
private function hydrate(array &$record, array $fields, array $index_fields) /**
* @param array $record
* @param Field[] $fields
* @param array $index_fields
* @throws Exception
*/
private function hydrate(array &$record, $fields, array $index_fields)
{ {
if (!isset($record['databox_id'])) { if (!isset($record['databox_id'])) {
throw new Exception('Expected a record with the "databox_id" key set.'); throw new Exception('Expected a record with the "databox_id" key set.');
@@ -61,7 +67,8 @@ class ThesaurusHydrator implements HydratorInterface
$terms = array(); $terms = array();
$filters = array(); $filters = array();
$field_names = array(); $field_names = array();
foreach ($fields as $name => $root_concepts) { foreach ($fields as $name => $field) {
$root_concepts = $field->getThesaurusRoots();
// Loop through all values to prepare bulk query // Loop through all values to prepare bulk query
$field_values = \igorw\get_in($record, explode('.', $index_fields[$name])); $field_values = \igorw\get_in($record, explode('.', $index_fields[$name]));
if ($field_values !== null) { if ($field_values !== null) {
@@ -84,14 +91,18 @@ class ThesaurusHydrator implements HydratorInterface
$bulk = $this->thesaurus->findConceptsBulk($terms, null, $filters, true); $bulk = $this->thesaurus->findConceptsBulk($terms, null, $filters, true);
foreach ($bulk as $offset => $item_concepts) { foreach ($bulk as $offset => $item_concepts) {
if ($item_concepts && is_array($item_concepts) && count($item_concepts)>0) {
$name = $field_names[$offset]; $name = $field_names[$offset];
if ($item_concepts && is_array($item_concepts) && count($item_concepts)>0) {
foreach ($item_concepts as $concept) { foreach ($item_concepts as $concept) {
$record['concept_path'][$name][] = $concept->getPath(); $record['concept_path'][$name][] = $concept->getPath();
} }
} else { }
else {
$field = $fields[$name];
if($field->get_generate_cterms()) {
$this->candidate_terms->insert($field_names[$offset], $values[$offset]); $this->candidate_terms->insert($field_names[$offset], $values[$offset]);
} }
} }
} }
} }
}

View File

@@ -46,22 +46,23 @@ class FacetsResponse
if (!isset($bucket['key']) || !isset($bucket['doc_count'])) { if (!isset($bucket['key']) || !isset($bucket['doc_count'])) {
$this->throwAggregationResponseError(); $this->throwAggregationResponseError();
} }
$key = array_key_exists('key_as_string', $bucket) ? $bucket['key_as_string'] : $bucket['key'];
if($tf) { if($tf) {
// the field is one of the hardcoded tech fields // the field is one of the hardcoded tech fields
$value = [ $value = [
'value' => $valueFormatter($bucket['key']), 'value' => $valueFormatter($key),
'raw_value' => $bucket['key'], 'raw_value' => $key,
'count' => $bucket['doc_count'], 'count' => $bucket['doc_count'],
'query' => sprintf($tf['query'], $this->escaper->escapeWord($bucket['key'])) 'query' => sprintf($tf['query'], $this->escaper->escapeWord($key))
]; ];
} }
else { else {
// the field is a normal field // the field is a normal field
$value = [ $value = [
'value' => $bucket['key'], 'value' => $key,
'raw_value' => $bucket['key'], 'raw_value' => $key,
'count' => $bucket['doc_count'], 'count' => $bucket['doc_count'],
'query' => sprintf('field.%s:%s', $this->escaper->escapeWord($name), $this->escaper->escapeWord($bucket['key'])) 'query' => sprintf('field.%s:%s', $this->escaper->escapeWord($name), $this->escaper->escapeWord($key))
]; ];
} }

View File

@@ -63,4 +63,26 @@ class StringUtils
return self::$transliterator->transliterate($string); return self::$transliterator->transliterate($string);
} }
/**
* replace bad chars (ascii 0...31 except 9,10,13)
*
* @param $s
* @param string $replace
* @return mixed
*/
public static function substituteCtrlCharacters($s, $replace = '_')
{
static $bad_chars = null;
if($bad_chars === null) {
$bad_chars = [];
for($i=0; $i<32; $i++) {
if($i != 9 && $i != 10 && $i != 13) {
$bad_chars[] = chr($i);
}
}
}
return str_replace($bad_chars, $replace, $s);
}
} }

View File

@@ -43,6 +43,8 @@ class Field implements Typed
private $thesaurus_roots; private $thesaurus_roots;
private $generate_cterms;
private $used_by_collections; private $used_by_collections;
public static function createFromLegacyField(databox_field $field, $with = Structure::WITH_EVERYTHING) public static function createFromLegacyField(databox_field $field, $with = Structure::WITH_EVERYTHING)
@@ -75,6 +77,7 @@ class Field implements Typed
'private' => $field->isBusiness(), 'private' => $field->isBusiness(),
'facet' => $facet, 'facet' => $facet,
'thesaurus_roots' => $roots, 'thesaurus_roots' => $roots,
'generate_cterms' => $field->get_generate_cterms(),
'used_by_collections' => $databox->get_collection_unique_ids() 'used_by_collections' => $databox->get_collection_unique_ids()
]); ]);
} }
@@ -103,6 +106,7 @@ class Field implements Typed
$this->is_private = \igorw\get_in($options, ['private'], false); $this->is_private = \igorw\get_in($options, ['private'], false);
$this->facet = \igorw\get_in($options, ['facet']); $this->facet = \igorw\get_in($options, ['facet']);
$this->thesaurus_roots = \igorw\get_in($options, ['thesaurus_roots'], null); $this->thesaurus_roots = \igorw\get_in($options, ['thesaurus_roots'], null);
$this->generate_cterms = \igorw\get_in($options, ['generate_cterms'], false);
$this->used_by_collections = \igorw\get_in($options, ['used_by_collections'], []); $this->used_by_collections = \igorw\get_in($options, ['used_by_collections'], []);
Assertion::boolean($this->is_searchable); Assertion::boolean($this->is_searchable);
@@ -126,6 +130,7 @@ class Field implements Typed
'private' => $this->is_private, 'private' => $this->is_private,
'facet' => $this->facet, 'facet' => $this->facet,
'thesaurus_roots' => $this->thesaurus_roots, 'thesaurus_roots' => $this->thesaurus_roots,
'generate_cterms' => $this->generate_cterms,
'used_by_collections' => $this->used_by_collections 'used_by_collections' => $this->used_by_collections
]); ]);
} }
@@ -190,6 +195,11 @@ class Field implements Typed
return $this->thesaurus_roots; return $this->thesaurus_roots;
} }
public function get_generate_cterms()
{
return $this->generate_cterms;
}
/** /**
* Merge with another field, returning the new instance * Merge with another field, returning the new instance
* *

View File

@@ -32,6 +32,7 @@ class CandidateTerms
public function insert($field, $value) public function insert($field, $value)
{ {
$value = StringUtils::substituteCtrlCharacters($value, '');
$this->ensureVisitorSetup(); $this->ensureVisitorSetup();
if (!$this->visitor->hasTerm($field, $value)) { if (!$this->visitor->hasTerm($field, $value)) {
$this->new_candidates[$value] = $field; $this->new_candidates[$value] = $field;

View File

@@ -462,6 +462,8 @@ class databox extends base implements ThumbnailedElement
->set_aggregable((isset($field['aggregable']) ? (string) $field['aggregable'] : 0)) ->set_aggregable((isset($field['aggregable']) ? (string) $field['aggregable'] : 0))
->set_type($type) ->set_type($type)
->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_gui_editable((isset($field['gui_editable']) && (string) $field['gui_editable'] == 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();
@@ -1214,21 +1216,40 @@ class databox extends base implements ThumbnailedElement
$domct = $this->get_dom_cterms(); $domct = $this->get_dom_cterms();
if ($domct !== false) { if ($domct !== false) {
$changed = false;
$nodesToDel = []; $nodesToDel = [];
// loop on first level : "fields"
for($n = $domct->documentElement->firstChild; $n; $n = $n->nextSibling) { for($n = $domct->documentElement->firstChild; $n; $n = $n->nextSibling) {
if($n->nodeType == XML_ELEMENT_NODE && !($n->getAttribute('delbranch'))){ if($n->nodeType == XML_ELEMENT_NODE && !($n->getAttribute('delbranch'))){
$nodesToDel2 = [];
// loop on 2nd level : "terms"
for($n2 = $n->firstChild; $n2; $n2 = $n2->nextSibling) {
// do not remove "rejected" candidates
if(substr($n2->getAttribute('id'), 0, 1) != 'R') {
$nodesToDel2[] = $n2;
}
}
foreach($nodesToDel2 as $n2) {
$n->removeChild($n2);
$changed = true;
}
// if a field has no more candidates, we can remove it
if(!($n->firstChild)) {
$nodesToDel[] = $n; $nodesToDel[] = $n;
} }
} }
}
foreach($nodesToDel as $n) { foreach($nodesToDel as $n) {
$n->parentNode->removeChild($n); $n->parentNode->removeChild($n);
$changed = true;
} }
if(!empty($nodesToDel)) { if($changed) {
$this->saveCterms($domct); $this->saveCterms($domct);
} }
} }
} catch (\Exception $e) { }
catch (\Exception $e) {
// no-op
} }
} }

View File

@@ -43,6 +43,8 @@ class databox_field implements cache_cacheableInterface
protected $report; protected $report;
protected $type; protected $type;
protected $tbranch; protected $tbranch;
protected $generate_cterms;
protected $gui_editable;
protected $separator; protected $separator;
protected $thumbtitle; protected $thumbtitle;
@@ -166,6 +168,8 @@ class databox_field implements cache_cacheableInterface
$this->position = (int)$row['sorter']; $this->position = (int)$row['sorter'];
$this->type = $row['type'] ?: self::TYPE_STRING; $this->type = $row['type'] ?: self::TYPE_STRING;
$this->tbranch = $row['tbranch']; $this->tbranch = $row['tbranch'];
$this->generate_cterms = (bool)$row['generate_cterms'];
$this->gui_editable = (bool)$row['gui_editable'];
$this->VocabularyType = $row['VocabularyControlType']; $this->VocabularyType = $row['VocabularyControlType'];
$this->VocabularyRestriction = (bool)$row['RestrictToVocabularyControl']; $this->VocabularyRestriction = (bool)$row['RestrictToVocabularyControl'];
@@ -306,6 +310,8 @@ class databox_field implements cache_cacheableInterface
`report` = :report, `report` = :report,
`type` = :type, `type` = :type,
`tbranch` = :tbranch, `tbranch` = :tbranch,
`generate_cterms` = :generate_cterms,
`gui_editable` = :gui_editable,
`sorter` = :position, `sorter` = :position,
`thumbtitle` = :thumbtitle, `thumbtitle` = :thumbtitle,
`VocabularyControlType` = :VocabularyControlType, `VocabularyControlType` = :VocabularyControlType,
@@ -329,6 +335,8 @@ class databox_field implements cache_cacheableInterface
':report' => $this->report ? '1' : '0', ':report' => $this->report ? '1' : '0',
':type' => $this->type, ':type' => $this->type,
':tbranch' => $this->tbranch, ':tbranch' => $this->tbranch,
':generate_cterms' => $this->generate_cterms ? '1' : '0',
':gui_editable' => $this->gui_editable ? '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,
@@ -380,6 +388,8 @@ class databox_field implements cache_cacheableInterface
$meta->setAttribute('aggregable', $this->aggregable); $meta->setAttribute('aggregable', $this->aggregable);
$meta->setAttribute('type', $this->type); $meta->setAttribute('type', $this->type);
$meta->setAttribute('tbranch', $this->tbranch); $meta->setAttribute('tbranch', $this->tbranch);
$meta->setAttribute('generate_cterms', $this->generate_cterms ? '1' : '0');
$meta->setAttribute('gui_editable', $this->gui_editable ? '1' : '0');
if ($this->multi) { if ($this->multi) {
$meta->setAttribute('separator', $this->separator); $meta->setAttribute('separator', $this->separator);
} }
@@ -711,6 +721,28 @@ class databox_field implements cache_cacheableInterface
return $this; return $this;
} }
/**
* @param boolean $generate_cterms
* @return databox_field
*/
public function set_generate_cterms($generate_cterms)
{
$this->generate_cterms = $generate_cterms;
return $this;
}
/**
* @param boolean $gui_editable
* @return databox_field
*/
public function set_gui_editable($gui_editable)
{
$this->gui_editable = $gui_editable;
return $this;
}
/** /**
* *
* @param string $separator * @param string $separator
@@ -795,6 +827,24 @@ class databox_field implements cache_cacheableInterface
return $this->tbranch; return $this->tbranch;
} }
/**
*
* @return boolean
*/
public function get_generate_cterms()
{
return $this->generate_cterms;
}
/**
*
* @return boolean
*/
public function get_gui_editable()
{
return $this->gui_editable;
}
/** /**
* @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
* *
@@ -905,6 +955,8 @@ class databox_field implements cache_cacheableInterface
'sorter' => $this->position, 'sorter' => $this->position,
'thumbtitle' => $this->thumbtitle, 'thumbtitle' => $this->thumbtitle,
'tbranch' => $this->tbranch, 'tbranch' => $this->tbranch,
'generate_cterms' => $this->generate_cterms,
'gui_editable' => $this->gui_editable,
'separator' => $this->separator, 'separator' => $this->separator,
'required' => $this->required, 'required' => $this->required,
'report' => $this->report, 'report' => $this->report,
@@ -943,10 +995,10 @@ class databox_field implements cache_cacheableInterface
} }
$sql = "INSERT INTO metadatas_structure $sql = "INSERT INTO metadatas_structure
(`id`, `name`, `src`, `readonly`, `required`, `indexable`, `type`, `tbranch`, (`id`, `name`, `src`, `readonly`, `gui_editable`, `required`, `indexable`, `type`, `tbranch`, `generate_cterms`,
`thumbtitle`, `multi`, `business`, `aggregable`, `thumbtitle`, `multi`, `business`, `aggregable`,
`report`, `sorter`, `separator`) `report`, `sorter`, `separator`)
VALUES (null, :name, '', 0, 0, 1, 'string', '', VALUES (null, :name, '', 0, 1, 0, 1, 'string', '', 1,
null, 0, 0, 0, null, 0, 0, 0,
1, :sorter, '')"; 1, :sorter, '')";

View File

@@ -0,0 +1,67 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
class patch_410alpha17a implements patchInterface
{
/** @var string */
private $release = '4.1.0-alpha.17a';
/** @var array */
private $concern = [base::DATA_BOX];
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
// -- done by xml schema --
// $sql = "ALTER TABLE `metadatas_structure` ADD `generate_cterms` INT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `tbranch`";
// $databox->get_connection()->executeQuery($sql);
// $sql = "ALTER TABLE `metadatas_structure` ADD `gui_editable` INT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `readonly`";
// $databox->get_connection()->executeQuery($sql);
return true;
}
}

View File

@@ -2033,6 +2033,22 @@
<default></default> <default></default>
<comment></comment> <comment></comment>
</field> </field>
<field>
<name>generate_cterms</name>
<type>int(1) unsigned</type>
<null></null>
<extra></extra>
<default>1</default>
<comment></comment>
</field>
<field>
<name>gui_editable</name>
<type>int(1) unsigned</type>
<null></null>
<extra></extra>
<default>1</default>
<comment></comment>
</field>
</fields> </fields>
<indexes> <indexes>
<index> <index>

View File

@@ -65,7 +65,7 @@
"normalize-css": "^2.1.0", "normalize-css": "^2.1.0",
"npm": "^6.0.0", "npm": "^6.0.0",
"npm-modernizr": "^2.8.3", "npm-modernizr": "^2.8.3",
"phraseanet-production-client": "0.34.72-d", "phraseanet-production-client": "0.34.76-d",
"requirejs": "^2.3.5", "requirejs": "^2.3.5",
"tinymce": "^4.0.28", "tinymce": "^4.0.28",
"underscore": "^1.8.3", "underscore": "^1.8.3",

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: sketchtool 58 (101010) - https://sketch.com -->
<title>5609DDD5-6B9C-411B-B926-EEA284949013</title>
<desc>Created with sketchtool.</desc>
<defs>
<polygon id="path-1" points="0 0 22.3169609 16.2062701 0 32.4125403"></polygon>
<filter x="-31.4%" y="-15.4%" width="162.7%" height="143.2%" filterUnits="objectBoundingBox" id="filter-3">
<feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
</defs>
<g id="Pictos" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Pictos/Arrow/Pleine">
<g id="Colors/Black" transform="translate(5.000000, 0.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<g id="Mask" fill="black" fill-opacity="1">
<use filter="url(#filter-3)" xlink:href="#path-1"></use>
</g>
<g id="Colors/Rectangular/Black" mask="url(#mask-2)" fill="#000000">
<g transform="translate(-5.000000, 0.000000)" id="Rectangle">
<rect x="0" y="0" width="32" height="32"></rect>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="times-circle" class="svg-inline--fa fa-times-circle fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#aaa" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"></path></svg>

After

Width:  |  Height:  |  Size: 705 B

View File

@@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="check-circle" class="svg-inline--fa fa-check-circle fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#aaa" d="M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 48c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m140.204 130.267l-22.536-22.718c-4.667-4.705-12.265-4.736-16.97-.068L215.346 303.697l-59.792-60.277c-4.667-4.705-12.265-4.736-16.97-.069l-22.719 22.536c-4.705 4.667-4.736 12.265-.068 16.971l90.781 91.516c4.667 4.705 12.265 4.736 16.97.068l172.589-171.204c4.704-4.668 4.734-12.266.067-16.971z"></path></svg>

After

Width:  |  Height:  |  Size: 738 B

View File

@@ -109,3 +109,48 @@ dd {
float: left; float: left;
} }
} }
/*Help menu*/
.contextMenu.helpcontextmenu {
display: none;
&.shown {
display: block;
position: absolute;
z-index: 101;
}
}
.help-trigger {
display:inline-block;
cursor:pointer;
padding: 0 4px;
border:none;
margin-left: -12px;
margin-right: 94px;
.fa-caret-down:before {
content: "\25BC";
font-size: 11px;
}
}
.context-menu-theme-vista {
background-image: none;
background-color: #414141;
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
.context-menu-item {
transition: 500ms;
&:hover {
background-image: none;
background-color: #75abff;
border: none;
}
.context-menu-item-inner {
padding: 4px 12px;
margin-left: 0;
font-family: Helvetica;
font-size: 12px;
font-weight: 700;
color: #fff;
}
}
}

View File

@@ -189,6 +189,14 @@
</label> </label>
</td> </td>
</tr> </tr>
<tr>
<td>
<label for="gui_editable" class="checkbox">
<input id="gui_editable" type="checkbox" <%= field.gui_editable ? "checked='checked'" : "" %> />
{% trans %}gui_editable{% endtrans %}
</label>
</td>
</tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<label for="business" class="checkbox"> <label for="business" class="checkbox">
@@ -247,6 +255,10 @@
<td><label for="tbranch">{% trans %}Thesaurus branch{% endtrans %}</label></td> <td><label for="tbranch">{% trans %}Thesaurus branch{% endtrans %}</label></td>
<td><input id="tbranch" type="text" value="<%= field.tbranch %>"/></td> <td><input id="tbranch" type="text" value="<%= field.tbranch %>"/></td>
</tr> </tr>
<tr>
<td><label for="generate_cterms" class="checkbox">{% trans %}generate_cterms{% endtrans %}</label></td>
<td><input id="generate_cterms" type="checkbox" <%= field.generate_cterms ? "checked='checked'" : "" %> /></td>
</tr>
</table> </table>
</div> </div>
</div> </div>

View File

@@ -90,7 +90,7 @@
{% endif %} {% endif %}
{% for field in fields %} {% for field in fields %}
{% set i = field.get_id() %} {% set i = field.get_id() %}
{% if field.is_readonly() is empty %} {% if field.is_readonly() is empty and field.get_gui_editable()== 1 %}
<div class="edit_field edit-field-action" id="EditFieldBox_{{i}}" <div class="edit_field edit-field-action" id="EditFieldBox_{{i}}"
data-id="{{i}}" data-id="{{i}}"
data-name="{{field.get_name()}}"> data-name="{{field.get_name()}}">

View File

@@ -92,12 +92,12 @@
} }
} }
$(".records-subititution .diapo", scope) /* $(".records-subititution .diapo", scope)
.bind('click', function(e){ .bind('click', function(e){
$(this).closest('.lazaret-proposals').find('.diapo').removeClass('selected'); $(this).closest('.lazaret-proposals').find('.diapo').removeClass('selected');
$(this).addClass('selected'); $(this).addClass('selected');
} }
); );*/
$(".records-subititution .captionTips", scope).tooltip(); $(".records-subititution .captionTips", scope).tooltip();
$(".records-subititution .infoTips", scope).tooltip(); $(".records-subititution .infoTips", scope).tooltip();
@@ -176,27 +176,32 @@
emptying = true; emptying = true;
f(); f();
}); });
var data;
//add lazaret file click action //add lazaret file click action
$("button.add-lazaret", scope).bind('click', function () { $("button.add-lazaret", scope).bind('click', function () {
var that = $(this); var that = $(this);
var lazaretId = getLazaretId(that); var lazaretId = getLazaretId(that);
var destinationCollectionId = getDestinationId(that); var destinationCollectionId = getDestinationId(that);
var container = $(this).closest('.wrapper-item');
var form = $(this).closest("form");
/*fix POST on firefox*/
data = form.serializeArray();
var allData = that.parent().closest('.wrapper-item').find(".change-record-wrapper").html();
that.closest(".form-backup ").append(allData);
that.parent().closest('.wrapper-item').find(".change-record ").remove();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/prod/lazaret/' + lazaretId + '/force-add/', url: '/prod/lazaret/' + lazaretId + '/force-add/',
dataType: 'json', dataType: 'json',
data : { data: data,
bas_id:destinationCollectionId,
keep_attributes: 1
},
beforeSend: function () { beforeSend: function () {
startAjax(that); startAjax(that);
}, },
success: function (data) { success: function (data) {
if (data.success) { if (data.success) {
that.closest(".wrapper-item").remove(); container.remove();
} else { } else {
var html = _.template($("#alert_error_tpl").html(), { var html = _.template($("#alert_error_tpl").html(), {
content: data.message content: data.message
@@ -221,6 +226,12 @@
$("button.delete-lazaret", scope).bind('click', function () { $("button.delete-lazaret", scope).bind('click', function () {
var that = $(this); var that = $(this);
var lazaretId = getLazaretId(that); var lazaretId = getLazaretId(that);
var container = $(this).closest('.wrapper-item');
var form = $(this).closest("form");
data = form.serializeArray();
var allData = that.parent().closest('.wrapper-item').find(".change-record-wrapper").html();
that.closest(".form-backup ").append(allData);
that.parent().closest('.wrapper-item').find(".change-record ").remove();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
@@ -231,7 +242,7 @@
}, },
success: function (data) { success: function (data) {
if (data.success) { if (data.success) {
that.closest(".wrapper-item").remove(); container.remove();
} else { } else {
var html = _.template($("#alert_error_tpl").html(), { var html = _.template($("#alert_error_tpl").html(), {
content: data.message content: data.message
@@ -252,6 +263,89 @@
}); });
}); });
//update status list
function resetStatus(that) {
that.removeClass('selected');
var html = that.parent().closest('.wrapper-item').find(".status-backup").html();
that.parent().closest('.wrapper-item').find(".status-container").html('');
that.parent().closest('.wrapper-item').find(".status-container").append(html);
};
$(".span12 img, .reset-status").click(function () {
var that = $(this).closest('.wrapper-item').find('.lazaret-proposals .diapo');
resetStatus(that);
});
$(".records-subititution .diapo", scope).bind('click', function () {
var that = $(this);
var diapo = that.closest('.lazaret-proposals').find('.diapo');
var container = that.closest('.wrapper-item');
diapo.not(this).removeClass('selected');
/*Set selected or not to check for sending ajax request*/
if (that.hasClass("selected")) {
resetStatus(that);
} else {
that.addClass('selected');
var elements = $(".selected", container);
var recordId = elements.first().attr("data-record_id");
var sBas = elements.first().attr("sbas");
$.ajax({
type: 'GET',
url: '/prod/lazaret/' + sBas + '/' + recordId + '/status',
dataType: 'json',
beforeSend: function () {
startAjax(that);
},
success: function (data) {
if (data.status) {
html = '';
for ([key, value] of Object.entries(data.status)) {
if (value.flag == 1) {
checkValOff = '';
checkValOn = 'checked=checked';
} else {
checkValOff = 'checked=checked';
checkValOn = '';
}
var labelOff = value['labels_off_i18n']["{{ app['locale'] }}"];
var labelOn = value['labels_on_i18n']["{{ app['locale'] }}"];
if (labelOff == null || labelOff == "") {
labelOff = 'off';
}
if (labelOn == null || labelOn == "") {
labelOn = 'on';
}
html += '<tr>';
html += '<td class="status-tab-left">';
if (value['img_off'] != null) {
html += ' <img src="{{ value['img_off'] }}" width="16" height="16" />';
}
;
html += '<span>' + labelOff + '</span>';
html += '<input type="radio" name="status[' + sBas + '][' + value.bit + ']" value="0" ' + checkValOff + ' />';
html += '</td>';
html += '<td class="status-tab-right">';
html += '<input type="radio" name="status[' + sBas + '][' + value.bit + ']" value="1" ' + checkValOn + ' />';
html += '<span>' + labelOn + '</span>';
if (value['img_on'] != null) {
html += '<img src="' + value['img_on'] + '" width="16" height="16" />';
}
;
html += '</td>';
html += '</tr>';
}
;
that.parent().closest('.wrapper-item').find(".status-container").html('');
that.parent().closest('.wrapper-item').find(".status-container").append(html);
}
},
complete: function () {
stopAjax(that);
reloadContent();
}
});
}
});
//substitute lazaret file click action //substitute lazaret file click action
$("button.subtitute-lazaret", scope).bind('click', function () { $("button.subtitute-lazaret", scope).bind('click', function () {
var that = $(this); var that = $(this);
@@ -278,20 +372,27 @@
} }
var recordId = elements.first().attr("data-record_id"); var recordId = elements.first().attr("data-record_id");
var form = $(this).closest("form");
$(".record_id").val(recordId);
var form = $(this).closest("form");
data = form.serializeArray();
var allData = that.parent().closest('.wrapper-item').find(".change-record-wrapper").html();
that.closest(".form-backup ").append(allData);
that.parent().closest('.wrapper-item').find(".change-record ").remove();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/prod/lazaret/' + lazaretId + '/accept/', url: '/prod/lazaret/' + lazaretId + '/accept/',
dataType: 'json', dataType: 'json',
data:{ data: data,
record_id: recordId
},
beforeSend: function () { beforeSend: function () {
startAjax(that); startAjax(that);
}, },
success: function (data) { success: function (data) {
if (data.success) { if (data.success) {
that.closest(".wrapper-item").remove(); container.remove();
} else { } else {
var html = _.template($("#alert_error_tpl").html(), { var html = _.template($("#alert_error_tpl").html(), {
content: data.message content: data.message
@@ -311,18 +412,18 @@
} }
}); });
}); });
/*Toggle status block*/
$(".toggle-status").click(function () {
$(this).nextAll('.status-wrapper').first().toggleClass('hidden');
});
}); });
</script> </script>
<style>
.lazaret-proposals .diapo {
float:none;
}
</style>
{% macro lazaretElement(app, file) %} {% macro lazaretElement(app, file) %}
{% import "common/thumbnail.html.twig" as thumb %} {% import "common/thumbnail.html.twig" as thumb %}
{% set records = file.getRecordsToSubstitute(app, true) %} {% set records = file.getRecordsToSubstitute(app, true) %}
<div class="lazaret-file span4"> <div class="lazaret-file span4">
<h5>{{ "Last uploaded version" | trans }}</h5> <h5>{{ "Last uploaded version" | trans }}</h5>
<ul class="thumbnails"> <ul class="thumbnails">
<li class="span12"> <li class="span12">
@@ -344,6 +445,66 @@
<p>{{ border_checker_from_fqcn(check.getCheckClassname()).getMessage(app['translator']) }}</p> <p>{{ border_checker_from_fqcn(check.getCheckClassname()).getMessage(app['translator']) }}</p>
{% endfor %} {% endfor %}
</div> </div>
<form class="change-record" name="change-records-status" action="/" method="POST">
<div class="change-record-wrapper">
{% set collection = file.getCollection(app) %}
<input type="hidden" name="bas_id" value="{{ collection.get_base_id() }}">
<input type="hidden" name="keep_attributes" value="1">
<input class="record_id" type="hidden" name="record_id">
<div class="update-status">
<div id="status-{{ collection.get_base_id() }}" class='collection-status'>
<a href="#" class="reset-status btn">Reset status</a>
<h5 class="toggle-status">{{ 'upload:: Status :' | trans }} <img src="/assets/common/images/icons/icon-right-arrow.svg" width="10" height="10" class="btn-status"></h5>
<div class="status-wrapper hidden">
<table style="margin: auto">
<tbody class="status-container">
{% if file.getStatus(app) is not null %}
{% for bit, status in file.getStatus(app) %}
<tr>
<td class="status-tab-left">
{% if status['img_off'] is not empty %}
<img src="{{ status['img_off'] }}" width="16" height="16" />
{% endif %}
<span>{{ status['labels_off_i18n'][app['locale']]|default('off') }}</span>
<input type="radio" name="status[{{ collection.get_sbas_id() }}][{{ bit }}]" value="0" {% if status['flag'] == 0 %}checked="checked"{% endif%}/>
</td>
<td class="status-tab-right">
<input type="radio" name="status[{{ collection.get_sbas_id() }}][{{ bit }}]" value="1" {% if status['flag'] == 1 %}checked="checked"{% endif%} />
<span for="labelon">{{ status['labels_on_i18n'][app['locale']]|default('on') }}</span>
{% if status['img_on'] is not empty %}
<img src="{{ status['img_on'] }}" width="16" height="16" />
{% endif %}
</td>
</tr>
{% endfor %}
{% else %}
{% for bit, status in collection.get_databox().getStatusStructure() %}
<tr>
<td class="status-tab-left">
{% if status['img_off'] is not empty %}
<img src="{{ status['img_off'] }}" width="16" height="16" />
{% endif %}
<span>{{ status['labels_off_i18n'][app['locale']]|default('off') }}</span>
<input type="radio" name="status[{{ collection.get_sbas_id() }}][{{ bit }}]" value="0" checked="checked"/>
</td>
<td class="status-tab-right">
<input type="radio" name="status[{{ collection.get_sbas_id() }}][{{ bit }}]" value="1" />
<span for="labelon">{{ status['labels_on_i18n'][app['locale']]|default('on') }}</span>
{% if status['img_on'] is not empty %}
<img src="{{ status['img_on'] }}" width="16" height="16" />
{% endif %}
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
<div class="btn-group" style="text-align:center; padding:5px;"> <div class="btn-group" style="text-align:center; padding:5px;">
<button class="btn add-lazaret" title="{{ "Add" | trans }}"> <button class="btn add-lazaret" title="{{ "Add" | trans }}">
<img src="/assets/common/images/icons/add.png" width="16" height="16" class="btn-image">{{ "Add" | trans }} <img src="/assets/common/images/icons/add.png" width="16" height="16" class="btn-image">{{ "Add" | trans }}
@@ -358,6 +519,55 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
</form>
<div class="hidden form-backup"></div>
{# bloc to backup initial value of status list#}
<table class="hidden">
<tbody class="status-backup">
{% if file.getStatus(app) is not null %}
{% for bit, status in file.getStatus(app) %}
<tr>
<td class="status-tab-left">
{% if status['img_off'] is not empty %}
<img src="{{ status['img_off'] }}" width="16" height="16"/>
{% endif %}
<span>{{ status['labels_off_i18n'][app['locale']]|default('off') }}</span>
<input type="radio" name="status[{{ collection.get_sbas_id() }}][{{ bit }}]" value="0" {% if status['flag'] == 0 %}checked="checked"{% endif%}/>
</td>
<td class="status-tab-right">
<input type="radio" name="status[{{ collection.get_sbas_id() }}][{{ bit }}]" value="1" {% if status['flag'] == 1 %}checked="checked"{% endif%} />
<span for="labelon">{{ status['labels_on_i18n'][app['locale']]|default('on') }}</span>
{% if status['img_on'] is not empty %}
<img src="{{ status['img_on'] }}" width="16" height="16"/>
{% endif %}
</td>
</tr>
{% endfor %}
{% else %}
{% for bit, status in collection.get_databox().getStatusStructure() %}
<tr>
<td class="status-tab-left">
{% if status['img_off'] is not empty %}
<img src="{{ status['img_off'] }}" width="16" height="16" />
{% endif %}
<span>{{ status['labels_off_i18n'][app['locale']]|default('off') }}</span>
<input type="radio" name="status[{{ collection.get_sbas_id() }}][{{ bit }}]" value="0" checked="checked"/>
</td>
<td class="status-tab-right">
<input type="radio" name="status[{{ collection.get_sbas_id() }}][{{ bit }}]" value="1" />
<span for="labelon">{{ status['labels_on_i18n'][app['locale']]|default('on') }}</span>
{% if status['img_on'] is not empty %}
<img src="{{ status['img_on'] }}" width="16" height="16" />
{% endif %}
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>
</li> </li>
</ul> </ul>
{# Store lazaret file id in hidden input #} {# Store lazaret file id in hidden input #}
@@ -406,3 +616,30 @@
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
<style>
.lazaret-proposals .diapo {
float:none;
}
.collection-status {
margin: 0 11px 14px;
background: #f5f5f5;
padding-bottom: 10px;
color: #151515;
}
.collection-status h5 {
padding: 10px 10px 0 10px;
cursor: pointer;
margin-bottom: 0;
}
.reset-status {
display: inline-block;
float: right;
background: #fff;
border: 1px solid;
padding: 2px 5px;
margin-top: -4px;
margin-right: -6px;
}
</style>

View File

@@ -229,6 +229,8 @@ class FieldsTest extends \PhraseanetAuthenticatedWebTestCase
'dces-element' => null, 'dces-element' => null,
'vocabulary-type' => 'User', 'vocabulary-type' => 'User',
'vocabulary-restricted' => true, 'vocabulary-restricted' => true,
'gui_editable' => true,
'generate_cterms' => true,
]); ]);
$response = $this->request("POST", sprintf("/admin/fields/%d/fields", $databox->get_sbas_id()), [], [], $body); $response = $this->request("POST", sprintf("/admin/fields/%d/fields", $databox->get_sbas_id()), [], [], $body);

View File

@@ -26,6 +26,8 @@ define([
"type": "string", "type": "string",
"thumbtitle": "0", "thumbtitle": "0",
"tbranch": "", "tbranch": "",
"generate_cterms": false,
"gui_editable": true,
"separator": "", "separator": "",
"required": false, "required": false,
"report": true, "report": true,

View File

@@ -44,6 +44,14 @@ define([
this.field.get('tbranch').should.equal(""); this.field.get('tbranch').should.equal("");
}); });
it("should default generate_cterms property to '1'", function () {
this.field.get('generate_cterms').should.equal("1");
});
it("should default gui_editable property to '1'", function () {
this.field.get('gui_editable').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("");
}); });

View File

@@ -7555,10 +7555,10 @@ phraseanet-common@^0.4.1:
js-cookie "^2.1.0" js-cookie "^2.1.0"
pym.js "^1.3.1" pym.js "^1.3.1"
phraseanet-production-client@0.34.72-d: phraseanet-production-client@0.34.76-d:
version "0.34.72-d" version "0.34.76-d"
resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.72-d.tgz#028a5ccd589e696b5433eea9d53d9367966613c8" resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.76-d.tgz#641e9bc4379725ee06669c7cefe0bc78996342e0"
integrity sha512-IPaDRqXwyJegoKmzr56bggxTzN4TnmuAqU4O7rDEhh0aqdCiuC8rlH/yzKoLeEIMSrESCw5mBhrI//ccntvv9w== integrity sha512-/SYoQrhVHfvtchjwmVm0/QkuWBTcmbPpNlepCKvjTMZBBPLepe+eUNHJh/vcnd+tCZkeYWu16kQvvdjs92dn5Q==
dependencies: dependencies:
"@mapbox/mapbox-gl-language" "^0.9.2" "@mapbox/mapbox-gl-language" "^0.9.2"
"@turf/turf" "^5.1.6" "@turf/turf" "^5.1.6"