diff --git a/config/sync/core.entity_view_display.node.enregistrement.default.yml b/config/sync/core.entity_view_display.node.enregistrement.default.yml
index ec4c921da..1c7c205a0 100644
--- a/config/sync/core.entity_view_display.node.enregistrement.default.yml
+++ b/config/sync/core.entity_view_display.node.enregistrement.default.yml
@@ -6,6 +6,8 @@ dependencies:
- field.field.node.enregistrement.body
- field.field.node.enregistrement.field_collectionneurs
- field.field.node.enregistrement.field_description
+ - field.field.node.enregistrement.field_domain_access
+ - field.field.node.enregistrement.field_domain_all_affiliates
- field.field.node.enregistrement.field_entrees
- field.field.node.enregistrement.field_genres
- field.field.node.enregistrement.field_langues
@@ -59,11 +61,25 @@ content:
audio_player_autoplay: 0
download_button: 0
download_link: 0
+ audio_player_wavesurfer_audiorate: 1
+ audio_player_wavesurfer_autocenter: true
+ audio_player_wavesurfer_bargap: 0
+ audio_player_wavesurfer_barheight: 1
+ audio_player_wavesurfer_barwidth: null
+ audio_player_wavesurfer_cursorcolor: '#333'
+ audio_player_wavesurfer_cursorwidth: 1
+ audio_player_wavesurfer_forcedecode: false
+ audio_player_wavesurfer_normalize: false
+ audio_player_wavesurfer_progresscolor: '#555'
+ audio_player_wavesurfer_responsive: false
+ audio_player_wavesurfer_wavecolor: '#999'
third_party_settings: { }
hidden:
body: true
chutier_actions: true
field_collectionneurs: true
+ field_domain_access: true
+ field_domain_all_affiliates: true
field_entrees: true
field_genres: true
field_langues: true
@@ -75,3 +91,4 @@ hidden:
langcode: true
links: true
relations: true
+ search_api_excerpt: true
diff --git a/config/sync/core.entity_view_display.node.enregistrement.docsindex.yml b/config/sync/core.entity_view_display.node.enregistrement.docsindex.yml
new file mode 100644
index 000000000..420aa34ec
--- /dev/null
+++ b/config/sync/core.entity_view_display.node.enregistrement.docsindex.yml
@@ -0,0 +1,68 @@
+uuid: 69543cf8-6951-47c3-a811-c3c7d5e1a711
+langcode: fr
+status: true
+dependencies:
+ config:
+ - core.entity_view_mode.node.docsindex
+ - field.field.node.enregistrement.body
+ - field.field.node.enregistrement.field_collectionneurs
+ - field.field.node.enregistrement.field_description
+ - field.field.node.enregistrement.field_domain_access
+ - field.field.node.enregistrement.field_domain_all_affiliates
+ - field.field.node.enregistrement.field_entrees
+ - field.field.node.enregistrement.field_genres
+ - field.field.node.enregistrement.field_langues
+ - field.field.node.enregistrement.field_locuteurs
+ - field.field.node.enregistrement.field_nbr_locuteurs
+ - field.field.node.enregistrement.field_son
+ - field.field.node.enregistrement.field_transcript_trad
+ - field.field.node.enregistrement.field_transcript_vo
+ - field.field.node.enregistrement.field_workflow
+ - node.type.enregistrement
+ module:
+ - text
+ - user
+id: node.enregistrement.docsindex
+targetEntityType: node
+bundle: enregistrement
+mode: docsindex
+content:
+ content_moderation_control:
+ weight: -20
+ region: content
+ settings: { }
+ third_party_settings: { }
+ field_description:
+ weight: 1
+ label: hidden
+ settings: { }
+ third_party_settings: { }
+ type: text_default
+ region: content
+ field_entrees:
+ type: entity_reference_label
+ weight: 0
+ region: content
+ label: hidden
+ settings:
+ link: false
+ third_party_settings: { }
+hidden:
+ addtoany: true
+ body: true
+ chutier_actions: true
+ field_collectionneurs: true
+ field_domain_access: true
+ field_domain_all_affiliates: true
+ field_genres: true
+ field_langues: true
+ field_locuteurs: true
+ field_nbr_locuteurs: true
+ field_son: true
+ field_transcript_trad: true
+ field_transcript_vo: true
+ field_workflow: true
+ langcode: true
+ links: true
+ relations: true
+ search_api_excerpt: true
diff --git a/config/sync/core.entity_view_mode.node.docsindex.yml b/config/sync/core.entity_view_mode.node.docsindex.yml
new file mode 100644
index 000000000..1e19fe09f
--- /dev/null
+++ b/config/sync/core.entity_view_mode.node.docsindex.yml
@@ -0,0 +1,10 @@
+uuid: e08c4592-af43-4ddb-9a18-e56830765372
+langcode: fr
+status: true
+dependencies:
+ module:
+ - node
+id: node.docsindex
+label: DocsIndex
+targetEntityType: node
+cache: true
diff --git a/web/modules/custom/edlp_ajax/edlp_ajax.module b/web/modules/custom/edlp_ajax/edlp_ajax.module
index aaf1bb3e3..1ba9cf8a0 100644
--- a/web/modules/custom/edlp_ajax/edlp_ajax.module
+++ b/web/modules/custom/edlp_ajax/edlp_ajax.module
@@ -55,6 +55,7 @@ function edlp_ajax_page_attachments(array &$attachments) {
|| preg_match('/^\/?agenda/', $current_path)
|| preg_match('/^\/?studio/', $current_path)
|| preg_match('/^\/?search/', $current_path)
+ || preg_match('/^\/?docsindex/', $current_path)
|| preg_match('/^\/?lastdocs/', $current_path)
|| preg_match('/^\/?articles/', $current_path)){
$redirect = true;
diff --git a/web/modules/custom/edlp_corpus/edlp_corpus.module b/web/modules/custom/edlp_corpus/edlp_corpus.module
index fe6e82887..c920f5bf4 100644
--- a/web/modules/custom/edlp_corpus/edlp_corpus.module
+++ b/web/modules/custom/edlp_corpus/edlp_corpus.module
@@ -25,9 +25,17 @@ function edlp_corpus_theme($existing, $type, $theme, $path) {
// 'render element' => '',
'file' => 'includes/blockentrees.inc',
'variables' => array(
+ 'docsindex_link' => null,
'entrees_items' => array(),
),
),
+ 'edlp_corpus_docsindex' => array(
+ // 'render element' => '',
+ 'file' => 'includes/edlp_corpus_docsindex.inc',
+ 'variables' => array(
+ 'docsindex_nodes' => NULL,
+ ),
+ ),
'edlp_corpus_lastdocs' => array(
// 'render element' => '',
'file' => 'includes/edlp_corpus_lastdocs.inc',
diff --git a/web/modules/custom/edlp_corpus/edlp_corpus.routing.yml b/web/modules/custom/edlp_corpus/edlp_corpus.routing.yml
index 20d4eb6b2..e7331dd82 100644
--- a/web/modules/custom/edlp_corpus/edlp_corpus.routing.yml
+++ b/web/modules/custom/edlp_corpus/edlp_corpus.routing.yml
@@ -15,6 +15,23 @@ edlp_corpus.corpusjson:
_permission: 'access content'
+edlp_corpus.docsindex:
+ path: '/docsindex'
+ defaults:
+ _controller: '\Drupal\edlp_corpus\Controller\CorpusController::docsindex'
+ _title: 'Docs Index'
+ requirements:
+ _permission: 'access content'
+
+edlp_corpus.docsindexajax:
+ path: '/docsindex/ajax'
+ defaults:
+ _controller: '\Drupal\edlp_corpus\Controller\CorpusController::docsindexjson'
+ _title: 'Docs Index'
+ requirements:
+ _permission: 'access content'
+
+
edlp_corpus.lastdocs:
path: '/lastdocs'
defaults:
diff --git a/web/modules/custom/edlp_corpus/includes/blockentrees.inc b/web/modules/custom/edlp_corpus/includes/blockentrees.inc
index f7f3da570..e22f73e08 100644
--- a/web/modules/custom/edlp_corpus/includes/blockentrees.inc
+++ b/web/modules/custom/edlp_corpus/includes/blockentrees.inc
@@ -8,6 +8,11 @@ function template_preprocess_blockentrees(&$vars){
'#items' => array(),
);
+ $docsindex = $vars['docsindex_link']->toRenderable();
+ $docsindex['#prefix'] = '';
+ $docsindex['#suffix'] = "";
+ $entrees['#items'][] = $docsindex;
+
foreach ($vars['entrees_items'] as $entree) {
$tid = $entree['tid'];
diff --git a/web/modules/custom/edlp_corpus/includes/edlp_corpus_docsindex.inc b/web/modules/custom/edlp_corpus/includes/edlp_corpus_docsindex.inc
new file mode 100644
index 000000000..98fbccc03
--- /dev/null
+++ b/web/modules/custom/edlp_corpus/includes/edlp_corpus_docsindex.inc
@@ -0,0 +1,30 @@
+getViewBuilder('node');
+
+ if(count($vars['docsindex_nodes'])){
+ $docsindex_list = array (
+ '#theme' => 'item_list',
+ '#items' => [],
+ );
+ foreach($vars['docsindex_nodes'] as $node){
+ $docsindex_list['#items'][] = $view_builder->view($node, 'docsindex');
+ }
+
+ $vars['docsindex'] = array(
+ "#type"=>"container",
+ "#attributes"=>array(
+ "class"=>['docsindex']
+ ),
+ "#markup"=>"
".t("Documents Index")."
",
+ "docsindex"=>$docsindex_list
+ );
+ }
+}
diff --git a/web/modules/custom/edlp_corpus/src/Controller/CorpusController.php b/web/modules/custom/edlp_corpus/src/Controller/CorpusController.php
index afa3c7ec1..83c41f5d1 100644
--- a/web/modules/custom/edlp_corpus/src/Controller/CorpusController.php
+++ b/web/modules/custom/edlp_corpus/src/Controller/CorpusController.php
@@ -150,6 +150,133 @@ class CorpusController extends ControllerBase {
}
+
+ // ___ ___ _
+ // | \ ___ __ __|_ _|_ _ __| |_____ __
+ // | |) / _ \/ _(_-<| || ' \/ _` / -_) \ /
+ // |___/\___/\__/__/___|_||_\__,_\___/_\_\
+
+ private function docsindexQuery() {
+ // $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
+
+ $query = \Drupal::entityQuery('node')
+ ->condition('status', 1)
+ ->condition('type', 'enregistrement')
+ ->sort('title', 'ASC');
+ // ->range(0,50);
+
+ $nids = $query->execute();
+ $nodes = entity_load_multiple('node', $nids);
+
+ // $current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
+
+ $this->docsindex_nodes = [];
+ $this->docsindex_nids = [];
+ foreach ($nodes as $node) {
+ // remove masqué
+ $sid = WorkflowManager::getCurrentStateId($node, 'field_workflow');
+ if($sid != 'corpus_documents_publie') continue;
+
+ $this->docsindex_nodes[] = $node;
+ // record an array of nids for corpus map filtering
+ $this->docsindex_nids[] = $node->get('nid')->getString();
+
+ // // translate the node
+ // $node = \Drupal::service('entity.repository')->getTranslationFromContext($node, $language);
+ // $title = $this->stripAccent($node->getTitle());
+ // $ordered_trans_nodes[$title] = $node;
+ }
+
+ // // TODO: sort by title
+ // ksort($ordered_trans_nodes);
+ //
+ // foreach ($ordered_trans_nodes as $title => $node) {
+ // $this->docsindex_nodes[] = $node;
+ // // record an array of nids for corpus map filtering
+ // $this->docsindex_nids[] = $node->get('nid')->getString();
+ // }
+ }
+
+ // private function stripAccent($str){
+ // return strtr(
+ // utf8_decode($str),
+ // utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ'),
+ // 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
+ // }
+
+ private function docsindexToRenderable(){
+ $this->docsindexQuery();
+
+ return array(
+ "#theme"=>'edlp_corpus_docsindex',
+ '#docsindex_nodes' => $this->docsindex_nodes
+ );
+
+ }
+ /**
+ * Display lastdocs as a page.
+ *
+ * @return renderable array
+ */
+ public function docsindex() {
+ return $this->docsindexToRenderable();
+ }
+
+ /**
+ * Get lastdocs data as json through ajax.
+ *
+ * @return json
+ */
+ public function docsindexjson() {
+
+ $renderable = $this->docsindexToRenderable();
+ // $rendered = render($renderable);
+ // We can't render directly the entity as it throw an exception with cachable data
+ //http://blog.dcycle.com/blog/2018-01-24/caching-drupal-8-rest-resource/#the-dreaded-leaked-metadata-error
+ $rendered = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($renderable) {
+ return render($renderable);
+ });
+
+ $data = [
+ 'rendered'=> $rendered,
+ 'title'=>t('Documents Index'),
+ 'documents_lies' => $this->docsindex_nids,
+ ];
+
+ // translations links
+ $route_name = 'edlp_corpus.docsindex';
+ $links = \Drupal::languageManager()->getLanguageSwitchLinks(LanguageInterface::TYPE_URL, Url::fromRoute($route_name));
+ if (isset($links->links)) {
+ $translations_build = [
+ '#theme' => 'links__language_block',
+ '#links' => $links->links,
+ '#attributes' => ['class' => ["language-switcher-{$links->method_id}",],],
+ '#set_active_class' => TRUE,
+ ];
+ $translations_rendered = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($translations_build) {return render($translations_build);});
+
+ $data['translations_links'] = $translations_rendered;
+ }
+
+ $data['#cache'] = [
+ 'max-age' => \Drupal\Core\Cache\Cache::PERMANENT,
+ 'tags' => ['edlp-docsindex-cache'],
+ 'contexts' => [
+ 'languages:language_content'
+ ]
+ ];
+
+ // $response = new JsonResponse();
+ // $response->setData($data);
+ $response = new CacheableJsonResponse($data);
+ $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($data));
+ $response->addCacheableDependency(CacheableMetadata::createFromRenderArray($renderable));
+
+ return $response;
+ }
+
+
+
// _ _ _
// | | __ _ __| |_ __| |___ __ ___
// | |__/ _` (_-< _/ _` / _ \/ _(_-<
diff --git a/web/modules/custom/edlp_corpus/src/Plugin/Block/BlockEntrees.php b/web/modules/custom/edlp_corpus/src/Plugin/Block/BlockEntrees.php
index 57acdc47d..957774832 100644
--- a/web/modules/custom/edlp_corpus/src/Plugin/Block/BlockEntrees.php
+++ b/web/modules/custom/edlp_corpus/src/Plugin/Block/BlockEntrees.php
@@ -101,8 +101,19 @@ class BlockEntrees extends BlockBase {
$entrees[] = $entree;
}
+ // add general docs index link
+ $url = Url::fromRoute('edlp_corpus.docsindex');
+ $url->setOptions(array(
+ 'attributes' => array(
+ 'class' => ['docsindex-link', 'ajax-link'],
+ 'data-drupal-link-system-path' => $url->getInternalPath()
+ )
+ ));
+ $docsindex_link = Link::fromTextAndUrl('Index', $url);
+
return array (
'#theme' => 'blockentrees',
+ '#docsindex_link' => $docsindex_link,
'#entrees_items' => $entrees,
'#attached'=>array(
'library' => array('edlp_corpus/corpus'),
diff --git a/web/modules/custom/edlp_corpus/templates/blockentrees.html.twig b/web/modules/custom/edlp_corpus/templates/blockentrees.html.twig
index a0f0f71d0..fbe36e68f 100644
--- a/web/modules/custom/edlp_corpus/templates/blockentrees.html.twig
+++ b/web/modules/custom/edlp_corpus/templates/blockentrees.html.twig
@@ -1,2 +1 @@
-
{{ entrees }}
diff --git a/web/modules/custom/edlp_corpus/templates/edlp-corpus-docsindex.html.twig b/web/modules/custom/edlp_corpus/templates/edlp-corpus-docsindex.html.twig
new file mode 100644
index 000000000..4030eb03b
--- /dev/null
+++ b/web/modules/custom/edlp_corpus/templates/edlp-corpus-docsindex.html.twig
@@ -0,0 +1 @@
+{{ docsindex }}
diff --git a/web/themes/custom/edlptheme/assets/dist/scripts/main.min.js b/web/themes/custom/edlptheme/assets/dist/scripts/main.min.js
index 6135e6a8b..6c975a7f4 100644
--- a/web/themes/custom/edlptheme/assets/dist/scripts/main.min.js
+++ b/web/themes/custom/edlptheme/assets/dist/scripts/main.min.js
@@ -69,7 +69,6 @@ $this.height(Math.min($this.attr('init-height'),_$row.height()));});};function c
function initCollectionNav(){void 0;$('.field--name-field-notice, .index','.taxonomy-term.vocabulary-entrees.home_mobile').addClass('closed');$('.field--name-field-notice>.field__label','.taxonomy-term.vocabulary-entrees.home_mobile').on('click',onClickCollectionNotice);$('.index>.field__label','.taxonomy-term.vocabulary-entrees.home_mobile').on('click',onClickCollectionIndex);};function onClickCollectionNotice(e){toggleEntreeOpening($(this).parent(),'notice');};function onClickCollectionIndex(e){toggleEntreeOpening($(this).parent(),'index');};function toggleEntreeOpening($e,part){$e.toggleClass('closed').parents('.taxonomy-term.vocabulary-entrees.home_mobile').toggleClass(part+'-opened');}
function initSearch(){$('#edit-entries--wrapper legend','#edlp-search-form').on('click',function(){$(this).parent().toggleClass('opened');});};function initEnregistrementTranscript(){void 0;var $node=_$row.find('article.node--type-enregistrement.node--view-mode-transcript');var $nav=$('