From 23383d72a93ba8231d8cf187ab13bc76201a75fc Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Fri, 10 Jan 2025 10:56:04 +0100
Subject: [PATCH 01/36] first version of special issues summary display in cras

---
 .../templates/ptf/bs5/blocks/issue-list.html  | 14 ++++-
 .../ptf/bs5/blocks/volume-items.html          | 17 +++---
 .../ptf/bs5/common/issue/all-issues.html      | 24 +++++++++
 .../bs5/common/issue/special-issue-list.html  | 25 +++++++++
 src/ptf/urls.py                               |  3 ++
 src/ptf/views/base_views.py                   | 52 +++++++++++++++++--
 6 files changed, 120 insertions(+), 15 deletions(-)
 create mode 100644 src/ptf/templates/ptf/bs5/common/issue/all-issues.html
 create mode 100644 src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html

diff --git a/src/ptf/templates/ptf/bs5/blocks/issue-list.html b/src/ptf/templates/ptf/bs5/blocks/issue-list.html
index bd73d580..965a33e5 100644
--- a/src/ptf/templates/ptf/bs5/blocks/issue-list.html
+++ b/src/ptf/templates/ptf/bs5/blocks/issue-list.html
@@ -6,7 +6,9 @@
 {% comment %} Pas de breadcrumb ici {% endcomment %}
 {% block breadcrumb %}
 {% endblock breadcrumb %}
-
+{% block extra_css %}
+  <link rel="stylesheet" href="{% static "cr_app/css/cr_common.css" %}" />
+{% endblock %}
 {% block center_middle %}
   <div class="d-flex flex-column gap-2 align-items-start">
     {% with logo_path=journal|get_image_path %}
@@ -15,8 +17,16 @@
         <img href="{% static logo_path %}" src="{% static logo_path %}" class="lightbox journal-image">
       {% endif %}
     {% endwith %}
-    <div class="w-100">
+    <div class="w-100 cras-issue-list">
+      <div class="year-listing">
         {% include "common/issue/issue-list.html" %}
+      </div>
+        
+      <div class="special-issues-listing">
+        
+        {% include "common/issue/special-issue-list.html" %}
+      </div>
     </div>
+    
   </div>
 {% endblock %}
diff --git a/src/ptf/templates/ptf/bs5/blocks/volume-items.html b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
index 0eb41006..3d765461 100644
--- a/src/ptf/templates/ptf/bs5/blocks/volume-items.html
+++ b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
@@ -2,21 +2,20 @@
 {% load i18n %}
 
 {% block title %}
+<h1>Bonjour</h1>
   {% with issues_articles|first as first %}
     {{ first.issue.my_collection.title_sort }}, {% include 'common/volume/volume_string.html' %} {{ first.issue.volume }} ({{ first.issue.year }})
   {% endwith %}
 {% endblock %}
-
+{% comment %} 
 {% block breadcrumb %}
   {% include "common/breadcrumb.html" %}
-  {% comment %}
-  {% endcomment %}
-
-  {% comment %} {% with issues_articles|first as first %}
-  {% endcomment %}
-{% endblock %}
-
+{% endblock %} {% endcomment %}
 {% block center_middle %}
-  {% include 'common/volume/volume-items.html' %}
+  {% if all_issues %}
+  {% include 'common/issue/all-issues.html' %}
+  {% else %}
+    {% include 'common/volume/volume-items.html' %}
+  {% endif %}
 {% endblock %}
 
diff --git a/src/ptf/templates/ptf/bs5/common/issue/all-issues.html b/src/ptf/templates/ptf/bs5/common/issue/all-issues.html
new file mode 100644
index 00000000..70701e26
--- /dev/null
+++ b/src/ptf/templates/ptf/bs5/common/issue/all-issues.html
@@ -0,0 +1,24 @@
+{% load i18n %}
+{% load helpers %}
+{% load static %}
+<h3>{% trans 'Sommaire' %}</h3>
+<hr class="separator">
+{% for special_issue in special_issues %}
+<div class="article-div" style="margin-bottom:40px">
+    <div class="row">
+      <div class="col-12">
+        {% with issue=special_issue%}
+            {% if issue.title_html %}
+                {% include 'common/issue-header-cr.html' with volume_toc=True %}
+                {% if not forloop.last %}<hr class="separator">{% endif %}
+            {% elif with_thematic %}
+                {% include 'common/issue-header-general-cr.html' with volume_toc=True with_title_link=True %}
+                {% if not forloop.last %}<hr class="separator">{% endif %}
+            {% else %}
+                {% include 'common/issue/issue-items-articles.html' with articles=issue_articles.articles %}
+            {% endif %}
+        {% endwith %}
+      </div>
+    </div>
+  </div>
+{% endfor %}
diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
new file mode 100644
index 00000000..e9169375
--- /dev/null
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
@@ -0,0 +1,25 @@
+<h4>Derniers numéro thématiques </h4>
+<div>
+  {% for special_issue in special_issues %}
+        {% comment %} {% if special_issue.ctype == 'issue_special' %} {% endcomment %}
+    <div class="last-special-issue">
+        <div>
+            <img class="special-issue-icon" src="/biologies/static/crbiol/img/couv-crbiol.jpg">
+        </div>
+        <div class="special-issue-caption">
+            <a href="{%url 'item_id' special_issue.pid %}">{{ special_issue.title_html }}</a>
+            {% for contribution in special_issue.contributions.all %}
+                {{contribution}};
+            {% endfor %}
+        </div>
+        
+    </div>
+        
+        {% comment %} {% endif %} {% endcomment %}
+    {% endfor %}  
+</div>
+<div style="text-align:center;">
+    {{journal.pid}}
+    <a href="{% url 'all_issues' journal.pid %}" >Voir tous nos numéros thématiques</a>
+</div>
+
diff --git a/src/ptf/urls.py b/src/ptf/urls.py
index 4c21f247..09c9bd3a 100644
--- a/src/ptf/urls.py
+++ b/src/ptf/urls.py
@@ -5,6 +5,7 @@ from django.views.generic import TemplateView
 
 from .views import (
     AllIssuesAPIView,
+    AllSpecialIssuesView,
     APIFetchAllView,
     APIFetchId,
     APIFetchView,
@@ -83,6 +84,8 @@ urlpatterns_protectable_by_account = [
     path("item/", ItemView.as_view(), name="item"),  # Compatibility with Numdam v1
     path("item/<path:pid>/latest_issue/", LatestIssue.as_view(), name="latest_issue"),
     path("item/<path:pid>/", ItemView.as_view(), name="item_id"),
+    path("items/<path:pid>/", AllSpecialIssuesView.as_view(), name="all_issues"),
+    # path("items/<path:pid>/", ItemView.as_view(), name="all_issues"),
     path("journals/", journals, name="journals"),
     path("journals/<path:pid>/latest_issue/", LatestIssue.as_view(), name="journal_latest_issue"),
     path("journals/<path:jid>/", IssuesView.as_view(), name="journal-issues"),
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index a40b3db0..b16ca011 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -323,7 +323,8 @@ class ItemView(TemplateView):
 
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
-        context["journal"] = self.obj.get_collection()
+        collection = self.obj.get_collection()
+        context["journal"] = collection
         context["obj"] = self.obj
         return context
 
@@ -583,6 +584,42 @@ class CollectionView(ItemView):
             # en theorie: coltype=book-series TODO: check lectures
             request.META["QUERY_STRING"] = '"' + collection.title_html + '"-p'
             return sorted_books(request)
+class AllSpecialIssuesView(TemplateView):
+    template_name = "blocks/volume-items.html"
+
+    def get_context_data(self, **kwargs):
+        context = super().get_context_data(**kwargs)
+        pid = self.kwargs.get('pid')
+        collection =  model_helpers.get_collection(pid)
+        special_issues = collection.content.all().exclude(title_html="").order_by("-year", "-volume", "-number")
+        context["issues_articles"] = []
+        for special_issue in special_issues:
+            if special_issue.ctype == 'issue_special':
+                for resource in special_issue.resources_in_special_issue.all():
+                    context["issues_articles"].append(resource)
+                # context["issues_articles"].append(resource.all() for resource in special_issue.resources_in_special_issue.all())
+            elif special_issue.ctype == 'issue':
+                for article in special_issue.article_set.all():
+                    context["issues_articles"].append(article)
+                # context["issues_articles"].append(article for article in special_issue.article_set.all())
+        context["group_issues"] = True
+        is_cr = (
+            hasattr(settings, "SITE_NAME")
+            and len(settings.SITE_NAME) == 6
+            and settings.SITE_NAME[0:2] == "cr"
+        )
+        context["is_cr"] = is_cr
+
+        
+
+        context["collection"] = collection
+        context["journal"] = collection
+        context["coltype"] = collection.coltype
+        context["btn_show_tex"] = settings.SHOW_TEX if hasattr(settings, "SHOW_TEX") else False
+        context["special_issues"]= special_issues
+        context["all_issues"] = True
+
+        return context
 
 
 class VolumeDetailView(TemplateView):
@@ -849,9 +886,14 @@ class IssuesView(TemplateView):
 
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
-
-        journal = model_helpers.get_collection(self.kwargs.get("jid"), sites="")
-
+        jid = self.kwargs.get("jid")
+        journal = model_helpers.get_collection(jid, sites="")
+        if "CR" in jid:
+            special_issues = []
+            issues = journal.content.all().exclude(title_html="").order_by("-year", "-volume", "-number")
+            for n, special_issue in enumerate(issues):
+                if n <= 3:
+                    special_issues.append(special_issue)
         if journal is None:
             raise Http404
         try:
@@ -922,6 +964,7 @@ class IssuesView(TemplateView):
             "is_cr": is_cr,
             "current_edition": current_edition,
             "collections": collections,
+            
         }
 
         if journal.pid in settings.YEARLY_COLLECTIONS:
@@ -937,6 +980,7 @@ class IssuesView(TemplateView):
                 {
                     "sorted_issues": sorted_issues,
                     "display_with_titles": display_with_titles,
+                    "special_issues": special_issues,
                 }
             )
         context.update(params)
-- 
GitLab


From 10fb8074f9df0135a946dee250ad80a801cb377c Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Fri, 10 Jan 2025 11:55:55 +0100
Subject: [PATCH 02/36] wip

---
 src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
index e9169375..a9e02225 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
@@ -19,7 +19,6 @@
     {% endfor %}  
 </div>
 <div style="text-align:center;">
-    {{journal.pid}}
     <a href="{% url 'all_issues' journal.pid %}" >Voir tous nos numéros thématiques</a>
 </div>
 
-- 
GitLab


From 84ea221f52a4f4995078ad334eb1b2cffaff821a Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 13 Jan 2025 09:42:20 +0100
Subject: [PATCH 03/36] wip

---
 src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
index a9e02225..96011e2c 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
@@ -1,4 +1,5 @@
 <h4>Derniers numéro thématiques </h4>
+<hr>
 <div>
   {% for special_issue in special_issues %}
         {% comment %} {% if special_issue.ctype == 'issue_special' %} {% endcomment %}
@@ -14,7 +15,7 @@
         </div>
         
     </div>
-        
+    <hr >
         {% comment %} {% endif %} {% endcomment %}
     {% endfor %}  
 </div>
-- 
GitLab


From 615b2fa25e99782fd82739eca74240a1e85ae5ea Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 13 Jan 2025 09:58:12 +0100
Subject: [PATCH 04/36] wip

---
 src/ptf/templates/ptf/bs5/blocks/volume-items.html | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/ptf/templates/ptf/bs5/blocks/volume-items.html b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
index 3d765461..95c8b5d6 100644
--- a/src/ptf/templates/ptf/bs5/blocks/volume-items.html
+++ b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
@@ -2,7 +2,6 @@
 {% load i18n %}
 
 {% block title %}
-<h1>Bonjour</h1>
   {% with issues_articles|first as first %}
     {{ first.issue.my_collection.title_sort }}, {% include 'common/volume/volume_string.html' %} {{ first.issue.volume }} ({{ first.issue.year }})
   {% endwith %}
-- 
GitLab


From 2c273396a44dad90f38dc613ed28082d8485874f Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 13 Jan 2025 10:33:30 +0100
Subject: [PATCH 05/36] wip

---
 .../oai/common-issue_eudml-article2.xml       |  1 -
 .../ptf/bs5/blocks/volume-items.html          | 19 ++++++++++++++++---
 .../bs5/common/issue/special-issue-list.html  |  2 +-
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/oai/templates/oai/common-issue_eudml-article2.xml b/src/oai/templates/oai/common-issue_eudml-article2.xml
index a7a938fd..1a17f1a4 100644
--- a/src/oai/templates/oai/common-issue_eudml-article2.xml
+++ b/src/oai/templates/oai/common-issue_eudml-article2.xml
@@ -16,7 +16,6 @@
       {% for resource in container.resources_in_special_issue.all|sort_by:"seq" %}
       {% comment %} {{ resource.resource }} {% endcomment %}
         {% if resource.resource.classname == "Article" %}
-        {% comment %} bonjour 2 {% endcomment %}
           {% include "oai/common-external-article.xml" with resource=resource %}
           {% comment %} {% include "oai/common-article_eudml-article2.xml" with article=resource.resource %} {% endcomment %}
         {% comment %} In the future the template shall be able to deal with other resources that Article {% endcomment %}
diff --git a/src/ptf/templates/ptf/bs5/blocks/volume-items.html b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
index 95c8b5d6..202b9317 100644
--- a/src/ptf/templates/ptf/bs5/blocks/volume-items.html
+++ b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
@@ -2,15 +2,28 @@
 {% load i18n %}
 
 {% block title %}
-  {% with issues_articles|first as first %}
-    {{ first.issue.my_collection.title_sort }}, {% include 'common/volume/volume_string.html' %} {{ first.issue.volume }} ({{ first.issue.year }})
-  {% endwith %}
+  {% if all_issues %}
+    {% with special_issues|first as first_issue%}
+      {{ first_issue.my_collection.title_sort }}
+    {% endwith %}
+  {% else %}
+    {% with issues_articles|first as first %}
+      {{ first.issue.my_collection.title_sort }}, {% include 'common/volume/volume_string.html' %} {{ first.issue.volume }} ({{ first.issue.year }})
+    {% endwith %}
+  {% endif %}
 {% endblock %}
 {% comment %} 
 {% block breadcrumb %}
   {% include "common/breadcrumb.html" %}
 {% endblock %} {% endcomment %}
+
 {% block center_middle %}
+
+
+
+{% with  special_issues|first as first %}
+    {{ first.issue.my_collection.title_sort }}, {% include 'common/volume/volume_string.html' %} {{ first.issue.volume }} ({{ first.issue.year }})
+  {% endwith %}
   {% if all_issues %}
   {% include 'common/issue/all-issues.html' %}
   {% else %}
diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
index 96011e2c..bc7c0a80 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
@@ -1,4 +1,4 @@
-<h4>Derniers numéro thématiques </h4>
+<h4>Numéro thématiques </h4>
 <hr>
 <div>
   {% for special_issue in special_issues %}
-- 
GitLab


From e8015cc1e9338df5ddaba67e8244cdddec83d37d Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 13 Jan 2025 11:29:21 +0100
Subject: [PATCH 06/36] fix for deploy to prod

---
 src/ptf/cmds/xml/jats/jats_parser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ptf/cmds/xml/jats/jats_parser.py b/src/ptf/cmds/xml/jats/jats_parser.py
index 8a3f89bb..2b63adaa 100644
--- a/src/ptf/cmds/xml/jats/jats_parser.py
+++ b/src/ptf/cmds/xml/jats/jats_parser.py
@@ -370,7 +370,7 @@ class JatsBase(XmlParserBase):
             else:
                 mimetype = "image/jpeg"
 
-            if "is_abstract" in kwargs.keys() and kwargs["is_abstract"]:
+            if "is_abstract" in kwargs.keys() and kwargs.get("is_abstract", False):
                 img_url = "src/figures/" + basename
             else:
                 img_url = "src/tex/figures/" + basename
-- 
GitLab


From 6633e73f921959df90a10ca8e088da981b759c5a Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 13 Jan 2025 15:52:56 +0100
Subject: [PATCH 07/36] wip

---
 .../ptf/bs5/common/issue/special-issue-list.html          | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
index bc7c0a80..5dae6327 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
@@ -6,13 +6,15 @@
     <div class="last-special-issue">
         <div>
             <img class="special-issue-icon" src="/biologies/static/crbiol/img/couv-crbiol.jpg">
-        </div>
-        <div class="special-issue-caption">
             <a href="{%url 'item_id' special_issue.pid %}">{{ special_issue.title_html }}</a>
+            <p class="special_issue_editor">
             {% for contribution in special_issue.contributions.all %}
                 {{contribution}};
-            {% endfor %}
+            {% endfor %}</p>
         </div>
+        {% comment %} <div class="special-issue-caption">
+            
+        </div> {% endcomment %}
         
     </div>
     <hr >
-- 
GitLab


From 2e6ae8bfefd74bea2383df7a709af67a34e49e54 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 13 Jan 2025 16:04:20 +0100
Subject: [PATCH 08/36] wip

---
 src/ptf/templates/ptf/bs5/blocks/volume-items.html | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/ptf/templates/ptf/bs5/blocks/volume-items.html b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
index 202b9317..8cd325a2 100644
--- a/src/ptf/templates/ptf/bs5/blocks/volume-items.html
+++ b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
@@ -18,12 +18,6 @@
 {% endblock %} {% endcomment %}
 
 {% block center_middle %}
-
-
-
-{% with  special_issues|first as first %}
-    {{ first.issue.my_collection.title_sort }}, {% include 'common/volume/volume_string.html' %} {{ first.issue.volume }} ({{ first.issue.year }})
-  {% endwith %}
   {% if all_issues %}
   {% include 'common/issue/all-issues.html' %}
   {% else %}
-- 
GitLab


From 5ea655323749ede70110fc9d46b1fb9c270c77a6 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 13 Jan 2025 16:07:05 +0100
Subject: [PATCH 09/36] down to 3 last special issue

---
 src/ptf/views/base_views.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index b16ca011..812f47db 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -892,7 +892,7 @@ class IssuesView(TemplateView):
             special_issues = []
             issues = journal.content.all().exclude(title_html="").order_by("-year", "-volume", "-number")
             for n, special_issue in enumerate(issues):
-                if n <= 3:
+                if n <= 2:
                     special_issues.append(special_issue)
         if journal is None:
             raise Http404
-- 
GitLab


From bf4472fa9f6f5f590e6931b289229ae701990972 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 13 Jan 2025 16:52:31 +0100
Subject: [PATCH 10/36] wip

---
 .../ptf/bs5/common/issue/special-issue-list.html     | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
index 5dae6327..5c841d78 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
@@ -1,5 +1,4 @@
 <h4>Numéro thématiques </h4>
-<hr>
 <div>
   {% for special_issue in special_issues %}
         {% comment %} {% if special_issue.ctype == 'issue_special' %} {% endcomment %}
@@ -7,17 +6,18 @@
         <div>
             <img class="special-issue-icon" src="/biologies/static/crbiol/img/couv-crbiol.jpg">
             <a href="{%url 'item_id' special_issue.pid %}">{{ special_issue.title_html }}</a>
-            <p class="special_issue_editor">
+            
+            <div class="clearfix"></div>
             {% for contribution in special_issue.contributions.all %}
-                {{contribution}};
-            {% endfor %}</p>
+                <span class="special_issue_editor">{{contribution}}</span>;
+            {% endfor %}
         </div>
         {% comment %} <div class="special-issue-caption">
             
         </div> {% endcomment %}
-        
+        <hr >
     </div>
-    <hr >
+    
         {% comment %} {% endif %} {% endcomment %}
     {% endfor %}  
 </div>
-- 
GitLab


From 59862b0b578c8c5b06749123b32da669b6ba9dfa Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 13 Jan 2025 17:26:16 +0100
Subject: [PATCH 11/36] wip

---
 .../ptf/bs5/common/issue/special-issue-list.html      | 11 +++++++----
 src/ptf/views/base_views.py                           |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
index 5c841d78..7c223560 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
@@ -1,4 +1,4 @@
-<h4>Numéro thématiques </h4>
+<h4 style="margin-bottom: 25px;">Numéro thématiques </h4>
 <div>
   {% for special_issue in special_issues %}
         {% comment %} {% if special_issue.ctype == 'issue_special' %} {% endcomment %}
@@ -8,9 +8,12 @@
             <a href="{%url 'item_id' special_issue.pid %}">{{ special_issue.title_html }}</a>
             
             <div class="clearfix"></div>
-            {% for contribution in special_issue.contributions.all %}
-                <span class="special_issue_editor">{{contribution}}</span>;
-            {% endfor %}
+            <p class="special_issue_editor">
+                {% for contribution in special_issue.contributions.all %}
+                    <span >{{contribution}}</span>;
+                {% endfor %}
+            </p>
+            
         </div>
         {% comment %} <div class="special-issue-caption">
             
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index 812f47db..b16ca011 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -892,7 +892,7 @@ class IssuesView(TemplateView):
             special_issues = []
             issues = journal.content.all().exclude(title_html="").order_by("-year", "-volume", "-number")
             for n, special_issue in enumerate(issues):
-                if n <= 2:
+                if n <= 3:
                     special_issues.append(special_issue)
         if journal is None:
             raise Http404
-- 
GitLab


From 5d51db6e0742d16af199ff31d4c41da56b401223 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Tue, 14 Jan 2025 10:14:19 +0100
Subject: [PATCH 12/36] i lost flags for language selection

---
 src/ptf/templates/ptf/bs5/blocks/issue-list.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ptf/templates/ptf/bs5/blocks/issue-list.html b/src/ptf/templates/ptf/bs5/blocks/issue-list.html
index 965a33e5..300a0fb5 100644
--- a/src/ptf/templates/ptf/bs5/blocks/issue-list.html
+++ b/src/ptf/templates/ptf/bs5/blocks/issue-list.html
@@ -6,9 +6,9 @@
 {% comment %} Pas de breadcrumb ici {% endcomment %}
 {% block breadcrumb %}
 {% endblock breadcrumb %}
-{% block extra_css %}
+{% comment %} {% block extra_css %}
   <link rel="stylesheet" href="{% static "cr_app/css/cr_common.css" %}" />
-{% endblock %}
+{% endblock %} {% endcomment %}
 {% block center_middle %}
   <div class="d-flex flex-column gap-2 align-items-start">
     {% with logo_path=journal|get_image_path %}
-- 
GitLab


From 48f661ca5b0fa46831f0e5bdb6a1c14fbf9058bd Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Wed, 15 Jan 2025 10:36:03 +0100
Subject: [PATCH 13/36] wip

---
 .../bs5/common/issue/special-issue-list.html  | 22 +++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
index 7c223560..1d52592d 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
@@ -4,13 +4,31 @@
         {% comment %} {% if special_issue.ctype == 'issue_special' %} {% endcomment %}
     <div class="last-special-issue">
         <div>
-            <img class="special-issue-icon" src="/biologies/static/crbiol/img/couv-crbiol.jpg">
+            {% if special_issue.icon %}
+                <img class="special-issue-icon" src="{{ special_issue.icon }}">
+            {% else %}
+                <img class="special-issue-icon" src="{{ special_issue.icon }}">
+            {% endif %}
             <a href="{%url 'item_id' special_issue.pid %}">{{ special_issue.title_html }}</a>
             
             <div class="clearfix"></div>
             <p class="special_issue_editor">
                 {% for contribution in special_issue.contributions.all %}
-                    <span >{{contribution}}</span>;
+                    
+                    {% if LANGUAGE_CODE == "fr" %}
+                        {% if forloop.last %}
+                            <span >{{contribution}}</span> (éd.)
+                        {% else %}
+                            <span >{{contribution}}</span>;
+                        {% endif %}
+                        
+                    {% else %}
+                        {% if forloop.last %}
+                            <span >{{contribution}}</span> (ed.)
+                        {% else %}
+                            <span >{{contribution}}</span>;
+                        {% endif %}
+                    {% endif %}
                 {% endfor %}
             </p>
             
-- 
GitLab


From a8aea028c63e76e02f56d9dba1a2ce89d94e57f3 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Wed, 15 Jan 2025 14:55:32 +0100
Subject: [PATCH 14/36] changed src

---
 .../templates/ptf/bs5/common/issue/special-issue-list.html | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
index 1d52592d..41271cb9 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
@@ -1,3 +1,6 @@
+{% load i18n %}
+{% load static %}
+
 <h4 style="margin-bottom: 25px;">Numéro thématiques </h4>
 <div>
   {% for special_issue in special_issues %}
@@ -7,7 +10,9 @@
             {% if special_issue.icon %}
                 <img class="special-issue-icon" src="{{ special_issue.icon }}">
             {% else %}
-                <img class="special-issue-icon" src="{{ special_issue.icon }}">
+                {% with ""|add:special_issue.my_collection.pid|lower|add:"/img/couv-"|add:special_issue.my_collection.pid|lower|add:".jpg" as couv %}
+                    <img class="special-issue-icon" src="{% static couv %}">
+                {% endwith %}
             {% endif %}
             <a href="{%url 'item_id' special_issue.pid %}">{{ special_issue.title_html }}</a>
             
-- 
GitLab


From 20454778a1588ab2e8d0513213fc5815d12e2325 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Thu, 16 Jan 2025 15:28:57 +0100
Subject: [PATCH 15/36] commit before work for data migrations

---
 .../ptf/bs5/blocks/volume-items.html          | 28 +++++++++++++++++--
 .../templates/ptf/bs5/common/title/title.html |  2 +-
 src/ptf/views/base_views.py                   |  8 ++++--
 3 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/src/ptf/templates/ptf/bs5/blocks/volume-items.html b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
index 8cd325a2..1f31f86c 100644
--- a/src/ptf/templates/ptf/bs5/blocks/volume-items.html
+++ b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
@@ -19,9 +19,33 @@
 
 {% block center_middle %}
   {% if all_issues %}
-  {% include 'common/issue/all-issues.html' %}
+    {% include 'common/issue/all-issues.html' %}
   {% else %}
-    {% include 'common/volume/volume-items.html' %}
+    {% with modern_cras=modern_cras %}
+    {{issues_articles}}
+      {% include 'common/volume/volume-items.html'%}{% comment %} modern_cras is used for annual volume from 2025 {% endcomment %}
+    {% endwith %}
+    {{issues_articles}}
+    {{ special_issues }}
+    {% for special_issue in special_issues %}
+      <div class="article-div" style="margin-bottom:40px">
+        <div class="row">
+          <div class="col-12">
+            {% with issue=special_issue%}
+                {% if issue.title_html %}
+                    {% include 'common/issue-header-cr.html' with volume_toc=True %}
+                    {% if not forloop.last %}<hr class="separator">{% endif %}
+                {% elif with_thematic %}
+                    {% include 'common/issue-header-general-cr.html' with volume_toc=True with_title_link=True %}
+                    {% if not forloop.last %}<hr class="separator">{% endif %}
+                {% else %}
+                    {% include 'common/issue/issue-items-articles.html' with articles=issue_articles.articles %}
+                {% endif %}
+            {% endwith %}
+          </div>
+        </div>
+      </div>
+    {% endfor %}
   {% endif %}
 {% endblock %}
 
diff --git a/src/ptf/templates/ptf/bs5/common/title/title.html b/src/ptf/templates/ptf/bs5/common/title/title.html
index a3f60a93..5a8546d0 100644
--- a/src/ptf/templates/ptf/bs5/common/title/title.html
+++ b/src/ptf/templates/ptf/bs5/common/title/title.html
@@ -20,7 +20,7 @@
 {% endif %}
 
 {% if virtual_issues %}
-<p>Cet article fait partie du numéro spécial</p>
+<p>Cet article fait partie du numéro thématique</p>
 {% for virtual_issue in virtual_issues%}
 <ul>
   <li>{{virtual_issue.title_tex}}</li>
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index b16ca011..cec79a88 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -47,7 +47,7 @@ from ptf.cmds.xml.jats.builder.issue import get_title_xml
 from ptf.cmds.xml.jats.jats_parser import get_tex_from_xml
 from ptf.display import resolver, utils
 from ptf.model_data_converter import jats_from_abstract
-from ptf.models import Article
+from ptf.models import Article, Container
 from ptf.solr.search_helpers import CleanSearchURL
 from ptf.templatetags.helpers import decode_query_string
 from ptf.url_utils import format_url_with_params
@@ -640,7 +640,11 @@ class VolumeDetailView(TemplateView):
         issues_articles, collection = model_helpers.get_issues_in_volume(kwargs.get("vid"), is_cr)
         year = int(issues_articles[0]["issue"].year.split("-")[0])
         context["year"] = year
-
+        if year >= 2025:
+            context["special_issues"] = Container.objects.filter(year=year, my_collection__pid=collection.pid, ctype="issue_special")
+            context["modern_cras"] = True
+        else:
+            context["modern_cras"] = False
         if is_cr:
             context["group_issues"] = (settings.SITE_NAME != "crbiol" and year > 2020) or (
                 settings.SITE_NAME == "crbiol" and year > 2022
-- 
GitLab


From 98a584e8730c6730972d6652259d3f374b1bcdf8 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 3 Feb 2025 15:41:14 +0100
Subject: [PATCH 16/36] new display for cras volumes

---
 src/ptf/static/ptf/css/bs5/ptf.css            | 12 +++++
 .../ptf/bs5/blocks/volume-items.html          |  3 --
 src/ptf/views/base_views.py                   | 46 +++++++++++--------
 3 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/src/ptf/static/ptf/css/bs5/ptf.css b/src/ptf/static/ptf/css/bs5/ptf.css
index ae534f91..56c178fe 100644
--- a/src/ptf/static/ptf/css/bs5/ptf.css
+++ b/src/ptf/static/ptf/css/bs5/ptf.css
@@ -1224,3 +1224,15 @@ hr.panel-title-separator {
     margin-top: 5px;
     margin-bottom: 10px;
 }
+
+.cras-collapse-summary {
+    display: flex;
+    background-color: #cfc3d3ab;
+    margin-bottom: 20px;
+}
+
+.cras-collapse-summary-title {
+   width: 96%;
+   padding-top: 10px;
+   padding-left: 10px;
+}
\ No newline at end of file
diff --git a/src/ptf/templates/ptf/bs5/blocks/volume-items.html b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
index 1f31f86c..b1b10e17 100644
--- a/src/ptf/templates/ptf/bs5/blocks/volume-items.html
+++ b/src/ptf/templates/ptf/bs5/blocks/volume-items.html
@@ -22,11 +22,8 @@
     {% include 'common/issue/all-issues.html' %}
   {% else %}
     {% with modern_cras=modern_cras %}
-    {{issues_articles}}
       {% include 'common/volume/volume-items.html'%}{% comment %} modern_cras is used for annual volume from 2025 {% endcomment %}
     {% endwith %}
-    {{issues_articles}}
-    {{ special_issues }}
     {% for special_issue in special_issues %}
       <div class="article-div" style="margin-bottom:40px">
         <div class="row">
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index cec79a88..de87f785 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -637,14 +637,21 @@ class VolumeDetailView(TemplateView):
         )
         context["is_cr"] = is_cr
 
-        issues_articles, collection = model_helpers.get_issues_in_volume(kwargs.get("vid"), is_cr)
+        issues_articles, collection = model_helpers.get_issues_in_volume(kwargs.get("vid"), is_cr, general_articles=True)
         year = int(issues_articles[0]["issue"].year.split("-")[0])
         context["year"] = year
-        if year >= 2025:
-            context["special_issues"] = Container.objects.filter(year=year, my_collection__pid=collection.pid, ctype="issue_special")
+        if year >= 2024:
+            self.template_name = "blocks/volume-general-items.html"
+            # used for special issue with year == context["year"]
+            in_year_special_issues = Container.objects.filter(year=year, my_collection__pid=collection.pid, ctype="issue_special")
+            # used for special issue with a ResourceInSpecialIssue with year = context["year"]
+            previous_year_special_issues = Container.objects.filter(my_collection__pid=collection.pid, ctype="issue_special" , resources_in_special_issue__resource__date_published__year=year)
+            context["special_issues"] = in_year_special_issues.union(previous_year_special_issues)
             context["modern_cras"] = True
         else:
             context["modern_cras"] = False
+
+        # if not context["modern_cras"]:
         if is_cr:
             context["group_issues"] = (settings.SITE_NAME != "crbiol" and year > 2020) or (
                 settings.SITE_NAME == "crbiol" and year > 2022
@@ -654,23 +661,26 @@ class VolumeDetailView(TemplateView):
                 len(issues_articles) > 1 and len(issues_articles[1]["issue"].title_html) > 0
             )
             context["with_thematic"] = with_thematic
+        
+            # Olivier 7/30/2020. Le code suivant crash lorsque fpage n'est pas un entier mais un chiffre romain
+            # Il faut rediscuter des specs. Ordonner par 'seq' semble plus simple.
+            # Il faut peut-être juste s'assurer que 'seq' soit bien mis à l'import ?
+
+            #  Ex: /volume/WBLN_2018__5/
+            # issues_articles = []
+            # for issue in issues:
+            #     articles = issue.article_set.all().annotate(
+            #         fpage_int=Cast(
+            #             Case(When(~Q(fpage=''), then='fpage'), default=Value('0')),
+            #             IntegerField()
+            #         )
+            #     ).order_by('seq', 'fpage_int')
+            #
+            #     issues_articles.append({'issue': issue, 'articles': articles})
 
-        # Olivier 7/30/2020. Le code suivant crash lorsque fpage n'est pas un entier mais un chiffre romain
-        # Il faut rediscuter des specs. Ordonner par 'seq' semble plus simple.
-        # Il faut peut-être juste s'assurer que 'seq' soit bien mis à l'import ?
-
-        #  Ex: /volume/WBLN_2018__5/
-        # issues_articles = []
-        # for issue in issues:
-        #     articles = issue.article_set.all().annotate(
-        #         fpage_int=Cast(
-        #             Case(When(~Q(fpage=''), then='fpage'), default=Value('0')),
-        #             IntegerField()
-        #         )
-        #     ).order_by('seq', 'fpage_int')
-        #
-        #     issues_articles.append({'issue': issue, 'articles': articles})
+        # else:
 
+        
         context["issues_articles"] = issues_articles
         context["collection"] = collection
         context["journal"] = collection
-- 
GitLab


From 656d83d65c56d5a43c576b668950cd2ecae6d3fe Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Tue, 4 Feb 2025 14:28:49 +0100
Subject: [PATCH 17/36] added empty special_issue for other collections

---
 src/ptf/views/base_views.py | 44 +++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 16 deletions(-)

diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index de87f785..e48d9760 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -584,21 +584,25 @@ class CollectionView(ItemView):
             # en theorie: coltype=book-series TODO: check lectures
             request.META["QUERY_STRING"] = '"' + collection.title_html + '"-p'
             return sorted_books(request)
+
+
 class AllSpecialIssuesView(TemplateView):
     template_name = "blocks/volume-items.html"
 
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
-        pid = self.kwargs.get('pid')
-        collection =  model_helpers.get_collection(pid)
-        special_issues = collection.content.all().exclude(title_html="").order_by("-year", "-volume", "-number")
+        pid = self.kwargs.get("pid")
+        collection = model_helpers.get_collection(pid)
+        special_issues = (
+            collection.content.all().exclude(title_html="").order_by("-year", "-volume", "-number")
+        )
         context["issues_articles"] = []
         for special_issue in special_issues:
-            if special_issue.ctype == 'issue_special':
+            if special_issue.ctype == "issue_special":
                 for resource in special_issue.resources_in_special_issue.all():
                     context["issues_articles"].append(resource)
                 # context["issues_articles"].append(resource.all() for resource in special_issue.resources_in_special_issue.all())
-            elif special_issue.ctype == 'issue':
+            elif special_issue.ctype == "issue":
                 for article in special_issue.article_set.all():
                     context["issues_articles"].append(article)
                 # context["issues_articles"].append(article for article in special_issue.article_set.all())
@@ -610,13 +614,11 @@ class AllSpecialIssuesView(TemplateView):
         )
         context["is_cr"] = is_cr
 
-        
-
         context["collection"] = collection
         context["journal"] = collection
         context["coltype"] = collection.coltype
         context["btn_show_tex"] = settings.SHOW_TEX if hasattr(settings, "SHOW_TEX") else False
-        context["special_issues"]= special_issues
+        context["special_issues"] = special_issues
         context["all_issues"] = True
 
         return context
@@ -637,15 +639,23 @@ class VolumeDetailView(TemplateView):
         )
         context["is_cr"] = is_cr
 
-        issues_articles, collection = model_helpers.get_issues_in_volume(kwargs.get("vid"), is_cr, general_articles=True)
+        issues_articles, collection = model_helpers.get_issues_in_volume(
+            kwargs.get("vid"), is_cr, general_articles=True
+        )
         year = int(issues_articles[0]["issue"].year.split("-")[0])
         context["year"] = year
         if year >= 2024:
             self.template_name = "blocks/volume-general-items.html"
             # used for special issue with year == context["year"]
-            in_year_special_issues = Container.objects.filter(year=year, my_collection__pid=collection.pid, ctype="issue_special")
+            in_year_special_issues = Container.objects.filter(
+                year=year, my_collection__pid=collection.pid, ctype="issue_special"
+            )
             # used for special issue with a ResourceInSpecialIssue with year = context["year"]
-            previous_year_special_issues = Container.objects.filter(my_collection__pid=collection.pid, ctype="issue_special" , resources_in_special_issue__resource__date_published__year=year)
+            previous_year_special_issues = Container.objects.filter(
+                my_collection__pid=collection.pid,
+                ctype="issue_special",
+                resources_in_special_issue__resource__date_published__year=year,
+            )
             context["special_issues"] = in_year_special_issues.union(previous_year_special_issues)
             context["modern_cras"] = True
         else:
@@ -661,7 +671,7 @@ class VolumeDetailView(TemplateView):
                 len(issues_articles) > 1 and len(issues_articles[1]["issue"].title_html) > 0
             )
             context["with_thematic"] = with_thematic
-        
+
             # Olivier 7/30/2020. Le code suivant crash lorsque fpage n'est pas un entier mais un chiffre romain
             # Il faut rediscuter des specs. Ordonner par 'seq' semble plus simple.
             # Il faut peut-être juste s'assurer que 'seq' soit bien mis à l'import ?
@@ -680,7 +690,6 @@ class VolumeDetailView(TemplateView):
 
         # else:
 
-        
         context["issues_articles"] = issues_articles
         context["collection"] = collection
         context["journal"] = collection
@@ -902,9 +911,13 @@ class IssuesView(TemplateView):
         context = super().get_context_data(**kwargs)
         jid = self.kwargs.get("jid")
         journal = model_helpers.get_collection(jid, sites="")
+        special_issues = []
         if "CR" in jid:
-            special_issues = []
-            issues = journal.content.all().exclude(title_html="").order_by("-year", "-volume", "-number")
+            issues = (
+                journal.content.all()
+                .exclude(title_html="")
+                .order_by("-year", "-volume", "-number")
+            )
             for n, special_issue in enumerate(issues):
                 if n <= 3:
                     special_issues.append(special_issue)
@@ -978,7 +991,6 @@ class IssuesView(TemplateView):
             "is_cr": is_cr,
             "current_edition": current_edition,
             "collections": collections,
-            
         }
 
         if journal.pid in settings.YEARLY_COLLECTIONS:
-- 
GitLab


From 0355ec3c2f62a5e69ed3b6603a1a989333de4610 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Thu, 6 Feb 2025 15:02:49 +0100
Subject: [PATCH 18/36] added simple issue for display

---
 src/ptf/views/base_views.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index e48d9760..f38920e0 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -648,12 +648,12 @@ class VolumeDetailView(TemplateView):
             self.template_name = "blocks/volume-general-items.html"
             # used for special issue with year == context["year"]
             in_year_special_issues = Container.objects.filter(
-                year=year, my_collection__pid=collection.pid, ctype="issue_special"
+                year=year, my_collection__pid=collection.pid, ctype__in=["issue_special", "issue"]
             )
             # used for special issue with a ResourceInSpecialIssue with year = context["year"]
             previous_year_special_issues = Container.objects.filter(
                 my_collection__pid=collection.pid,
-                ctype="issue_special",
+                ctype__in=["issue_special", "issue"],
                 resources_in_special_issue__resource__date_published__year=year,
             )
             context["special_issues"] = in_year_special_issues.union(previous_year_special_issues)
-- 
GitLab


From b044c4653d64d7137192187f30121dc6ac3750f9 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Thu, 6 Feb 2025 15:40:35 +0100
Subject: [PATCH 19/36] added 2021 to new display

---
 src/ptf/views/base_views.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index f38920e0..989d8cdc 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -643,8 +643,9 @@ class VolumeDetailView(TemplateView):
             kwargs.get("vid"), is_cr, general_articles=True
         )
         year = int(issues_articles[0]["issue"].year.split("-")[0])
+        context["modern_cras"] = False
         context["year"] = year
-        if year >= 2024:
+        if year >= 2021:
             self.template_name = "blocks/volume-general-items.html"
             # used for special issue with year == context["year"]
             in_year_special_issues = Container.objects.filter(
@@ -658,8 +659,6 @@ class VolumeDetailView(TemplateView):
             )
             context["special_issues"] = in_year_special_issues.union(previous_year_special_issues)
             context["modern_cras"] = True
-        else:
-            context["modern_cras"] = False
 
         # if not context["modern_cras"]:
         if is_cr:
-- 
GitLab


From 278fef141c3cd9dd9f39f118ac1ae2338c3f0af5 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Thu, 6 Feb 2025 17:46:19 +0100
Subject: [PATCH 20/36] wip

---
 .../ptf/bs5/common/issue/special-issue-list.html     | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
index 41271cb9..6144227b 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-list.html
@@ -1,7 +1,10 @@
 {% load i18n %}
 {% load static %}
-
-<h4 style="margin-bottom: 25px;">Numéro thématiques </h4>
+{% if LANGUAGE_CODE == 'en' %}
+<h4 style="margin-bottom: 25px;">Special issues</h4>
+{% else %}
+<h4 style="margin-bottom: 25px;">Numéros thématiques </h4>
+{% endif %}
 <div>
   {% for special_issue in special_issues %}
         {% comment %} {% if special_issue.ctype == 'issue_special' %} {% endcomment %}
@@ -48,6 +51,11 @@
     {% endfor %}  
 </div>
 <div style="text-align:center;">
+    {% if LANGUAGE_CODE == 'en' %}
+    <a href="{% url 'all_issues' journal.pid %}" >See all special issues</a>
+    {% else %}
     <a href="{% url 'all_issues' journal.pid %}" >Voir tous nos numéros thématiques</a>
+    {% endif %}
+    
 </div>
 
-- 
GitLab


From d5651f124d71914b578771e5164ae52e5f627253 Mon Sep 17 00:00:00 2001
From: Samuel Conjard <samuel.conjard@univ-grenoble-alpes.fr>
Date: Mon, 10 Feb 2025 10:24:00 +0100
Subject: [PATCH 21/36] Pandoc added list types for li, removed useless kwargs
 comment

---
 requirements.txt                             |  3 +-
 src/ptf/cmds/xml/ckeditor/ckeditor_parser.py | 13 ++++---
 src/ptf/utils.py                             | 39 +++++++++++++++++---
 3 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/requirements.txt b/requirements.txt
index ff606d19..99a08aab 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -30,4 +30,5 @@ requests==2.31.0
 Unidecode==1.3.7
 xmltodict==0.13.0
 pre-commit==3.6.2
-requests-cache==1.2.1
\ No newline at end of file
+requests-cache==1.2.1
+roman==5.0
\ No newline at end of file
diff --git a/src/ptf/cmds/xml/ckeditor/ckeditor_parser.py b/src/ptf/cmds/xml/ckeditor/ckeditor_parser.py
index 7ef1e5d6..e2c4ff49 100644
--- a/src/ptf/cmds/xml/ckeditor/ckeditor_parser.py
+++ b/src/ptf/cmds/xml/ckeditor/ckeditor_parser.py
@@ -30,6 +30,7 @@ from lxml import etree
 
 from ptf.cmds.xml.xml_utils import escape, get_xml_from_node, normalize, replace_html_entities
 from ptf.display import resolver
+from ptf.utils import convert_index_to_list_type
 
 # from ptf.utils import create_interlink_for_citation
 
@@ -454,16 +455,18 @@ class CkeditorParser:
             tex_text = f"<li >{inner_tex_text}</li>"
         else:  # ol
             index = int(parent_node.get("start", 1))
+            list_type = parent_node.get("type", "1")  # Defaults to numeric if no type specified
             current_node = node
-            while (
-                current_node.getprevious() is not None
-            ):  # Search for preceding li elements to know current node value index.
+
+            # Calculate the correct index value based on preceding <li> elements
+            while current_node.getprevious() is not None:
                 index += 1
                 current_node = current_node.getprevious()
-            value_attribute = f" value='{index}'"
+
+            value_attribute = f" value='{convert_index_to_list_type(index, list_type)}'"
+
             html_text = f"<li class='article-list'{value_attribute}>{inner_html_text}</li>"
             tex_text = f"<li class='article-list'{value_attribute}>{inner_tex_text}</li>"
-            kwargs["index"] = index + 1
 
         xml_text = f"<list-item><p>{inner_jats_xml_text}</p></list-item>"
 
diff --git a/src/ptf/utils.py b/src/ptf/utils.py
index 7210e5f7..34e06ba4 100644
--- a/src/ptf/utils.py
+++ b/src/ptf/utils.py
@@ -15,6 +15,7 @@ from django.template.loader import render_to_string  # type: ignore
 from django.utils.html import strip_tags  # type: ignore
 from django.utils.translation import gettext_lazy as _  # type: ignore
 from PIL import Image, ImageFile
+from roman import toRoman
 
 from ptf.site_register import SITE_REGISTER
 
@@ -88,16 +89,18 @@ def pdf_to_text(pdf_filename, force_execute=False):
     # Extract full text from the PDF
     if settings.MERSENNE_CREATE_FRONTPAGE or force_execute:
         txt_filename = os.path.join(settings.MERSENNE_TMP_FOLDER, "fulltext.txt")
-        
+
         try:
             os.makedirs(settings.MERSENNE_TMP_FOLDER, exist_ok=True)
-            
+
             cmd_str = "pdftotext -raw -nopgbrk -enc UTF-8 " + pdf_filename + " " + txt_filename
             execute_cmd(cmd_str, force_execute=force_execute)
-            
+
             # Check if the output file has been created
             if not os.path.isfile(txt_filename) or os.path.getsize(txt_filename) == 0:
-                raise RuntimeError("The PDF file was not converted by pdftotext (output file is empty).")
+                raise RuntimeError(
+                    "The PDF file was not converted by pdftotext (output file is empty)."
+                )
 
             body = get_file_content_in_utf8(txt_filename)
             # strip control characters
@@ -112,7 +115,7 @@ def pdf_to_text(pdf_filename, force_execute=False):
             if os.path.isfile(txt_filename):
                 os.remove(txt_filename)
     else:
-       return ""
+        return ""
 
 
 def linearize_pdf(from_path, to_path):
@@ -578,3 +581,29 @@ def create_interlink_for_citation(html_text: str, bibliography: list[dict[str, s
         html_text = pattern.sub(replace_with_link, html_text)
 
     return html_text
+
+
+def convert_index_to_list_type(index: int, list_type: str) -> str:
+    """
+    Converts the index of a list to the same index of corresponding type
+    i.e. index 3 with list_type "a" will give "c"
+
+    Args:
+        index (int): The index.
+        list_type (str): The list type ("1", "a", "A", "i" or "I")
+
+    Returns:
+        _type_: The converted index
+    """
+    if list_type == "1":
+        return f"{index}"
+    elif list_type == "a":
+        return f"{chr(96 + index)}"
+    elif list_type == "A":
+        return f"{chr(64 + index)}"
+    elif list_type == "i":
+        return f"{toRoman(index).lower()}"
+    elif list_type == "I":
+        return f"{toRoman(index)}"
+    else:  # Fallback to numeric
+        return f"{index}"
-- 
GitLab


From 9704924a8713b14da881e7302c47bdc556a5b5ae Mon Sep 17 00:00:00 2001
From: Xavier Beaufils <xavier.beaufils@univ-grenoble-alpes.fr>
Date: Mon, 10 Feb 2025 10:44:58 +0100
Subject: [PATCH 22/36] Indexing checker

---
 src/ptf/external/ads.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ptf/external/ads.py b/src/ptf/external/ads.py
index 6e0af2b8..c4aeba0f 100644
--- a/src/ptf/external/ads.py
+++ b/src/ptf/external/ads.py
@@ -43,6 +43,7 @@ class AdsQuery:
                 print(result)
 
     def _query(self, issn: str):
+        ads_token = getattr(settings, "ADS_TOKEN", None)
         url = "https://api.adsabs.harvard.edu/v1/search/query"
         query_param = {
             "fl": "doi,title,pub",
@@ -50,7 +51,7 @@ class AdsQuery:
             "start": self._start,
             "q": f"issn:\"{issn}\"",
         }
-        response = session.get(url, params=query_param, headers={"Authorization": "Bearer " + settings.ADS_TOKEN})
+        response = session.get(url, params=query_param, headers={"Authorization": "Bearer " + ads_token})
         response.raise_for_status()
         data = json.loads(response.text)
         self._count = data["response"]["numFound"]
-- 
GitLab


From 248e12a1ebda4875c005711b501ce989390df987 Mon Sep 17 00:00:00 2001
From: Samuel Conjard <samuel.conjard@univ-grenoble-alpes.fr>
Date: Mon, 10 Feb 2025 16:54:58 +0100
Subject: [PATCH 23/36] Removed deceased author icon religious connotation for
 PCJ

---
 src/ptf/templates/common/common-contrib-with-address.html       | 2 +-
 .../ptf/bs5/common/contribution/contrib-with-address.html       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ptf/templates/common/common-contrib-with-address.html b/src/ptf/templates/common/common-contrib-with-address.html
index 1132b142..54a0f01a 100644
--- a/src/ptf/templates/common/common-contrib-with-address.html
+++ b/src/ptf/templates/common/common-contrib-with-address.html
@@ -28,7 +28,7 @@
     {% endspaceless %}<!--
 -->{% if article_page and contribution.equal_contrib %}<sup title="{% trans 'Contribution à part égale' %}"><i class="fa fa-hashtag text-muted" aria-hidden="true"></i></sup>{% endif %}<!--
 -->{% if article_page and contribution.corresponding %}<sup><span class="glyphicon glyphicon-user" title="{% trans "Auteur correspondant" %}" style="color:#999999"></span></sup>{% endif %}<!--
--->{% if article_page and contribution.deceased_before_publication %}&nbsp;<sup>&dagger;</sup>{% endif %}<!--
+-->{% if article_page and contribution.deceased_before_publication %}{% if collection.pid == "PCJ" %}*{% else %} &nbsp;<sup>&dagger;</sup>{% endif %}{% endif %}<!--
 -->{% if not forloop.last %}{% if LANGUAGE_CODE == 'fr' %}&nbsp;{% endif %};{% endif %}<!--
 -->{% endif %}
   {% endfor %}
diff --git a/src/ptf/templates/ptf/bs5/common/contribution/contrib-with-address.html b/src/ptf/templates/ptf/bs5/common/contribution/contrib-with-address.html
index c0e67491..2581e5f0 100644
--- a/src/ptf/templates/ptf/bs5/common/contribution/contrib-with-address.html
+++ b/src/ptf/templates/ptf/bs5/common/contribution/contrib-with-address.html
@@ -28,7 +28,7 @@
 -->{% if article_page and contribution.orcid %}<sup><a href="{{contribution.orcid_href}}" target="_blank"><img style="width:16px;margin-top:-3px;margin-left:3px" src='{% static "ptf/img/orcid.svg" %}'></a></sup>&nbsp;{% endif %}<!--
 -->{% if article_page and contribution.equal_contrib %}<sup title="{% trans 'Contribution à part égale' %}"><i class="fa fa-hashtag text-muted" aria-hidden="true"></i></sup>&nbsp;{% endif %}<!--
 -->{% if article_page and contribution.corresponding %}<sup><span class="glyphicon glyphicon-user" title="{% trans "Auteur correspondant" %}" style="color:#999999"></span></sup>&nbsp;{% endif %}<!--
--->{% if article_page and contribution.deceased_before_publication %}&nbsp;<sup>&dagger;</sup>{% endif %}<!--
+-->{% if article_page and contribution.deceased_before_publication %}{% if collection.pid == "PCJ" %}*{% else %} &nbsp;<sup>&dagger;</sup>{% endif %}{% endif %}<!--
 -->{% if not forloop.last %}{% if LANGUAGE_CODE == 'fr' %}&nbsp;{% endif %};{% endif %}<!--
 -->{% endif %}
   {% endfor %}
-- 
GitLab


From 72df14bd7f89650020a31dd21c96244a4db52f51 Mon Sep 17 00:00:00 2001
From: Samuel Conjard <samuel.conjard@univ-grenoble-alpes.fr>
Date: Tue, 11 Feb 2025 08:46:13 +0100
Subject: [PATCH 24/36] Update PCJ requirements, remove useless roman import

---
 requirements.txt                                            | 3 +--
 src/ptf/templates/common/common-contrib-with-address.html   | 2 +-
 .../ptf/bs5/common/contribution/contrib-with-address.html   | 2 +-
 src/ptf/utils.py                                            | 6 +++---
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/requirements.txt b/requirements.txt
index 99a08aab..ff606d19 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -30,5 +30,4 @@ requests==2.31.0
 Unidecode==1.3.7
 xmltodict==0.13.0
 pre-commit==3.6.2
-requests-cache==1.2.1
-roman==5.0
\ No newline at end of file
+requests-cache==1.2.1
\ No newline at end of file
diff --git a/src/ptf/templates/common/common-contrib-with-address.html b/src/ptf/templates/common/common-contrib-with-address.html
index 54a0f01a..18ccbd38 100644
--- a/src/ptf/templates/common/common-contrib-with-address.html
+++ b/src/ptf/templates/common/common-contrib-with-address.html
@@ -28,7 +28,7 @@
     {% endspaceless %}<!--
 -->{% if article_page and contribution.equal_contrib %}<sup title="{% trans 'Contribution à part égale' %}"><i class="fa fa-hashtag text-muted" aria-hidden="true"></i></sup>{% endif %}<!--
 -->{% if article_page and contribution.corresponding %}<sup><span class="glyphicon glyphicon-user" title="{% trans "Auteur correspondant" %}" style="color:#999999"></span></sup>{% endif %}<!--
--->{% if article_page and contribution.deceased_before_publication %}{% if collection.pid == "PCJ" %}*{% else %} &nbsp;<sup>&dagger;</sup>{% endif %}{% endif %}<!--
+-->{% if article_page and contribution.deceased_before_publication and not collection.pid == "PCJ"%}&nbsp;<sup>&dagger;</sup>{% endif %}<!--
 -->{% if not forloop.last %}{% if LANGUAGE_CODE == 'fr' %}&nbsp;{% endif %};{% endif %}<!--
 -->{% endif %}
   {% endfor %}
diff --git a/src/ptf/templates/ptf/bs5/common/contribution/contrib-with-address.html b/src/ptf/templates/ptf/bs5/common/contribution/contrib-with-address.html
index 2581e5f0..4fb6a299 100644
--- a/src/ptf/templates/ptf/bs5/common/contribution/contrib-with-address.html
+++ b/src/ptf/templates/ptf/bs5/common/contribution/contrib-with-address.html
@@ -28,7 +28,7 @@
 -->{% if article_page and contribution.orcid %}<sup><a href="{{contribution.orcid_href}}" target="_blank"><img style="width:16px;margin-top:-3px;margin-left:3px" src='{% static "ptf/img/orcid.svg" %}'></a></sup>&nbsp;{% endif %}<!--
 -->{% if article_page and contribution.equal_contrib %}<sup title="{% trans 'Contribution à part égale' %}"><i class="fa fa-hashtag text-muted" aria-hidden="true"></i></sup>&nbsp;{% endif %}<!--
 -->{% if article_page and contribution.corresponding %}<sup><span class="glyphicon glyphicon-user" title="{% trans "Auteur correspondant" %}" style="color:#999999"></span></sup>&nbsp;{% endif %}<!--
--->{% if article_page and contribution.deceased_before_publication %}{% if collection.pid == "PCJ" %}*{% else %} &nbsp;<sup>&dagger;</sup>{% endif %}{% endif %}<!--
+-->{% if article_page and contribution.deceased_before_publication and not collection.pid == "PCJ"%}&nbsp;<sup>&dagger;</sup>{% endif %}<!--
 -->{% if not forloop.last %}{% if LANGUAGE_CODE == 'fr' %}&nbsp;{% endif %};{% endif %}<!--
 -->{% endif %}
   {% endfor %}
diff --git a/src/ptf/utils.py b/src/ptf/utils.py
index 34e06ba4..bf1f86ad 100644
--- a/src/ptf/utils.py
+++ b/src/ptf/utils.py
@@ -15,7 +15,7 @@ from django.template.loader import render_to_string  # type: ignore
 from django.utils.html import strip_tags  # type: ignore
 from django.utils.translation import gettext_lazy as _  # type: ignore
 from PIL import Image, ImageFile
-from roman import toRoman
+from ptf.cmds.xml.xml_utils import int_to_Roman
 
 from ptf.site_register import SITE_REGISTER
 
@@ -602,8 +602,8 @@ def convert_index_to_list_type(index: int, list_type: str) -> str:
     elif list_type == "A":
         return f"{chr(64 + index)}"
     elif list_type == "i":
-        return f"{toRoman(index).lower()}"
+        return f"{int_to_Roman(index).lower()}"
     elif list_type == "I":
-        return f"{toRoman(index)}"
+        return f"{int_to_Roman(index)}"
     else:  # Fallback to numeric
         return f"{index}"
-- 
GitLab


From ec851bdfe54c4075f5709f00995722e857b9d014 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Tue, 11 Feb 2025 12:42:29 +0100
Subject: [PATCH 25/36] Fix abstract images class

---
 src/ptf/cmds/xml/ckeditor/ckeditor_parser.py | 10 +++++++---
 src/ptf/cmds/xml/jats/jats_parser.py         |  8 ++++++--
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/ptf/cmds/xml/ckeditor/ckeditor_parser.py b/src/ptf/cmds/xml/ckeditor/ckeditor_parser.py
index e2c4ff49..6ed008bb 100644
--- a/src/ptf/cmds/xml/ckeditor/ckeditor_parser.py
+++ b/src/ptf/cmds/xml/ckeditor/ckeditor_parser.py
@@ -405,6 +405,7 @@ class CkeditorParser:
             if "uploads" in src:
                 specific_use = "/".join(src.split("/")[-3:])
         classe = ""
+        style = ""
         for attrib in node.attrib:
             name = normalize(attrib)
             if name == "src":
@@ -430,18 +431,21 @@ class CkeditorParser:
                 src = f"{src}/{img}"
                 if "CR" in self.issue_pid or "HOUCHES" in self.issue_pid:
                     href = f"{href}/{img}"
-            elif name == "style":
+            elif name == "style" and "CR" not in self.issue_pid:
                 classe = "article-body-img"
             elif name == "data-custom-style":
                 classe = node.attrib[name].replace(" ", "-")
+            elif name == "class":
+                print(name, node.attrib[name])
+                classe = node.attrib[name]
 
-        html_text = f"<img src={src} class={classe}>{inner_html_text}</img>"
+        html_text = f"<img src={src} class={classe} style='{style}'>{inner_html_text}</img>"
         tex_text = f"<img src={src} class={classe}>{inner_html_text}</img>"
         xml_text = '<graphic xmlns:xlink="http://www.w3.org/1999/xlink" href="'
         if self.issue_pid.startswith("PCJ"):
             xml_text += f'{src}">{inner_jats_xml_text}</graphic>'
         elif "CR" in self.issue_pid or "HOUCHES" in self.issue_pid:
-            xml_text += f'{href}" specific-use="{specific_use}">{inner_jats_xml_text}</graphic>'
+            xml_text += f'{href}" specific-use="{specific_use}" position="{classe}">{inner_jats_xml_text}</graphic>'
 
         return html_text, tex_text, xml_text
 
diff --git a/src/ptf/cmds/xml/jats/jats_parser.py b/src/ptf/cmds/xml/jats/jats_parser.py
index 0f368bff..493d4f1d 100644
--- a/src/ptf/cmds/xml/jats/jats_parser.py
+++ b/src/ptf/cmds/xml/jats/jats_parser.py
@@ -346,11 +346,14 @@ class JatsBase(XmlParserBase):
         => change the location to "file:/..." for Elsevier JATS (the xarticle has a pii attribute)
         """
         href = ""
-
+        style = ""
+        classe = "article-body-img"
         for attrib in node.attrib:
             name = normalize(attrib)
             if name == "href":
                 href = node.attrib[attrib]
+            if name == "position":
+                classe = node.attrib[attrib]
         if not kwargs.get("base_url", False):
             if hasattr(settings, "SITE_URL_PREFIX") and kwargs.get("is_abstract", False):
                 prefix = settings.SITE_URL_PREFIX
@@ -404,9 +407,10 @@ class JatsBase(XmlParserBase):
                 img_url = os.path.join(kwargs["base_url"], "png", img_url)
             else:
                 img_url = os.path.join(kwargs["base_url"], "jpg", img_url)
+            
             img_text = '<a href="' + img_url + '" data-lightbox="image-'
             img_text += str(len(self.figures)) + '" title="">'
-            img_text += '<img src="' + img_url + '" class="article-body-img" />'
+            img_text += '<img src="' + img_url + f'" class="{classe}"/>'
             img_text += "</a>"
 
             if data not in self.figures:
-- 
GitLab


From 6db6b3e35d47f03dc34ec12afec3e837dafdf634 Mon Sep 17 00:00:00 2001
From: Xavier Beaufils <xavier.beaufils@univ-grenoble-alpes.fr>
Date: Tue, 11 Feb 2025 14:30:37 +0100
Subject: [PATCH 26/36] Indexing checker

---
 src/ptf/external/ads.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ptf/external/ads.py b/src/ptf/external/ads.py
index c4aeba0f..574260da 100644
--- a/src/ptf/external/ads.py
+++ b/src/ptf/external/ads.py
@@ -13,7 +13,7 @@ session = CachedSession(
         decode_content=False,
     ),
     match_headers={
-        "Authorization": "Bearer " + settings.ADS_TOKEN,
+        "Authorization": "Bearer " + getattr(settings, "ADS_TOKEN", ""),
         "User-Agent": getattr(settings, "REQUESTS_USER_AGENT", None) or "Mathdoc/1.0.0",
         "From": getattr(settings, "REQUESTS_EMAIL", None) or "accueil@listes.mathdoc.fr",
     },
-- 
GitLab


From 3963acc436d4683efbcc32b1cba226d289ad3565 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Wed, 12 Feb 2025 16:32:23 +0100
Subject: [PATCH 27/36] added order_by in issues list

---
 src/ptf/views/base_views.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index 989d8cdc..d8d9e471 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -657,7 +657,7 @@ class VolumeDetailView(TemplateView):
                 ctype__in=["issue_special", "issue"],
                 resources_in_special_issue__resource__date_published__year=year,
             )
-            context["special_issues"] = in_year_special_issues.union(previous_year_special_issues)
+            context["special_issues"] = in_year_special_issues.union(previous_year_special_issues).order_by("-year", "-volume", "-number")
             context["modern_cras"] = True
 
         # if not context["modern_cras"]:
-- 
GitLab


From 7c513043f9c81aee5fe0894e11fe4c2585aa52ce Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Thu, 13 Feb 2025 17:13:31 +0100
Subject: [PATCH 28/36] edito appear first in special issue summary

---
 src/ptf/models.py                             |  3 ++-
 .../ptf/bs5/common/issue/issue-items.html     |  1 -
 .../issue/special-issue-items-resource.html   | 18 +++++++++++++++++-
 src/ptf/urls.py                               |  6 ++++++
 src/ptf/views/base_views.py                   | 19 +++++++++++++++++--
 5 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/src/ptf/models.py b/src/ptf/models.py
index 95dcdb35..1e06947c 100644
--- a/src/ptf/models.py
+++ b/src/ptf/models.py
@@ -710,7 +710,7 @@ class Resource(models.Model):
         filename = None
 
         if (
-            doctype not in ["self", "toc", "frontmatter", "backmatter"]
+            doctype not in ["self", "toc", "frontmatter", "backmatter", "edito"]
             and len(doctype) == 2
             and hasattr(self, "translations")
         ):
@@ -733,6 +733,7 @@ class Resource(models.Model):
             else:
                 try:
                     obj = self.datastream_set.get(mimetype=mimetype)
+                    
 
                 except DataStream.DoesNotExist:
                     # status = 404
diff --git a/src/ptf/templates/ptf/bs5/common/issue/issue-items.html b/src/ptf/templates/ptf/bs5/common/issue/issue-items.html
index 2a3cb075..a6bef657 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/issue-items.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/issue-items.html
@@ -54,7 +54,6 @@
                 {% endif %}
               {% endfor %}
             </div>
-              
             {% if issue.body_html %}
               {{ issue.body_html|safe }}
             {% endif %}
diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
index 0d055003..9f55688a 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
@@ -2,9 +2,25 @@
 {% load helpers %}
 {% load static %}
 
+{% if issue_edito %}
+<span class="common-title article-title">
+  {% if LANGUAGE_CODE == "fr"%}
+  Édito
+  {% else %}
+  Edito
+  {% endif %}
+</span>
+<p>
+  <a href="{% url 'item-edito-pdf' issue_edito 'pdf'  %}" target="_blank">
+    <img src="{% static 'ptf/img/pdf.gif' %}">
+  </a>
+</p>
 
+<div style="margin-bottom: 10px;">{% include 'common/contribution/contrib.html' with item=obj for_issue=True %}</div>
+<hr class="separator">
+{% endif %}
 {% for resource in resources %}
-
+  
   <div class="row">
     
     {% if resource.resource == None %}
diff --git a/src/ptf/urls.py b/src/ptf/urls.py
index 09c9bd3a..056e7495 100644
--- a/src/ptf/urls.py
+++ b/src/ptf/urls.py
@@ -134,6 +134,12 @@ urlpatterns_protectable_by_account = [
         {"binary_file_type": None, "relative_path": ""},
         name="item-pdf",
     ),
+    re_path(
+        r'^item/(?P<pid>[^/]+|/{0,1}?)\.(?P<extension>pdf|djvu)$',
+        get_binary_file,
+        {"binary_file_type": None,},
+        name="item-edito-pdf",
+    ),
     # Compatibility with urls inside SolR
     re_path(
         r"^article/(?P<pid>[:\(\)\./\w-]+|/{0,1}?)\.(?P<extension>pdf|djvu)$",
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index d8d9e471..6df2ef0f 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -324,8 +324,22 @@ class ItemView(TemplateView):
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
         collection = self.obj.get_collection()
+        print("coucou")
+        pid = self.obj.pid
         context["journal"] = collection
         context["obj"] = self.obj
+        if isinstance(self.obj, Container ) and self.obj.ctype == "issue_special":
+            pdf_path = os.path.dirname(resolver.get_disk_location(
+                f"{settings.RESOURCES_ROOT}",
+                f"{collection.pid}",
+                "pdf",
+                pid,
+                article_id=None,
+                do_create_folder=False,
+                ))
+            edito_path = f"{pdf_path}/{pid}_edito.pdf"
+            if os.path.isfile(edito_path):
+                context["issue_edito"] = f"{pid}_edito"
         return context
 
     def get(self, request, *args, **kwargs):
@@ -1347,11 +1361,12 @@ def get_binary_file(request, pid, binary_file_type, extension, relative_path):
     if "/" in pid:
         resource = model_helpers.get_resource_by_doi(pid)
     else:
-        resource = model_helpers.get_resource(pid)
+        resource = model_helpers.get_resource(pid.replace("_edito", ""))
 
     if resource is not None:
         resource = resource.cast()
-
+    if "_edito" in pid:
+        mimetype = "edito/pdf"
     filename, status = get_binary_filename(resource, relative_path, binary_file_type, mimetype)
     return render_binary_file(request, resource, status, filename)
 
-- 
GitLab


From 3dc25486f774d9042e3a022cbfac1423e762fca2 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Thu, 13 Feb 2025 17:13:31 +0100
Subject: [PATCH 29/36] Revert "edito appear first in special issue summary"

This reverts commit 7c513043f9c81aee5fe0894e11fe4c2585aa52ce.
---
 src/ptf/models.py                             |  3 +--
 .../ptf/bs5/common/issue/issue-items.html     |  1 +
 .../issue/special-issue-items-resource.html   | 18 +-----------------
 src/ptf/urls.py                               |  6 ------
 src/ptf/views/base_views.py                   | 19 ++-----------------
 5 files changed, 5 insertions(+), 42 deletions(-)

diff --git a/src/ptf/models.py b/src/ptf/models.py
index 1e06947c..95dcdb35 100644
--- a/src/ptf/models.py
+++ b/src/ptf/models.py
@@ -710,7 +710,7 @@ class Resource(models.Model):
         filename = None
 
         if (
-            doctype not in ["self", "toc", "frontmatter", "backmatter", "edito"]
+            doctype not in ["self", "toc", "frontmatter", "backmatter"]
             and len(doctype) == 2
             and hasattr(self, "translations")
         ):
@@ -733,7 +733,6 @@ class Resource(models.Model):
             else:
                 try:
                     obj = self.datastream_set.get(mimetype=mimetype)
-                    
 
                 except DataStream.DoesNotExist:
                     # status = 404
diff --git a/src/ptf/templates/ptf/bs5/common/issue/issue-items.html b/src/ptf/templates/ptf/bs5/common/issue/issue-items.html
index a6bef657..2a3cb075 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/issue-items.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/issue-items.html
@@ -54,6 +54,7 @@
                 {% endif %}
               {% endfor %}
             </div>
+              
             {% if issue.body_html %}
               {{ issue.body_html|safe }}
             {% endif %}
diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
index 9f55688a..0d055003 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
@@ -2,25 +2,9 @@
 {% load helpers %}
 {% load static %}
 
-{% if issue_edito %}
-<span class="common-title article-title">
-  {% if LANGUAGE_CODE == "fr"%}
-  Édito
-  {% else %}
-  Edito
-  {% endif %}
-</span>
-<p>
-  <a href="{% url 'item-edito-pdf' issue_edito 'pdf'  %}" target="_blank">
-    <img src="{% static 'ptf/img/pdf.gif' %}">
-  </a>
-</p>
 
-<div style="margin-bottom: 10px;">{% include 'common/contribution/contrib.html' with item=obj for_issue=True %}</div>
-<hr class="separator">
-{% endif %}
 {% for resource in resources %}
-  
+
   <div class="row">
     
     {% if resource.resource == None %}
diff --git a/src/ptf/urls.py b/src/ptf/urls.py
index 056e7495..09c9bd3a 100644
--- a/src/ptf/urls.py
+++ b/src/ptf/urls.py
@@ -134,12 +134,6 @@ urlpatterns_protectable_by_account = [
         {"binary_file_type": None, "relative_path": ""},
         name="item-pdf",
     ),
-    re_path(
-        r'^item/(?P<pid>[^/]+|/{0,1}?)\.(?P<extension>pdf|djvu)$',
-        get_binary_file,
-        {"binary_file_type": None,},
-        name="item-edito-pdf",
-    ),
     # Compatibility with urls inside SolR
     re_path(
         r"^article/(?P<pid>[:\(\)\./\w-]+|/{0,1}?)\.(?P<extension>pdf|djvu)$",
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index 6df2ef0f..d8d9e471 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -324,22 +324,8 @@ class ItemView(TemplateView):
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
         collection = self.obj.get_collection()
-        print("coucou")
-        pid = self.obj.pid
         context["journal"] = collection
         context["obj"] = self.obj
-        if isinstance(self.obj, Container ) and self.obj.ctype == "issue_special":
-            pdf_path = os.path.dirname(resolver.get_disk_location(
-                f"{settings.RESOURCES_ROOT}",
-                f"{collection.pid}",
-                "pdf",
-                pid,
-                article_id=None,
-                do_create_folder=False,
-                ))
-            edito_path = f"{pdf_path}/{pid}_edito.pdf"
-            if os.path.isfile(edito_path):
-                context["issue_edito"] = f"{pid}_edito"
         return context
 
     def get(self, request, *args, **kwargs):
@@ -1361,12 +1347,11 @@ def get_binary_file(request, pid, binary_file_type, extension, relative_path):
     if "/" in pid:
         resource = model_helpers.get_resource_by_doi(pid)
     else:
-        resource = model_helpers.get_resource(pid.replace("_edito", ""))
+        resource = model_helpers.get_resource(pid)
 
     if resource is not None:
         resource = resource.cast()
-    if "_edito" in pid:
-        mimetype = "edito/pdf"
+
     filename, status = get_binary_filename(resource, relative_path, binary_file_type, mimetype)
     return render_binary_file(request, resource, status, filename)
 
-- 
GitLab


From d4afcc9283240350399f34e200f1165757f7e847 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Thu, 13 Feb 2025 17:13:31 +0100
Subject: [PATCH 30/36] edito appear first in special issue summary

---
 src/ptf/models.py                             |  3 ++-
 .../ptf/bs5/common/issue/issue-items.html     |  1 -
 .../issue/special-issue-items-resource.html   | 18 +++++++++++++++++-
 src/ptf/urls.py                               |  6 ++++++
 src/ptf/views/base_views.py                   | 19 +++++++++++++++++--
 5 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/src/ptf/models.py b/src/ptf/models.py
index 95dcdb35..1e06947c 100644
--- a/src/ptf/models.py
+++ b/src/ptf/models.py
@@ -710,7 +710,7 @@ class Resource(models.Model):
         filename = None
 
         if (
-            doctype not in ["self", "toc", "frontmatter", "backmatter"]
+            doctype not in ["self", "toc", "frontmatter", "backmatter", "edito"]
             and len(doctype) == 2
             and hasattr(self, "translations")
         ):
@@ -733,6 +733,7 @@ class Resource(models.Model):
             else:
                 try:
                     obj = self.datastream_set.get(mimetype=mimetype)
+                    
 
                 except DataStream.DoesNotExist:
                     # status = 404
diff --git a/src/ptf/templates/ptf/bs5/common/issue/issue-items.html b/src/ptf/templates/ptf/bs5/common/issue/issue-items.html
index 2a3cb075..a6bef657 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/issue-items.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/issue-items.html
@@ -54,7 +54,6 @@
                 {% endif %}
               {% endfor %}
             </div>
-              
             {% if issue.body_html %}
               {{ issue.body_html|safe }}
             {% endif %}
diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
index 0d055003..9f55688a 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
@@ -2,9 +2,25 @@
 {% load helpers %}
 {% load static %}
 
+{% if issue_edito %}
+<span class="common-title article-title">
+  {% if LANGUAGE_CODE == "fr"%}
+  Édito
+  {% else %}
+  Edito
+  {% endif %}
+</span>
+<p>
+  <a href="{% url 'item-edito-pdf' issue_edito 'pdf'  %}" target="_blank">
+    <img src="{% static 'ptf/img/pdf.gif' %}">
+  </a>
+</p>
 
+<div style="margin-bottom: 10px;">{% include 'common/contribution/contrib.html' with item=obj for_issue=True %}</div>
+<hr class="separator">
+{% endif %}
 {% for resource in resources %}
-
+  
   <div class="row">
     
     {% if resource.resource == None %}
diff --git a/src/ptf/urls.py b/src/ptf/urls.py
index 09c9bd3a..056e7495 100644
--- a/src/ptf/urls.py
+++ b/src/ptf/urls.py
@@ -134,6 +134,12 @@ urlpatterns_protectable_by_account = [
         {"binary_file_type": None, "relative_path": ""},
         name="item-pdf",
     ),
+    re_path(
+        r'^item/(?P<pid>[^/]+|/{0,1}?)\.(?P<extension>pdf|djvu)$',
+        get_binary_file,
+        {"binary_file_type": None,},
+        name="item-edito-pdf",
+    ),
     # Compatibility with urls inside SolR
     re_path(
         r"^article/(?P<pid>[:\(\)\./\w-]+|/{0,1}?)\.(?P<extension>pdf|djvu)$",
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index d8d9e471..6df2ef0f 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -324,8 +324,22 @@ class ItemView(TemplateView):
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
         collection = self.obj.get_collection()
+        print("coucou")
+        pid = self.obj.pid
         context["journal"] = collection
         context["obj"] = self.obj
+        if isinstance(self.obj, Container ) and self.obj.ctype == "issue_special":
+            pdf_path = os.path.dirname(resolver.get_disk_location(
+                f"{settings.RESOURCES_ROOT}",
+                f"{collection.pid}",
+                "pdf",
+                pid,
+                article_id=None,
+                do_create_folder=False,
+                ))
+            edito_path = f"{pdf_path}/{pid}_edito.pdf"
+            if os.path.isfile(edito_path):
+                context["issue_edito"] = f"{pid}_edito"
         return context
 
     def get(self, request, *args, **kwargs):
@@ -1347,11 +1361,12 @@ def get_binary_file(request, pid, binary_file_type, extension, relative_path):
     if "/" in pid:
         resource = model_helpers.get_resource_by_doi(pid)
     else:
-        resource = model_helpers.get_resource(pid)
+        resource = model_helpers.get_resource(pid.replace("_edito", ""))
 
     if resource is not None:
         resource = resource.cast()
-
+    if "_edito" in pid:
+        mimetype = "edito/pdf"
     filename, status = get_binary_filename(resource, relative_path, binary_file_type, mimetype)
     return render_binary_file(request, resource, status, filename)
 
-- 
GitLab


From e03b90a3bd6b65927ecbd96f5f08e733c77502b5 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Fri, 14 Feb 2025 10:45:03 +0100
Subject: [PATCH 31/36] new url to get special issue edito

---
 src/ptf/models.py                                           | 2 +-
 .../ptf/bs5/common/issue/special-issue-items-resource.html  | 2 +-
 src/ptf/urls.py                                             | 6 ------
 src/ptf/views/base_views.py                                 | 1 -
 4 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/ptf/models.py b/src/ptf/models.py
index 1e06947c..c2c6cc8d 100644
--- a/src/ptf/models.py
+++ b/src/ptf/models.py
@@ -723,7 +723,7 @@ class Resource(models.Model):
             # relative path are used with supplementary materials or TeX Source file
             filename = os.path.join(self.get_relative_folder(), relativepath)
         else:
-            if doctype != "self":
+            if doctype not in  ["self", "edito"]:
                 try:
                     obj = self.relatedobject_set.filter(mimetype=mimetype, rel=doctype).get()
 
diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
index 9f55688a..8d5c2d86 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
@@ -11,7 +11,7 @@
   {% endif %}
 </span>
 <p>
-  <a href="{% url 'item-edito-pdf' issue_edito 'pdf'  %}" target="_blank">
+  <a href="{% url 'issue-relatedobject-pdf' 'edito' issue_edito 'pdf'  %}" target="_blank">
     <img src="{% static 'ptf/img/pdf.gif' %}">
   </a>
 </p>
diff --git a/src/ptf/urls.py b/src/ptf/urls.py
index 056e7495..09c9bd3a 100644
--- a/src/ptf/urls.py
+++ b/src/ptf/urls.py
@@ -134,12 +134,6 @@ urlpatterns_protectable_by_account = [
         {"binary_file_type": None, "relative_path": ""},
         name="item-pdf",
     ),
-    re_path(
-        r'^item/(?P<pid>[^/]+|/{0,1}?)\.(?P<extension>pdf|djvu)$',
-        get_binary_file,
-        {"binary_file_type": None,},
-        name="item-edito-pdf",
-    ),
     # Compatibility with urls inside SolR
     re_path(
         r"^article/(?P<pid>[:\(\)\./\w-]+|/{0,1}?)\.(?P<extension>pdf|djvu)$",
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index 6df2ef0f..f3d62d0e 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -324,7 +324,6 @@ class ItemView(TemplateView):
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
         collection = self.obj.get_collection()
-        print("coucou")
         pid = self.obj.pid
         context["journal"] = collection
         context["obj"] = self.obj
-- 
GitLab


From 749df7171bfe78f4bf5291540b3abcc975f356c2 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Fri, 14 Feb 2025 11:26:53 +0100
Subject: [PATCH 32/36] more object oriented solution to get special_issue
 edito

---
 src/ptf/cmds/xml/jats/jats_parser.py |  7 +++++--
 src/ptf/views/base_views.py          | 19 +++++--------------
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/ptf/cmds/xml/jats/jats_parser.py b/src/ptf/cmds/xml/jats/jats_parser.py
index 586d51d5..0fa5ee52 100644
--- a/src/ptf/cmds/xml/jats/jats_parser.py
+++ b/src/ptf/cmds/xml/jats/jats_parser.py
@@ -1502,9 +1502,12 @@ class JatsBase(XmlParserBase):
 
         if self.no_bib:
             href = "http://www.numdam.org/item/" + os.path.basename(href)
-
+        if "specific-use" in node.attrib.keys() and node.attrib["specific-use"] == 'edito':
+            rel = 'edito'
+        else:
+            rel = 'full-text'
         data = {
-            "rel": "full-text",
+            "rel": rel,
             "mimetype": node_type,
             "location": href,
             "base": base,
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index f3d62d0e..d4376e08 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -47,7 +47,7 @@ from ptf.cmds.xml.jats.builder.issue import get_title_xml
 from ptf.cmds.xml.jats.jats_parser import get_tex_from_xml
 from ptf.display import resolver, utils
 from ptf.model_data_converter import jats_from_abstract
-from ptf.models import Article, Container
+from ptf.models import Article, Container, DataStream
 from ptf.solr.search_helpers import CleanSearchURL
 from ptf.templatetags.helpers import decode_query_string
 from ptf.url_utils import format_url_with_params
@@ -324,21 +324,8 @@ class ItemView(TemplateView):
     def get_context_data(self, **kwargs):
         context = super().get_context_data(**kwargs)
         collection = self.obj.get_collection()
-        pid = self.obj.pid
         context["journal"] = collection
         context["obj"] = self.obj
-        if isinstance(self.obj, Container ) and self.obj.ctype == "issue_special":
-            pdf_path = os.path.dirname(resolver.get_disk_location(
-                f"{settings.RESOURCES_ROOT}",
-                f"{collection.pid}",
-                "pdf",
-                pid,
-                article_id=None,
-                do_create_folder=False,
-                ))
-            edito_path = f"{pdf_path}/{pid}_edito.pdf"
-            if os.path.isfile(edito_path):
-                context["issue_edito"] = f"{pid}_edito"
         return context
 
     def get(self, request, *args, **kwargs):
@@ -571,6 +558,10 @@ class ContainerView(ItemView):
             views_update_container_context(self.request, container, context, self.display_lang)
 
             self.template_name = context["template"]
+        try:
+            context["issue_edito"] = self.obj.datastream_set.get(mimetype='application/pdf', rel='edito').location
+        except DataStream.DoesNotExist:
+            pass
 
         return context
 
-- 
GitLab


From 9b3e26fdac3057f11540f3686a754475c060bb93 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Fri, 14 Feb 2025 15:00:11 +0100
Subject: [PATCH 33/36] commit before mooving to related object for edito

---
 .../ptf/bs5/common/issue/special-issue-items-resource.html  | 2 +-
 src/ptf/views/base_views.py                                 | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html b/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
index 8d5c2d86..e4239ab9 100644
--- a/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
+++ b/src/ptf/templates/ptf/bs5/common/issue/special-issue-items-resource.html
@@ -11,7 +11,7 @@
   {% endif %}
 </span>
 <p>
-  <a href="{% url 'issue-relatedobject-pdf' 'edito' issue_edito 'pdf'  %}" target="_blank">
+  <a href="{% url 'issue-relatedobject-pdf' 'edito' pid 'pdf'  %}" target="_blank">
     <img src="{% static 'ptf/img/pdf.gif' %}">
   </a>
 </p>
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index d4376e08..18e6c546 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -1351,12 +1351,12 @@ def get_binary_file(request, pid, binary_file_type, extension, relative_path):
     if "/" in pid:
         resource = model_helpers.get_resource_by_doi(pid)
     else:
-        resource = model_helpers.get_resource(pid.replace("_edito", ""))
+        resource = model_helpers.get_resource(pid)
 
     if resource is not None:
         resource = resource.cast()
-    if "_edito" in pid:
-        mimetype = "edito/pdf"
+    # if binary_file_type == "edito":
+    #     mimetype = "edito/pdf"
     filename, status = get_binary_filename(resource, relative_path, binary_file_type, mimetype)
     return render_binary_file(request, resource, status, filename)
 
-- 
GitLab


From 0ddef2e3d6dab969469fa11ff54ce7fdf1ba3bc1 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Fri, 14 Feb 2025 15:10:20 +0100
Subject: [PATCH 34/36] switch to related objects for special issue edito

---
 src/ptf/models.py           | 2 +-
 src/ptf/views/base_views.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ptf/models.py b/src/ptf/models.py
index c2c6cc8d..1e06947c 100644
--- a/src/ptf/models.py
+++ b/src/ptf/models.py
@@ -723,7 +723,7 @@ class Resource(models.Model):
             # relative path are used with supplementary materials or TeX Source file
             filename = os.path.join(self.get_relative_folder(), relativepath)
         else:
-            if doctype not in  ["self", "edito"]:
+            if doctype != "self":
                 try:
                     obj = self.relatedobject_set.filter(mimetype=mimetype, rel=doctype).get()
 
diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index 18e6c546..3c815e53 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -559,7 +559,7 @@ class ContainerView(ItemView):
 
             self.template_name = context["template"]
         try:
-            context["issue_edito"] = self.obj.datastream_set.get(mimetype='application/pdf', rel='edito').location
+            context["issue_edito"] = self.obj.relatedobject_set.get(mimetype='application/pdf', rel='edito').location
         except DataStream.DoesNotExist:
             pass
 
-- 
GitLab


From dce5b3116811375d0837e985c51326c6ba791238 Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Fri, 14 Feb 2025 15:58:50 +0100
Subject: [PATCH 35/36] wip

---
 src/ptf/views/base_views.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ptf/views/base_views.py b/src/ptf/views/base_views.py
index 3c815e53..608999a7 100644
--- a/src/ptf/views/base_views.py
+++ b/src/ptf/views/base_views.py
@@ -47,7 +47,7 @@ from ptf.cmds.xml.jats.builder.issue import get_title_xml
 from ptf.cmds.xml.jats.jats_parser import get_tex_from_xml
 from ptf.display import resolver, utils
 from ptf.model_data_converter import jats_from_abstract
-from ptf.models import Article, Container, DataStream
+from ptf.models import Article, Container, RelatedObject
 from ptf.solr.search_helpers import CleanSearchURL
 from ptf.templatetags.helpers import decode_query_string
 from ptf.url_utils import format_url_with_params
@@ -560,7 +560,7 @@ class ContainerView(ItemView):
             self.template_name = context["template"]
         try:
             context["issue_edito"] = self.obj.relatedobject_set.get(mimetype='application/pdf', rel='edito').location
-        except DataStream.DoesNotExist:
+        except RelatedObject.DoesNotExist:
             pass
 
         return context
-- 
GitLab


From 16d2c91ee62e9d1327607e3fc3ed993b524f344d Mon Sep 17 00:00:00 2001
From: Matthieu Guimard <matthieu.guimard@univ-grenoble-alpes.fr>
Date: Mon, 17 Feb 2025 17:20:16 +0100
Subject: [PATCH 36/36] fix for edito related objects

---
 src/ptf/cmds/xml/jats/jats_parser.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/ptf/cmds/xml/jats/jats_parser.py b/src/ptf/cmds/xml/jats/jats_parser.py
index 0fa5ee52..a1c48761 100644
--- a/src/ptf/cmds/xml/jats/jats_parser.py
+++ b/src/ptf/cmds/xml/jats/jats_parser.py
@@ -1502,10 +1502,7 @@ class JatsBase(XmlParserBase):
 
         if self.no_bib:
             href = "http://www.numdam.org/item/" + os.path.basename(href)
-        if "specific-use" in node.attrib.keys() and node.attrib["specific-use"] == 'edito':
-            rel = 'edito'
-        else:
-            rel = 'full-text'
+        rel = 'full-text'
         data = {
             "rel": rel,
             "mimetype": node_type,
-- 
GitLab