mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Merge pull request #6 from nlegoff/hydrate-records
This commit is contained in:
@@ -128,6 +128,7 @@ use Alchemy\Phrasea\Twig\JSUniqueID;
|
||||
use Alchemy\Phrasea\Twig\Fit;
|
||||
use Alchemy\Phrasea\Twig\Camelize;
|
||||
use Alchemy\Phrasea\Twig\BytesConverter;
|
||||
use Alchemy\Phrasea\Twig\PhraseanetExtension;
|
||||
use Alchemy\Phrasea\Utilities\CachedTranslator;
|
||||
use FFMpeg\FFMpegServiceProvider;
|
||||
use Monolog\Logger;
|
||||
@@ -645,6 +646,7 @@ class Application extends SilexApplication
|
||||
$twig->addExtension(new Fit());
|
||||
$twig->addExtension(new Camelize());
|
||||
$twig->addExtension(new BytesConverter());
|
||||
$twig->addExtension(new PhraseanetExtension($app));
|
||||
|
||||
$twig->addFilter('serialize', new \Twig_Filter_Function('serialize'));
|
||||
$twig->addFilter('stristr', new \Twig_Filter_Function('stristr'));
|
||||
|
@@ -207,7 +207,7 @@ class Feed implements ControllerProviderInterface
|
||||
|
||||
$feeds = $app['repo.feeds']->getAllForUser($app['acl']->get($app['authentication']->getUser()));
|
||||
|
||||
$datas = $app['twig']->render('prod/feeds/feeds.html.twig', [
|
||||
$datas = $app['twig']->render('prod/results/feeds.html.twig', [
|
||||
'feeds' => $feeds,
|
||||
'feed' => new Aggregate($app['EM'], $feeds),
|
||||
'page' => $page
|
||||
|
@@ -52,8 +52,6 @@ class Query implements ControllerProviderInterface
|
||||
{
|
||||
$query = (string) $request->request->get('qry');
|
||||
|
||||
$mod = $app['settings']->getUserSetting($app['authentication']->getUser(), 'view');
|
||||
|
||||
$json = [];
|
||||
|
||||
$options = SearchEngineOptions::fromRequest($app, $request);
|
||||
@@ -176,21 +174,10 @@ class Query implements ControllerProviderInterface
|
||||
if ($result->getTotal() === 0) {
|
||||
$template = 'prod/results/help.html.twig';
|
||||
} else {
|
||||
if ($mod == 'thumbs') {
|
||||
$template = 'prod/results/answergrid.html.twig';
|
||||
} else {
|
||||
$template = 'prod/results/answerlist.html.twig';
|
||||
}
|
||||
$template = 'prod/results/records.html.twig';
|
||||
}
|
||||
|
||||
$json['results'] = $app['twig']->render($template, [
|
||||
'results' => $result,
|
||||
'highlight' => $result->getQuery(),
|
||||
'searchEngine' => $app['phraseanet.SE'],
|
||||
'searchOptions' => $options,
|
||||
'suggestions' => $prop
|
||||
]
|
||||
);
|
||||
$json['results'] = $app['twig']->render($template, ['results'=> $result]);
|
||||
|
||||
$json['query'] = $query;
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
namespace Alchemy\Phrasea\Media;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\ElasticSearchEngine;
|
||||
use MediaAlchemyst\Alchemyst;
|
||||
use MediaAlchemyst\Specification\SpecificationInterface;
|
||||
use MediaVorus\MediaVorus;
|
||||
@@ -72,6 +73,10 @@ class SubdefGenerator
|
||||
}
|
||||
|
||||
$record->clearSubdefCache($subdefname);
|
||||
|
||||
if ($this->app['phraseanet.SE'] instanceof ElasticSearchEngine && in_array($subdefname, ['thumbnail', 'thumbnailgif', 'preview'])) {
|
||||
$this->app['phraseanet.SE']->updateRecord($record);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
288
lib/Alchemy/Phrasea/Model/Entities/ElasticsearchRecord.php
Normal file
288
lib/Alchemy/Phrasea/Model/Entities/ElasticsearchRecord.php
Normal file
@@ -0,0 +1,288 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Model\Entities;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Alchemy\Phrasea\Model\RecordInterface;
|
||||
use Alchemy\Phrasea\Model\MutableRecordInterface;
|
||||
|
||||
/**
|
||||
* Record entity from elastic search
|
||||
*/
|
||||
class ElasticsearchRecord implements RecordInterface, MutableRecordInterface
|
||||
{
|
||||
private $databoxId;
|
||||
private $recordId;
|
||||
private $collectionId;
|
||||
private $baseId;
|
||||
private $mimeType;
|
||||
private $title;
|
||||
private $originalName;
|
||||
private $updated;
|
||||
private $created;
|
||||
private $sha256;
|
||||
private $uuid;
|
||||
private $position;
|
||||
private $type;
|
||||
private $status;
|
||||
private $isStory;
|
||||
/** @var ArrayCollection */
|
||||
private $caption;
|
||||
/** @var ArrayCollection */
|
||||
private $exif;
|
||||
/** @var ArrayCollection */
|
||||
private $subdefs;
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getId()
|
||||
{
|
||||
return sprintf('%s_%s', $this->getDataboxId(), $this->getRecordId());
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getBaseId()
|
||||
{
|
||||
return $this->baseId;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function setBaseId($baseId)
|
||||
{
|
||||
$this->baseId = $baseId;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getCollectionId()
|
||||
{
|
||||
return $this->collectionId;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function setCollectionId($collectionId)
|
||||
{
|
||||
$this->collectionId = $collectionId;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getCreated()
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function setCreated(\DateTime $created = null)
|
||||
{
|
||||
$this->created = $created;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getDataboxId()
|
||||
{
|
||||
return $this->databoxId;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function setDataboxId($databoxId)
|
||||
{
|
||||
$this->databoxId = $databoxId;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function isStory()
|
||||
{
|
||||
return $this->isStory;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function setIsStory($isStory)
|
||||
{
|
||||
$this->isStory = (bool) $isStory;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getMimeType()
|
||||
{
|
||||
return $this->mimeType;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function setMimeType($mimeType)
|
||||
{
|
||||
if (null === $mimeType || '' === $mimeType) {
|
||||
$mimeType = 'application/octet-stream';
|
||||
}
|
||||
$this->mimeType = $mimeType;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getOriginalName()
|
||||
{
|
||||
return $this->originalName;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function setOriginalName($originalName)
|
||||
{
|
||||
$this->originalName = $originalName;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getRecordId()
|
||||
{
|
||||
return $this->recordId;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function setRecordId($recordId)
|
||||
{
|
||||
$this->recordId = $recordId;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getSha256()
|
||||
{
|
||||
return $this->sha256;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function setSha256($sha256)
|
||||
{
|
||||
$this->sha256 = $sha256;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $locale
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle($locale = null)
|
||||
{
|
||||
if ($locale && $this->title->containsKey($locale)) {
|
||||
return $this->title->get($locale);
|
||||
}
|
||||
|
||||
if ($this->title->containsKey('default')) {
|
||||
return $this->title->get('default');
|
||||
}
|
||||
|
||||
return $this->getOriginalName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of titles
|
||||
*
|
||||
* @param ArrayCollection $titles
|
||||
*/
|
||||
public function setTitles(ArrayCollection $titles)
|
||||
{
|
||||
$this->title = $titles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Available types are ['document', 'audio', 'video', 'image', 'flash', 'map', 'unknown']
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/** @return \DateTime */
|
||||
public function getUpdated()
|
||||
{
|
||||
return $this->updated;
|
||||
}
|
||||
|
||||
public function setUpdated(\DateTime $updated = null)
|
||||
{
|
||||
$this->updated = $updated;
|
||||
}
|
||||
|
||||
public function getUuid()
|
||||
{
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
public function setUuid($uuid)
|
||||
{
|
||||
$this->uuid = $uuid;
|
||||
}
|
||||
|
||||
/** @return ArrayCollection */
|
||||
public function getCaption()
|
||||
{
|
||||
return $this->caption;
|
||||
}
|
||||
|
||||
public function setCaption(ArrayCollection $caption)
|
||||
{
|
||||
$this->caption = $caption;
|
||||
}
|
||||
|
||||
/** @return ArrayCollection */
|
||||
public function getExif()
|
||||
{
|
||||
return $this->exif;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $exif
|
||||
*/
|
||||
public function setExif(ArrayCollection $exif)
|
||||
{
|
||||
$this->exif = $exif;
|
||||
}
|
||||
|
||||
/** @return ArrayCollection */
|
||||
public function getSubdefs()
|
||||
{
|
||||
return $this->subdefs;
|
||||
}
|
||||
|
||||
/** @return ArrayCollection */
|
||||
public function setSubdefs(ArrayCollection $subdefs)
|
||||
{
|
||||
$this->subdefs = $subdefs;
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status of current current as 32 bits binary string
|
||||
*
|
||||
* Eg: 00000000001011100000000000011111
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@@ -216,7 +216,7 @@ class FeedItem
|
||||
*/
|
||||
public function setLastInFeedItem()
|
||||
{
|
||||
$this->setOrd($this->getEntry()->getItems()->count() + 1);
|
||||
$this->setOrd($this->getEntry()->getItems()->count());
|
||||
}
|
||||
|
||||
/**
|
||||
|
45
lib/Alchemy/Phrasea/Model/MutableRecordInterface.php
Normal file
45
lib/Alchemy/Phrasea/Model/MutableRecordInterface.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Model;
|
||||
|
||||
interface MutableRecordInterface
|
||||
{
|
||||
/** @param integer $baseId */
|
||||
public function setBaseId($baseId);
|
||||
|
||||
/** @param string $sha256 */
|
||||
public function setSha256($sha256);
|
||||
|
||||
/** @param integer $recordId */
|
||||
public function setRecordId($recordId);
|
||||
|
||||
/** @param string $originalName */
|
||||
public function setOriginalName($originalName);
|
||||
|
||||
/** @param string $mimeType */
|
||||
public function setMimeType($mimeType);
|
||||
|
||||
/** @param boolean $isStory */
|
||||
public function setIsStory($isStory);
|
||||
|
||||
/** @param \DateTime $created */
|
||||
public function setCreated(\DateTime $created = null);
|
||||
|
||||
/** @param integer $databoxId */
|
||||
public function setDataboxId($databoxId);
|
||||
|
||||
/** @param integer $collectionId */
|
||||
public function setCollectionId($collectionId);
|
||||
|
||||
/** @param string $uuid */
|
||||
public function setUuid($uuid);
|
||||
|
||||
/** @param string $status */
|
||||
public function setStatus($status);
|
||||
|
||||
/** @param \DateTime $updated */
|
||||
public function setUpdated(\DateTime $updated = null);
|
||||
|
||||
/** @param string $type */
|
||||
public function setType($type);
|
||||
}
|
63
lib/Alchemy/Phrasea/Model/RecordInterface.php
Normal file
63
lib/Alchemy/Phrasea/Model/RecordInterface.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Model;
|
||||
|
||||
interface RecordInterface
|
||||
{
|
||||
/** @return string */
|
||||
public function getId();
|
||||
|
||||
/**
|
||||
* The unique id of the collection where belong the record.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getBaseId();
|
||||
|
||||
/**
|
||||
* The id of the collection where belong the record.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getCollectionId();
|
||||
|
||||
/** @return \DateTime */
|
||||
public function getCreated();
|
||||
|
||||
/**
|
||||
* The id of the databox where belong the record.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getDataboxId();
|
||||
|
||||
/** @return boolean */
|
||||
public function isStory();
|
||||
|
||||
/** @return string */
|
||||
public function getMimeType();
|
||||
|
||||
/** @return string */
|
||||
public function getOriginalName();
|
||||
|
||||
/** @return integer */
|
||||
public function getRecordId();
|
||||
|
||||
/** @return string */
|
||||
public function getSha256();
|
||||
|
||||
/** @return string */
|
||||
public function getType();
|
||||
|
||||
/** @return \DateTime */
|
||||
public function getUpdated();
|
||||
|
||||
/** @return string */
|
||||
public function getUuid();
|
||||
|
||||
/** @return string */
|
||||
public function getStatus();
|
||||
|
||||
/** @return ArrayCollection */
|
||||
public function getExif();
|
||||
}
|
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Alchemy\Phrasea\SearchEngine\Elastic;
|
||||
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchRecordHydrator;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\RecordIndexer;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\TermIndexer;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\Search\SearchQuery;
|
||||
@@ -368,13 +369,10 @@ class ElasticSearchEngine implements SearchEngineInterface
|
||||
|
||||
$results = new ArrayCollection();
|
||||
$suggestions = new ArrayCollection();
|
||||
|
||||
$n = 0;
|
||||
|
||||
foreach ($res['hits']['hits'] as $hit) {
|
||||
$databoxId = is_array($hit['fields']['databox_id']) ? array_pop($hit['fields']['databox_id']) : $hit['fields']['databox_id'];
|
||||
|
||||
$recordId = is_array($hit['fields']['record_id']) ? array_pop($hit['fields']['record_id']) : $hit['fields']['record_id'];
|
||||
$results[] = new \record_adapter($this->app, $databoxId, $recordId, $n++);
|
||||
$results[] = ElasticsearchRecordHydrator::hydrate($hit['_source'], $n++);
|
||||
}
|
||||
|
||||
$query['_ast'] = $searchQuery->dump();
|
||||
@@ -446,7 +444,6 @@ class ElasticSearchEngine implements SearchEngineInterface
|
||||
'index' => $this->indexName,
|
||||
'type' => RecordIndexer::TYPE_NAME,
|
||||
'body' => [
|
||||
'fields' => ['databox_id', 'record_id'],
|
||||
'sort' => $this->createSortQueryParams($options),
|
||||
]
|
||||
];
|
||||
|
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\SearchEngine\Elastic;
|
||||
|
||||
use Alchemy\Phrasea\Model\Entities\ElasticsearchRecord;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use igorw;
|
||||
|
||||
class ElasticsearchRecordHydrator
|
||||
{
|
||||
public static function hydrate(array $data, $position)
|
||||
{
|
||||
$record = new ElasticsearchRecord();
|
||||
|
||||
$record->setPosition($position);
|
||||
$record->setBaseId(igorw\get_in($data, ['base_id'], 0));
|
||||
$record->setCollectionId(igorw\get_in($data, ['collection_id'], 0));
|
||||
$createdOn = igorw\get_in($data, ['created_on']);
|
||||
$record->setCreated($createdOn ? new \DateTime($createdOn) : $createdOn);
|
||||
$record->setDataboxId(igorw\get_in($data, ['databox_id'], 0));
|
||||
$record->setIsStory(igorw\get_in($data, ['type']) === 'story');
|
||||
$record->setMimeType(igorw\get_in($data, ['mime'], 'application/octet-stream'));
|
||||
$record->setOriginalName(igorw\get_in($data, ['original_name'], ''));
|
||||
$record->setRecordId(igorw\get_in($data, ['record_id'], 0));
|
||||
$record->setSha256(igorw\get_in($data, ['sha256'], ''));
|
||||
$record->setType(igorw\get_in($data, ['type'], 'unknown'));
|
||||
$updatedOn = igorw\get_in($data, ['updated_on']);
|
||||
$record->setUpdated($updatedOn ? new \DateTime($updatedOn) : $updatedOn);
|
||||
$record->setUuid(igorw\get_in($data, ['uuid'], ''));
|
||||
$record->setStatus(igorw\get_in($data, ['bin_status'], str_repeat('0', 32)));
|
||||
$record->setTitles(new ArrayCollection((array) igorw\get_in($data, ['title'], [])));
|
||||
$record->setCaption(new ArrayCollection((array) igorw\get_in($data, ['caption'], [])));
|
||||
$record->setExif(new ArrayCollection((array) igorw\get_in($data, ['exif'], [])));
|
||||
$record->setSubdefs(new ArrayCollection((array) igorw\get_in($data, ['subdefs'], [])));
|
||||
|
||||
return $record;
|
||||
}
|
||||
}
|
@@ -158,6 +158,27 @@ class RecordIndexer
|
||||
->addRawVersion()
|
||||
;
|
||||
|
||||
// Index title
|
||||
$titleMapping = new Mapping();
|
||||
$titleMapping->add('default', 'string')->notAnalyzed()->notIndexed();
|
||||
foreach ($this->locales as $locale) {
|
||||
$titleMapping->add($locale, 'string')->notAnalyzed()->notIndexed();
|
||||
}
|
||||
$mapping->add('title', $titleMapping);
|
||||
|
||||
// Minimal subdefs mapping info for display purpose
|
||||
$subdefMapping = new Mapping();
|
||||
$subdefMapping->add('path', 'string')->notAnalyzed()->notIndexed();
|
||||
$subdefMapping->add('height', 'integer')->notIndexed();
|
||||
$subdefMapping->add('width', 'integer')->notIndexed();
|
||||
|
||||
$subdefsMapping = new Mapping();
|
||||
$subdefsMapping->add('thumbnail', $subdefMapping);
|
||||
$subdefsMapping->add('thumbnailgif', $subdefMapping);
|
||||
$subdefsMapping->add('preview', $subdefMapping);
|
||||
|
||||
$mapping->add('subdefs', $subdefsMapping);
|
||||
|
||||
// Caption mapping
|
||||
$captionMapping = new Mapping();
|
||||
$mapping->add('caption', $captionMapping);
|
||||
@@ -306,15 +327,13 @@ class RecordIndexer
|
||||
private function getFlagsMapping()
|
||||
{
|
||||
$mapping = new Mapping();
|
||||
$seen = array();
|
||||
|
||||
foreach ($this->appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_statusbits() as $bit => $status) {
|
||||
$key = self::normalizeFlagKey($status['labelon']);
|
||||
// We only add to mapping new statuses
|
||||
if (!in_array($key, $seen)) {
|
||||
if (!$mapping->has($key)) {
|
||||
$mapping->add($key, 'boolean');
|
||||
$seen[] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,14 +356,13 @@ class RecordIndexer
|
||||
{
|
||||
$dateFields = $this->elasticSearchEngine->getAvailableDateFields();
|
||||
$structure = $this->getFieldsStructure();
|
||||
$fullStatus = str_pad($record['bin_status'], 32, "0", STR_PAD_LEFT);
|
||||
|
||||
foreach ($this->appbox->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_statusbits() as $bit => $status) {
|
||||
$key = self::normalizeFlagKey($status['labelon']);
|
||||
$position = 31-$bit;
|
||||
|
||||
$record['flags'][$key] = isset($fullStatus{$position}) ? (bool) $fullStatus{$position} : null;
|
||||
$record['flags'][$key] = isset($record['bin_status']{$position}) ? (bool) $record['bin_status']{$position} : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -176,6 +176,11 @@ class Mapping
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function has($name)
|
||||
{
|
||||
return isset($this->fields[$name]);
|
||||
}
|
||||
|
||||
protected function ¤tField()
|
||||
{
|
||||
if (null === $this->current) {
|
||||
|
@@ -55,8 +55,9 @@ class RecordFetcher
|
||||
return false; // End
|
||||
}
|
||||
|
||||
// Fetch metadata
|
||||
$records = $this->addMetadataToRecords($records);
|
||||
$this->addTitleToRecord($records);
|
||||
$this->addMetadataToRecords($records);
|
||||
$this->addSubdefsToRecord($records);
|
||||
|
||||
// Hydrate records
|
||||
foreach ($records as $key => $record) {
|
||||
@@ -70,8 +71,12 @@ class RecordFetcher
|
||||
{
|
||||
$stmt = $this->statementRecord($record_adapter->get_record_id());
|
||||
$stmt->execute();
|
||||
$record = $stmt->fetchAll();
|
||||
$records = $this->addMetadataToRecords($record);
|
||||
|
||||
$records = $stmt->fetchAll();
|
||||
$this->addTitleToRecord($records);
|
||||
$this->addMetadataToRecords($records);
|
||||
$this->addSubdefsToRecord($records);
|
||||
|
||||
foreach ($records as $key => $record) {
|
||||
$records[$key] = $this->hydrate($record);
|
||||
}
|
||||
@@ -90,7 +95,7 @@ class RecordFetcher
|
||||
private function hydrate(array $record)
|
||||
{
|
||||
// Some casting
|
||||
$record['record_id'] = (int) $record['record_id'];
|
||||
$record['record_id'] = (int) $record['record_id'];
|
||||
$record['collection_id'] = (int) $record['collection_id'];
|
||||
// Some identifiers
|
||||
$record['id'] = $this->helper->getUniqueRecordId($this->databoxId, $record['record_id']);
|
||||
@@ -103,6 +108,10 @@ class RecordFetcher
|
||||
$record['record_type'] = SearchEngineInterface::GEM_TYPE_RECORD;
|
||||
}
|
||||
|
||||
if (false == $record['mime']) {
|
||||
$record['mime'] = 'application/octet-stream';
|
||||
}
|
||||
|
||||
unset($record['parent_record_id']);
|
||||
|
||||
return $record;
|
||||
@@ -115,7 +124,7 @@ class RecordFetcher
|
||||
SELECT r.record_id
|
||||
, r.coll_id as collection_id
|
||||
, r.uuid
|
||||
, BIN(r.status) as bin_status
|
||||
, LPAD(BIN(r.status), 32, "0") as bin_status
|
||||
, r.sha256 -- TODO rename in "hash"
|
||||
, r.originalname as original_name
|
||||
, r.mime
|
||||
@@ -143,7 +152,7 @@ SQL;
|
||||
SELECT r.record_id
|
||||
, r.coll_id as collection_id
|
||||
, r.uuid
|
||||
, BIN(r.status) as bin_status
|
||||
, LPAD(BIN(r.status), 32, "0") as bin_status
|
||||
, r.sha256 -- TODO rename in "hash"
|
||||
, r.originalname as original_name
|
||||
, r.mime
|
||||
@@ -179,7 +188,7 @@ SQL;
|
||||
return $this->connection->executeQuery($sql, array($ids, $ids), array(Connection::PARAM_INT_ARRAY, Connection::PARAM_INT_ARRAY));
|
||||
}
|
||||
|
||||
private function addMetadataToRecords($records)
|
||||
private function addMetadataToRecords(&$records)
|
||||
{
|
||||
$statementMetadata = $this->execStatementMetadata(array_keys($records));
|
||||
|
||||
@@ -200,14 +209,70 @@ SQL;
|
||||
|
||||
// Metadata can be multi-valued
|
||||
if (!isset($records[$metadata['record_id']] [$type][$key])) {
|
||||
$records[$metadata['record_id']] [$type][$key] = $value;
|
||||
$records[$metadata['record_id']][$type][$key] = $value;
|
||||
} elseif (is_array($records[$metadata['record_id']] [$type][$key])) {
|
||||
$records[$metadata['record_id']] [$type][$key][] = $value;
|
||||
$records[$metadata['record_id']][$type][$key][] = $value;
|
||||
} else {
|
||||
$records[$metadata['record_id']] [$type][$key] = array($records[$metadata['record_id']] [$type][$key], $value);
|
||||
$records[$metadata['record_id']][$type][$key] = array($records[$metadata['record_id']][$type][$key], $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function execStatementTitle($ids)
|
||||
{
|
||||
$sql = <<<SQL
|
||||
SELECT
|
||||
m.`record_id`,
|
||||
CASE ms.`thumbtitle`
|
||||
WHEN "1" THEN "default" ELSE ms.`thumbtitle`
|
||||
END AS locale,
|
||||
GROUP_CONCAT(m.value ORDER BY ms.`thumbtitle`, ms.`sorter` SEPARATOR " - ") AS title
|
||||
FROM metadatas AS m FORCE INDEX(`record_id`)
|
||||
STRAIGHT_JOIN metadatas_structure AS ms ON (ms.`id` = m.`meta_struct_id` AND ms.`thumbtitle` != "0")
|
||||
WHERE record_id IN (?)
|
||||
GROUP BY m.`record_id`, ms.`thumbtitle`
|
||||
SQL;
|
||||
|
||||
return $this->connection->executeQuery($sql, array($ids), array(Connection::PARAM_INT_ARRAY));
|
||||
}
|
||||
|
||||
private function addTitleToRecord(&$records)
|
||||
{
|
||||
$statementTitle = $this->execStatementTitle(array_keys($records));
|
||||
|
||||
while ($row = $statementTitle->fetch()) {
|
||||
$records[$row['record_id']]['title'][$row['locale']] = $row['title'];
|
||||
}
|
||||
}
|
||||
|
||||
private function addSubdefsToRecord(&$records)
|
||||
{
|
||||
$statementSubdef = $this->execStatementSubdefs(array_keys($records));
|
||||
|
||||
while ($subdefs = $statementSubdef->fetch()) {
|
||||
$records[$subdefs['record_id']]['subdefs'][$subdefs['name']] = array(
|
||||
'path' => $subdefs['path'],
|
||||
'width' => $subdefs['width'],
|
||||
'height' => $subdefs['height'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function execStatementSubdefs($ids)
|
||||
{
|
||||
$sql = <<<SQL
|
||||
SELECT
|
||||
s.record_id,
|
||||
s.name,
|
||||
s.height,
|
||||
s.width,
|
||||
CONCAT(TRIM(TRAILING '/' FROM s.path), '/', s.file) AS path
|
||||
FROM subdef s
|
||||
WHERE s.record_id IN (?)
|
||||
AND s.name IN ('thumbnail', 'preview', 'thumbnailgif')
|
||||
SQL;
|
||||
|
||||
return $this->connection->executeQuery($sql, array($ids), array(Connection::PARAM_INT_ARRAY));
|
||||
|
||||
return $records;
|
||||
}
|
||||
}
|
||||
|
188
lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php
Normal file
188
lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea\Twig;
|
||||
|
||||
use Alchemy\Phrasea\Model\Entities\ElasticsearchRecord;
|
||||
use Alchemy\Phrasea\Model\Entities\User;
|
||||
use Alchemy\Phrasea\Model\RecordInterface;
|
||||
|
||||
class PhraseanetExtension extends \Twig_Extension
|
||||
{
|
||||
private $app;
|
||||
|
||||
public function __construct(
|
||||
$app
|
||||
) {
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
{
|
||||
return array(
|
||||
);
|
||||
}
|
||||
|
||||
public function getFunctions()
|
||||
{
|
||||
return array(
|
||||
new \Twig_SimpleFunction('user_setting', array($this, 'getUserSetting')),
|
||||
new \Twig_SimpleFunction('record_thumbnail_url', array($this, 'getThumbnailUrl')),
|
||||
new \Twig_SimpleFunction('record_doctype_icon', array($this, 'getDoctypeIcon'), array(
|
||||
'is_safe' => array('html')
|
||||
)),
|
||||
new \Twig_SimpleFunction('has_access_subdef', array($this, 'hasAccessSubDefinition')),
|
||||
new \Twig_SimpleFunction('record_thumbnailgif_url', array($this, 'getThumbnailGifUrl')),
|
||||
new \Twig_SimpleFunction('granted_on_collection', array($this, 'isGrantedOnCollection')),
|
||||
new \Twig_SimpleFunction('granted_on_databox', array($this, 'isGrantedOnDatabox')),
|
||||
new \Twig_SimpleFunction('collection_logo', array($this, 'getCollectionLogo'), array(
|
||||
'is_safe' => array('html')
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
public function isGrantedOnDatabox($databoxId, $rights)
|
||||
{
|
||||
if (false === ($this->app['authentication']->getUser() instanceof User)) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$rights = (array) $rights;
|
||||
foreach ($rights as $right) {
|
||||
if (false === $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_sbas($databoxId, $right)) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isGrantedOnCollection($baseId, $rights)
|
||||
{
|
||||
if (false === ($this->app['authentication']->getUser() instanceof User)) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$rights = (array) $rights;
|
||||
foreach ($rights as $right) {
|
||||
if (false === $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($baseId, $right)) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getCollectionLogo($baseId)
|
||||
{
|
||||
if (false === $this->app['filesystem']->exists(sprintf('%s/config/minilogos/%s', $this->app['root.path'], $baseId))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'<img title="%s" src="/custom/minilogos/%s" />',
|
||||
\phrasea::bas_labels($baseId, $this->app),
|
||||
$baseId
|
||||
);
|
||||
}
|
||||
|
||||
public function hasAccessSubDefinition(RecordInterface $record, $subDefinition)
|
||||
{
|
||||
if (false === ($this->app['authentication']->getUser() instanceof User)) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->app['acl']->get($this->app['authentication']->getUser())->has_access_to_subdef($record, $subDefinition);
|
||||
}
|
||||
|
||||
public function getDoctypeIcon(RecordInterface $record)
|
||||
{
|
||||
$src = $title = '';
|
||||
if ($record->isStory()) {
|
||||
$src = '/skins/icons/icon_story.gif';
|
||||
$title = $this->app['translator']->trans('reportage');
|
||||
|
||||
return sprintf('<img src="%s" title="%s" />', $src, $title);
|
||||
}
|
||||
|
||||
switch ($record->getType()) {
|
||||
case 'image':
|
||||
$src = '/skins/icons/icon_image.gif';
|
||||
$title = $this->app['translator']->trans('image');
|
||||
break;
|
||||
case 'document':
|
||||
$src = '/skins/icons/icon_document.gif';
|
||||
$title = $this->app['translator']->trans('document');
|
||||
break;
|
||||
case 'video':
|
||||
$src = '/skins/icons/icon_video.gif';
|
||||
$title = $this->app['translator']->trans('reportage');
|
||||
break;
|
||||
case 'audio':
|
||||
$src = '/skins/icons/icon_audio.gif';
|
||||
$title = $this->app['translator']->trans('audio');
|
||||
break;
|
||||
case 'flash':
|
||||
$src = '/skins/icons/icon_flash.gif';
|
||||
$title = $this->app['translator']->trans('flash');
|
||||
break;
|
||||
}
|
||||
|
||||
return sprintf('<img src="%s" title="%s" />', $src, $title);
|
||||
}
|
||||
|
||||
public function getThumbnailUrl(RecordInterface $record)
|
||||
{
|
||||
return $this->getSubdefUrl($record, 'thumbnail');
|
||||
}
|
||||
|
||||
public function getThumbnailGifUrl(RecordInterface $record)
|
||||
{
|
||||
return $this->getSubdefUrl($record, 'thumbnailgif');
|
||||
}
|
||||
|
||||
public function getSubdefUrl(RecordInterface $record, $subdefName)
|
||||
{
|
||||
if ($record instanceof ElasticsearchRecord) {
|
||||
if ($record->getSubdefs()->containsKey($subdefName)) {
|
||||
$thumbnail = $record->getSubdefs()->get($subdefName);
|
||||
if (null !== $path = $thumbnail['path']) {
|
||||
if (is_string($path) && '' !== $path) {
|
||||
return $this->app['phraseanet.static-file']->getUrl($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($record instanceof \record_adapter) {
|
||||
if (null !== $thumbnail = $record->get_subdef($subdefName)) {
|
||||
if ('' !== $path = $thumbnail->get_pathfile()) {
|
||||
return $this->app['phraseanet.static-file']->getUrl($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$path = sprintf('/skins/icons/substitution/%s.png',
|
||||
str_replace('/', '_', $record->getMimeType())
|
||||
);
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
public function getUserSetting($setting, $default = null)
|
||||
{
|
||||
if (false === ($this->app['authentication']->getUser() instanceof User)) {
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
return $this->app['settings']->getUserSetting($this->app['authentication']->getUser(), $setting, $default);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'phraseanet';
|
||||
}
|
||||
}
|
@@ -12,6 +12,7 @@
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Model\Entities\User;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Alchemy\Phrasea\Model\RecordInterface;
|
||||
|
||||
class ACL implements cache_cacheableInterface
|
||||
{
|
||||
@@ -118,24 +119,22 @@ class ACL implements cache_cacheableInterface
|
||||
/**
|
||||
* Check if a hd grant has been received for a record
|
||||
*
|
||||
* @param record_Interface $record
|
||||
* @param \record_adapter $record
|
||||
* @return boolean
|
||||
*/
|
||||
public function has_hd_grant(record_Interface $record)
|
||||
public function has_hd_grant(RecordInterface $record)
|
||||
{
|
||||
|
||||
$this->load_hd_grant();
|
||||
|
||||
$key = $record->get_serialize_key();
|
||||
|
||||
if (array_key_exists($key, $this->_rights_records_document)) {
|
||||
if (array_key_exists($record->getId(), $this->_rights_records_document)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function grant_hd_on(record_adapter $record, User $pusher, $action)
|
||||
public function grant_hd_on(RecordInterface $record, User $pusher, $action)
|
||||
{
|
||||
$sql = 'REPLACE INTO records_rights
|
||||
(id, usr_id, sbas_id, record_id, document, `case`, pusher_usr_id)
|
||||
@@ -144,8 +143,8 @@ class ACL implements cache_cacheableInterface
|
||||
|
||||
$params = [
|
||||
':usr_id' => $this->user->getId()
|
||||
, ':sbas_id' => $record->get_sbas_id()
|
||||
, ':record_id' => $record->get_record_id()
|
||||
, ':sbas_id' => $record->getDataboxId()
|
||||
, ':record_id' => $record->getRecordId()
|
||||
, ':case' => $action
|
||||
, ':pusher' => $pusher->getId()
|
||||
];
|
||||
@@ -159,7 +158,7 @@ class ACL implements cache_cacheableInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function grant_preview_on(record_adapter $record, User $pusher, $action)
|
||||
public function grant_preview_on(RecordInterface $record, User $pusher, $action)
|
||||
{
|
||||
$sql = 'REPLACE INTO records_rights
|
||||
(id, usr_id, sbas_id, record_id, preview, `case`, pusher_usr_id)
|
||||
@@ -168,8 +167,8 @@ class ACL implements cache_cacheableInterface
|
||||
|
||||
$params = [
|
||||
':usr_id' => $this->user->getId()
|
||||
, ':sbas_id' => $record->get_sbas_id()
|
||||
, ':record_id' => $record->get_record_id()
|
||||
, ':sbas_id' => $record->getDataboxId()
|
||||
, ':record_id' => $record->getRecordI()
|
||||
, ':case' => $action
|
||||
, ':pusher' => $pusher->getId()
|
||||
];
|
||||
@@ -186,49 +185,48 @@ class ACL implements cache_cacheableInterface
|
||||
/**
|
||||
* Check if a hd grant has been received for a record
|
||||
*
|
||||
* @param record_Interface $record
|
||||
* @param \record_adapter $record
|
||||
* @return boolean
|
||||
*/
|
||||
public function has_preview_grant(record_Interface $record)
|
||||
public function has_preview_grant(RecordInterface $record)
|
||||
{
|
||||
$this->load_hd_grant();
|
||||
|
||||
$key = $record->get_serialize_key();
|
||||
|
||||
if (array_key_exists($key, $this->_rights_records_preview)) {
|
||||
if (array_key_exists($record->getId(), $this->_rights_records_preview)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function has_access_to_record(\record_adapter $record)
|
||||
public function has_access_to_record(RecordInterface $record)
|
||||
{
|
||||
if ($this->has_access_to_base($record->get_base_id()) && $this->has_status_access_to_record($record)) {
|
||||
if ($this->has_access_to_base($record->getBaseId()) && $this->has_status_access_to_record($record)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->has_preview_grant($record) || $this->has_hd_grant($record);
|
||||
}
|
||||
|
||||
public function has_status_access_to_record(record_adapter $record)
|
||||
public function has_status_access_to_record(RecordInterface $record)
|
||||
{
|
||||
return 0 === ((bindec($record->get_status()) ^ $this->get_mask_xor($record->get_base_id())) & $this->get_mask_and($record->get_base_id()));
|
||||
return 0 === ((bindec($record->getStatus()) ^ $this->get_mask_xor($record->getBaseId())) & $this->get_mask_and($record->getBaseId()));
|
||||
}
|
||||
|
||||
public function has_access_to_subdef(record_Interface $record, $subdef_name)
|
||||
public function has_access_to_subdef(RecordInterface $record, $subdef_name)
|
||||
{
|
||||
if ($subdef_name == 'thumbnail') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($record->is_grouping()) {
|
||||
if ($record->isStory()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$databox = $this->app['phraseanet.appbox']->get_databox($record->getDataboxId());
|
||||
try {
|
||||
$subdef_class = $record->get_databox()->get_subdef_structure()
|
||||
->get_subdef($record->get_type(), $subdef_name)
|
||||
$subdef_class = $databox->get_subdef_structure()
|
||||
->get_subdef($record->getType(), $subdef_name)
|
||||
->get_class();
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
@@ -238,17 +236,17 @@ class ACL implements cache_cacheableInterface
|
||||
|
||||
if ($subdef_class == databox_subdef::CLASS_THUMBNAIL) {
|
||||
$granted = true;
|
||||
} elseif ($subdef_class == databox_subdef::CLASS_PREVIEW && $this->has_right_on_base($record->get_base_id(), 'candwnldpreview')) {
|
||||
} elseif ($subdef_class == databox_subdef::CLASS_PREVIEW && $this->has_right_on_base($record->getBaseId(), 'candwnldpreview')) {
|
||||
$granted = true;
|
||||
} elseif ($subdef_class == databox_subdef::CLASS_PREVIEW && $this->has_preview_grant($record)) {
|
||||
$granted = true;
|
||||
} elseif ($subdef_class == databox_subdef::CLASS_DOCUMENT && $this->has_right_on_base($record->get_base_id(), 'candwnldhd')) {
|
||||
} elseif ($subdef_class == databox_subdef::CLASS_DOCUMENT && $this->has_right_on_base($record->getBaseId(), 'candwnldhd')) {
|
||||
$granted = true;
|
||||
} elseif ($subdef_class == databox_subdef::CLASS_DOCUMENT && $this->has_hd_grant($record)) {
|
||||
$granted = true;
|
||||
}
|
||||
|
||||
if (false === $granted && $this->app['repo.feed-items']->isRecordInPublicFeed($this->app, $record->get_sbas_id(), $record->get_record_id())) {
|
||||
if (false === $granted && $this->app['repo.feed-items']->isRecordInPublicFeed($this->app, $record->getDataboxId(), $record->getRecordId())) {
|
||||
$granted = true;
|
||||
}
|
||||
|
||||
|
@@ -290,7 +290,7 @@ class caption_Field_Value implements cache_cacheableInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function create(Application $app, databox_field $databox_field, record_Interface $record, $value, Vocabulary\ControlProvider\ControlProviderInterface $vocabulary = null, $vocabularyId = null)
|
||||
public static function create(Application $app, databox_field $databox_field, \record_adapter $record, $value, Vocabulary\ControlProvider\ControlProviderInterface $vocabulary = null, $vocabularyId = null)
|
||||
{
|
||||
$connbas = $databox_field->get_connection();
|
||||
|
||||
|
@@ -38,11 +38,11 @@ class caption_field implements cache_cacheableInterface
|
||||
*
|
||||
* @param Application $app
|
||||
* @param databox_field $databox_field
|
||||
* @param record_Interface $record
|
||||
* @param record_adapter $record
|
||||
*
|
||||
* @return caption_field
|
||||
*/
|
||||
public function __construct(Application $app, databox_field $databox_field, record_Interface $record)
|
||||
public function __construct(Application $app, databox_field $databox_field, \record_adapter $record)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->record = $record;
|
||||
|
@@ -16,7 +16,7 @@ use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
||||
interface caption_interface
|
||||
{
|
||||
|
||||
public function __construct(Application $app, record_Interface $record, databox $databox);
|
||||
public function __construct(Application $app, \record_adapter $record, databox $databox);
|
||||
|
||||
public function get_highlight_fields($highlight = '', Array $grep_fields = null, SearchEngineInterface $searchEngine = null, $includeBusiness = false, SearchEngineOptions $options = null);
|
||||
}
|
||||
|
@@ -38,12 +38,12 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
||||
/**
|
||||
*
|
||||
* @param Application $app
|
||||
* @param record_Interface $record
|
||||
* @param record_adapter $record
|
||||
* @param databox $databox
|
||||
*
|
||||
* @return caption_record
|
||||
*/
|
||||
public function __construct(Application $app, record_Interface $record, databox $databox)
|
||||
public function __construct(Application $app, \record_adapter $record, databox $databox)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->sbas_id = $record->get_sbas_id();
|
||||
|
@@ -655,7 +655,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
return $datas;
|
||||
}
|
||||
|
||||
public static function create(Application $app, record_Interface $record, $name, MediaInterface $media)
|
||||
public static function create(Application $app, \record_adapter $record, $name, MediaInterface $media)
|
||||
{
|
||||
$databox = $record->get_databox();
|
||||
$connbas = $databox->get_connection();
|
||||
|
@@ -1,100 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Model\Entities\User;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineInterface;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
interface record_Interface
|
||||
{
|
||||
|
||||
public function get_creation_date();
|
||||
|
||||
public function get_uuid();
|
||||
|
||||
public function get_modification_date();
|
||||
|
||||
public function get_number();
|
||||
|
||||
public function set_number($number);
|
||||
|
||||
public function set_type($type);
|
||||
|
||||
public function is_grouping();
|
||||
|
||||
public function get_base_id();
|
||||
|
||||
public function get_record_id();
|
||||
|
||||
public function get_databox();
|
||||
|
||||
public function get_thumbnail();
|
||||
|
||||
public function get_embedable_medias();
|
||||
|
||||
public function get_status_icons();
|
||||
|
||||
public function get_type();
|
||||
|
||||
public function get_formated_duration();
|
||||
|
||||
public function get_duration();
|
||||
|
||||
public function move_to_collection(collection $collection, appbox $appbox);
|
||||
|
||||
public function get_rollover_thumbnail();
|
||||
|
||||
public function get_sha256();
|
||||
|
||||
public function get_mime();
|
||||
|
||||
public function get_status();
|
||||
|
||||
public function get_subdef($name);
|
||||
|
||||
public function get_subdefs();
|
||||
|
||||
public function get_collection_logo();
|
||||
|
||||
public function get_technical_infos($data = false);
|
||||
|
||||
public function get_caption();
|
||||
|
||||
public function get_original_name();
|
||||
|
||||
public function get_title($highlight = false, SearchEngineInterface $searchEngine = null);
|
||||
|
||||
public function get_preview();
|
||||
|
||||
public function has_preview();
|
||||
|
||||
public function get_serialize_key();
|
||||
|
||||
public function get_sbas_id();
|
||||
|
||||
public function set_metadatas(Array $metadatas, $force_readonly = false);
|
||||
|
||||
public function reindex();
|
||||
|
||||
public function rebuild_subdefs();
|
||||
|
||||
public function write_metas();
|
||||
|
||||
public function set_binary_status($status);
|
||||
|
||||
public function get_hd_file();
|
||||
|
||||
public function delete();
|
||||
|
||||
public function log_view($log_id, $referrer, $gv_sit);
|
||||
|
||||
public function get_container_baskets(EntityManager $em, User $user);
|
||||
}
|
@@ -18,11 +18,13 @@ use Alchemy\Phrasea\Model\Serializer\CaptionSerializer;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineInterface;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use MediaVorus\MediaVorus;
|
||||
use Rhumsaa\Uuid\Uuid;
|
||||
use Alchemy\Phrasea\Model\RecordInterface;
|
||||
use Symfony\Component\HttpFoundation\File\File as SymfoFile;
|
||||
|
||||
class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
@@ -739,7 +741,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
*/
|
||||
public function get_technical_infos($data = false)
|
||||
{
|
||||
|
||||
if (!$this->technical_datas) {
|
||||
try {
|
||||
$this->technical_datas = $this->get_data_from_cache(self::CACHE_TECHNICAL_DATAS);
|
||||
@@ -1839,4 +1840,105 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getBaseId()
|
||||
{
|
||||
return $this->get_base_id();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getCollectionId()
|
||||
{
|
||||
return $this->get_collection()->get_coll_id();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getCreated()
|
||||
{
|
||||
return $this->get_creation_date();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getDataboxId()
|
||||
{
|
||||
return $this->get_databox()->get_sbas_id();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function isStory()
|
||||
{
|
||||
return $this->is_grouping();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getMimeType()
|
||||
{
|
||||
return $this->get_mime();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getOriginalName()
|
||||
{
|
||||
return $this->get_original_name();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function setOriginalName($originalName)
|
||||
{
|
||||
$this->set_original_name($originalName);
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getRecordId()
|
||||
{
|
||||
return $this->get_record_id();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getSha256()
|
||||
{
|
||||
return $this->get_sha256();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getType()
|
||||
{
|
||||
return $this->get_type();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getUpdated()
|
||||
{
|
||||
return $this->get_modification_date();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getUuid()
|
||||
{
|
||||
return $this->get_uuid();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getId()
|
||||
{
|
||||
return $this->get_serialize_key();
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->set_binary_status($status);
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->get_status();
|
||||
}
|
||||
|
||||
/** {@inheritdoc} */
|
||||
public function getExif()
|
||||
{
|
||||
return new ArrayCollection($this->get_technical_infos());
|
||||
}
|
||||
}
|
||||
|
@@ -111,8 +111,8 @@ class record_preview extends record_adapter
|
||||
foreach ($results->getResults() as $record) {
|
||||
$number = $pos;
|
||||
$this->original_item = $record;
|
||||
$sbas_id = $record->get_sbas_id();
|
||||
$record_id = $record->get_record_id();
|
||||
$sbas_id = $record->getDataboxId();
|
||||
$record_id = $record->getRecordId();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -270,7 +270,7 @@ class record_preview extends record_adapter
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public function get_title($highlight = '', SearchEngineInterface $search_engine = null)
|
||||
public function get_title($highlight = false, SearchEngineInterface $searchEngine = null, $removeExtension = null, SearchEngineOptions $options = null)
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title;
|
||||
@@ -282,10 +282,10 @@ class record_preview extends record_adapter
|
||||
|
||||
case "RESULT":
|
||||
$this->title .= $this->app->trans('preview:: resultat numero %number%', ['%number%' => '<span id="current_result_n">' . ($this->number + 1) . '</span> : ']);
|
||||
$this->title .= parent::get_title($highlight, $search_engine);
|
||||
$this->title .= parent::get_title($highlight, $searchEngine);
|
||||
break;
|
||||
case "BASK":
|
||||
$this->title .= $this->name . ' - ' . parent::get_title($highlight, $search_engine)
|
||||
$this->title .= $this->name . ' - ' . parent::get_title($highlight, $searchEngine)
|
||||
. ' (' . $this->get_number() . '/' . $this->total . ') ';
|
||||
break;
|
||||
case "REG":
|
||||
@@ -299,7 +299,7 @@ class record_preview extends record_adapter
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$this->title .= parent::get_title($highlight, $search_engine);
|
||||
$this->title .= parent::get_title($highlight, $searchEngine);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -139,10 +139,10 @@ abstract class set_abstract implements IteratorAggregate
|
||||
|
||||
/**
|
||||
*
|
||||
* @param record_Interface $record
|
||||
* @param record_adapter $record
|
||||
* @return set
|
||||
*/
|
||||
public function add_element(record_Interface $record)
|
||||
public function add_element(\record_adapter $record)
|
||||
{
|
||||
$this->elements[$record->get_serialize_key()] = $record;
|
||||
|
||||
@@ -151,10 +151,10 @@ abstract class set_abstract implements IteratorAggregate
|
||||
|
||||
/**
|
||||
*
|
||||
* @param record_Interface $record
|
||||
* @param record_adapter $record
|
||||
* @return set
|
||||
*/
|
||||
public function remove_element(record_Interface $record)
|
||||
public function remove_element(\record_adapter $record)
|
||||
{
|
||||
$key = $record->get_serialize_key();
|
||||
if (isset($this->elements[$key]))
|
||||
|
@@ -29,7 +29,7 @@
|
||||
{% for item in feed_entry.getItems() %}
|
||||
<li class="image_box" id="item_{{item.getId()}}">
|
||||
<a href="{{ path('lightbox_ajax_load_feeditem', { 'entry_id' : feed_entry.getId(), 'item_id' : item.getId()}) }}">
|
||||
{{thumbnail.format(item.getRecord(app).get_thumbnail(), 80, 80, '', true, false)}}
|
||||
{{ thumbnail.format(item.getRecord(app).get_thumbnail(), 80, 80, '', true, false) }}
|
||||
</a>
|
||||
<input type="hidden" class="display_id" name="display_id" value="{{item.getOrd()}}" />
|
||||
</li>
|
||||
|
@@ -1,16 +0,0 @@
|
||||
{% macro format(record)%}
|
||||
{% set doctype = record.get_type() %}
|
||||
{% if record.is_grouping() %}
|
||||
<img src="/skins/icons/icon_story.gif" title="{{ 'reportage' | trans }}" />
|
||||
{% elseif doctype == 'image' %}
|
||||
<img src="/skins/icons/icon_image.gif" title="{{ 'image' | trans }}" />
|
||||
{% elseif doctype == 'document' %}
|
||||
<img src="/skins/icons/icon_document.gif" title="{{ 'document' | trans }}" />
|
||||
{% elseif doctype == 'flash' %}
|
||||
<img src="/skins/icons/icon_flash.gif" title="{{ 'animation flash' | trans }}" />
|
||||
{% elseif doctype == 'video' %}
|
||||
<img src="/skins/icons/icon_video.gif" title="{{ 'video' | trans }}" />
|
||||
{% elseif doctype == 'audio' %}
|
||||
<img src="/skins/icons/icon_audio.gif" title="{{ 'audio' | trans }}" />
|
||||
{% endif %}
|
||||
{% endmacro %}
|
@@ -1,49 +0,0 @@
|
||||
{% macro prod(record, entry_id)%}
|
||||
{% if not entry_id %}
|
||||
<a style="float:right;padding:0;margin:0;cursor:pointer;" class="contextMenuTrigger"
|
||||
id="contextTrigger_{{record.get_base_id}}_{{record.get_record_id}}">▼</a>
|
||||
<table cellspacing="0" cellpadding="0" style="display:none;"
|
||||
id="answerContext_{{record.get_base_id}}_{{record.get_record_id}}" class="contextMenu answercontextmenu">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="context-menu context-menu-theme-vista">
|
||||
{% if app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id, 'canputinalbum') and not record.is_grouping() %}
|
||||
<div title="" class="context-menu-item">
|
||||
<div class="context-menu-item-inner"
|
||||
onclick="evt_add_in_chutier('{{record.get_sbas_id}}','{{record.get_record_id}}',false,this);return(false);">
|
||||
{{ 'action : ajouter au panier' | trans }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id, 'candwnldpreview') or app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id, 'candwnldhd') %}
|
||||
<div title="" class="context-menu-item">
|
||||
<div class="context-menu-item-inner"
|
||||
onclick="evt_dwnl('{{record.get_sbas_id}}_{{record.get_record_id}}',false,this);return(false);">
|
||||
{{ 'action : exporter' | trans }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div title="" class="context-menu-item">
|
||||
<div class="context-menu-item-inner"
|
||||
onclick="evt_print('{{record.get_sbas_id}}_{{record.get_record_id}}');return(false);">
|
||||
{{ 'action : print' | trans }}
|
||||
</div>
|
||||
</div>
|
||||
{% if app['conf'].get(['registry', 'actions', 'social-tools']) == 'all' or (app['conf'].get(['registry', 'actions', 'social-tools']) == 'publishers' and app['acl'].get(app['authentication'].getUser()).has_right_on_sbas(record.get_sbas_id(), 'bas_chupub')) %}
|
||||
{% if record.is_grouping() is empty %}
|
||||
<div title="" class="context-menu-item">
|
||||
<div class="context-menu-item-inner"
|
||||
onclick="shareThis('{{record.get_base_id}}','{{record.get_record_id}}');">
|
||||
{{ 'reponses:: partager' | trans }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
@@ -4,7 +4,7 @@
|
||||
theme : 'custom',
|
||||
custom_theme_widget: 'recaptcha_widget',
|
||||
lang : '{{ app['locale'] }}'
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="row-fluid">
|
||||
@@ -46,7 +46,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -54,9 +54,9 @@
|
||||
{% set public_key = app["conf"].get(['registry', 'webservices', 'recaptcha-public-key']) %}
|
||||
<script type="text/javascript" src="https://www.google.com/recaptcha/api/challenge?k={{ app['recaptcha'].getPublicKey() }}"></script>
|
||||
<noscript>
|
||||
<iframe src="https://www.google.com/recaptcha/api/noscript?k={{ app['recaptcha'].getPublicKey() }}" height="300" width="500" frameborder="0"></iframe><br>
|
||||
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
|
||||
<input type="hidden" name="recaptcha_response_field" value="manual_challenge">
|
||||
<iframe src="https://www.google.com/recaptcha/api/noscript?k={{ app['recaptcha'].getPublicKey() }}" height="300" width="500" frameborder="0"></iframe><br>
|
||||
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
|
||||
<input type="hidden" name="recaptcha_response_field" value="manual_challenge">
|
||||
</noscript>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -115,3 +115,21 @@
|
||||
{% include 'common/technical_datas.html.twig' %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro caption(record, business, technical) %}
|
||||
{# @todo handle business fields #}
|
||||
{% for name, value in record.caption %}
|
||||
<div class="desc {{ loop.index is odd ? 'impair' : 'pair' }}">
|
||||
<b>{{ name }}</b> :
|
||||
{% if value is iterable %}
|
||||
{{ value | join(' ; ') }}
|
||||
{% else %}
|
||||
{{ value }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if technical|default(true) and app['authentication'].user is not none and user_setting('technical_display') == 'group' %}
|
||||
<hr/>
|
||||
{% include 'common/technical_datas.html.twig' %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
@@ -1,160 +1,145 @@
|
||||
{% if record.is_grouping() %}
|
||||
{{ 'Story_id' | trans }} : {{ record.get_record_id() }}<br/>
|
||||
{% if record.story %}
|
||||
{{ 'Story_id' | trans }} : {{ record.recordId }}<br/>
|
||||
{% else %}
|
||||
{{ 'Record_id' | trans }} : {{ record.get_record_id() }}<br/>
|
||||
{{ 'Record_id' | trans }} : {{ record.recordId }}<br/>
|
||||
{% endif %}
|
||||
|
||||
{% if record.is_grouping() == false %}
|
||||
{% if not record.story %}
|
||||
{% block td_original_name %}
|
||||
{{ 'Nom Original' | trans }} : {{ record.originalName }}
|
||||
{% endblock %}
|
||||
|
||||
{% set document = record.get_subdef('document') %}
|
||||
{% block td_mime %}
|
||||
{{ record.mimeType }}
|
||||
{% endblock %}
|
||||
|
||||
{% block td_original_name %}
|
||||
{{ 'Nom Original' | trans }} :
|
||||
{{ record.get_original_name() }}
|
||||
{% endblock %}
|
||||
{% block td_weight %}
|
||||
{# @todo we should index document weight as well #}
|
||||
{% endblock %}
|
||||
<br/>
|
||||
|
||||
{% block td_mime %}
|
||||
{{ record.get_mime() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block td_weight %}
|
||||
{% if document and document.get_size() %}
|
||||
- {{document.get_size()| formatOctets}}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
<br/>
|
||||
|
||||
{% block td_size %}
|
||||
{% if document and document.get_width() and document.get_height() %}
|
||||
{{ 'Size' | trans }} :
|
||||
{{document.get_width()}} x {{document.get_height()}} px
|
||||
<br/>
|
||||
{% if record.get_type() == 'image' and document.get_width() and document.get_height() %}
|
||||
{% set size_w = (document.get_width() * (254/100) / 300) %}
|
||||
{% set size_h = (document.get_height() * (254/100) / 300) %}
|
||||
{{ size_w|round(1) }} x {{ size_h|round(1) }} cm (300dpi)
|
||||
{% set size_w = (document.get_width() * (254/100) / 72) %}<br/>
|
||||
{% set size_h = (document.get_height() * (254/100) / 72) %}
|
||||
{{ size_w|round(1) }} x {{ size_h|round(1) }} cm (72dpi)
|
||||
{% block td_size %}
|
||||
{% set width = record.exif.get(constant('media_subdef::TC_DATA_WIDTH')) %}
|
||||
{% set height = record.exif.get(constant('media_subdef::TC_DATA_HEIGHT')) %}
|
||||
{% if width is not none and height is not none %}
|
||||
{{ width ~ " x " ~ height }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
<hr/>
|
||||
{% block td_camera_model %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_CAMERAMODEL')) is not empty %}
|
||||
{{ 'Camera Model' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_CAMERAMODEL')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_color_space %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_COLORSPACE')) is not empty %}
|
||||
{{ 'Color space' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_COLORSPACE')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_channels %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_CHANNELS')) is not empty %}
|
||||
{{ 'Channels' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_CHANNELS')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_color_depth %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_COLORDEPTH')) is not empty %}
|
||||
{{ 'Color Depth' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_COLORDEPTH')) }} bits
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_iso_sensibility %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_ISO')) is not empty %}
|
||||
{{ 'ISO sensibility' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_ISO')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_flash %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_FLASHFIRED')) is not empty %}
|
||||
{{ 'Flash' | trans }} :
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_FLASHFIRED')) %}
|
||||
{{ 'yes' | trans }}
|
||||
{% else %}
|
||||
{{ 'no' | trans }}
|
||||
{% endif %}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_shutter_speed %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_SHUTTERSPEED')) is not empty %}
|
||||
{{ 'Shutter speed' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_SHUTTERSPEED')) }} s.
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_apeture %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_APERTURE')) is not empty %}
|
||||
{{ 'Aperture' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_APERTURE')) | round(2) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_focal_length %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_FOCALLENGTH')) is not empty %}
|
||||
{{ 'Focal length' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_FOCALLENGTH')) }} mm
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_hyperfocal_distance %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_HYPERFOCALDISTANCE')) is not empty %}
|
||||
{{ 'Hyperfocal distance' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_HYPERFOCALDISTANCE')) | round(2) }} mm
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_light_value %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_LIGHTVALUE')) is not empty %}
|
||||
{{ 'Light Value' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_LIGHTVALUE')) | round(2) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_duration %}
|
||||
{% if record.get_formated_duration() %}
|
||||
{{ 'Duree' | trans }} :
|
||||
{{ record.get_formated_duration() }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_framerate %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_FRAMERATE')) is not empty %}
|
||||
{{ 'Images par secondes' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_FRAMERATE')) | round(2) }} ips
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_codec_audio %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_AUDIOCODEC')) %}
|
||||
{{ 'Codec Audio' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_AUDIOCODEC')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_codec_video %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_VIDEOCODEC')) %}
|
||||
{{ 'Codec Video' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_VIDEOCODEC')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_audio_rate %}
|
||||
{% if record.get_technical_infos(constant('media_subdef::TC_DATA_AUDIOSAMPLERATE')) %}
|
||||
{{ 'Frequence d\'echantillonage' | trans }} :
|
||||
{{ record.get_technical_infos(constant('media_subdef::TC_DATA_AUDIOSAMPLERATE')) | round(2) }} kHz
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
<hr/>
|
||||
{% block td_camera_model %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_CAMERAMODEL')) is not none %}
|
||||
{{ 'Camera Model' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_CAMERAMODEL')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_color_space %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_COLORSPACE')) is not none %}
|
||||
{{ 'Color space' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_COLORSPACE')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_channels %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_CHANNELS')) is not none %}
|
||||
{{ 'Channels' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_CHANNELS')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_color_depth %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_COLORDEPTH')) is not none %}
|
||||
{{ 'Color Depth' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_COLORDEPTH')) }} bits
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_iso_sensibility %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_ISO')) is not none %}
|
||||
{{ 'ISO sensibility' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_ISO')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_flash %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_FLASHFIRED')) is not none %}
|
||||
{{ 'Flash' | trans }} :
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_FLASHFIRED')) %}
|
||||
{{ 'yes' | trans }}
|
||||
{% else %}
|
||||
{{ 'no' | trans }}
|
||||
{% endif %}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_shutter_speed %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_SHUTTERSPEED')) is not none %}
|
||||
{{ 'Shutter speed' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_SHUTTERSPEED')) }} s.
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_apeture %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_APERTURE')) is not none %}
|
||||
{{ 'Aperture' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_APERTURE')) | round(2) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_focal_length %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_FOCALLENGTH')) is not none %}
|
||||
{{ 'Focal length' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_FOCALLENGTH')) }} mm
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_hyperfocal_distance %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_HYPERFOCALDISTANCE')) is not none %}
|
||||
{{ 'Hyperfocal distance' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_HYPERFOCALDISTANCE')) | round(2) }} mm
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_light_value %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_LIGHTVALUE')) is not none %}
|
||||
{{ 'Light Value' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_LIGHTVALUE')) | round(2) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_duration %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_DURATION')) is not none %}
|
||||
{{ 'Duree' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_DURATION')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_framerate %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_FRAMERATE')) is not none %}
|
||||
{{ 'Images par secondes' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_FRAMERATE')) | round(2) }} ips
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_codec_audio %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_AUDIOCODEC')) %}
|
||||
{{ 'Codec Audio' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_AUDIOCODEC')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_codec_video %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_VIDEOCODEC')) %}
|
||||
{{ 'Codec Video' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_VIDEOCODEC')) }}
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_audio_rate %}
|
||||
{% if record.exif.get(constant('media_subdef::TC_DATA_AUDIOSAMPLERATE')) %}
|
||||
{{ 'Frequence d\'echantillonage' | trans }} :
|
||||
{{ record.exif.get(constant('media_subdef::TC_DATA_AUDIOSAMPLERATE')) | round(2) }} kHz
|
||||
<br />
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
|
@@ -1,65 +1,64 @@
|
||||
{% macro format(thumbnail, box_w, box_h, extra_class, wrap, lazyload) %}
|
||||
{% set record_type = thumbnail.get_type() %}
|
||||
{% set box_w = box_w|round %}
|
||||
{% set box_h = box_h|default(box_w)|round %}
|
||||
{# @todo remove lazyload #}
|
||||
|
||||
{% if record_type == 'AUDIO_MP3' %}
|
||||
{% set original_w = 320 %}
|
||||
{% set original_h = 60 %}
|
||||
{% set record_type = thumbnail.get_type() %}
|
||||
{% set box_w = box_w|round %}
|
||||
{% set box_h = box_h|default(box_w)|round %}
|
||||
|
||||
{% set fit_size = {
|
||||
"width":original_w,
|
||||
"height":original_h,
|
||||
"top":0,
|
||||
"left": 0
|
||||
} %}
|
||||
{% elseif record_type == 'FLEXPAPER' %}
|
||||
{% set original_w = 800 %}
|
||||
{% set original_h = 600 %}
|
||||
{% if record_type == 'AUDIO_MP3' %}
|
||||
{% set original_w = 320 %}
|
||||
{% set original_h = 60 %}
|
||||
|
||||
{% set fit_size = {
|
||||
"width":800,
|
||||
"height":600,
|
||||
"top":0,
|
||||
"left": 0
|
||||
} %}
|
||||
{% else %}
|
||||
{% set original_h = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
|
||||
{% set original_w = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
|
||||
{% set fit_size = {
|
||||
"width":original_w,
|
||||
"height":original_h,
|
||||
"top":0,
|
||||
"left": 0
|
||||
} %}
|
||||
{% elseif record_type == 'FLEXPAPER' %}
|
||||
{% set original_w = 800 %}
|
||||
{% set original_h = 600 %}
|
||||
|
||||
{% set fit_size = fitIn(
|
||||
{"width":original_w, "height":original_h},
|
||||
{"width":box_w, "height":box_h}
|
||||
)%}
|
||||
{% endif %}
|
||||
{% set fit_size = {
|
||||
"width":800,
|
||||
"height":600,
|
||||
"top":0,
|
||||
"left": 0
|
||||
} %}
|
||||
{% else %}
|
||||
{% set original_h = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
|
||||
{% set original_w = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
|
||||
|
||||
{% set url = app['authentication'].isAuthenticated() ? thumbnail.get_url() : thumbnail.get_permalink().get_url() %}
|
||||
{% set fit_size = fitIn(
|
||||
{"width":original_w, "height":original_h},
|
||||
{"width":box_w, "height":box_h}
|
||||
)%}
|
||||
{% endif %}
|
||||
|
||||
{% if wrap %}
|
||||
<div
|
||||
style="width:{{box_w}}px;height:{{box_h}}px;"
|
||||
class="thumb_wrapper {{extra_class|default('')}}"
|
||||
>
|
||||
{% endif %}
|
||||
{% set url = app['authentication'].isAuthenticated() ? thumbnail.get_url() : thumbnail.get_permalink().get_url() %}
|
||||
|
||||
{% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %}
|
||||
{% import 'common/players/video.html.twig' as player %}
|
||||
{{ player.video_player(thumbnail, url, original_w, original_h, fit_size) }}
|
||||
{% elseif record_type == 'FLEXPAPER' %}
|
||||
{% import 'common/players/pdf.html.twig' as player %}
|
||||
{{ player.pdf_player(thumbnail, url, original_w, original_h, fit_size) }}
|
||||
{% elseif record_type == 'AUDIO_MP3' %}
|
||||
{% import 'common/players/audio.html.twig' as player %}
|
||||
{{ player.audio_player(thumbnail, url, original_w, original_h, fit_size) }}
|
||||
{% else %}
|
||||
<img class="{% if lazyload %}lazyload{% endif %} record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
||||
style="width:{{fit_size.width}}px;height:{{fit_size.height}}px;top:{{fit_size.top}}px;"
|
||||
src="{% if lazyload %}/skins/grey.gif{% else %}{{ url }}{% endif %}" data-original="{{ url }}" ondragstart="return false;">
|
||||
<input type="hidden" name="width" value="{{original_w}}"/>
|
||||
<input type="hidden" name="height" value="{{original_h}}"/>
|
||||
{% endif %}
|
||||
{% if wrap %}
|
||||
<div style="width:{{box_w}}px;height:{{box_h}}px;" class="thumb_wrapper {{extra_class|default('')}}" >
|
||||
{% endif %}
|
||||
|
||||
{% if wrap %}
|
||||
{% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %}
|
||||
{% import 'common/players/video.html.twig' as player %}
|
||||
{{ player.video_player(thumbnail, url, original_w, original_h, fit_size) }}
|
||||
{% elseif record_type == 'FLEXPAPER' %}
|
||||
{% import 'common/players/pdf.html.twig' as player %}
|
||||
{{ player.pdf_player(thumbnail, url, original_w, original_h, fit_size) }}
|
||||
{% elseif record_type == 'AUDIO_MP3' %}
|
||||
{% import 'common/players/audio.html.twig' as player %}
|
||||
{{ player.audio_player(thumbnail, url, original_w, original_h, fit_size) }}
|
||||
{% else %}
|
||||
<img class="{% if lazyload %}lazyload{% endif %} record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
||||
style="width:{{fit_size.width}}px;height:{{fit_size.height}}px;top:{{fit_size.top}}px;"
|
||||
src="{% if lazyload %}/skins/grey.gif{% else %}{{ url }}{% endif %}" data-original="{{ url }}" ondragstart="return false;">
|
||||
<input type="hidden" name="width" value="{{original_w}}"/>
|
||||
<input type="hidden" name="height" value="{{original_h}}"/>
|
||||
{% endif %}
|
||||
|
||||
{% if wrap %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
@@ -1,2 +0,0 @@
|
||||
{% import 'prod/feeds/entry_macro.html.twig' as _entry %}
|
||||
{{ _entry.format(entry.getFeed(), entry) }}
|
@@ -1,67 +0,0 @@
|
||||
{% macro format(feed, entry)%}
|
||||
{% import 'prod/results/record.html.twig' as record_format %}
|
||||
|
||||
<div class="entry ui-corner-all" id="entry_{{ entry.getId() }}">
|
||||
<table class="head">
|
||||
<tr>
|
||||
<td>
|
||||
<h1 class="title">
|
||||
{% if feed.isAggregated() %}
|
||||
<img style="height:16px;" src="{% if entry.getFeed().getIconUrl() == false %}
|
||||
/skins/icons/rss32.gif
|
||||
{% else %}
|
||||
/custom/feed_{{ entry.getFeed().getId() }}.jpg
|
||||
{% endif %}"/>
|
||||
{% endif %}
|
||||
{{ entry.getTitle() }}
|
||||
{% set author = entry.getAuthorName() %}
|
||||
<span class="author">{% trans with {'%author%' : author} %}Par %author%{% endtrans %}</span>
|
||||
</h1>
|
||||
</td>
|
||||
<td style="width:60px;text-align:right;">
|
||||
{% if entry.getFeed().isOwner(app['authentication'].getUser()) or entry.isPublisher(app['authentication'].getUser()) %}
|
||||
<a class="tools options feed_edit" href="{{ path('prod_feeds_entry_edit', { 'id' : entry.getId() }) }}">
|
||||
<img src="/skins/icons/file-edit.png" title="{{ 'boutton::editer' | trans }}"/>
|
||||
</a>
|
||||
<a class="tools feed_delete" href="{{ path('prod_feeds_entry_delete', { 'id' : entry.getId() }) }}">
|
||||
<img src="/skins/icons/delete.png" title="{{ 'boutton::supprimer' | trans }}"/>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="post_date">
|
||||
{% set updated_on = app['date-formatter'].getPrettyString(entry.getUpdatedOn()) %}
|
||||
{% set created_on = app['date-formatter'].getPrettyString(entry.getCreatedOn()) %}
|
||||
<span class="created_on">
|
||||
{{ created_on }}
|
||||
</span>
|
||||
{% if created_on != updated_on %}
|
||||
<span class="updated_on">
|
||||
(
|
||||
{% trans with {'%updated_on%' : updated_on} %}Derniere mise a jour le %updated_on%{% endtrans %}
|
||||
)
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if feed.isAggregated() %}
|
||||
<a class="ajax_answers" href="{{ path('prod_feeds_feed', { 'id' : entry.getFeed().getId() }) }}">
|
||||
{% set feed_name = entry.getFeed().getTitle() %}
|
||||
{% trans with {'%feed_name%' : feed_name} %}dans %feed_name%{% endtrans %}
|
||||
<img style="height:16px;" src="{% if entry.getFeed().getIconUrl() == false %}
|
||||
/skins/icons/rss32.gif
|
||||
{% else %}
|
||||
/custom/feed_{{ entry.getFeed().getId() }}.jpg
|
||||
{% endif %}"/>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<p>{{ entry.getSubtitle()|nl2br|raw }}</p>
|
||||
<div class="contents selectable">
|
||||
{% for item in entry.getItems() %}
|
||||
{% set record = item.getRecord(app) %}
|
||||
{% set prefix = 'PUBLI_' ~ item.getId() %}
|
||||
{{record_format.block(record, false, null, prefix, entry.getId())}}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
@@ -1,84 +0,0 @@
|
||||
{% import 'prod/feeds/entry_macro.html.twig' as _entry %}
|
||||
<div class="feed">
|
||||
{% if page == 1 %}
|
||||
<div class="headblock">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:600px;">
|
||||
<h1>
|
||||
<img src="{% if feed.getIconUrl() == false %}
|
||||
/skins/icons/rss32.gif
|
||||
{% else %}
|
||||
/custom/feed_{{ feed.getId() }}.jpg
|
||||
{% endif %}" style="height:32px;"/>
|
||||
{% if feed.isAggregated %}
|
||||
{{ 'Toutes les publications' | trans }}
|
||||
<a class="feed_reload ajax_answers no_scroll" href="{{ path('prod_feeds') }}" >
|
||||
<img src="/skins/icons/reload.png" title="{{ 'rafraichir' | trans }}" />
|
||||
</a>
|
||||
{% else %}
|
||||
{{ feed.getTitle() }}
|
||||
<a class="feed_reload ajax_answers" href="{{ path('prod_feeds_feed', { 'id' : feed.getId() }) }}" >
|
||||
<img src="/skins/icons/reload.png" title="{{ 'rafraichir' | trans }}" />
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if feed.isAggregated %}
|
||||
<a class="subscribe_rss" href="{{ path('prod_feeds_subscribe_aggregated') }}">{{ 'publications:: s\'abonner aux publications' | trans }}</a>
|
||||
{% else %}
|
||||
<a class="subscribe_rss" href="{{ path('prod_feeds_subscribe_feed', { 'id' : feed.getId() }) }}">{{ 'publications:: s\'abonner aux publications' | trans }}</a>
|
||||
{% endif %}
|
||||
</h1>
|
||||
</td>
|
||||
<td>
|
||||
<div class="menu_feeds">
|
||||
<div class="btn-group">
|
||||
<button class="trigger btn btn-inverse dropdown-toggle" data-toggle="dropdown">
|
||||
{{ 'Aller a' | trans }}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="submenu dropdown-menu">
|
||||
{% for aval_feed in feeds %}
|
||||
<li>
|
||||
<a class="ajax_answers" href="{{ path('prod_feeds_feed', { 'id' : aval_feed.getId() }) }}">
|
||||
<img src="{% if aval_feed.getIconUrl() == false %}
|
||||
/skins/icons/rss32.gif
|
||||
{% else %}
|
||||
/custom/feed_{{ aval_feed.getId() }}.jpg
|
||||
{% endif %}" style="height:16px;"/> {{ aval_feed.getTitle() }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% set offset_start = ((page - 1) * 5 )%}
|
||||
{% set entries = feed.getEntries(offset_start,5) %}
|
||||
|
||||
{% for entry in entries %}
|
||||
{{ _entry.format(feed, entry) }}
|
||||
{% endfor %}
|
||||
{% if entries|length == 0 %}
|
||||
<p>{{ 'Aucune entree pour le moment' | trans }}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if feed.getCountTotalEntries() > (page*5) %}
|
||||
{% set next_page = page + 1 %}
|
||||
<div class="see_more">
|
||||
{% if feed.isAggregated() %}
|
||||
<a href="{{ path('prod_feeds', { page : next_page }) }}" class="ajax_answers append">
|
||||
{{ 'charger d\'avantage de publications' | trans }}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ path('prod_feeds_feed', { 'id' : feed.getId(), 'page' : next_page }) }}" class="ajax_answers append">
|
||||
{{ 'charger d\'avantage de publications' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
@@ -1,35 +1,48 @@
|
||||
<div id="PREVIEWCURRENTCONT" class="PNB10">
|
||||
<ul>
|
||||
{% for child in record.get_container().getElements() %}
|
||||
{% set basket = record.get_container %}
|
||||
{% for element in basket.elements %}
|
||||
|
||||
{% set thumbnail = child.getRecord(app).get_thumbnail() %}
|
||||
{% if thumbnail.is_paysage() %}
|
||||
{% set style = 'width:65px;top:' %}
|
||||
{% if thumbnail.get_width() > 0 and thumbnail.get_height() > 0 %}
|
||||
{% set top = ((66 - (65 / (thumbnail.get_width() / thumbnail.get_height()))) / 2)|round %}
|
||||
{% else %}
|
||||
{% set top = 65 %}
|
||||
{% set record_item = element.record(app) %}
|
||||
|
||||
{% set thumb_w = 70 %}
|
||||
{% set thumb_h = 70 %}
|
||||
|
||||
{% set thumbnail = record_item.get_thumbnail %}
|
||||
|
||||
{% if thumbnail is not none %}
|
||||
{% set thumb_w = thumbnail.get_width %}
|
||||
{% set thumb_h = thumbnail.get_height %}
|
||||
{% endif %}
|
||||
{% set style = style ~ top %}
|
||||
{% set style = style ~ 'px;' %}
|
||||
{% else %}
|
||||
{% set style = 'height:65px;top:0;' %}
|
||||
{% endif %}
|
||||
|
||||
{% set tooltip = '' %}
|
||||
{% if app['conf'].get(['registry', 'classic', 'stories-preview']) %}
|
||||
{% set tooltip = path('prod_tooltip_caption', { 'sbas_id' : child.getRecord(app).get_sbas_id(), 'record_id' : child.getRecord(app).get_record_id(), 'context' : 'basket' }) %}
|
||||
{% endif %}
|
||||
{% set url = record_thumbnail_url(record_item) %}
|
||||
|
||||
{% set class = '' %}
|
||||
{% if record.get_number() == child.getOrd() %}
|
||||
{% set class = ' selected' %}
|
||||
{% endif %}
|
||||
{% set box_w = 70 %}
|
||||
{% set box_h = 80 %}
|
||||
|
||||
<li class="{{class}} prevTrainCurrent">
|
||||
<img {% if tooltip %}tooltipsrc="{{ tooltip }}"{% endif %} jsargs="BASK|{{child.getOrd()}}|{{record.get_container().getId()}}"
|
||||
class="openPreview prevRegToolTip" return(false);" src="{{thumbnail.get_url()}}"
|
||||
style="{{style}}margin:7px;position:relative;"/></li>
|
||||
{% set original_h = thumb_h > 0 ? thumb_h : 70 %}
|
||||
{% set original_w = thumb_w > 0 ? thumb_w : 70 %}
|
||||
|
||||
{% set fit_size = fitIn(
|
||||
{"width":original_w, "height":original_h},
|
||||
{"width":box_w, "height":box_h}
|
||||
)
|
||||
%}
|
||||
|
||||
<li class="{% if record.get_number == element.ord %}selected{% endif %} prevTrainCurrent">
|
||||
<img {% if app['conf'].get(['registry', 'classic', 'stories-preview']) %}
|
||||
tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record_item.databoxId, 'record_id' : record_item.recordId, 'context' : 'basket' }) }}"
|
||||
{% endif %}
|
||||
jsargs="BASK|{{element.ord}}|{{basket.id}}"
|
||||
class="openPreview prevRegToolTip" src="{{url}}"
|
||||
style="
|
||||
width:{{fit_size.width}}px;
|
||||
height:{{fit_size.height}}px;
|
||||
top:{{fit_size.top}}px;
|
||||
position:relative;
|
||||
"
|
||||
/>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
|
@@ -15,5 +15,5 @@
|
||||
{% if record.is_from_reg() %}
|
||||
{{macro.format_caption(record, '', null, null, business, false, true)}}
|
||||
{% else %}
|
||||
{{macro.format_caption(record, highlight, searchEngine, business, false, true)}}
|
||||
{{macro.format_caption(record, null, null, business, false, true)}}
|
||||
{% endif %}
|
||||
|
@@ -1,35 +1,46 @@
|
||||
<div id="PREVIEWCURRENTCONT" class="PNB10">
|
||||
<ul>
|
||||
{% for child in record.get_container() %}
|
||||
{% set entry = record.get_container() %}
|
||||
{% for item in entry.items %}
|
||||
{% set record_item = item.record(app) %}
|
||||
|
||||
{% set thumbnail = child.getRecord(app).get_thumbnail() %}
|
||||
{% if thumbnail.is_paysage() %}
|
||||
{% set style = 'width:65px;top:' %}
|
||||
{% if thumbnail.get_width() > 0 and thumbnail.get_height() > 0 %}
|
||||
{% set top = ((66 - (65 / (thumbnail.get_width() / thumbnail.get_height()))) / 2)|round %}
|
||||
{% else %}
|
||||
{% set top = 65 %}
|
||||
{% set thumb_w = 70 %}
|
||||
{% set thumb_h = 70 %}
|
||||
|
||||
{% set thumbnail = record_item.get_thumbnail %}
|
||||
|
||||
{% if thumbnail is not none %}
|
||||
{% set thumb_w = thumbnail.get_width %}
|
||||
{% set thumb_h = thumbnail.get_height %}
|
||||
{% endif %}
|
||||
{% set style = style ~ top %}
|
||||
{% set style = style ~ 'px;' %}
|
||||
{% else %}
|
||||
{% set style = 'height:65px;top:0;' %}
|
||||
{% endif %}
|
||||
|
||||
{% set tooltip = '' %}
|
||||
{% if app['conf'].get(['registry', 'classic', 'stories-preview']) %}
|
||||
{% set tooltip = path('prod_tooltip_preview', { 'sbas_id' : child.get_record().get_sbas_id(), 'record_id' : child.get_record().get_record_id() }) %}
|
||||
{% endif %}
|
||||
{% set url = record_thumbnail_url(record_item) %}
|
||||
|
||||
{% set class = '' %}
|
||||
{% if record.get_number() == child.getOrd() %}
|
||||
{% set class = ' selected' %}
|
||||
{% endif %}
|
||||
{% set box_w = 70 %}
|
||||
{% set box_h = 80 %}
|
||||
|
||||
<li class="{{class}} prevTrainCurrent">
|
||||
<img {% if tooltip %}tooltipsrc="{{ tooltip }}"{% endif %} jsargs="FEED|{{child.get_ord()}}|{{record.get_container().getId()}}"
|
||||
class="openPreview prevRegToolTip" return(false);" src="{{thumbnail.get_url()}}"
|
||||
style="{{style}}margin:7px;position:relative;"/></li>
|
||||
{% set original_h = thumb_h > 0 ? thumb_h : 70 %}
|
||||
{% set original_w = thumb_w > 0 ? thumb_w : 70 %}
|
||||
|
||||
{% set fit_size = fitIn(
|
||||
{"width":original_w, "height":original_h},
|
||||
{"width":box_w, "height":box_h}
|
||||
)
|
||||
%}
|
||||
|
||||
<li class="{% if record.get_number == item.ord %}selected{% endif %} prevTrainCurrent">
|
||||
<img {% if app['conf'].get(['registry', 'classic', 'stories-preview']) %}
|
||||
tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' :record_item.databoxId, 'record_id' : record_item.recordId }) }}"
|
||||
{% endif %}
|
||||
jsargs="FEED|{{item.ord}}|{{entry.id}}"
|
||||
class="openPreview prevRegToolTip" src="{{url}}"
|
||||
style="
|
||||
width:{{fit_size.width}}px;
|
||||
height:{{fit_size.height}}px;
|
||||
top:{{fit_size.top}}px;
|
||||
position:relative;
|
||||
"
|
||||
/></li>
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
|
@@ -1,54 +1,79 @@
|
||||
{% set story = record.get_container %}
|
||||
|
||||
{% set regroupement = record.get_container() %}
|
||||
{% set thumbnail = regroupement.get_thumbnail() %}
|
||||
{% set thumb_w = 90 %}
|
||||
{% set thumb_h = 90 %}
|
||||
|
||||
{% if thumbnail.get_height() > 0 %}
|
||||
{% set ratio = thumbnail.get_width() / thumbnail.get_height() %}
|
||||
{% else %}
|
||||
{% set ratio = 1 %}
|
||||
{% endif %}
|
||||
{% if thumbnail.is_paysage %}
|
||||
{% set style = 'width:80px;top:' %}
|
||||
{% set top = (8 + (80 - (80 / ratio)) / 2)|round %}
|
||||
{% set style = style ~ top %}
|
||||
{% set style = style ~ 'px;' %}
|
||||
{% else %}
|
||||
{% set style = 'height:80px;top:8px;' %}
|
||||
{% endif %}
|
||||
{% set thumbnail = story.get_thumbnail %}
|
||||
|
||||
{% if thumbnail is not none %}
|
||||
{% set thumb_w = thumbnail.get_width %}
|
||||
{% set thumb_h = thumbnail.get_height %}
|
||||
{% endif %}
|
||||
|
||||
{% set url = record_thumbnail_url(story) %}
|
||||
|
||||
{% set box_w = 90 %}
|
||||
{% set box_h = 96 %}
|
||||
|
||||
{% set original_h = thumb_h > 0 ? thumb_h : 90 %}
|
||||
{% set original_w = thumb_w > 0 ? thumb_w : 90 %}
|
||||
|
||||
{% set fit_size = fitIn(
|
||||
{"width":original_w, "height":original_h},
|
||||
{"width":box_w, "height":box_h}
|
||||
)
|
||||
%}
|
||||
|
||||
<div id="PREVMAINREG" class="PNB10">
|
||||
<img onclick="openPreview('REG',0,'{{regroupement.get_serialize_key()}}')"
|
||||
src="{{thumbnail.get_url()}}" style="position:relative;{{style}}" />
|
||||
<img onclick="openPreview('REG',0,'{{story.get_serialize_key}}')"
|
||||
src="{{url}}"
|
||||
style="
|
||||
width:{{fit_size.width}}px;
|
||||
height:{{fit_size.height}}px;
|
||||
top:{{fit_size.top}}px;
|
||||
position:relative;
|
||||
" />
|
||||
</div>
|
||||
|
||||
|
||||
<div id="PREVIEWCURRENTCONT" class="PNB10 group_case">
|
||||
<ul>
|
||||
{% for record_item in record.get_train %}
|
||||
{% set thumb_w = 70 %}
|
||||
{% set thumb_h = 70 %}
|
||||
|
||||
{% for contained in record.get_train %}
|
||||
{% set thumbnail = contained.get_thumbnail() %}
|
||||
{% set thumbnail = record_item.get_thumbnail %}
|
||||
|
||||
{% if thumbnail.is_paysage %}
|
||||
{% set style = 'width:65px;top:' %}
|
||||
{% set top = ((66 - (65 / (thumbnail.get_width() / thumbnail.get_height()))) / 2)|round %}
|
||||
{% set style = style ~ top %}
|
||||
{% set style = style ~ 'px;' %}
|
||||
{% else %}
|
||||
{% set style = 'height:65px;top:8px;' %}
|
||||
{% endif %}
|
||||
{% if thumbnail is not none %}
|
||||
{% set thumb_w = thumbnail.get_width %}
|
||||
{% set thumb_h = thumbnail.get_height %}
|
||||
{% endif %}
|
||||
|
||||
{% set tooltip = '' %}
|
||||
{% if app['conf'].get(['registry', 'classic', 'stories-preview']) %}
|
||||
{% set tooltip = path('prod_tooltip_caption', { 'sbas_id' : contained.get_sbas_id(), 'record_id' : contained.get_record_id(), 'context' : 'preview', 'number' : contained.get_number() }) %}
|
||||
{% endif %}
|
||||
{% set url = record_thumbnail_url(record_item) %}
|
||||
|
||||
{% set class = '' %}
|
||||
{% if loop.index == record.get_number() %}
|
||||
{% set class = ' selected' %}
|
||||
{% endif %}
|
||||
{% set box_w = 70 %}
|
||||
{% set box_h = 80 %}
|
||||
|
||||
<li class="{{class}} prevTrainCurrent" style="">
|
||||
<img {% if tooltip %}tooltipsrc="{{ tooltip }}"{% endif %} jsargs="REG|{{loop.index}}|{{regroupement.get_serialize_key}}"
|
||||
class="openPreview prevRegToolTip" src="{{thumbnail.get_url()}}"
|
||||
style="{{style}}margin:7px;position:relative;"/></li>
|
||||
{% set original_h = thumb_h > 0 ? thumb_h : 70 %}
|
||||
{% set original_w = thumb_w > 0 ? thumb_w : 70 %}
|
||||
|
||||
{% set fit_size = fitIn(
|
||||
{"width":original_w, "height":original_h},
|
||||
{"width":box_w, "height":box_h}
|
||||
)
|
||||
%}
|
||||
|
||||
<li class="{% if loop.index == record.get_number %}selected{% endif %} prevTrainCurrent" style="">
|
||||
<img {% if app['conf'].get(['registry', 'classic', 'stories-preview']) %}tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record_item.databoxId, 'record_id' : record_item.recordId, 'context' : 'preview', 'number' : record_item.get_number }) }}"{% endif %}
|
||||
jsargs="REG|{{loop.index}}|{{story.get_serialize_key}}"
|
||||
class="openPreview prevRegToolTip" src="{{url}}"
|
||||
style="
|
||||
width:{{fit_size.width}}px;
|
||||
height:{{fit_size.height}}px;
|
||||
top:{{fit_size.top}}px;
|
||||
position:relative;
|
||||
"
|
||||
/></li>
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
|
@@ -1,30 +1,41 @@
|
||||
<div id="PREVIEWCURRENTCONT" class="PNB10">
|
||||
<ul>
|
||||
{% for rec in records %}
|
||||
{% for record in records %}
|
||||
|
||||
{% set thumbnail = rec.get_thumbnail() %}
|
||||
{% set w = thumbnail.get_width() %}
|
||||
{% set h = thumbnail.get_height() %}
|
||||
{% set thumb_w = 70 %}
|
||||
{% set thumb_h = 70 %}
|
||||
|
||||
{% if thumbnail.is_paysage() %}
|
||||
{% set style = 'width:65px;top:' %}
|
||||
{% set top = ((66 - (65 / (w / h))) / 2)|round %}
|
||||
{% set style = style ~ top %}
|
||||
{% set style = style ~ 'px;' %}
|
||||
{% else %}
|
||||
{% set style = 'height:65px;top:0;' %}
|
||||
{% set thumbnail = record.subdefs.get('thumbnail') %}
|
||||
|
||||
{% if thumbnail is not none %}
|
||||
{% set thumb_w = thumbnail.width %}
|
||||
{% set thumb_h = thumbnail.height %}
|
||||
{% endif %}
|
||||
|
||||
{% if selected == rec.get_number() %}
|
||||
{% set class = ' selected ' %}
|
||||
{% else %}
|
||||
{% set class = '' %}
|
||||
{% endif %}
|
||||
{% set url = record_thumbnail_url(record) %}
|
||||
|
||||
<li class="prevTrainCurrent current{{rec.get_number()}} {{class}}" style="">
|
||||
<!--<div class="doc_infos">' . $array_icons[$record->get_type()] . '<span class="duration">{{rec.get_formated_duration()}}</span></div>-->
|
||||
<img jsargs="RESULT|{{rec.get_number()}}|" class="openPreview" src="{{thumbnail.get_url()}}"
|
||||
style="{{style}}margin:7px;position:relative;"/>
|
||||
{% set box_w = 70 %}
|
||||
{% set box_h = 80 %}
|
||||
|
||||
{% set original_h = thumb_h > 0 ? thumb_h : 70 %}
|
||||
{% set original_w = thumb_w > 0 ? thumb_w : 70 %}
|
||||
|
||||
{% set fit_size = fitIn(
|
||||
{"width":original_w, "height":original_h},
|
||||
{"width":box_w, "height":box_h}
|
||||
)
|
||||
%}
|
||||
|
||||
<li class="prevTrainCurrent current{{loop.index0}} {% if loop.index0 == selected %}selected{% endif %}">
|
||||
<img jsargs="RESULT|{{loop.index0}}|" class="openPreview" src="{{url}}"
|
||||
src="{{url}}"
|
||||
style="
|
||||
width:{{fit_size.width}}px;
|
||||
height:{{fit_size.height}}px;
|
||||
top:{{fit_size.top}}px;
|
||||
position:relative;
|
||||
"
|
||||
/>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
|
@@ -1,20 +0,0 @@
|
||||
{% import 'prod/results/record.html.twig' as record_format %}
|
||||
|
||||
{% if results.getError() %}
|
||||
<div>{{results.getError()}}</div>
|
||||
{% else %}
|
||||
{% if results.getWarning() %}
|
||||
<div>{{results.getWarning()}}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if suggestions %}
|
||||
{% set suggestions = suggestions|e %}
|
||||
{% set link = '<a href="#" onclick="doSpecialSearch(\'' ~ suggestions ~ '\');return false;">' ~ suggestions ~ '</a>' %}
|
||||
{% trans with {'%link%' : link} %}Voulez-vous dire %link% ?{% endtrans %}
|
||||
<br/>
|
||||
{% endif %}
|
||||
{% set th_size = app['settings'].getUserSetting(app['authentication'].getUser(), 'images_size')%}
|
||||
<div class="selectable" style="margin:10px 0; float:left;">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
{% endif %}
|
@@ -1,11 +0,0 @@
|
||||
|
||||
{% extends "prod/results/answerabstract.html.twig" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% for record in results.getResults() %}
|
||||
{{record_format.block(record, highlight, searchEngine, 'IMGT', false)}}
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
@@ -1,27 +0,0 @@
|
||||
{% extends "prod/results/answerabstract.html.twig" %}
|
||||
{% block content %}
|
||||
|
||||
{% import 'common/macros.html.twig' as macro %}
|
||||
|
||||
{% for record in results.getResults() %}
|
||||
<div class='list ui-corner-all'>
|
||||
<table style='width:100%;' cellspacing='0' cellpadding='0' border='0'>
|
||||
<tr>
|
||||
<td valign="top" style='width:{{th_size+50}}px'>
|
||||
{{ record_format.block(record, highlight, searchEngine, 'IMGT', false) }}
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<div class='desc' style='max-height:{{th_size+70}}px;overflow-y:auto;'>
|
||||
<div class="fixeddesc">
|
||||
{% set business = app['acl'].get(app['authentication'].getUser()).has_right_on_base(record.get_base_id(), 'canmodifrecord') %}
|
||||
{{ macro.format_caption(record, highlight, searchEngine, searchOptions, business, true, true) }}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
70
templates/web/prod/results/entry.html.twig
Normal file
70
templates/web/prod/results/entry.html.twig
Normal file
@@ -0,0 +1,70 @@
|
||||
{% import 'prod/results/macro.html.twig' as result_macro %}
|
||||
|
||||
<div class="entry ui-corner-all" id="entry_{{ entry.id }}">
|
||||
<table class="head">
|
||||
<tr>
|
||||
<td>
|
||||
<h1 class="title">
|
||||
{% if feed.aggregated %}
|
||||
<img style="height:16px;" src="{% if entry.feed.iconUrl == false %} /skins/icons/rss32.gif{% else %}/custom/feed_{{ entry.feed.id }}.jpg{% endif %}"/>
|
||||
{% endif %}
|
||||
{{ entry.title }}
|
||||
{% set author = entry.authorName %}
|
||||
<span class="author">
|
||||
{% trans with {'%author%' : author} %}Par %author%{% endtrans %}
|
||||
</span>
|
||||
</h1>
|
||||
</td>
|
||||
<td style="width:60px;text-align:right;">
|
||||
{% if entry.feed.isOwner(app['authentication'].user) or entry.isPublisher(app['authentication'].user) %}
|
||||
<a class="tools options feed_edit" href="{{ path('prod_feeds_entry_edit', { 'id' : entry.id }) }}">
|
||||
<img src="/skins/icons/file-edit.png" title="{{ 'boutton::editer' | trans }}"/>
|
||||
</a>
|
||||
<a class="tools feed_delete"href="{{ path('prod_feeds_entry_delete', { 'id' : entry.id }) }}">
|
||||
<img src="/skins/icons/delete.png" title="{{ 'boutton::supprimer' | trans }}"/>
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="post_date">
|
||||
{% set updated_on = app['date-formatter'].getPrettyString(entry.updatedOn) %}
|
||||
{% set created_on = app['date-formatter'].getPrettyString(entry.createdOn) %}
|
||||
<span class="created_on">
|
||||
{{ created_on }}
|
||||
</span>
|
||||
{% if created_on != updated_on %}
|
||||
<span class="updated_on">
|
||||
(
|
||||
{% trans with {'%updated_on%' : updated_on} %}Derniere mise a jour le %updated_on%{% endtrans %}
|
||||
)
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if feed.aggregated %}
|
||||
<a class="ajax_answers" href="{{ path('prod_feeds_feed', { 'id' : entry.feed.id }) }}">
|
||||
{% set feed_name = entry.feed.title %}
|
||||
{% trans with {'%feed_name%' : feed_name} %}dans %feed_name%{% endtrans %}
|
||||
<img style="height:16px;" src="{% if entry.feed.iconUrl == false %}/skins/icons/rss32.gif{% else %}/custom/feed_{{ entry.feed.id }}.jpg{% endif %}"/>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<p>{{ entry.getSubtitle()|nl2br|raw }}</p>
|
||||
|
||||
<div class="contents selectable">
|
||||
{% for item in entry.items %}
|
||||
{% block item %}
|
||||
{% include 'prod/results/item.html.twig' with {
|
||||
'item' : item,
|
||||
'entry': entry,
|
||||
'settings': {
|
||||
'images_size': images_size,
|
||||
'technical_display': technical_display,
|
||||
'rollover_thumbnail': rollover_thumbnail,
|
||||
'doctype_display': doctype_display
|
||||
}
|
||||
} %}
|
||||
{% endblock %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
97
templates/web/prod/results/feeds.html.twig
Normal file
97
templates/web/prod/results/feeds.html.twig
Normal file
@@ -0,0 +1,97 @@
|
||||
{% block result %}
|
||||
<div class="feed">
|
||||
{# header for first page #}
|
||||
{% if page == 1 %}
|
||||
<div class="headblock">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:600px;">
|
||||
<h1>
|
||||
<img src="{% if feed.iconUrl == false %}/skins/icons/rss32.gif{% else %}{% endif %}" style="height:32px;"/>
|
||||
{% if feed.isAggregated %}
|
||||
{{ 'Toutes les publications' | trans }}
|
||||
<a class="subscribe_rss" href="{{ path('prod_feeds_subscribe_aggregated') }}">
|
||||
{{ 'publications:: s\'abonner aux publications' | trans }}
|
||||
</a>
|
||||
<a class="feed_reload ajax_answers no_scroll" href="{{ path('prod_feeds') }}" >
|
||||
<img src="/skins/icons/reload.png" title="{{ 'rafraichir' | trans }}" />
|
||||
</a>
|
||||
{% else %}
|
||||
{{ feed.title }}
|
||||
<a class="feed_reload ajax_answers" href="{{ path('prod_feeds_feed', { 'id' : feed.id }) }}" >
|
||||
<img src="/skins/icons/reload.png" title="{{ 'rafraichir' | trans }}" />
|
||||
</a>
|
||||
<a class="subscribe_rss" href="{{ path('prod_feeds_subscribe_feed', { 'id' : feed.id }) }}">
|
||||
{{ 'publications:: s\'abonner aux publications' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</h1>
|
||||
</td>
|
||||
<td>
|
||||
<div class="menu_feeds">
|
||||
<div class="btn-group">
|
||||
<button class="trigger btn btn-inverse dropdown-toggle" data-toggle="dropdown">
|
||||
{{ 'Aller a' | trans }}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="submenu dropdown-menu">
|
||||
{% for aval_feed in feeds %}
|
||||
<li>
|
||||
<a class="ajax_answers" href="{{ path('prod_feeds_feed', { 'id' : aval_feed.id }) }}">
|
||||
<img src="{% if aval_feed.iconUrl == false %}/skins/icons/rss32.gif{% else %}/custom/feed_{{ aval_feed.id }}.jpg{% endif %}" style="height:16px;"/> {{ aval_feed.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% block content %}
|
||||
{% set images_size = user_setting('images_size') %}
|
||||
{% set technical_display = user_setting('technical_display') %}
|
||||
{% set rollover_thumbnail = user_setting('rollover_thumbnail') %}
|
||||
{% set doctype_display = user_setting('doctype_display') %}
|
||||
|
||||
{% set offset_start = ((page - 1) * 5 )%}
|
||||
{% set entries = feed.getEntries(offset_start,5) %}
|
||||
|
||||
{% for entry in entries %}
|
||||
{% block content_item %}
|
||||
{% include 'prod/results/entry.html.twig' with {
|
||||
'feed': feed,
|
||||
'entry': entry,
|
||||
'settings': {
|
||||
'images_size': images_size,
|
||||
'technical_display': technical_display,
|
||||
'rollover_thumbnail': rollover_thumbnail,
|
||||
'doctype_display': doctype_display
|
||||
}
|
||||
} %}
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
<p>{{ 'Aucune entree pour le moment' | trans }}</p>
|
||||
{% endfor %}
|
||||
|
||||
{# pagination #}
|
||||
{% if feed.countTotalEntries > (page * 5) %}
|
||||
{% set next_page = page + 1 %}
|
||||
<div class="see_more">
|
||||
{% if feed.aggregated %}
|
||||
<a href="{{ path('prod_feeds', { page : next_page }) }}" class="ajax_answers append">
|
||||
{{ 'charger d\'avantage de publications' | trans }}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ path('prod_feeds_feed', { 'id' : feed.id, 'page' : next_page }) }}" class="ajax_answers append">
|
||||
{{ 'charger d\'avantage de publications' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
4
templates/web/prod/results/grid.html.twig
Normal file
4
templates/web/prod/results/grid.html.twig
Normal file
@@ -0,0 +1,4 @@
|
||||
{% include 'prod/results/record.html.twig' with {
|
||||
'record': record,
|
||||
'settings': settings
|
||||
} %}
|
@@ -1,85 +1,73 @@
|
||||
{% block content %}
|
||||
{% if results.getError() %}
|
||||
<div>{{results.getError()}}</div>
|
||||
{% else %}
|
||||
{% if results.getWarning() %}
|
||||
<div>{{results.getWarning()}}</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if results.error %}
|
||||
<div>{{ results.error }}</div>
|
||||
{% elseif results.warning %}
|
||||
<div>{{ results.warning }}</div>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
{{ 'Votre recherche ne retourne aucun resultat' | trans }}
|
||||
</p>
|
||||
<p>
|
||||
{{ 'Votre recherche ne retourne aucun resultat' | trans }}
|
||||
</p>
|
||||
|
||||
|
||||
{% if suggestions %}
|
||||
{% set link = '<a href="#" onclick="doSpecialSearch(\'' ~ suggestions ~ '\');return false;">' ~ suggestions ~ '</a>' %}
|
||||
{% trans with {'%link%' : link} %}Voulez-vous dire %link% ?{% endtrans %}
|
||||
<br/>
|
||||
{% endif %}
|
||||
|
||||
{% set th_size = app['settings'].getUserSetting(app['authentication'].getUser(), 'images_size')%}
|
||||
|
||||
{% if app['locale'] == 'fr' %}
|
||||
<div class="client_help">
|
||||
<h5>{{ 'La recherche s\'effectue grâce à la boîte de dialogue qui se trouve en haut à gauche de l\'écran.' | trans }}
|
||||
{{ 'Sachez que vous pouvez utiliser les opérateurs ou caractères spéciaux suivants :' | trans }}</h5>
|
||||
<h5 style="border:#CCCCCC 2px solid">{{ '* , ? , ET , OU , SAUF , DANS , DERNIERS , TOUT (ou AND , OR , EXCEPT , LAST , ALL)' | trans }}</h5>
|
||||
<h5>{{ 'La recherche s\'effectue grâce à la boîte de dialogue qui se trouve en haut à gauche de l\'écran.' | trans }}
|
||||
{{ 'Sachez que vous pouvez utiliser les opérateurs ou caractères spéciaux suivants :' | trans }}</h5>
|
||||
<h5 style="border:#CCCCCC 2px solid">{{ '* , ? , ET , OU , SAUF , DANS , DERNIERS , TOUT (ou AND , OR , EXCEPT , LAST , ALL)' | trans }}</h5>
|
||||
|
||||
<H5>{{ 'Caractères de troncature' | trans }}</H5>
|
||||
<h5>{{ 'Caractères de troncature' | trans }}</h5>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'auto*' | trans }}</kbd></td>
|
||||
<td valign="top"> {{ 'retourne "automobile", "automate", "autoroute", ...' | trans }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'dé?it' | trans }}</kbd></td>
|
||||
<td valign="top"> {{ 'retourne "délit", "débit", ...' | trans }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'auto*' | trans }}</kbd></td>
|
||||
<td valign="top"> {{ 'retourne "automobile", "automate", "autoroute", ...' | trans }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'dé?it' | trans }}</kbd></td>
|
||||
<td valign="top"> {{ 'retourne "délit", "débit", ...' | trans }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<H5>{{ 'Visualiser tous les enregistrements / les derniers enregistrements' | trans }}</H5>
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky"><b>{{ 'TOUT' | trans }}</b></kbd></td>
|
||||
<td valign="top">{{ 'retourne tous les enregistrements des collections selectionnees' | trans }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky"><b>{{ 'LAST 20' | trans }}</b></kbd></td>
|
||||
<td valign="top">{{ 'retourne les 20 derniers enregistrements archives dans les collections selectionnees' | trans }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h5>{{ 'Visualiser tous les enregistrements / les derniers enregistrements' | trans }}</h5>
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky"><b>{{ 'TOUT' | trans }}</b></kbd></td>
|
||||
<td valign="top">{{ 'retourne tous les enregistrements des collections selectionnees' | trans }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky"><b>{{ 'LAST 20' | trans }}</b></kbd></td>
|
||||
<td valign="top">{{ 'retourne les 20 derniers enregistrements archives dans les collections selectionnees' | trans }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<H5>{{ 'Recherche multicritères' | trans }}</H5>
|
||||
{{ 'Vous pouvez affiner votre recherche avec les opérateurs : ET, OU, SAUF ou DANS' | trans }}<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'sport' | trans }} <b>ET</b> {{ 'automobile' | trans }}</kbd></td>
|
||||
<td valign="top">{{ 'retourne les documents comprenant les deux mots.' | trans }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'journal OU jt' | trans }}</kbd></td>
|
||||
<td valign="top">{{ 'retourne les documents comprenant un mot et/ou l\'autre.' | trans }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'cannes SAUF festival' | trans }}</kbd></td>
|
||||
<td valign="top">{{ 'retourne les documents comprenant cannes sans le mot festival.' | trans }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'thalassa DANS titre' | trans }}</kbd></td>
|
||||
<td valign="top">{{ 'retourne les documents où le terme est au moins présent dans le titre, en évitant par exemple celles où le terme est uniquement cité dans la légende.' | trans }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h5>{{ 'Recherche multicritères' | trans }}</h5>
|
||||
{{ 'Vous pouvez affiner votre recherche avec les opérateurs : ET, OU, SAUF ou DANS' | trans }}<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'sport' | trans }} <b>ET</b> {{ 'automobile' | trans }}</kbd></td>
|
||||
<td valign="top">{{ 'retourne les documents comprenant les deux mots.' | trans }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'journal OU jt' | trans }}</kbd></td>
|
||||
<td valign="top">{{ 'retourne les documents comprenant un mot et/ou l\'autre.' | trans }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'cannes SAUF festival' | trans }}</kbd></td>
|
||||
<td valign="top">{{ 'retourne les documents comprenant cannes sans le mot festival.' | trans }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><kbd class="ky">{{ 'thalassa DANS titre' | trans }}</kbd></td>
|
||||
<td valign="top">{{ 'retourne les documents où le terme est au moins présent dans le titre, en évitant par exemple celles où le terme est uniquement cité dans la légende.' | trans }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<center>
|
||||
<h3 style="background-color:#CCCCCC; color:#000000">{{ 'Attention' | trans }}</h3>
|
||||
<h4> {{ 'pour chercher une phrase contenant un des mots-clé ci-dessus, utilisez les guillemets :' | trans }}</h4>
|
||||
<kbd class='tx'><i>"</i>{{ 'C dans l\'air' | trans }}<i>"</i></kbd>
|
||||
, <kbd class='tx'><i>"</i>{{ 'Et Dieu créa la femme' | trans }}<i>"</i></kbd>
|
||||
, <kbd class='tx'><i>"</i>{{ 'bijou en or' | trans }}<i>"</i></kbd>
|
||||
, <kbd class='tx'><i>"</i>{{ 'tout le sport' | trans }}<i>"</i></kbd>
|
||||
</center>
|
||||
<center>
|
||||
<h3 style="background-color:#CCCCCC; color:#000000">{{ 'Attention' | trans }}</h3>
|
||||
<h4> {{ 'pour chercher une phrase contenant un des mots-clé ci-dessus, utilisez les guillemets :' | trans }}</h4>
|
||||
<kbd class='tx'><i>"</i>{{ 'C dans l\'air' | trans }}<i>"</i></kbd>
|
||||
, <kbd class='tx'><i>"</i>{{ 'Et Dieu créa la femme' | trans }}<i>"</i></kbd>
|
||||
, <kbd class='tx'><i>"</i>{{ 'bijou en or' | trans }}<i>"</i></kbd>
|
||||
, <kbd class='tx'><i>"</i>{{ 'tout le sport' | trans }}<i>"</i></kbd>
|
||||
</center>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
80
templates/web/prod/results/item.html.twig
Normal file
80
templates/web/prod/results/item.html.twig
Normal file
@@ -0,0 +1,80 @@
|
||||
{% import 'common/thumbnail.html.twig' as thumbnail %}
|
||||
|
||||
{% set record = item.record(app) %}
|
||||
|
||||
<div style="width:{{ images_size+30 }}px;"
|
||||
sbas="{{ record.databoxId }}"
|
||||
id="{{'PUBLI_' ~ entry.id ~ '_' ~ record.id }}"
|
||||
class="IMGT diapo type-{{ record.type }}"
|
||||
onDblClick="openPreview('FEED',{{ record.get_number }},{{ entry.id }});"
|
||||
>
|
||||
<div style="padding: 4px;">
|
||||
<div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;">
|
||||
<div class="title" style="max-height:100%" title="{{ record.get_title }}">
|
||||
{{ record.get_title }}
|
||||
</div>
|
||||
<div class="status">
|
||||
{{ record.get_status_icons|raw }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% set rollover_gif = record.get_rollover_thumbnail %}
|
||||
|
||||
{% if rollover_thumbnail == 'caption' %}
|
||||
{% set tooltipsrc = path('prod_tooltip_caption', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId, 'context' : 'publi' }) %}
|
||||
{% elseif rollover_thumbnail == 'preview' %}
|
||||
{% set tooltipsrc = path('prod_tooltip_preview', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) %}
|
||||
{% endif %}
|
||||
|
||||
<div class="thumb captionTips " tooltipsrc="{{ tooltipsrc }}"
|
||||
style="height:{{ images_size }}px; z-index:90;">
|
||||
<div class="doc_infos">
|
||||
{% if doctype_display %}
|
||||
{{ record_doctype_icon(record) }}
|
||||
{% endif %}
|
||||
<span class="duration">
|
||||
{{ record.get_formated_duration }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="{% if rollover_gif %}rollovable{% endif %}">
|
||||
{% set extraclass = rollover_gif ? 'rollover-gif-out' : '' %}
|
||||
{{ thumbnail.format(record.get_thumbnail(), images_size, images_size, extraclass, true, false) }}
|
||||
{% if rollover_gif %}
|
||||
{{ thumbnail.format(rollover_gif, images_size, images_size, 'rollover-gif-hover', true, false) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="height: 25px; position:relative; text-align:left;">
|
||||
<table class="bottom" style="width:100%; table-layout:fixed;">
|
||||
<tr>
|
||||
<td style="text-align:left;text-overflow:ellipsis;overflow:hidden;">
|
||||
{{ record.get_collection_logo(app)|raw }}
|
||||
</td>
|
||||
{% set l_width = 30 %}
|
||||
{% if rollover_thumbnail == 'preview' %}
|
||||
{% set l_width = l_width + 20 %}
|
||||
{% endif %}
|
||||
{% if technical_display == '1' %}
|
||||
{% set l_width = l_width + 20 %}
|
||||
{% endif %}
|
||||
<td style='text-align:right;width:{{ l_width }}px;' valign='bottom'>
|
||||
{% if record.has_preview and has_access_subdef(record, 'preview') %}
|
||||
<div tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) }}"
|
||||
class="previewTips"></div>
|
||||
{% endif %}
|
||||
{% if 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>
|
||||
{% endif %}
|
||||
{% if 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"/>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
24
templates/web/prod/results/list.html.twig
Normal file
24
templates/web/prod/results/list.html.twig
Normal file
@@ -0,0 +1,24 @@
|
||||
{% import 'common/macros.html.twig' as macro %}
|
||||
|
||||
{% block content_item %}
|
||||
<div class='list ui-corner-all'>
|
||||
<table style='width:100%;' cellspacing='0' cellpadding='0' border='0'>
|
||||
<tr>
|
||||
<td valign="top" style='width:{{ settings.images_size + 50 }}px'>
|
||||
{% include 'prod/results/record.html.twig' with {
|
||||
'record': record,
|
||||
'settings': settings
|
||||
} %}
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<div class='desc' style='max-height:{{ settings.images_size + 70 }}px;overflow-y:auto;'>
|
||||
<div class="fixeddesc">
|
||||
{% set business = granted_on_collection(record.baseId, 'canmodifrecord') %}
|
||||
{{ macro.caption(record, business) }}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
69
templates/web/prod/results/macro.html.twig
Normal file
69
templates/web/prod/results/macro.html.twig
Normal file
@@ -0,0 +1,69 @@
|
||||
{% macro thumbnail(record, box_w, box_h, extra_class) %}
|
||||
{% set record_type = record.type %}
|
||||
|
||||
{% set thumb_w = 256 %}
|
||||
{% set thumb_h = 256 %}
|
||||
|
||||
{% set thumbnail = record.subdefs.get('thumbnail') %}
|
||||
{% if thumbnail is not none %}
|
||||
{% set thumb_w = thumbnail.width %}
|
||||
{% set thumb_h = thumbnail.height %}
|
||||
{% endif %}
|
||||
|
||||
{% set url = record_thumbnail_url(record) %}
|
||||
|
||||
{% set box_w = box_w|round %}
|
||||
{% set box_h = box_h|default(box_w)|round %}
|
||||
|
||||
{% set original_h = thumb_h > 0 ? thumb_h : 120 %}
|
||||
{% set original_w = thumb_w > 0 ? thumb_w : 120 %}
|
||||
|
||||
{% set fit_size = fitIn(
|
||||
{"width":original_w, "height":original_h},
|
||||
{"width":box_w, "height":box_h}
|
||||
)
|
||||
%}
|
||||
|
||||
<div style="width:{{box_w}}px;height:{{box_h}}px;" class="thumb_wrapper {{ extra_class|default('') }}">
|
||||
<img class="record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
||||
style="width:{{fit_size.width}}px;height:{{fit_size.height}}px;top:{{fit_size.top}}px;"
|
||||
src="{{ url }}" ondragstart="return false;">
|
||||
<input type="hidden" name="width" value="{{original_w}}"/>
|
||||
<input type="hidden" name="height" value="{{original_h}}"/>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro thumbnailgif(record, box_w, box_h, extra_class) %}
|
||||
{% set record_type = record.type %}
|
||||
|
||||
{% set thumb_w = 256 %}
|
||||
{% set thumb_h = 256 %}
|
||||
|
||||
{% set thumbnail = record.subdefs.get('thumbnailgif') %}
|
||||
{% if thumbnail is not none %}
|
||||
{% set thumb_w = thumbnail.width %}
|
||||
{% set thumb_h = thumbnail.height %}
|
||||
{% endif %}
|
||||
|
||||
{% set url = record_thumbnailgif_url(record) %}
|
||||
|
||||
{% set box_w = box_w|round %}
|
||||
{% set box_h = box_h|default(box_w)|round %}
|
||||
|
||||
{% set original_h = thumb_h > 0 ? thumb_h : 120 %}
|
||||
{% set original_w = thumb_w > 0 ? thumb_w : 120 %}
|
||||
|
||||
{% set fit_size = fitIn(
|
||||
{"width":original_w, "height":original_h},
|
||||
{"width":box_w, "height":box_h}
|
||||
)
|
||||
%}
|
||||
|
||||
<div style="width:{{box_w}}px;height:{{box_h}}px;" class="thumb_wrapper {{ extra_class|default('') }}">
|
||||
<img class="record record_image imgTips zoomable thumb" oncontextMenu="return(false);"
|
||||
style="width:{{fit_size.width}}px;height:{{fit_size.height}}px;top:{{fit_size.top}}px;"
|
||||
src="{{ url }}" ondragstart="return false;">
|
||||
<input type="hidden" name="width" value="{{original_w}}"/>
|
||||
<input type="hidden" name="height" value="{{original_h}}"/>
|
||||
</div>
|
||||
{% endmacro %}
|
@@ -1,105 +1,131 @@
|
||||
{% macro block(record, highlight, searchEngine, prefix, entry_id) %}
|
||||
{% import 'common/thumbnail.html.twig' as thumbnail %}
|
||||
{% import 'common/doctype_icons.html.twig' as doctype_icons %}
|
||||
{% import 'common/drop_down_options.html.twig' as drop_down %}
|
||||
{% set th_size = app['settings'].getUserSetting(app['authentication'].getUser(), 'images_size') %}
|
||||
{% set sbas_id = record.get_sbas_id %}
|
||||
{% set lazyload = app['phraseanet.configuration']['lazyload']|default(false) %}
|
||||
{% set container_attributes %}
|
||||
{% if entry_id %}
|
||||
class="IMGT diapo type-{{ record.get_type }}"
|
||||
onDblClick="openPreview('FEED',{{ record.get_number() }},{{ entry_id }});"
|
||||
{% elseif record.is_grouping() %}
|
||||
class="IMGT diapo grouping type-{{ record.get_type }}"
|
||||
onDblClick="openPreview('REG','0','{{ record.get_serialize_key() }}');"
|
||||
{% else %}
|
||||
class="IMGT diapo type-{{ record.get_type }}"
|
||||
onDblClick="openPreview('RESULT',{{ record.get_number }});"
|
||||
{% endif %}
|
||||
{% endset %}
|
||||
{% import 'prod/results/macro.html.twig' as result_macro %}
|
||||
|
||||
<div style="width:{{ th_size+30 }}px;" sbas="{{ sbas_id }}"
|
||||
id="{{ prefix|default('IMGT') }}_{{ record.get_sbas_id }}_{{ record.get_record_id }}" {{ container_attributes }}>
|
||||
<div style="padding: 4px;">
|
||||
<div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;">
|
||||
<div class="title" style="max-height:100%" title="{{ record.get_title() }}">
|
||||
{{ record.get_title() }}
|
||||
</div>
|
||||
<div class="status">
|
||||
{{ record.get_status_icons|raw }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% set rollover_gif = record.get_rollover_thumbnail() %}
|
||||
{% set user_technical_display = app['settings'].getUserSetting(app['authentication'].getUser(), 'technical_display') %}
|
||||
{% set user_rollover_thumbnail =app['settings'].getUserSetting(app['authentication'].getUser(), 'rollover_thumbnail') %}
|
||||
{% set extraclass = '' %}
|
||||
|
||||
{% if user_rollover_thumbnail == 'caption' and searchEngine is not null %}
|
||||
{% set extraclass = extraclass ~ ' captionTips' %}
|
||||
{% set tooltipsrc = path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'answer', 'number' : record.get_number() }) %}
|
||||
{% elseif user_rollover_thumbnail == 'caption' and searchEngine is null %}
|
||||
{% set extraclass = extraclass ~ ' captionTips' %}
|
||||
{% set tooltipsrc = path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'publi' }) %}
|
||||
{% elseif user_rollover_thumbnail == 'preview' %}
|
||||
{% set extraclass = extraclass ~ ' captionTips' %}
|
||||
{% set tooltipsrc = path('prod_tooltip_preview', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) %}
|
||||
{% endif %}
|
||||
|
||||
<div class="thumb {{ extraclass }} " tooltipsrc="{{ tooltipsrc }}"
|
||||
style="height:{{ th_size }}px; z-index:90;">
|
||||
<div class="doc_infos">
|
||||
{% if app['settings'].getUserSetting(app['authentication'].getUser(), 'doctype_display') == '1' %}
|
||||
{{ doctype_icons.format(record) }}
|
||||
{% endif %}
|
||||
<span class="duration">
|
||||
{{ record.get_formated_duration() }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="{% if rollover_gif %}rollovable{% endif %}">
|
||||
{% set extraclass = '' %}
|
||||
{% if rollover_gif %}
|
||||
{% set extraclass = 'rollover-gif-out' %}
|
||||
{% endif %}
|
||||
{{ thumbnail.format(record.get_thumbnail(), th_size, th_size, extraclass, true, lazyload) }}
|
||||
{% if rollover_gif %}
|
||||
{{ thumbnail.format(rollover_gif, th_size, th_size, 'rollover-gif-hover', true, lazyload) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="height: 25px; position:relative; text-align:left;">
|
||||
<table class="bottom" style="width:100%; table-layout:fixed;">
|
||||
<tr>
|
||||
<td style="text-align:left;text-overflow:ellipsis;overflow:hidden;">
|
||||
{{ record.get_collection_logo(app)|raw }}
|
||||
</td>
|
||||
{% set l_width = 30 %}
|
||||
{% if user_rollover_thumbnail == 'preview' %}
|
||||
{% set l_width = l_width + 20 %}
|
||||
{% endif %}
|
||||
{% if user_technical_display == '1' %}
|
||||
{% set l_width = l_width + 20 %}
|
||||
{% endif %}
|
||||
<td style='text-align:right;width:{{ l_width }}px;' valign='bottom'>
|
||||
{{ drop_down.prod(record, entry_id) }}
|
||||
{% if record.has_preview() and app['acl'].get(app['authentication'].getUser()).has_access_to_subdef(record, 'preview') %}
|
||||
<div tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) }}"
|
||||
class="previewTips"></div>
|
||||
{% endif %}
|
||||
{% if user_rollover_thumbnail == 'preview' %}
|
||||
<div tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'answer', 'number' : record.get_number() }) }}"
|
||||
class="captionRolloverTips"></div>
|
||||
{% endif %}
|
||||
{% if user_technical_display == '1' %}
|
||||
<img class="infoTips"
|
||||
tooltipsrc="{{ path('prod_tooltip_technical_data', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) }}"
|
||||
src="/skins/icons/info.gif"/>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div style="width:{{ settings.images_size + 30}}px;"
|
||||
sbas="{{ record.databoxId }}"
|
||||
id="{{ prefix|default('IMGT') }}_{{ record.id }}"
|
||||
class="IMGT diapo {% if record.story %}grouping{% endif %} type-{{ record.type }}"
|
||||
onDblClick="openPreview('{{ record.story ? 'REG' : 'RESULT' }}', '{{ record.position|default(0) }}', '{{ record.id }}');">
|
||||
<div style="padding: 4px;">
|
||||
<div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;">
|
||||
{# @todo title should be localized #}
|
||||
<div class="title" style="max-height:100%" title="{{ record.title }}">
|
||||
{{ record.title }}
|
||||
</div>
|
||||
<div class="status">
|
||||
{# @todo find a proper way to map lifted flag to status icon img path #}
|
||||
{#{{record.get_status_icons|raw}}#}
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% if settings.rollover_thumbnail == 'caption' %}
|
||||
{% set tooltip = path('prod_tooltip_caption', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId, 'context' : 'answer', 'number' : record.position|default(0) }) %}
|
||||
{% elseif settings.rollover_thumbnail == 'preview' %}
|
||||
{% set tooltip = path('prod_tooltip_preview', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) %}
|
||||
{% endif %}
|
||||
|
||||
<div class="thumb captionTips" tooltipsrc="{{ tooltip }}" style="height:{{ settings.images_size }}px; z-index:90;">
|
||||
<div class="doc_infos">
|
||||
{% if settings.doctype_display == '1' %}
|
||||
{{ record_doctype_icon(record) }}
|
||||
{% endif %}
|
||||
<span class="duration">
|
||||
{% if record.type == 'video' and attribute(record.exif, constant('\\media_subdef::TC_DATA_DURATION')) is defined %}
|
||||
{{ attribute(record.exif, constant('\\media_subdef::TC_DATA_DURATION')) }}
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
{% set rollover = record.subdefs.containsKey('thumbnailgif') %}
|
||||
{% set extraclass = '' %}
|
||||
<div class="{% if rollover %}rollovable{% endif %}">
|
||||
{% if rollover %}
|
||||
{% set extraclass = 'rollover-gif-out' %}
|
||||
{% endif %}
|
||||
|
||||
{{ result_macro.thumbnail(record, settings.images_size, settings.images_size, extraclass) }}
|
||||
|
||||
{% if rollover %}
|
||||
{% set extraclass = 'rollover-gif-hover' %}
|
||||
{{ result_macro.thumbnailgif(record, settings.images_size, settings.images_size, extraclass) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 25px; position:relative; text-align:left;">
|
||||
<table class="bottom" style="width:100%; table-layout:fixed;">
|
||||
<tr>
|
||||
<td style="text-align:left;text-overflow:ellipsis;overflow:hidden;">
|
||||
{{ collection_logo(record.baseId) }}
|
||||
</td>
|
||||
|
||||
{% set l_width = 30 %}
|
||||
|
||||
{% if settings.rollover_thumbnail == 'preview' %}
|
||||
{% set l_width = l_width + 20 %}
|
||||
{% elseif settings.technical_display == '1' %}
|
||||
{% set l_width = l_width + 20 %}
|
||||
{% endif %}
|
||||
|
||||
{# drop down options #}
|
||||
<td style='text-align:right;width:{{l_width}}px;' valign='bottom'>
|
||||
<a style="float:right;padding:0;margin:0;cursor:pointer;" class="contextMenuTrigger" id="contextTrigger_{{record.id}}">▼</a>
|
||||
<table cellspacing="0" cellpadding="0" style="display:none;" id="answerContext_{{record.id}}" class="contextMenu answercontextmenu">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="context-menu context-menu-theme-vista">
|
||||
{% if granted_on_collection(record.baseId, 'canputinalbum') and not record.story %}
|
||||
<div title="" class="context-menu-item">
|
||||
<div class="context-menu-item-inner"
|
||||
onclick="evt_add_in_chutier('{{record.databoxId}}','{{record.recordId}}',false,this);return(false);">
|
||||
{{ 'action : ajouter au panier' | trans }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if granted_on_collection(record.baseId, 'candwnldpreview') or granted_on_collection(record.baseId, 'candwnldhd') %}
|
||||
<div title="" class="context-menu-item">
|
||||
<div class="context-menu-item-inner"
|
||||
onclick="evt_dwnl('{{record.id}}',false,this);return(false);">
|
||||
{{ 'action : exporter' | trans }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div title="" class="context-menu-item">
|
||||
<div class="context-menu-item-inner"
|
||||
onclick="evt_print('{{record.id}}');return(false);">
|
||||
{{ 'action : print' | trans }}
|
||||
</div>
|
||||
</div>
|
||||
{% if app['conf'].get(['registry', 'actions', 'social-tools']) == 'all'
|
||||
or (app['conf'].get(['registry', 'actions', 'social-tools']) == 'publishers'
|
||||
and granted_on_databox(record.databoxId, 'bas_chupub')) %}
|
||||
{% if record.story is empty %}
|
||||
<div title="" class="context-menu-item">
|
||||
<div class="context-menu-item-inner"
|
||||
onclick="shareThis('{{record.baseId}}','{{record.recordId}}');">
|
||||
{{ 'reponses:: partager' | trans }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if record.subdefs.containsKey('preview') and has_access_subdef(record, 'preview') %}
|
||||
<div tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) }}" class="previewTips"></div>
|
||||
{% endif %}
|
||||
|
||||
{% if settings.rollover_thumbnail == 'preview' %}
|
||||
<div tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId, 'context' : 'answer', 'number' : record.position|default(0) }) }}" class="captionRolloverTips"></div>
|
||||
{% endif %}
|
||||
|
||||
{% if settings.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"/>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
38
templates/web/prod/results/records.html.twig
Normal file
38
templates/web/prod/results/records.html.twig
Normal file
@@ -0,0 +1,38 @@
|
||||
{% if results.error %}
|
||||
{% block result_error %}
|
||||
<div>
|
||||
{{ results.error }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
{% if results.warning %}
|
||||
{% block result_warning %}
|
||||
<div>
|
||||
{{ results.warning }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
|
||||
{% block content %}
|
||||
{% set images_size = user_setting('images_size') %}
|
||||
{% set technical_display = user_setting('technical_display') %}
|
||||
{% set rollover_thumbnail = user_setting('rollover_thumbnail') %}
|
||||
{% set doctype_display = user_setting('doctype_display') %}
|
||||
|
||||
<div class="selectable" style="margin:10px 0; float:left;">
|
||||
{% for record in results.results %}
|
||||
{% block content_item %}
|
||||
{% include (user_setting('view', 'thumbs') == 'thumbs') ? 'prod/results/grid.html.twig' : 'prod/results/list.html.twig' with {
|
||||
'record': record,
|
||||
'settings': {
|
||||
'images_size': images_size,
|
||||
'technical_display': technical_display,
|
||||
'rollover_thumbnail': rollover_thumbnail,
|
||||
'doctype_display': doctype_display
|
||||
}
|
||||
} %}
|
||||
{% endblock %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endif %}
|
@@ -1,5 +1,31 @@
|
||||
/******* GLOBAL PROD **********************************************************/
|
||||
|
||||
::-webkit-scrollbar-track
|
||||
{
|
||||
border-radius: 7px;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 14px;
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
height: 6px;
|
||||
border: 4px solid rgba(0, 0, 0, 0);
|
||||
background-clip: padding-box;
|
||||
-webkit-border-radius: 7px;
|
||||
background-color: #555;
|
||||
-webkit-box-shadow: inset -1px -1px 0px rgba(0, 0, 0, 0.05), inset 1px 1px 0px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
::-webkit-scrollbar-button {
|
||||
width: 0;
|
||||
height: 0;
|
||||
display: none;
|
||||
}
|
||||
::-webkit-scrollbar-corner {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
html {
|
||||
border: medium none;
|
||||
height: 100%;
|
||||
@@ -763,7 +789,7 @@ div.diapo {
|
||||
left: 0pt;
|
||||
right: 1px;
|
||||
bottom: 0px;
|
||||
overflow-y: scroll;
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
background-color: #404040;
|
||||
}
|
||||
|
@@ -1,5 +1,31 @@
|
||||
/******* GLOBAL PROD **********************************************************/
|
||||
|
||||
::-webkit-scrollbar-track
|
||||
{
|
||||
border-radius: 7px;
|
||||
background-color: #d9d9d9;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 14px;
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
height: 6px;
|
||||
border: 4px solid rgba(0, 0, 0, 0);
|
||||
background-clip: padding-box;
|
||||
-webkit-border-radius: 7px;
|
||||
background-color: #555;
|
||||
-webkit-box-shadow: inset -1px -1px 0px rgba(0, 0, 0, 0.05), inset 1px 1px 0px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
::-webkit-scrollbar-button {
|
||||
width: 0;
|
||||
height: 0;
|
||||
display: none;
|
||||
}
|
||||
::-webkit-scrollbar-corner {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
html {
|
||||
border: medium none;
|
||||
height: 100%;
|
||||
@@ -779,7 +805,7 @@ div.diapo {
|
||||
left: 0pt;
|
||||
right: 1px;
|
||||
bottom: 0px;
|
||||
overflow-y: scroll;
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
background-color: #B1B1B1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user