Commit af1933d2 authored by Viviane Pons's avatar Viviane Pons
Browse files

Fixing member list on pages and articles

parent 6d8f9e6f
......@@ -6,7 +6,7 @@ lang: fr
img: sage.png
description: Sage est un logiciel de mathématique open-source auquel contribue l'équipe GALaC
page_order: 2
members: Nicolas Thiéry, Florent Hivert, 2003, Joël Gay, Aladin Virmaux, Jean-Baptiste Priez, Erik Bray, Jeroen Demeyer
members: Nicolas Thiéry, Florent Hivert, Viviane Pons, Joël Gay, Erik Bray, Jeroen Demeyer
[Sage](http://www.sagemath.org/) est un logiciel mathématique libre destiné à la recherche et à l’enseignement en algèbre, géométrie, arithmétique, théorie des nombres, combinatoire, cryptographie, calcul scientifique et dans d’autres domaines apparentés. Le modèle de développement de Sage comme ses caractéristiques techniques se distinguent par un souci extrême d’ouverture, de partage, de coopération et de collaboration : notre but est de construire la voiture, non de réinventer la roue. L’objectif général de Sage est de créer une alternative libre viable à Maple, Mathematica, Magma et MATLAB.
......
......@@ -6,7 +6,7 @@ lang: en
img: sage.png
description: Sage is an open source mathematical software to which the GALaC team contributes a lot.
page_order: 2
members: Nicolas Thiéry, Florent Hivert, 2003, Joël Gay, Aladin Virmaux, Jean-Baptiste Priez, Erik Bray, Jeroen Demeyer
members: Nicolas Thiéry, Florent Hivert, Viviane Pons, Joël Gay, Erik Bray, Jeroen Demeyer
[Sage](http://www.sagemath.org/) is an open-source mathematical software for research and teaching in algebra, geometry, arithmetic, number theory, combinatorics, cryptography, scientific computation and many other domains. The development model is based on openness, sharing, and collaboration. The main objective is to create a viable alternative to Maple, Mathematical, Magma and MATLAB.
......
......@@ -7,25 +7,12 @@ Link a list of members on a page to a list of LRI members id
from pelican import signals
def find_member(allmembers, attribute):
if not type(attribute) == unicode:
attribute = unicode(attribute)
for m in allmembers:
fullname = m["firstname"] + " " + m["name"]
if fullname == attribute:
return m["id"]
if unicode(m["id"]) == attribute:
return m["id"]
def set_for_page(page, generator):
if hasattr(page, "members"):
members = page.members.split(",")
members = [m.strip() for m in members]
if generator.settings.has_key("ALLMEMBERS"):
membersId = [find_member(generator.settings["ALLMEMBERS"], m) for m in members]
membersId = [m for m in membersId if not m is None]
if len(membersId) > 0:
page.members_id = membersId
page.memberlist = members
def set_members_id(generator):
for page in generator.pages:
......
......@@ -52,9 +52,9 @@
<p><a href="{{ main_siteurl }}/documents/{{ article.slides }}">Download slides</a></p>
{% endif %}
{% if article.members_id %}
{% if article.memberlist %}
{% import 'members_macro.html' as members_macro with context %}
{{ members_macro.members(article.members_id) }}
{{ members_macro.members(article.memberlist) }}
{% endif %}
......
{% macro members(ids = none, showTitle = True) %}
<ul class="members list-unstyled" >
{% for m in ALLMEMBERS %}
{% if ids is none or m["id"] in ids %}
<li>
<a href="{{ m['webpage'] }}" >
{% if m["hasImage"] %}
<img class="img-responsive" src="{{ m['imageSrc'] }}" alt="" />
{% endif %}
{{ m["firstname"] }} {{ m["name"] }}
</a>{% if showTitle %} - <small>{{ m["title"] }}</small>{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
{% macro members(members = none, showTitle = True) %}
<div id="member_template" hidden>
<li>
<a href="">
<img class="img-responsive" alt=""> <div class="prenom">Johanne</div> <div class="nom" style="text-transform:capitalize;">COHEN</div>
</a> - <small><div class='poste'></div></small>
</li>
</div>
<div name="page-members" >
<ul class="members list-unstyled" ></ul>
</div>
<script>
function fill_tables (d) {
// members to show
members = [{%for m in members %}{% if loop.index != 1 %},{% endif %}"{{ m | lower}}"{% endfor %} ]
// sort by name
d.sort(function(a,b) { return (a.nom_membre < b.nom_membre)?-1:1; });
li_template = $("#member_template li")
li_template.find("div").css("display","inline");
// insert into the two lists
d.forEach(function(guy) {
/* Code meaning of 'statut_membre':
1) Permanent
2) Non permanent
3) Visiteur
4) Stagiaire
5) Associe;
6) Accueil en d&eacute;l&eacute;gation
7) Accueil ITA
8) Chercheur b&eacute;n&eacute;vole
9) Emeritat
A) Invite
*/
name = guy.prenom_membre.toLowerCase() + " " + guy.nom_membre.toLowerCase()
if($.inArray(name, members) > -1 ) {
colonne = "page-members"
li = li_template.clone()
if(!guy.photo_membre)
li.find("img").remove();
li.find("img").attr("src", "https://www.lri.fr/images/membre/"+guy.photo_membre);
li.find("a").attr("href",guy.url_membre);
li.find("div.prenom").html(guy.prenom_membre);
li.find("div.nom").html(guy.nom_membre.toLowerCase());
{% if showTitle %}
li.find("div.poste").html(guy.fonction_fr);
{% endif %}
$("[name='"+colonne+"'] ul").append(li);
}
});
};
window.onload = function() {
jQuery.getJSON("https://galac.lri.fr/php/get_membres.php?callback=?", fill_tables);
};
</script>
{% endmacro %}
......@@ -27,9 +27,9 @@
{% endif %}
{{ page.content }}
{% if page.members_id %}
{% if page.memberlist %}
{% import 'members_macro.html' as members_macro with context %}
{{ members_macro.members(page.members_id) }}
{{ members_macro.members(page.memberlist) }}
{% endif %}
{% if page.subpagespage %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment