Commit f9391ee7 authored by Pascal Engélibert's avatar Pascal Engélibert

Add number of certs & community in menu

parent e979b00f
...@@ -69,6 +69,9 @@ body { ...@@ -69,6 +69,9 @@ body {
#mapmenu li { #mapmenu li {
list-style-type: none; list-style-type: none;
} }
.idcard-community {
padding-left: 0.5em;
}
.searchresult { .searchresult {
border-bottom: 1px solid #e2dfd9; border-bottom: 1px solid #e2dfd9;
cursor: pointer; cursor: pointer;
...@@ -108,6 +111,7 @@ a, a:visited { ...@@ -108,6 +111,7 @@ a, a:visited {
<li><span style="color:#0c0;">Vert</span>&nbsp;: référent</li> <li><span style="color:#0c0;">Vert</span>&nbsp;: référent</li>
</ul> </ul>
<span id="mapmenu-naccounts"></span><br /> <span id="mapmenu-naccounts"></span><br />
<span id="mapmenu-ncommunities"></span><br />
<input type="text" id="mapmenu-searchinput" value="" aria-label="Chercher un compte" placeholder="Chercher un compte" onkeyup="search(this.value, event.keyCode==13);" /> <input type="text" id="mapmenu-searchinput" value="" aria-label="Chercher un compte" placeholder="Chercher un compte" onkeyup="search(this.value, event.keyCode==13);" />
<div id="mapmenu-searchresults"></div> <div id="mapmenu-searchresults"></div>
<div id="mapmenu-idcard" class="idcard" style="display: none;"> <div id="mapmenu-idcard" class="idcard" style="display: none;">
...@@ -115,7 +119,9 @@ a, a:visited { ...@@ -115,7 +119,9 @@ a, a:visited {
<input type="button" id="mapmenu-idcard-goto" value="Centrer" onclick="map.setView(accounts[active_account].pos);showURL();" /><br /> <input type="button" id="mapmenu-idcard-goto" value="Centrer" onclick="map.setView(accounts[active_account].pos);showURL();" /><br />
<img class="idcard-avatar" src="" alt="Avatar" style="display: none;" /><br /> <img class="idcard-avatar" src="" alt="Avatar" style="display: none;" /><br />
<strong class="idcard-title"></strong><br /> <strong class="idcard-title"></strong><br />
<details><summary class="idcard-pubkey-short"></summary><span class="idcard-pubkey"></span></details><br /> <details><summary class="idcard-pubkey-short" title="Afficher le clé publique entière"></summary><span class="idcard-pubkey"></span></details>
<span class="idcard-community" style=""></span><br />
<span class="idcard-ncerts" title="Certifications &#10515; reçues / &#8613; émises"><span aria-label="Certifications reçues">&#10515;</span>&nbsp;<span class="idcard-ncerts-received"></span> &#8211 <span aria-label="Certifications émises">&#8613;</span>&nbsp;<span class="idcard-ncerts-issued"></span></span><br />
<input type="checkbox" id="mapmenu-idcard-onlycertsofsel" onchange="onlyShowCertsOfSelected();" autocomplete="off" /> <input type="checkbox" id="mapmenu-idcard-onlycertsofsel" onchange="onlyShowCertsOfSelected();" autocomplete="off" />
<label for="mapmenu-idcard-onlycertsofsel">Afficher uniquement ses certifications</label><br /> <label for="mapmenu-idcard-onlycertsofsel">Afficher uniquement ses certifications</label><br />
<label for="mapmenu-idcard-onlycertsofsel-n">Niveaux&nbsp;:</label> <label for="mapmenu-idcard-onlycertsofsel-n">Niveaux&nbsp;:</label>
......
...@@ -53,7 +53,19 @@ class Account { ...@@ -53,7 +53,19 @@ class Account {
if(account.avatar) { if(account.avatar) {
$("#mapmenu-idcard .idcard-avatar").attr("src", cesium_data_url+"user/profile/"+active_account+"/_image/avatar.png"); $("#mapmenu-idcard .idcard-avatar").attr("src", cesium_data_url+"user/profile/"+active_account+"/_image/avatar.png");
$("#mapmenu-idcard .idcard-avatar").attr("style", "display: initial;"); $("#mapmenu-idcard .idcard-avatar").attr("style", "display: initial;");
} else {
$("#mapmenu-idcard .idcard-avatar").attr("src", "");
$("#mapmenu-idcard .idcard-avatar").attr("style", "display: none;");
} }
if(account.community != null) {
$("#mapmenu-idcard .idcard-community").html("Communauté <strong>"+account.community+"</strong>");
$("#mapmenu-idcard .idcard-community").attr("style", "border-left:1em solid "+communities[account.community].color+";");
} else {
$("#mapmenu-idcard .idcard-community").html("");
$("#mapmenu-idcard .idcard-community").attr("style", "");
}
$("#mapmenu-idcard .idcard-ncerts-received").html(account.certsReceived.length);
$("#mapmenu-idcard .idcard-ncerts-issued").html(account.certsIssued.length);
$("#mapmenu-idcard-cesiumlink").attr("href", cesium_url+"#/app/wot/"+active_account+"/"); $("#mapmenu-idcard-cesiumlink").attr("href", cesium_url+"#/app/wot/"+active_account+"/");
for(var cert in account.certsIssued) { for(var cert in account.certsIssued) {
certs[account.certsIssued[cert]].line.setStyle({color:"#4f4", weight:3, opacity:0.6}); certs[account.certsIssued[cert]].line.setStyle({color:"#4f4", weight:3, opacity:0.6});
...@@ -85,6 +97,8 @@ function mapInactiveAccount(pubkey) { ...@@ -85,6 +97,8 @@ function mapInactiveAccount(pubkey) {
$("#mapmenu-idcard .idcard-pubkey").html(""); $("#mapmenu-idcard .idcard-pubkey").html("");
$("#mapmenu-idcard .idcard-pubkey-short").html(); $("#mapmenu-idcard .idcard-pubkey-short").html();
$("#mapmenu-idcard .idcard-avatar").attr("style", "display: none;"); $("#mapmenu-idcard .idcard-avatar").attr("style", "display: none;");
$("#mapmenu-idcard .idcard-community").html("");
$("#mapmenu-idcard .idcard-community").attr("style", "");
$("#mapmenu-idcard-cesiumlink").attr("href", "#"); $("#mapmenu-idcard-cesiumlink").attr("href", "#");
for(var cert in account.certsIssued) { for(var cert in account.certsIssued) {
certs[account.certsIssued[cert]].line.setStyle({color:"black", weight:1, opacity:0.3}); certs[account.certsIssued[cert]].line.setStyle({color:"black", weight:1, opacity:0.3});
...@@ -385,7 +399,7 @@ function computeCommunities(circles=false) { ...@@ -385,7 +399,7 @@ function computeCommunities(circles=false) {
_edges.push(new CommunityEdge(certs[cert].issuer, certs[cert].receiver)); _edges.push(new CommunityEdge(certs[cert].issuer, certs[cert].receiver));
} }
var _communities = jLouvain().nodes(_nodes).edges(_edges)(); var _communities = jLouvain().nodes(_nodes).edges(_edges)();
var _points = {}; var _points = {};
var _allpoints = []; var _allpoints = [];
var i = 0; var i = 0;
...@@ -414,6 +428,8 @@ function computeCommunities(circles=false) { ...@@ -414,6 +428,8 @@ function computeCommunities(circles=false) {
l_communities.addTo(map); l_communities.addTo(map);
l_communities.remove(map); l_communities.remove(map);
$("#mapmenu-ncommunities").html(i + " communautés");
var voronoi = d3.voronoi() var voronoi = d3.voronoi()
.x(function(a) { return accounts[a].pos[0]; }) .x(function(a) { return accounts[a].pos[0]; })
.y(function(a) { return accounts[a].pos[1]; }); .y(function(a) { return accounts[a].pos[1]; });
......
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