This commit is contained in:
Nicolas Le Goff
2014-10-16 13:05:12 +02:00
parent e694677efd
commit 392ff21d51
11 changed files with 469 additions and 341 deletions

View File

@@ -14,7 +14,7 @@ namespace Alchemy\Phrasea\Model\Entities;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
/** /**
* Record entity that represents data from elastic search data * Record entity from elastic search
*/ */
class RecordES implements RecordInterface class RecordES implements RecordInterface
{ {
@@ -29,174 +29,153 @@ class RecordES implements RecordInterface
private $created; private $created;
private $sha256; private $sha256;
private $uuid; private $uuid;
private $position;
private $type; private $type;
private $status; private $status;
private $isStory; private $isStory;
/** @var ArrayCollection */
private $caption; private $caption;
/** @var ArrayCollection */
private $exif; private $exif;
/** @var ArrayCollection */
private $subdefs; private $subdefs;
/** {@inheritdoc} */
public function getId() public function getId()
{ {
return sprintf('%s_%s', $this->getDataboxId(), $this->getRecordId()); return sprintf('%s_%s', $this->getDataboxId(), $this->getRecordId());
} }
/**
* @return mixed /** {@inheritdoc} */
*/
public function getBaseId() public function getBaseId()
{ {
return $this->baseId; return $this->baseId;
} }
/** /** {@inheritdoc} */
* @param mixed $baseId
*/
public function setBaseId($baseId) public function setBaseId($baseId)
{ {
$this->baseId = $baseId; $this->baseId = $baseId;
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getCollectionId() public function getCollectionId()
{ {
return $this->collectionId; return $this->collectionId;
} }
/** /** {@inheritdoc} */
* @param mixed $collectionId
*/
public function setCollectionId($collectionId) public function setCollectionId($collectionId)
{ {
$this->collectionId = $collectionId; $this->collectionId = $collectionId;
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getCreated() public function getCreated()
{ {
return $this->created; return $this->created;
} }
/** /** {@inheritdoc} */
* @param mixed $created public function setCreated(\DateTime $created)
*/
public function setCreated($created)
{ {
$this->created = $created; $this->created = $created;
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getDataboxId() public function getDataboxId()
{ {
return $this->databoxId; return $this->databoxId;
} }
/** /** {@inheritdoc} */
* @param mixed $databoxId
*/
public function setDataboxId($databoxId) public function setDataboxId($databoxId)
{ {
$this->databoxId = $databoxId; $this->databoxId = $databoxId;
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function isStory() public function isStory()
{ {
return $this->isStory; return $this->isStory;
} }
/** /** {@inheritdoc} */
* @param mixed $isStory
*/
public function setIsStory($isStory) public function setIsStory($isStory)
{ {
$this->isStory = $isStory; $this->isStory = (bool) $isStory;
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getMimeType() public function getMimeType()
{ {
return $this->mimeType; return $this->mimeType;
} }
/** /** {@inheritdoc} */
* @param mixed $mimeType
*/
public function setMimeType($mimeType) public function setMimeType($mimeType)
{ {
$this->mimeType = $mimeType; $this->mimeType = $mimeType;
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getOriginalName() public function getOriginalName()
{ {
return $this->originalName; return $this->originalName;
} }
/** /** {@inheritdoc} */
* @param mixed $originalName
*/
public function setOriginalName($originalName) public function setOriginalName($originalName)
{ {
$this->originalName = $originalName; $this->originalName = $originalName;
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getRecordId() public function getRecordId()
{ {
return $this->recordId; return $this->recordId;
} }
/** /** {@inheritdoc} */
* @param mixed $recordId
*/
public function setRecordId($recordId) public function setRecordId($recordId)
{ {
$this->recordId = $recordId; $this->recordId = $recordId;
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getSha256() public function getSha256()
{ {
return $this->sha256; return $this->sha256;
} }
/** /** {@inheritdoc} */
* @param mixed $sha256
*/
public function setSha256($sha256) public function setSha256($sha256)
{ {
$this->sha256 = $sha256; $this->sha256 = $sha256;
} }
/** /**
* @return mixed * @param null $locale
*
* @return string
*/ */
public function getTitle($locale = null) public function getTitle($locale = null)
{ {
if ($locale && $this->title->containsKey($locale)) { if ($locale && $this->title->containsKey($locale)) {
return $this->title->get($locale); return $this->title->get($locale);
} }
return $this->title->get('default');
if ($this->title->containsKey('default')) {
return $this->title->get('default');
}
return $this->getOriginalName();
} }
/** /**
* @param mixed $title * Sets a collection of titles
*
* @param ArrayCollection $titles
*/ */
public function setTitles(ArrayCollection $titles) public function setTitles(ArrayCollection $titles)
{ {
@@ -204,72 +183,51 @@ class RecordES implements RecordInterface
} }
/** /**
* @return mixed * Available types are ['document', 'audio', 'video', 'image', 'flash', 'map', 'unknown']
*/ */
public function getType() public function getType()
{ {
return $this->type; return $this->type;
} }
/**
* @param mixed $type
*/
public function setType($type) public function setType($type)
{ {
$this->type = $type; $this->type = $type;
} }
/** /** @return \DateTime */
* @return mixed
*/
public function getUpdated() public function getUpdated()
{ {
return $this->updated; return $this->updated;
} }
/**
* @param mixed $updated
*/
public function setUpdated($updated) public function setUpdated($updated)
{ {
$this->updated = $updated; $this->updated = $updated;
} }
/**
* @return mixed
*/
public function getUuid() public function getUuid()
{ {
return $this->uuid; return $this->uuid;
} }
/**
* @param mixed $uuid
*/
public function setUuid($uuid) public function setUuid($uuid)
{ {
$this->uuid = $uuid; $this->uuid = $uuid;
} }
/** /** @return ArrayCollection */
* @return mixed
*/
public function getCaption() public function getCaption()
{ {
return $this->caption; return $this->caption;
} }
/**
* @param mixed $caption
*/
public function setCaption(ArrayCollection $caption) public function setCaption(ArrayCollection $caption)
{ {
$this->caption = $caption; $this->caption = $caption;
} }
/** /** @return ArrayCollection */
* @return mixed
*/
public function getExif() public function getExif()
{ {
return $this->exif; return $this->exif;
@@ -283,35 +241,45 @@ class RecordES implements RecordInterface
$this->exif = $exif; $this->exif = $exif;
} }
/** /** @return ArrayCollection */
* @return mixed
*/
public function getSubdefs() public function getSubdefs()
{ {
return $this->subdefs; return $this->subdefs;
} }
/** /** @return ArrayCollection */
* @param mixed $subdefs
*/
public function setSubdefs(ArrayCollection $subdefs) public function setSubdefs(ArrayCollection $subdefs)
{ {
$this->subdefs = $subdefs; $this->subdefs = $subdefs;
} }
/**
* @param $status
*/
public function setStatus($status) public function setStatus($status)
{ {
$this->status = $status; $this->status = $status;
} }
/** /**
* @return mixed * Get status of current current as 32 bits binary string
*
* Eg: 00000000001011100000000000011111
*
* Where the
*/ */
public function getStatus() public function getStatus()
{ {
return $this->status; return $this->status;
} }
}
/**
* Returns the position of the record in the result set
*/
public function getPosition()
{
return $this->position;
}
public function setPosition($position)
{
$this->position = $position;
}
}

View File

@@ -2,139 +2,184 @@
namespace Alchemy\Phrasea\Model\Entities; namespace Alchemy\Phrasea\Model\Entities;
use Doctrine\Common\Collections\ArrayCollection; /**
* Interface RecordInterface
*
*
* +---------------------+ +---------------------+
* | Application Box XXX | | Application Box YYY |
* +---------------------+ +---------------------+
* | Users | | Users |
* | ~~~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~~~~~ |
* | Rights (ACL) | | Rights (ACL) |
* | ~~~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~~~~~ |
* | Baskets, Feeds, | | Baskets, Feeds, |
* | Publications etc... | | Publications etc... |
* +---------------------+ +---------------------+
* / \ /
* / \ /
* / \ /
* / \ /
* / \ /
* +--------------------+ +--------------------+
* | Data Box AAA | | Data Box BBB |
* +--------------------+ +--------------------+
* | Collection (1) | | Collection (1) |
* | Collection (2) | | Collection (2) |
* | ... | | ... |
* | Collection (n) | | Collection (n) |
* | ~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~~~ |
* | Record (1) | | Record (1) |
* | Record (2) | | Record (2) |
* | ... | | ... |
* | Record (n) | | Record (n) |
* +--------------------+ +--------------------+
*
*
* An appbox (which is a database) is the heart of the application as it contains information
* about users, rights (ACL), publications, tasks and so on ...
*
* A databox (which is also a database) contains information about records and their documentary
* structure (metadata). It also contains collections which is a subset that allows to organize
* the records inside the databox.
*
* We could assimilate a databox to a wardrobe where collections would be the shelves and everything
* you put inside would be a record.
*
* A databox can be mounted or unmounted to an appbox .
*
* An appbox can reference "n" databox.
* A databox can be mounted on "n" appbox.
*
* This allows Phraseanet to share data between "n" instances of Phraseanet.
*
* The "databox_id" is the id of the databox from the appbox point of view, it is given when a new
* databox is mounted on the appbox.
*
* A databox contains a set of records.
* The "record_id" is the is of the record from the databox point of view.
*
* This "record_id" is no more unique from the appbox if two databox that have both records with the
* same ids.
*
* Thus the unique id of a record from an application point of view is the concatenation of the
* "databox_id' and the "record_id".
*
* A databox contains a set of collection. Each records belongs to one and only one collection.
* The "collection_id" is the id of the collection from the databox point of view.
*
* This "collection_id" is no more unique from the appbox point of view if two databox
* that have both a collection with the same id are mounted to the same appbox.
*
* The unique id of a collection from an application point of view could be the concatenation of
* the "databox_id" and "the collection_id" but when a databox is mounted on an appbox.
* A unique id is created foreach collection referenced in the mounted databox.
* This unique id id is called "base_id"
*
*/
interface RecordInterface interface RecordInterface
{ {
/**
* The record id is the concatenation of the databox_id where the record belongs
* And its record_id separated by an underscore.
*
* Eg: "1_256" for a record with an id of 256 in databox 1
*
* @return string
*/
public function getId(); public function getId();
/** /**
* @return mixed * The unique id of the collection where belong the record.
*
* @return integer
*/ */
public function getBaseId(); public function getBaseId();
/** /** @param integer $baseId */
* @param mixed $baseId
*/
public function setBaseId($baseId); public function setBaseId($baseId);
/** /**
* @return mixed * The id of the collection where belong the record.
*
* @return integer
*/ */
public function getCollectionId(); public function getCollectionId();
/** /** @param integer $collectionId */
* @param mixed $collectionId
*/
public function setCollectionId($collectionId); public function setCollectionId($collectionId);
/** /** @return \DateTime */
* @return mixed
*/
public function getCreated(); public function getCreated();
/** /** @param \DateTime $created */
* @param mixed $created public function setCreated(\DateTime $created);
*/
public function setCreated($created);
/** /**
* @return mixed * The id of the databox where belong the record.
*
* @return integer
*/ */
public function getDataboxId(); public function getDataboxId();
/** /** @param integer $databoxId */
* @param mixed $databoxId
*/
public function setDataboxId($databoxId); public function setDataboxId($databoxId);
/** /** @return boolean */
* @return mixed
*/
public function isStory(); public function isStory();
/** /** @param boolean $isStory */
* @param mixed $isStory
*/
public function setIsStory($isStory); public function setIsStory($isStory);
/** /** @return string */
* @return mixed
*/
public function getMimeType(); public function getMimeType();
/** /** @param string $mimeType */
* @param mixed $mimeType
*/
public function setMimeType($mimeType); public function setMimeType($mimeType);
/** /** @return string */
* @return mixed
*/
public function getOriginalName(); public function getOriginalName();
/** /** @param string $originalName */
* @param mixed $originalName
*/
public function setOriginalName($originalName); public function setOriginalName($originalName);
/** /**
* @return mixed * The record id of the record.
*
* @return integer
*/ */
public function getRecordId(); public function getRecordId();
/** /** @param integer $recordId */
* @param mixed $recordId
*/
public function setRecordId($recordId); public function setRecordId($recordId);
/** /** @return string */
* @return mixed
*/
public function getSha256(); public function getSha256();
/** /** @param string $sha256 */
* @param mixed $sha256
*/
public function setSha256($sha256); public function setSha256($sha256);
/** /** @return string */
* @return mixed
*/
public function getType(); public function getType();
/** /** @param string $type */
* @param mixed $type
*/
public function setType($type); public function setType($type);
/** /** @return \DateTime */
* @return mixed
*/
public function getUpdated(); public function getUpdated();
/** /** @param \DateTime $updated */
* @param mixed $updated public function setUpdated(\DateTime $updated);
*/
public function setUpdated($updated);
/** /** @return string */
* @return mixed
*/
public function getUuid(); public function getUuid();
/** /** @param string $uuid */
* @param mixed $uuid
*/
public function setUuid($uuid); public function setUuid($uuid);
/** /** @param string $status */
* @param $status
*/
public function setStatus($status); public function setStatus($status);
/** /** @return string */
* @return mixed
*/
public function getStatus(); public function getStatus();
} }

View File

@@ -16,9 +16,11 @@ use Doctrine\Common\Collections\ArrayCollection;
class ESRecordHydrator class ESRecordHydrator
{ {
public static function hydrate(array $data) public static function hydrate(array $data, $position)
{ {
$record = new RecordES(); $record = new RecordES();
$record->setPosition($position);
$record->setBaseId(isset($data['base_id']) ? $data['base_id'] : null); $record->setBaseId(isset($data['base_id']) ? $data['base_id'] : null);
$record->setCollectionId(isset($data['collection_id']) ? $data['collection_id'] : null); $record->setCollectionId(isset($data['collection_id']) ? $data['collection_id'] : null);
$record->setCreated(isset($data['created_on']) ? new \DateTime($data['created_on']) : null); $record->setCreated(isset($data['created_on']) ? new \DateTime($data['created_on']) : null);
@@ -32,7 +34,7 @@ class ESRecordHydrator
$record->setUpdated(isset($data['updated_on']) ? new \DateTime($data['updated_on']) : null); $record->setUpdated(isset($data['updated_on']) ? new \DateTime($data['updated_on']) : null);
$record->setUuid(isset($data['uuid']) ? $data['uuid'] : null); $record->setUuid(isset($data['uuid']) ? $data['uuid'] : null);
$record->setStatus(isset($data['bin_status']) ? $data['bin_status'] : null); $record->setStatus(isset($data['bin_status']) ? $data['bin_status'] : null);
$record->setTitles(new ArrayCollection(isset($data['title']) ? (array) $data['title'] : ['default' => $record->getOriginalName()])); $record->setTitles(new ArrayCollection(isset($data['title']) ? (array) $data['title'] : []));
$record->setCaption(new ArrayCollection(isset($data['caption']) ? (array) $data['caption'] : [])); $record->setCaption(new ArrayCollection(isset($data['caption']) ? (array) $data['caption'] : []));
$record->setExif(new ArrayCollection(isset($data['exif']) ? (array) $data['exif'] : [])); $record->setExif(new ArrayCollection(isset($data['exif']) ? (array) $data['exif'] : []));
$record->setSubdefs(new ArrayCollection(isset($data['subdefs']) ? (array) $data['subdefs'] : [])); $record->setSubdefs(new ArrayCollection(isset($data['subdefs']) ? (array) $data['subdefs'] : []));

View File

@@ -370,8 +370,9 @@ class ElasticSearchEngine implements SearchEngineInterface
$results = new ArrayCollection(); $results = new ArrayCollection();
$suggestions = new ArrayCollection(); $suggestions = new ArrayCollection();
$n = 0;
foreach ($res['hits']['hits'] as $hit) { foreach ($res['hits']['hits'] as $hit) {
$results[] = ESRecordHydrator::hydrate($hit['_source']); $results[] = ESRecordHydrator::hydrate($hit['_source'], $n++);
} }
$query['_ast'] = $searchQuery->dump(); $query['_ast'] = $searchQuery->dump();

View File

@@ -158,12 +158,14 @@ class RecordIndexer
->addRawVersion() ->addRawVersion()
; ;
// Index title
$titleMapping = new Mapping(); $titleMapping = new Mapping();
$titleMapping->add('default', 'string')->notAnalyzed()->notIndexed(); $titleMapping->add('default', 'string')->notAnalyzed()->notIndexed();
foreach ($this->locales as $locale) { foreach ($this->locales as $locale) {
$titleMapping->add($locale, 'string')->notAnalyzed()->notIndexed(); $titleMapping->add($locale, 'string')->notAnalyzed()->notIndexed();
} }
$mapping->add('title', $titleMapping); $mapping->add('title', $titleMapping);
// Minimal subdefs mapping info for display purpose // Minimal subdefs mapping info for display purpose
$subdefMapping = new Mapping(); $subdefMapping = new Mapping();
$subdefMapping->add('path', 'string')->notAnalyzed()->notIndexed(); $subdefMapping->add('path', 'string')->notAnalyzed()->notIndexed();

View File

@@ -1842,153 +1842,115 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
return $this; return $this;
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getBaseId() public function getBaseId()
{ {
return $this->get_base_id(); return $this->get_base_id();
} }
/** /** {@inheritdoc} */
* @param mixed $baseId
*/
public function setBaseId($baseId) public function setBaseId($baseId)
{ {
$this->base_id = $baseId; throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getCollectionId() public function getCollectionId()
{ {
return $this->get_collection()->get_coll_id(); return $this->get_collection()->get_coll_id();
} }
/** /** {@inheritdoc} */
* @param mixed $collectionId
*/
public function setCollectionId($collectionId) public function setCollectionId($collectionId)
{ {
// TODO: Implement setCollectionId() method. throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getCreated() public function getCreated()
{ {
return $this->get_creation_date(); return $this->get_creation_date();
} }
/** /** {@inheritdoc} */
* @param mixed $created public function setCreated(\DateTime $created)
*/
public function setCreated($created)
{ {
$this->creation_date = $created; throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getDataboxId() public function getDataboxId()
{ {
$this->get_databox()->get_sbas_id(); $this->get_databox()->get_sbas_id();
} }
/** /** {@inheritdoc} */
* @param mixed $databoxId
*/
public function setDataboxId($databoxId) public function setDataboxId($databoxId)
{ {
// TODO: Implement setDataboxId() method. throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function isStory() public function isStory()
{ {
return $this->is_grouping(); return $this->is_grouping();
} }
/** /** {@inheritdoc} */
* @param mixed $isStory
*/
public function setIsStory($isStory) public function setIsStory($isStory)
{ {
$this->grouping = (Boolean) $isStory; throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getMimeType() public function getMimeType()
{ {
return $this->get_mime(); return $this->get_mime();
} }
/** /** {@inheritdoc} */
* @param mixed $mimeType
*/
public function setMimeType($mimeType) public function setMimeType($mimeType)
{ {
// TODO: Implement setMimeType() method. throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getOriginalName() public function getOriginalName()
{ {
return $this->get_original_name(); return $this->get_original_name();
} }
/** /** {@inheritdoc} */
* @param mixed $originalName
*/
public function setOriginalName($originalName) public function setOriginalName($originalName)
{ {
// TODO: Implement setOriginalName() method. $this->set_original_name($originalName);
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getRecordId() public function getRecordId()
{ {
return $this->get_record_id(); return $this->get_record_id();
} }
/** /** {@inheritdoc} */
* @param mixed $recordId
*/
public function setRecordId($recordId) public function setRecordId($recordId)
{ {
// TODO: Implement setRecordId() method. throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getSha256() public function getSha256()
{ {
return $this->get_sha256(); return $this->get_sha256();
} }
/** /** {@inheritdoc} */
* @param mixed $sha256
*/
public function setSha256($sha256) public function setSha256($sha256)
{ {
// TODO: Implement setSha256() method. throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getType() public function getType()
{ {
return $this->get_type(); return $this->get_type();
@@ -1999,108 +1961,46 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
*/ */
public function setType($type) public function setType($type)
{ {
// TODO: Implement setType() method. throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getUpdated() public function getUpdated()
{ {
return $this->get_modification_date(); return $this->get_modification_date();
} }
/** /** {@inheritdoc} */
* @param mixed $updated public function setUpdated(\DateTime $updated)
*/
public function setUpdated($updated)
{ {
// TODO: Implement setUpdated() method. throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getUuid() public function getUuid()
{ {
return $this->get_uuid(); return $this->get_uuid();
} }
/** /** {@inheritdoc} */
* @param mixed $uuid
*/
public function setUuid($uuid) public function setUuid($uuid)
{ {
// TODO: Implement setUuid() method. throw new \BadMethodCallException(sprintf('Method %s::%s is not implemented', __CLASS__, __METHOD__));
}
/**
* @return mixed
*/
public function getExif()
{
return new ArrayCollection($this->get_technical_infos());
}
/**
* @param mixed $exif
*/
public function setExif(\Doctrine\Common\Collections\ArrayCollection $exif)
{
// TODO: Implement setExif() method.
}
/**
* @return mixed
*/
public function getCaption()
{
$caption = array();
foreach ($this->get_caption()->get_fields() as $field) {
$fieldValues = $field->get_values();
if (0 === count($fieldValues)) {
continue;
}
if ($field->is_multi()) {
$caption[$field->get_name()] = array_map(function($fieldValue) {
return $fieldValue->getValue();
}, $fieldValues);
continue;
}
$caption[$field->get_name()] = current($fieldValues)->getValue();
}
return new ArrayCollection($caption);
}
/**
* @param mixed $caption
*/
public function setCaption(\Doctrine\Common\Collections\ArrayCollection $caption)
{
// TODO: Implement setCaption() method.
} }
/** {@inheritdoc} */
public function getId() public function getId()
{ {
return $this->get_serialize_key(); return $this->get_serialize_key();
} }
/** /** {@inheritdoc} */
* @param $status
*/
public function setStatus($status) public function setStatus($status)
{ {
$this->set_binary_status($status); $this->set_binary_status($status);
} }
/** /** {@inheritdoc} */
* @return mixed
*/
public function getStatus() public function getStatus()
{ {
return $this->get_status(); return $this->get_status();

View File

@@ -0,0 +1,3 @@
*
!.gitignore
!insecure_private_key

View File

@@ -109,7 +109,7 @@
<b>{{ name }}</b> : {{ value is iterable ? value|join('; ') : value }} <b>{{ name }}</b> : {{ value is iterable ? value|join('; ') : value }}
</div> </div>
{% endfor %} {% endfor %}
{% if technical_data|default(true) and app['authentication'].getUser() is not none and app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') == 'group' %} {% if technical_data|default(true) and app['authentication'].user is not none and app['settings'].getUserSetting(app['authentication'].user, 'technical_display') == 'group' %}
<hr/> <hr/>
{% include 'common/technical_datas.html.twig' %} {% include 'common/technical_datas.html.twig' %}
{% endif %} {% endif %}

View File

@@ -1,16 +1,16 @@
{% if record.isStory() %} {% if record.isStory %}
{{ 'Story_id' | trans }} : {{ record.recordId() }}<br/> {{ 'Story_id' | trans }} : {{ record.recordId }}<br/>
{% else %} {% else %}
{{ 'Record_id' | trans }} : {{ record.recordId() }}<br/> {{ 'Record_id' | trans }} : {{ record.recordId }}<br/>
{% endif %} {% endif %}
{% if not record.isStory() %} {% if not record.isStory %}
{% block td_original_name %} {% block td_original_name %}
{{ 'Nom Original' | trans }} : {{ record.getOriginalName() }} {{ 'Nom Original' | trans }} : {{ record.getOriginalName }}
{% endblock %} {% endblock %}
{% block td_mime %} {% block td_mime %}
{{ record.getMimeType() }} {{ record.getMimeType }}
{% endblock %} {% endblock %}
{% block td_weight %} {% block td_weight %}

View File

@@ -2,16 +2,13 @@
{% import 'common/thumbnail.html.twig' as thumbnail_macro %} {% import 'common/thumbnail.html.twig' as thumbnail_macro %}
{% import 'common/doctype_icons.html.twig' as doctype_icons %} {% import 'common/doctype_icons.html.twig' as doctype_icons %}
{% import 'common/drop_down_options.html.twig' as drop_down %} {% import 'common/drop_down_options.html.twig' as drop_down %}
{% set th_size = app['settings'].getUserSetting(app['authentication'].getUser(), 'images_size')%} {% set th_size = app['settings'].getUserSetting(app['authentication'].user, 'images_size')%}
{# @todo retrieve current position of record in result set #}
{% set number = 1 %}
{% if entry_id %} {% if entry_id %}
<div style="width:{{th_size+30}}px;" sbas="{{record.databoxId}}" <div style="width:{{th_size+30}}px;" sbas="{{record.databoxId}}"
id="{{ prefix|default('IMGT') }}_{{record.databoxId}}_{{record.recordId}}" id="{{ prefix|default('IMGT') }}_{{record.databoxId}}_{{record.recordId}}"
class="IMGT diapo type-{{record.type}}" class="IMGT diapo type-{{record.type}}"
onDblClick="openPreview('FEED',{{number}},{{entry_id}});"> onDblClick="openPreview('FEED',{{record.position}},{{entry_id}});">
{% elseif record.story %} {% elseif record.story %}
<div style="width:{{th_size+30}}px;" sbas="{{record.databoxId}}" <div style="width:{{th_size+30}}px;" sbas="{{record.databoxId}}"
id="{{ prefix|default('IMGT') }}_{{record.databoxId}}_{{record.recordId}}" id="{{ prefix|default('IMGT') }}_{{record.databoxId}}_{{record.recordId}}"
@@ -21,12 +18,13 @@
<div style="width:{{th_size+30}}px;" sbas="{{record.databoxId}}" <div style="width:{{th_size+30}}px;" sbas="{{record.databoxId}}"
id="{{ prefix|default('IMGT') }}_{{record.databoxId}}_{{record.recordId}}" id="{{ prefix|default('IMGT') }}_{{record.databoxId}}_{{record.recordId}}"
class="IMGT diapo type-{{record.type}}" class="IMGT diapo type-{{record.type}}"
onDblClick="openPreview('RESULT',{{ number }});"> onDblClick="openPreview('RESULT',{{record.position}});">
{% endif %} {% endif %}
<div style="padding: 4px;"> <div style="padding: 4px;">
<div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;"> <div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;">
<div class="title" style="max-height:100%" title="{{ record.title|default(record.originalName) }}"> {# @todo title should be localized #}
{{ record.title|default(record.originalName) }} <div class="title" style="max-height:100%" title="{{ record.title }}">
{{ record.title }}
</div> </div>
<div class="status"> <div class="status">
{# @todo find a proper way to map lifted flag to status icon img path #} {# @todo find a proper way to map lifted flag to status icon img path #}
@@ -37,23 +35,23 @@
{% set preview = record.subdefs.containsKey('preview') ? record.subdefs.get('preview') : null %} {% set preview = record.subdefs.containsKey('preview') ? record.subdefs.get('preview') : null %}
{% set rollover_thumbnail = record.subdefs.containsKey('thumbnailgif') ? record.subdefs.get('thumbnailgif') : null %} {% set rollover_thumbnail = record.subdefs.containsKey('thumbnailgif') ? record.subdefs.get('thumbnailgif') : null %}
{% set user_technical_display = app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') %} {% set user_technical_display = app['settings'].getUserSetting(app['authentication'].user, 'technical_display') %}
{% set user_rollover_thumbnail = app['settings'].getUserSetting(app['authentication'].getUser(), 'rollover_thumbnail') %} {% set user_rollover_thumbnail = app['settings'].getUserSetting(app['authentication'].user, 'rollover_thumbnail') %}
{% set extraclass = '' %} {% set extraclass = '' %}
{% if user_rollover_thumbnail == 'caption' and searchEngine is not null %} {% if user_rollover_thumbnail == 'caption' and searchEngine is not null %}
{% set extraclass = extraclass ~ ' captionTips' %} {% set extraclass = extraclass ~ ' captionTips' %}
{% set tooltipsrc = path('prod_tooltip_caption', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId, 'context' : 'answer', 'number' : number }) %} {% set tooltip = path('prod_tooltip_caption', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId, 'context' : 'answer', 'number' : record.position }) %}
{% elseif user_rollover_thumbnail == 'caption' and searchEngine is null %} {% elseif user_rollover_thumbnail == 'caption' and searchEngine is null %}
{% set extraclass = extraclass ~ ' captionTips' %} {% set extraclass = extraclass ~ ' captionTips' %}
{% set tooltipsrc = path('prod_tooltip_caption', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId, 'context' : 'publi' }) %} {% set tooltip = path('prod_tooltip_caption', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId, 'context' : 'publi' }) %}
{% elseif user_rollover_thumbnail == 'preview' %} {% elseif user_rollover_thumbnail == 'preview' %}
{% set extraclass = extraclass ~ ' captionTips' %} {% set extraclass = extraclass ~ ' captionTips' %}
{% set tooltipsrc = path('prod_tooltip_preview', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) %} {% set tooltip = path('prod_tooltip_preview', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) %}
{% endif %} {% endif %}
<div class="thumb {{extraclass}} " tooltipsrc="{{tooltipsrc}}" style="height:{{th_size}}px; z-index:90;"> <div class="thumb {{extraclass}} " tooltipsrc="{{tooltip}}" style="height:{{th_size}}px; z-index:90;">
<div class="doc_infos"> <div class="doc_infos">
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'doctype_display') == '1' %} {% if app['settings'].getUserSetting(app['authentication'].user, 'doctype_display') == '1' %}
{{doctype_icons.format(record)}} {{doctype_icons.format(record)}}
{% endif %} {% endif %}
<span class="duration"> <span class="duration">
@@ -93,12 +91,11 @@
{% endif %} {% endif %}
<td style='text-align:right;width:{{l_width}}px;' valign='bottom'> <td style='text-align:right;width:{{l_width}}px;' valign='bottom'>
{{drop_down.prod(record, entry_id)}} {{drop_down.prod(record, entry_id)}}
{# @todo acl methods should accept RecordInterface Object as parameter #} {% if if preview and app['acl'].get(app['authentication'].user).has_access_to_subdef(record, 'preview') %}
{#{% if preview and app['acl'].get(app['authentication'].getUser()).has_access_to_subdef(record, 'preview') %}#} <div tooltipsrc="{{ path('prod_tooltip_preview', { 'databoxId' : record.databoxId, 'recordId' : record.recordId }) }}" class="previewTips"></div>
{#<div tooltipsrc="{{ path('prod_tooltip_preview', { 'databoxId' : record.databoxId, 'recordId' : record.recordId }) }}" class="previewTips"></div>#} {% enif %}
{#{% endif %}#}
{% if user_rollover_thumbnail == 'preview' %} {% if user_rollover_thumbnail == 'preview' %}
<div tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId, 'context' : 'answer', 'number' : record.get_number() }) }}" class="captionRolloverTips"></div> <div tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId, 'context' : 'answer', 'number' : record.position }) }}" class="captionRolloverTips"></div>
{% endif %} {% endif %}
{% if user_technical_display == '1' %} {% if user_technical_display == '1' %}
<img class="infoTips" tooltipsrc="{{ path('prod_tooltip_technical_data', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) }}" src="/skins/icons/info.gif"/> <img class="infoTips" tooltipsrc="{{ path('prod_tooltip_technical_data', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) }}" src="/skins/icons/info.gif"/>

View File

@@ -0,0 +1,210 @@
servername: 'http://local.phrasea/'
languages:
available: []
default: 'fr'
main:
maintenance: false
key: ''
database:
host: 'sql-host'
port: 3306
user: 'sql-user'
password: 'sql-password'
dbname: ab_phraseanet
driver: pdo_mysql
charset: UTF8
database-test:
driver: pdo_sqlite
path: '/tmp/db.sqlite'
charset: UTF8
cache:
type: MemcacheCache
options:
host: localhost
port: 11211
opcodecache:
type: ArrayCache
options: []
search-engine:
type: Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngine
options: []
task-manager:
status: started
enabled: true
logger:
max-files: 10
enabled: true
level: INFO
listener:
protocol: tcp
host: 127.0.0.1
port: 6660
linger: 500
websocket-server:
host: local.phrasea
port: 9090
ip: 0.0.0.0
subscriber:
protocol: tcp
host: 127.0.0.1
port: 13598
session:
type: 'file'
options: []
ttl: 86400
binaries:
ghostscript_binary: null
php_binary: null
swf_extract_binary: null
pdf2swf_binary: null
swf_render_binary: null
unoconv_binary: null
ffmpeg_binary: null
ffprobe_binary: null
mp4box_binary: null
pdftotext_binary: null
recess_binary: null
phraseanet_indexer: null
ffmpeg_timeout: 3600
ffprobe_timeout: 60
gs_timeout: 60
mp4box_timeout: 60
swftools_timeout: 60
unoconv_timeout: 60
storage:
subdefs: null
cache: null
log : null
download: null
lazaret: null
caption: null
bridge:
youtube:
enabled: false
client_id: null
client_secret: null
developer_key: null
flickr:
enabled: false
client_id: null
client_secret: null
dailymotion:
enabled: false
client_id: null
client_secret: null
trusted-proxies: []
debugger:
allowed-ips: []
border-manager:
enabled: true
extension-mapping: { }
checkers:
-
type: Checker\Sha256
enabled: true
-
type: Checker\UUID
enabled: true
-
type: Checker\Colorspace
enabled: false
options:
colorspaces: [cmyk, grayscale, rgb]
-
type: Checker\Dimension
enabled: false
options:
width: 80
height: 160
-
type: Checker\Extension
enabled: false
options:
extensions: [jpg, jpeg, bmp, tif, gif, png, pdf, doc, odt, mpg, mpeg, mov, avi, xls, flv, mp3, mp2]
-
type: Checker\Filename
enabled: false
options:
sensitive: true
-
type: Checker\MediaType
enabled: false
options:
mediatypes: [Audio, Document, Flash, Image, Video]
authentication:
auto-create:
templates: { }
captcha:
enabled: true
trials-before-display: 9
providers:
facebook:
enabled: false
options:
app-id: ''
secret: ''
twitter:
enabled: false
options:
consumer-key: ''
consumer-secret: ''
google-plus:
enabled: false
options:
client-id: ''
client-secret: ''
github:
enabled: false
options:
client-id: ''
client-secret: ''
viadeo:
enabled: false
options:
client-id: ''
client-secret: ''
linkedin:
enabled: false
options:
client-id: ''
client-secret: ''
registration-fields:
-
name: company
required: true
-
name: lastname
required: true
-
name: firstname
required: true
-
name: geonameid
required: true
xsendfile:
enabled: false
type: nginx
mapping: []
h264-pseudo-streaming:
enabled: false
type: nginx
mapping: []
plugins: []
api_cors:
enabled: false
allow_credentials: false
allow_origin: []
allow_headers: []
allow_methods: []
expose_headers: []
max_age: 0
hosts: []
session:
idle: 0
# 1 week
lifetime: 604800
crossdomain:
allow-access-from:
-
domain: '*.cooliris.com'
secure: 'false'