From ef7de07b1a1520497b2717a445cf3dda4febf038 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Tue, 18 Aug 2015 16:50:55 +0200 Subject: [PATCH] #PHRAS-610 #time 10h --- lib/Alchemy/Phrasea/Helper/Prod.php | 27 ++++- .../Elastic/ElasticSearchEngine.php | 5 - templates/web/prod/index.html.twig | 113 ++++++++---------- www/skins/prod/jquery.main-prod.js | 84 ++++--------- 4 files changed, 99 insertions(+), 130 deletions(-) diff --git a/lib/Alchemy/Phrasea/Helper/Prod.php b/lib/Alchemy/Phrasea/Helper/Prod.php index a6685c3fc2..650617d650 100644 --- a/lib/Alchemy/Phrasea/Helper/Prod.php +++ b/lib/Alchemy/Phrasea/Helper/Prod.php @@ -31,26 +31,43 @@ class Prod extends Helper $searchSet = json_decode($this->app['settings']->getUserSetting($this->app->getAuthenticatedUser(), 'search'), true); $saveSettings = $this->app['settings']->getUserSetting($this->app->getAuthenticatedUser(), 'advanced_search_reload'); - - foreach ($this->app->getAclForUser($this->app->getAuthenticatedUser())->get_granted_sbas() as $databox) { + $acl = $this->app->getAclForUser($this->app->getAuthenticatedUser()); + foreach ($acl->get_granted_sbas() as $databox) { $sbasId = $databox->get_sbas_id(); - $bases[$sbasId] = array('thesaurus' => (trim($databox->get_thesaurus()) !== ""), 'cterms' => false, 'collections' => array(), 'sbas_id' => $sbasId); + $bases[$sbasId] = array( + 'thesaurus' => (trim($databox->get_thesaurus()) !== ""), + 'cterms' => false, + 'collections' => array(), + 'sbas_id' => $sbasId + ); foreach ($this->app->getAclForUser($this->app->getAuthenticatedUser())->get_granted_base([], [$databox->get_sbas_id()]) as $coll) { $selected = $saveSettings ? ((isset($searchSet['bases']) && isset($searchSet['bases'][$sbasId])) ? (in_array($coll->get_base_id(), $searchSet['bases'][$sbasId])) : true) : true; - $bases[$sbasId]['collections'][] = array('selected' => $selected, 'base_id' => $coll->get_base_id()); + $bases[$sbasId]['collections'][] = array( + 'selected' => $selected, + 'base_id' => $coll->get_base_id() + ); } foreach ($databox->get_meta_structure() as $fieldMeta) { if (!$fieldMeta->is_indexable()) { continue; } + if($fieldMeta->isBusiness() && !$acl->can_see_business_fields($databox)) { + continue; + } + $id = $fieldMeta->get_id(); $name = $fieldMeta->get_name(); $type = $fieldMeta->get_type(); - $data = array('sbas' => array($sbasId), 'fieldname' => $name, 'type' => $type, 'id' => $id); + $data = array( + 'sbas' => array($sbasId), + 'fieldname' => $name, + 'type' => $type, + 'id' => $id + ); if ($fieldMeta->get_type() === \databox_field::TYPE_DATE) { if (!array_key_exists($name, $dates)) { diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php index efafcc1cc8..1b3baf1542 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticSearchEngine.php @@ -253,9 +253,7 @@ class ElasticSearchEngine implements SearchEngineInterface $context = $this->createQueryContext($options); /** @var QueryCompiler $query_compiler */ $query_compiler = $this->app['query_compiler']; -file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d)\n%s\n", __FILE__, __LINE__, var_export($string, true)), FILE_APPEND); $recordQuery = $query_compiler->compile($string, $context); -file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d)\n%s\n", __FILE__, __LINE__, var_export($recordQuery, true)), FILE_APPEND); $params = $this->createRecordQueryParams($recordQuery, $options, null); @@ -274,10 +272,8 @@ file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d)\n%s\n", __FILE__, if ($aggs = $this->getAggregationQueryParams($options)) { $params['body']['aggs'] = $aggs; } -file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d)\n%s\n", __FILE__, __LINE__, var_export($params, true)), FILE_APPEND); $res = $this->client->search($params); -file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d)\n%s\n", __FILE__, __LINE__, var_export($res, true)), FILE_APPEND); $results = new ArrayCollection(); @@ -293,7 +289,6 @@ file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d)\n%s\n", __FILE__, $query['query_main'] = $recordQuery; $query['query'] = $params['body']; $query['query_string'] = json_encode($params['body']); -file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d)\n%s\n", __FILE__, __LINE__, var_export($query['query_string'], true)), FILE_APPEND); return new SearchEngineResult( $results, // ArrayCollection of results json_encode($query), diff --git a/templates/web/prod/index.html.twig b/templates/web/prod/index.html.twig index 57d430568e..dcc86aa680 100644 --- a/templates/web/prod/index.html.twig +++ b/templates/web/prod/index.html.twig @@ -261,27 +261,30 @@
-
- - - - - -
-
-
- {% if GV_multiAndReport %} - - - {% else %} - - {% endif %} + + + +
+
+ + + + + +
+
+ {% if GV_multiAndReport %} + + + {% else %} + + {% endif %}
- - -