diff --git a/composer.lock b/composer.lock index e9acd51248..b6778cc408 100644 --- a/composer.lock +++ b/composer.lock @@ -2109,16 +2109,16 @@ }, { "name": "php-ffmpeg/php-ffmpeg", - "version": "0.4.3", + "version": "0.4.4", "source": { "type": "git", "url": "https://github.com/alchemy-fr/PHP-FFmpeg.git", - "reference": "554cec2bc7b76e222aeef083205ed3bd57327975" + "reference": "8dfaf1815802614352bbd10eac7299a100bf9757" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/PHP-FFmpeg/zipball/554cec2bc7b76e222aeef083205ed3bd57327975", - "reference": "554cec2bc7b76e222aeef083205ed3bd57327975", + "url": "https://api.github.com/repos/alchemy-fr/PHP-FFmpeg/zipball/8dfaf1815802614352bbd10eac7299a100bf9757", + "reference": "8dfaf1815802614352bbd10eac7299a100bf9757", "shasum": "" }, "require": { @@ -2174,7 +2174,7 @@ "video", "video processing" ], - "time": "2013-12-02 13:48:20" + "time": "2013-12-17 16:54:46" }, { "name": "php-mp4box/php-mp4box", diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index c2c91d22d4..9b57f7cf66 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -633,10 +633,24 @@ class Application extends SilexApplication return ConnectedUsers::appName($app['translator'], $value); })); $twig->addFilter(new \Twig_SimpleFilter('escapeSimpleQuote', function ($value) { - $ret = str_replace("'", "\'", $value); + $ret = str_replace("'", "\\'", $value); return $ret; })); + $twig->addFilter(new \Twig_SimpleFilter('thesaurus', function (\Twig_Environment $twig, $value) { + if (!$value instanceof \ThesaurusValue) { + return twig_escape_filter($twig, str_replace(array('[[em]]', '[[/em]]'), array('', ''), $value)); + } + + return "getField()->get_databox()->get_sbas_id() . "','" + . str_replace("'", "\\'", $value->getQuery()) + . "', '" + . str_replace("'", "\\'", $value->getField()->get_name()) + . "');return(false);\">" + . twig_escape_filter($twig, str_replace(array('[[em]]', '[[/em]]'), array('', ''), $value->getValue())) + . ""; + }, array('needs_environment' => true, 'is_safe' => array('html')))); + $twig->addFilter(new \Twig_SimpleFilter('escapeDoubleQuote', function ($value) { return str_replace('"', '\"', $value); })); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Export.php b/lib/Alchemy/Phrasea/Controller/Prod/Export.php index ed4af90e54..42d69eb407 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Export.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Export.php @@ -116,7 +116,7 @@ class Export implements ControllerProviderInterface { $download = new \set_exportftp($app, $request->request->get('lst'), $request->request->get('ssttid')); - $mandatoryParameters = ['address', 'login', 'dest_folder', 'prefix_folder', 'obj']; + $mandatoryParameters = ['address', 'login', 'obj']; foreach ($mandatoryParameters as $parameter) { if (!$request->request->get($parameter)) { diff --git a/lib/Alchemy/Phrasea/Helper/Prod.php b/lib/Alchemy/Phrasea/Helper/Prod.php index d85cf1d9d0..db4f3d72f5 100644 --- a/lib/Alchemy/Phrasea/Helper/Prod.php +++ b/lib/Alchemy/Phrasea/Helper/Prod.php @@ -29,6 +29,7 @@ class Prod extends Helper } $searchSet = json_decode($this->app['authentication']->getUser()->getPrefs('search'), true); + $saveSettings = $this->app['authentication']->getUser()->getPrefs('advanced_search_reload'); foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_sbas() as $databox) { $sbas_id = $databox->get_sbas_id(); @@ -41,8 +42,7 @@ class Prod extends Helper ]; foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]) as $coll) { - $selected = (isset($searchSet['bases']) && - isset($searchSet['bases'][$sbas_id])) ? (in_array($coll->get_base_id(), $searchSet['bases'][$sbas_id])) : true; + $selected = $saveSettings ? ((isset($searchSet['bases']) && isset($searchSet['bases'][$sbas_id])) ? (in_array($coll->get_base_id(), $searchSet['bases'][$sbas_id])) : true) : true; $bases[$sbas_id]['collections'][] = [ 'selected' => $selected, diff --git a/lib/Alchemy/Phrasea/Helper/User/Edit.php b/lib/Alchemy/Phrasea/Helper/User/Edit.php index e5526fd563..25312327c9 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/User/Edit.php @@ -610,6 +610,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $new_email = $user->get_email(); if ($old_email != $new_email) { + $oldReceiver = $newReceiver = null; try { $oldReceiver = new Receiver(null, $old_email); } catch (InvalidArgumentException $e) { diff --git a/lib/Alchemy/Phrasea/Notification/Emitter.php b/lib/Alchemy/Phrasea/Notification/Emitter.php index 5a4073c258..ec1d497cef 100644 --- a/lib/Alchemy/Phrasea/Notification/Emitter.php +++ b/lib/Alchemy/Phrasea/Notification/Emitter.php @@ -20,6 +20,10 @@ class Emitter implements EmitterInterface public function __construct($name, $email) { + if (!\Swift_Validate::email($email)) { + throw new InvalidArgumentException(sprintf('Invalid e-mail address (%s)', $email)); + } + $this->name = $name; $this->email = $email; } @@ -51,13 +55,6 @@ class Emitter implements EmitterInterface */ public static function fromUser(\User_Adapter $user) { - if (!\Swift_Validate::email($user->get_email())) { - throw new InvalidArgumentException(sprintf( - 'User provided does not have a valid e-mail address (%s)', - $user->get_email() - )); - } - return new static($user->get_display_name(), $user->get_email()); } } diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessFTPReceiver.php b/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessFTPReceiver.php new file mode 100644 index 0000000000..e16c39a391 --- /dev/null +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessFTPReceiver.php @@ -0,0 +1,67 @@ +server = $server; + } + + /** + * {@inheritdoc} + */ + public function getSubject() + { + if (!$this->server) { + throw new LogicException('You must set server before calling getSubject'); + } + + return $this->app->trans('task::ftp:Status about your FTP transfert from %application% to %server%', [ + '%application%' => $this->getPhraseanetTitle(), + '%server%' => $this->server, + ]); + } + + /** + * {@inheritdoc} + */ + public function getMessage() + { + return $this->message; + } + + /** + * {@inheritdoc} + */ + public function getButtonText() + { + } + + /** + * {@inheritdoc} + */ + public function getButtonURL() + { + } +} diff --git a/lib/Alchemy/Phrasea/Notification/Receiver.php b/lib/Alchemy/Phrasea/Notification/Receiver.php index 466efa547e..2d1e41b16b 100644 --- a/lib/Alchemy/Phrasea/Notification/Receiver.php +++ b/lib/Alchemy/Phrasea/Notification/Receiver.php @@ -20,6 +20,10 @@ class Receiver implements ReceiverInterface public function __construct($name, $email) { + if (!\Swift_Validate::email($email)) { + throw new InvalidArgumentException(sprintf('Invalid e-mail address (%s)', $email)); + } + $this->name = $name; $this->email = $email; } @@ -51,13 +55,6 @@ class Receiver implements ReceiverInterface */ public static function fromUser(\User_Adapter $user) { - if (!\Swift_Validate::email($user->get_email())) { - throw new InvalidArgumentException(sprintf( - 'User provided does not have a valid e-mail address (%s)', - $user->get_email() - )); - } - return new static($user->get_display_name(), $user->get_email()); } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php index e5e71dcd14..1d177f6df0 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php @@ -639,7 +639,7 @@ class PhraseaEngine implements SearchEngineInterface if ($sxe && $sxe->description && $sxe->description->$name) { $val = []; foreach ($sxe->description->$name as $value) { - $val[] = str_replace(['[[em]]', '[[/em]]'], ['', ''], (string) $value); + $val[] = (string) $value; } $separator = $field['separator'] ? $field['separator'][0] : ''; $val = implode(' ' . $separator . ' ', $val); diff --git a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php index 95b0008c70..1b7ea1dce2 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php @@ -552,8 +552,8 @@ class SphinxSearchEngine implements SearchEngineInterface } $opts = [ - 'before_match' => "", - 'after_match' => "", + 'before_match' => "[[em]]", + 'after_match' => "[[/em]]", ]; $fields_to_send = []; diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/FtpJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/FtpJob.php index d3e4eebbd3..d5178883c9 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Job/FtpJob.php +++ b/lib/Alchemy/Phrasea/TaskManager/Job/FtpJob.php @@ -12,6 +12,7 @@ namespace Alchemy\Phrasea\TaskManager\Job; use Alchemy\Phrasea\Application; +use Alchemy\Phrasea\Notification\Mail\MailSuccessFTPReceiver; use Alchemy\Phrasea\TaskManager\Editor\FtpEditor; use Alchemy\Phrasea\Exception\InvalidArgumentException; use Alchemy\Phrasea\Notification\Mail\MailSuccessFTPSender; @@ -391,7 +392,7 @@ class FtpJob extends AbstractJob try { $receiver = new Receiver(null, $export->getMail()); - $mail = MailSuccessFTPSender::create($app, $receiver, null, $receiver_message); + $mail = MailSuccessFTPReceiver::create($app, $receiver, null, $receiver_message); $mail->setServer($ftp_server); $app['notification.deliverer']->deliver($mail); } catch (\Exception $e) { diff --git a/lib/classes/User/Adapter.php b/lib/classes/User/Adapter.php index 8fbcebf4f6..72b7130219 100644 --- a/lib/classes/User/Adapter.php +++ b/lib/classes/User/Adapter.php @@ -76,6 +76,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface 'warning_on_delete_story' => 'true', 'client_basket_status' => '1', 'css' => '000000', + 'advanced_search_reload' => '1', 'start_page_query' => 'last', 'start_page' => 'QUERY', 'rollover_thumbnail' => 'caption', @@ -1037,16 +1038,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface return $this; } - $sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id'; - $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute([':id' => $this->id]); - $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) { - $this->_prefs[$row['prop']] = $row['value']; - } - foreach (self::$def_values as $k => $v) { if (!isset($this->_prefs[$k])) { if ($k == 'start_page_query' && $this->app['phraseanet.registry']->get('GV_defaultQuery')) { @@ -1068,6 +1059,16 @@ class User_Adapter implements User_Interface, cache_cacheableInterface ); } + $sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id'; + $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); + $stmt->execute([':id' => $this->id]); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + foreach ($rs as $row) { + $this->_prefs[$row['prop']] = $row['value']; + } + $this->preferences_loaded = true; return $this; diff --git a/lib/classes/User/Query.php b/lib/classes/User/Query.php index 58b5927c40..71a235f7f6 100644 --- a/lib/classes/User/Query.php +++ b/lib/classes/User/Query.php @@ -315,7 +315,7 @@ class User_Query implements User_QueryInterface } if ($this->last_model) { - $sql .= ' AND usr.lastModel = "' . mysql_real_escape_string($this->last_model) . '" '; + $sql .= ' AND usr.lastModel = ' . $this->app['phraseanet.appbox']->get_connection()->quote($this->last_model) . ' '; } $sql_like = []; diff --git a/lib/classes/caption/Field/ThesaurusValue.php b/lib/classes/caption/Field/ThesaurusValue.php new file mode 100644 index 0000000000..d62aa46d79 --- /dev/null +++ b/lib/classes/caption/Field/ThesaurusValue.php @@ -0,0 +1,47 @@ +value = $value; + $this->field = $field; + $this->query = $query; + } + + public function getValue() + { + return $this->value; + } + + public function getField() + { + return $this->field; + } + + public function getQuery() + { + return $this->query; + } + + public function __toString() + { + return $this->value; + } +} diff --git a/lib/classes/caption/Field/Value.php b/lib/classes/caption/Field/Value.php index 5bba1981ee..70ded50e33 100644 --- a/lib/classes/caption/Field/Value.php +++ b/lib/classes/caption/Field/Value.php @@ -346,73 +346,45 @@ class caption_Field_Value implements cache_cacheableInterface return $value; } - $DOM_branchs = $XPATH_thesaurus->query($tbranch); - - $fvalue = $value; - - $cleanvalue = str_replace(["", "", "'"], ["", "", "'"], $fvalue); + // ---------------- new code ---------------------- + $cleanvalue = str_replace(array("[[em]]", "[[/em]]", "'"), array("", "", "'"), $value); list($term_noacc, $context_noacc) = $this->splitTermAndContext($cleanvalue); $term_noacc = $this->app['unicode']->remove_indexer_chars($term_noacc); $context_noacc = $this->app['unicode']->remove_indexer_chars($context_noacc); + + // find all synonyms in all related branches + $q = "(" . $tbranch . ")//sy[@w='" . $term_noacc . "'"; if ($context_noacc) { - $q = "//sy[@w='" . $term_noacc . "' and @k='" . $context_noacc . "']"; + $q .= " and @k='" . $context_noacc . "']"; } else { - $q = "//sy[@w='" . $term_noacc . "' and not(@k)]"; + $q .= " and not(@k)]"; } - $qjs = $link = ""; + $q .= "/../sy"; - // loop on each linked branch for field - foreach ($DOM_branchs as $DOM_branch) { - $nodes = $XPATH_thesaurus->cache_query($q, $DOM_branch); - $lngfound = false; - foreach ($nodes as $node) { - if ($node->getAttribute("lng") == $this->app['locale']) { - // le terme est dans la bonne langue, on le rend cliquable - list($term, $context) = $this->splitTermAndContext($fvalue); - $term = str_replace(["", ""], ["", ""], $term); - $context = str_replace(["", ""], ["", ""], $context); - $qjs = $term; - if ($context) { - $qjs .= " [" . $context . "]"; - } - $link = $fvalue; + $nodes = $XPATH_thesaurus->query($q); - $lngfound = true; - break; - } - - $synonyms = $XPATH_thesaurus->query("sy[@lng='" . $this->app['locale'] . "']", $node->parentNode); - foreach ($synonyms as $synonym) { - $k = $synonym->getAttribute("k"); - if ($synonym->getAttribute("w") != $term_noacc || $k != $context_noacc) { - $link = $qjs = $synonym->getAttribute("v"); - $lngfound = true; - break; - } - } - - } - if (! $lngfound) { - list($term, $context) = $this->splitTermAndContext($fvalue); - $term = str_replace(["", ""], ["", ""], $term); - $context = str_replace(["", ""], ["", ""], $context); - $qjs = $term; - if ($context) { - $qjs .= " [" . $context . "]"; - } - $link = $fvalue; + // loop on every sy found + $bestnode = null; + $bestnote = 0; + foreach ($nodes as $node) { + $note = 0; + $note += ($node->getAttribute("lng") == $this->app['locale.I18n']) ? 4 : 0; + $note += ($node->getAttribute("w") == $term_noacc) ? 2 : 0; + if($context_noacc != "") + $note += ($node->getAttribute("k") == $context_noacc) ? 1 : 0; + if($note > $bestnote) + { + $bestnote = $note; + $bestnode = $node; } } + if($bestnode) + { + list($term, $context) = $this->splitTermAndContext(str_replace(array("[[em]]", "[[/em]]"), array("", ""), $value)); + $qjs = $term . ($context ? '['.$context.']' : ''); - if ($qjs) { - $value = "get_sbas_id() . "','" - . str_replace("'", "\'", $qjs) - . "', '" - . str_replace("'", "\'", $this->databox_field->get_name()) - . "');return(false);\">" - . $link - . ""; + $value = new ThesaurusValue($bestnode->getAttribute('v'), $this->databox_field, $qjs); } return $value; diff --git a/lib/classes/collection.php b/lib/classes/collection.php index 19653b102e..e9f95cf6c9 100644 --- a/lib/classes/collection.php +++ b/lib/classes/collection.php @@ -560,6 +560,12 @@ class collection implements cache_cacheableInterface '; + $sql = "SELECT GREATEST(0, MAX(ord)) + 1 AS ord FROM bas WHERE sbas_id = :sbas_id"; + $stmt = $conn->prepare($sql); + $stmt->execute(array(':sbas_id' => $sbas_id)); + $ord = $stmt->fetch(\PDO::FETCH_ASSOC); + $stmt->closeCursor(); + $sql = "INSERT INTO coll (coll_id, asciiname, prefs, logo) VALUES (null, :name, :prefs, '')"; @@ -574,11 +580,15 @@ class collection implements cache_cacheableInterface $new_id = (int) $connbas->lastInsertId(); - $sql = "INSERT INTO bas (base_id, active, server_coll_id, sbas_id, aliases) + $sql = "INSERT INTO bas (base_id, active, ord, server_coll_id, sbas_id, aliases) VALUES - (null, 1, :server_coll_id, :sbas_id, '')"; + (null, 1, :ord, :server_coll_id, :sbas_id, '')"; $stmt = $conn->prepare($sql); - $stmt->execute([':server_coll_id' => $new_id, ':sbas_id' => $sbas_id]); + $stmt->execute([ + ':server_coll_id' => $new_id, + ':sbas_id' => $sbas_id, + ':ord' => $ord['ord'] ?: 1, + ]); $stmt->closeCursor(); $new_bas = $conn->lastInsertId(); @@ -633,7 +643,7 @@ class collection implements cache_cacheableInterface VALUES (null, 1, :server_coll_id, :sbas_id, '')"; $stmt = $databox->get_appbox()->get_connection()->prepare($sql); - $stmt->execute([':server_coll_id' => $coll_id, ':sbas_id' => $sbas_id]); + $stmt->execute([':server_coll_id' => $coll_id, ':sbas_id' => $databox->get_sbas_id()]); $stmt->closeCursor(); $new_bas = $databox->get_appbox()->get_connection()->lastInsertId(); @@ -641,7 +651,7 @@ class collection implements cache_cacheableInterface $databox->delete_data_from_cache(databox::CACHE_COLLECTIONS); - cache_databox::update($app, $sbas_id, 'structure'); + cache_databox::update($app, $databox->get_sbas_id(), 'structure'); phrasea::reset_baseDatas($databox->get_appbox()); diff --git a/lib/classes/ftpclient.php b/lib/classes/ftpclient.php index e4be7664f3..4f1a6de335 100644 --- a/lib/classes/ftpclient.php +++ b/lib/classes/ftpclient.php @@ -228,7 +228,7 @@ class ftpclient { $ret = @ftp_nb_put($this->connexion, $remotefile, $localfile, FTP_BINARY, $start); - while ($ret == FTP_MOREDATA) { + while ($ret === FTP_MOREDATA) { set_time_limit(20); $ret = ftp_nb_continue($this->connexion); } @@ -280,7 +280,7 @@ class ftpclient $ret = @ftp_nb_get($this->connexion, $localfile, $remotefile, FTP_BINARY, $start); - while ($ret == FTP_MOREDATA) { + while ($ret === FTP_MOREDATA) { set_time_limit(20); $ret = ftp_nb_continue($this->connexion); } diff --git a/lib/classes/patch/381alpha1a.php b/lib/classes/patch/383alpha3a.php similarity index 96% rename from lib/classes/patch/381alpha1a.php rename to lib/classes/patch/383alpha3a.php index e2001c06c3..54422b6f4e 100644 --- a/lib/classes/patch/381alpha1a.php +++ b/lib/classes/patch/383alpha3a.php @@ -11,10 +11,10 @@ use Alchemy\Phrasea\Application; -class patch_381alpha1a implements patchInterface +class patch_383alpha3a implements patchInterface { /** @var string */ - private $release = '3.8.1-alpha.1'; + private $release = '3.8.3-alpha.3'; /** @var array */ private $concern = [base::APPLICATION_BOX]; diff --git a/templates/mobile/common/thumbnail.html.twig b/templates/mobile/common/thumbnail.html.twig index 537e608cef..e3854a2772 100644 --- a/templates/mobile/common/thumbnail.html.twig +++ b/templates/mobile/common/thumbnail.html.twig @@ -3,23 +3,27 @@ {% set b_height = b_h|default(b_w) %} {% set b_ratio = b_width / b_height %} - {% set i_ratio = thumbnail.get_width() / thumbnail.get_height() %} + + {% set thumbnail_height = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %} + {% set thumbnail_width = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %} + + {% set i_ratio = thumbnail_width / thumbnail_height %} {% if i_ratio > b_ratio%} - {% if b_width > thumbnail.get_width() %} - {% set d_width = thumbnail.get_width() %} + {% if b_width > thumbnail_width %} + {% set d_width = thumbnail_width %} {% else %} {% set d_width = b_width %} {% endif %} - {% set d_height = d_width / thumbnail.get_width() * thumbnail.get_height() %} + {% set d_height = d_width / thumbnail_width * thumbnail_height %} {% set top = (b_height - d_height) / 2 %} {% else %} - {% if b_height > thumbnail.get_height() %} - {% set d_height = thumbnail.get_height() %} + {% if b_height > thumbnail_height %} + {% set d_height = thumbnail_height %} {% else %} {% set d_height = b_height %} {% endif %} - {% set d_width = d_height * thumbnail.get_width() / thumbnail.get_height() %} + {% set d_width = d_height * thumbnail_width / thumbnail_height %} {% set top = ((b_height - d_height) / 2) %} {% endif %} @@ -37,8 +41,8 @@ {% set random = thumbnail.get_random() %}
@@ -87,7 +89,7 @@
var html = _.template($("#alert_"+ (datas.success ? "success" : "error") +"_tpl").html(), {
content:datas.msg
});
- $('#table-order').insertBefore(html);
+ $('#notification').html(html);
},
complete : function() {
$this.attr('disabled', false);
diff --git a/templates/web/client/home_inter_pub_basket.html.twig b/templates/web/client/home_inter_pub_basket.html.twig
index 74e517d3a9..f2f32a384e 100644
--- a/templates/web/client/home_inter_pub_basket.html.twig
+++ b/templates/web/client/home_inter_pub_basket.html.twig
@@ -43,7 +43,13 @@
{% set thumbnail = record.get_thumbnail() %}
{% set docType = record.get_type() %}
{% set duration = "" %}
- {% set ratio = thumbnail.get_width() / thumbnail.get_height() %}
+
+ {% if thumbnail.get_height() > 0 %}
+ {% set ratio = thumbnail.get_width() / thumbnail.get_height() %}
+ {% else %}
+ {% set ratio = 1 %}
+ {% endif %}
+
{% set wrapper_size = image_size + 30 %}
{% set types = {
diff --git a/templates/web/common/caption_templates/answer.html.twig b/templates/web/common/caption_templates/answer.html.twig
index 8d6875320a..ebb65f00bf 100644
--- a/templates/web/common/caption_templates/answer.html.twig
+++ b/templates/web/common/caption_templates/answer.html.twig
@@ -1,6 +1,6 @@
{% macro format_caption(record, highlight, searchEngine, includeBusiness) %}
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness) %}
- {{ value.label }} : {{value.value|raw}}
+ {{ value.label }} : {{ value.value | thesaurus }}
{% endfor %}
{% if app['authentication'].getUser().getPrefs('technical_display') == 'group' %}
diff --git a/templates/web/common/caption_templates/basket_element.html.twig b/templates/web/common/caption_templates/basket_element.html.twig index 58de726519..4896301eb8 100644 --- a/templates/web/common/caption_templates/basket_element.html.twig +++ b/templates/web/common/caption_templates/basket_element.html.twig @@ -1,5 +1,5 @@ {% macro format_caption(record, highlight, searchEngine, includeBusiness) %} {% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness) %} - {{ value.label }} : {{value.value|raw}}
+ {{ value.label }} : {{ value.value | thesaurus }}
{% endfor %}
-{% endmacro %}
\ No newline at end of file
+{% endmacro %}
diff --git a/templates/web/common/caption_templates/internal_publi.html.twig b/templates/web/common/caption_templates/internal_publi.html.twig
index e08a58bfc5..ebb65f00bf 100644
--- a/templates/web/common/caption_templates/internal_publi.html.twig
+++ b/templates/web/common/caption_templates/internal_publi.html.twig
@@ -1,9 +1,9 @@
{% macro format_caption(record, highlight, searchEngine, includeBusiness) %}
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness) %}
- {{ value.label }} : {{value.value|raw}}
+ {{ value.label }} : {{ value.value | thesaurus }}
{% endfor %}
{% if app['authentication'].getUser().getPrefs('technical_display') == 'group' %}
{% include 'common/technical_datas.html.twig' %} {% endif %} -{% endmacro %} \ No newline at end of file +{% endmacro %} diff --git a/templates/web/common/caption_templates/lazaret.html.twig b/templates/web/common/caption_templates/lazaret.html.twig index e08a58bfc5..ebb65f00bf 100644 --- a/templates/web/common/caption_templates/lazaret.html.twig +++ b/templates/web/common/caption_templates/lazaret.html.twig @@ -1,9 +1,9 @@ {% macro format_caption(record, highlight, searchEngine, includeBusiness) %} {% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness) %} - {{ value.label }} : {{value.value|raw}}
+ {{ value.label }} : {{ value.value | thesaurus }}
{% endfor %}
{% if app['authentication'].getUser().getPrefs('technical_display') == 'group' %}
{% include 'common/technical_datas.html.twig' %} {% endif %} -{% endmacro %} \ No newline at end of file +{% endmacro %} diff --git a/templates/web/common/caption_templates/overview.html.twig b/templates/web/common/caption_templates/overview.html.twig index 4298a51bca..78e01030f8 100644 --- a/templates/web/common/caption_templates/overview.html.twig +++ b/templates/web/common/caption_templates/overview.html.twig @@ -1,5 +1,5 @@ {% macro format_caption(record, highlight, searchEngine, includeBusiness) %} {% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness) %} - {{ value.label }} : {{value.value|raw}}
+ {{ value.label }} : {{ value.value }}
{% endfor %}
-{% endmacro %}
\ No newline at end of file
+{% endmacro %}
diff --git a/templates/web/common/caption_templates/preview.html.twig b/templates/web/common/caption_templates/preview.html.twig
index 58de726519..4896301eb8 100644
--- a/templates/web/common/caption_templates/preview.html.twig
+++ b/templates/web/common/caption_templates/preview.html.twig
@@ -1,5 +1,5 @@
{% macro format_caption(record, highlight, searchEngine, includeBusiness) %}
{% for value in record.get_caption().get_highlight_fields(highlight, null, searchEngine, includeBusiness) %}
- {{ value.label }} : {{value.value|raw}}
+ {{ value.label }} : {{ value.value | thesaurus }}
{% endfor %}
-{% endmacro %}
\ No newline at end of file
+{% endmacro %}
diff --git a/templates/web/common/thumbnail.html.twig b/templates/web/common/thumbnail.html.twig
index b91a64137f..4a5f265e8e 100644
--- a/templates/web/common/thumbnail.html.twig
+++ b/templates/web/common/thumbnail.html.twig
@@ -18,23 +18,27 @@
{% else %}
{% set b_ratio = b_width / b_height %}
- {% set i_ratio = thumbnail.get_width() / thumbnail.get_height() %}
+
+ {% set thumbnail_height = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %}
+ {% set thumbnail_width = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %}
+
+ {% set i_ratio = thumbnail_width / thumbnail_height %}
{% if i_ratio > b_ratio%}
- {% if b_width > thumbnail.get_width() %}
- {% set d_width = thumbnail.get_width() %}
+ {% if b_width > thumbnail_width %}
+ {% set d_width = thumbnail_width %}
{% else %}
{% set d_width = b_width %}
{% endif %}
- {% set d_height = d_width / thumbnail.get_width() * thumbnail.get_height() %}
+ {% set d_height = d_width / thumbnail_width * thumbnail_height %}
{% set top = (b_height - d_height) / 2 %}
{% else %}
- {% if b_height > thumbnail.get_height() %}
- {% set d_height = thumbnail.get_height() %}
+ {% if b_height > thumbnail_height %}
+ {% set d_height = thumbnail_height %}
{% else %}
{% set d_height = b_height %}
{% endif %}
- {% set d_width = d_height * thumbnail.get_width() / thumbnail.get_height() %}
+ {% set d_width = d_height * thumbnail_width / thumbnail_height %}
{% set top = ((b_height - d_height) / 2) %}
{% endif %}
@@ -54,8 +58,8 @@
{% set random = thumbnail.get_random() %}
-
-
+
+
|