diff --git a/lib/Alchemy/Phrasea/Application/Api.php b/lib/Alchemy/Phrasea/Application/Api.php
index 79bb722ed5..b59685c505 100644
--- a/lib/Alchemy/Phrasea/Application/Api.php
+++ b/lib/Alchemy/Phrasea/Application/Api.php
@@ -596,7 +596,7 @@ return call_user_func(function() {
$route = '/stories/{databox_id}/{story_id}/embed/';
$app->get(
$route, function($databox_id, $story_id) use ($app) {
- $result = $app['api']->get_record_embed($app['request'], $databox_id, $story_id);
+ $result = $app['api']->get_story_embed($app['request'], $databox_id, $story_id);
return $result->get_response();
}
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php
index 537dfb1307..bcf2a540b5 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php
@@ -117,8 +117,11 @@ class Tooltip implements ControllerProviderInterface
$controllers->post('/tc_datas/{sbas_id}/{record_id}/'
, function(Application $app, $sbas_id, $record_id) {
$record = new \record_adapter($sbas_id, $record_id);
- $document = $record->get_subdef('document');
-
+ try {
+ $document = $record->get_subdef('document');
+ } catch(\Exception $e) {
+ $document = null;
+ }
/* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig();
diff --git a/lib/classes/API/V1/adapter.class.php b/lib/classes/API/V1/adapter.class.php
index 9747bfc729..65f5dbc7a9 100644
--- a/lib/classes/API/V1/adapter.class.php
+++ b/lib/classes/API/V1/adapter.class.php
@@ -1026,7 +1026,7 @@ class API_V1_adapter extends API_V1_Abstract
$stories = array_map(function ($story) use ($that) {
return $that->list_story($story);
- }, $record->get_grouping_parents()->get_elements());
+ }, array_values($record->get_grouping_parents()->get_elements()));
$result->set_datas(array(
"baskets" => $baskets,
@@ -1120,6 +1120,36 @@ class API_V1_adapter extends API_V1_Abstract
return $result;
}
+ /**
+ * Get an API_V1_result containing the story embed files
+ *
+ * @param Request $request
+ * @param int $databox_id
+ * @param int $record_id
+ * @param string $response_type
+ * @return API_V1_result
+ */
+ public function get_story_embed(Request $request, $databox_id, $record_id)
+ {
+
+ $result = new API_V1_result($request, $this);
+
+ $record = $this->appbox->get_databox($databox_id)->get_record($record_id);
+
+ $ret = array();
+
+ $devices = $request->get('devices', array());
+ $mimes = $request->get('mimes', array());
+
+ foreach ($record->get_embedable_medias($devices, $mimes) as $name => $media) {
+ $ret[] = $this->list_embedable_media($media, $this->appbox->get_registry());
+ }
+
+ $result->set_datas(array("embed" => $ret));
+
+ return $result;
+ }
+
public function set_record_metadatas(Request $request, $databox_id, $record_id)
{
$result = new API_V1_result($request, $this);
diff --git a/lib/classes/record/adapter.class.php b/lib/classes/record/adapter.class.php
index 5949062ee4..c6cbbfae6a 100644
--- a/lib/classes/record/adapter.class.php
+++ b/lib/classes/record/adapter.class.php
@@ -371,7 +371,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
*/
public function get_embedable_medias($devices = null, $mimes = null)
{
-
return $this->getSubdfefByDeviceAndMime($devices, $mimes);
}
@@ -707,9 +706,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$searchDevices = array_merge((array) $devices, (array) databox_subdef::DEVICE_ALL);
+ $type = $this->is_grouping() ? 'image' : $this->get_type();
+
foreach ($this->databox->get_subdef_structure() as $group => $databoxSubdefs) {
- if ($this->get_type() != $group) {
+ if ($type != $group) {
continue;
}
diff --git a/templates/web/common/technical_datas.twig b/templates/web/common/technical_datas.twig
index a321d9d686..f5b2bb895f 100644
--- a/templates/web/common/technical_datas.twig
+++ b/templates/web/common/technical_datas.twig
@@ -1,4 +1,8 @@
-{% trans 'Record_id' %} : {{ record.get_record_id() }}
+{% if record.is_grouping() %}
+ {% trans 'Story_id' %} : {{ record.get_record_id() }}
+{% else %}
+ {% trans 'Record_id' %} : {{ record.get_record_id() }}
+{% endif %}
{% if record.is_grouping() == false %}