members.html 11.3 KB
Newer Older
1
${(host.substr(host.length-6,6) == '.onion') ? HTML_TOR_HEAD:HTML_HEAD}
Éloïs's avatar
Éloïs committed
2
  <title>${currencyName}-monit : ${MENU_LANG['MEMBERS']}</title>
Éloïs's avatar
Éloïs committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  <script type="text/javascript">// <![CDATA[
	var table = document.getElementById('table')
	var filter = document.getElementById('filter')

	/*filter.onchange = function() {
		return filterRows(table, 1, 0, this.value);
  }*/

	// tableElem : HTMLElement
	// rowIndex  : index du row pour commencer le filtrage (0 indexed)
	// tableElem : index du col à prendre en compte (0 indexed)
	// tableElem : lettre pour la comparaison
	function filterRows(tableElem, rowIndex, colIndex, filterString) {
		for (var i = rowIndex, val; i < tableElem.rows.length; ++i) {
			val = tableElem.rows[i].cells[colIndex].firstChild.nodeValue;
			if (val.substr(0,filterString.length).toLowerCase() != filterString.toLowerCase())
				tableElem.rows[i].style.display = 'none';
			else
				tableElem.rows[i].style.display = '';
		}  
		return false;
	}
// ]]></script>
Éloïs's avatar
Éloïs committed
26
27
</head>
<body>
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
28

29
<!-- Afficher le menu -->
Éloïs's avatar
Éloïs committed
30
${printMenu(MENU_LANG, help, "MEMBERS")}
31
32

<!-- Afficher le formulaire -->
Éloïs's avatar
Éloïs committed
33
<input type="number" name="d" value="${days}"/> ${LANG["FORM1"]} <select name="sort_by">
Éloïs's avatar
Éloïs committed
34
<option name="sort_by" value ="idtyWritten">${LANG["SORT_BY_IDTY_WRITTEN"]}
Éloïs's avatar
Éloïs committed
35
36
37
38
<option name="sort_by" value ="expireMembership" ${sort_by == 'expireMembership' ? 'selected' : ''}>${LANG["SORT_BY_EXPIRE_MEMBERSHIP"]}
<option name="sort_by" value ="lastRenewal" ${sort_by == 'lastRenewal' ? 'selected' : ''}>${LANG["SORT_LAST_RENEWAL"]}
<option name="sort_by" value ="oldestSig" ${sort_by == 'oldestSig' ? 'selected' : ''}>${LANG["SORT_BY_OLDEST_SIG"]}
<option name="sort_by" value ="lastSig" ${sort_by == 'lastSig' ? 'selected' : ''}>${LANG["SORT_BY_LAST_SIG"]}
39
<option name="sort_by" value ="centrality" ${sort_by == 'centrality' ? 'selected' : ''}>${LANG["SORT_BY_CENTRALITY"]}
Éloïs's avatar
Éloïs committed
40
<option name="sort_by" value ="quality" ${sort_by == 'quality' ? 'selected' : ''}>${LANG["SORT_BY_QUALITY"]}
Éloïs's avatar
Éloïs committed
41
<option name="sort_by" value ="sigCount" ${sort_by == 'sigCount' ? 'selected' : ''}>${LANG["SORT_BY_SIG_COUNT"]}
Éloïs's avatar
Éloïs committed
42
43
44
</select> ${LANG["ORDER_BY"]} <select name="order">
<option name="order" value ="asc"> ${LANG["ASC"]}
<option name="order" value ="desc" ${order == 'desc' ? 'selected' : ''}> ${LANG["DESC"]}</select>
45
46
<input type="submit" value="${LANG['SUBMIT_BUTTON']}"><br>
<input type="checkbox" name="centrality" value="yes">${LANG["CHECKBOX_CENTRALITY"]}.<br>
Éloïs's avatar
Éloïs committed
47
<input type="checkbox" name="pendingSigs" value="yes" ${pendingSigs == 'yes' ? 'checked' : ''}>${LANG["CHECKBOX_PENDING_SIGS"]}.<br>
48
<input type="checkbox" name="mode" value="emitted" ${mode == 'emitted' ? 'checked' : ''}>${LANG["CHECKBOX_MODE_SIG"]}.<br>
49
<input type="checkbox" name="nextYn" value="yes" ${nextYn == 'yes' ? 'checked' : ''}> ${LANG["NEXT_YN"]}<br>
Éloïs's avatar
Éloïs committed
50
51
<input type="checkbox" name="randomList" value="yes" ${randomList == 'yes' ? 'checked' : ''}> ${LANG["RANDOM_LIST"]} 
<input type="number" name="randomCounts" value="${numberOfRandomMembers}"/> ${LANG["MEMBERS"]}.<br>
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<hr>

<!-- Afficher la légende et l'aide -->
${(help != 'no') ? `
  <b>${LANG["LEGEND"]}</b><br>
  ${(pendingSigs == 'yes') ? ` ${LANG["LEGEND_AVAILABILITY"]}<br>` : ''}
  <br>
  <b>${LANG["WHAT_IS_CENTRALITY_TITLE"]}</b><br>
  ${LANG["WHAT_IS_CENTRALITY_TEXT"]}<br>
  <br>
  <b>${LANG["QUALITY_MEMBER_TITLE"]}</b><br>
  ${LANG["QUALITY_MEMBER_TXT"]}<br>
  <hr>
`:''}
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
66

67
68
69
70
71
72
73
74
75
76
<!-- Afficher l'état de tension de la toile de confiance -->
<h3>${LANG["WOT_TENSION_STATE"]}</h3>
${(membersLastCentralityCalcTime==0) ? `
	${LANG["CENTRALITY_NOT_CALC"]}.<br>
`:`
  ${(lockCentralityCalc) ? `
    ${LANG["CENTRALITY_CALC_BUSY"]}.<br>
  `:`
		<table border="1">
			<tr><td align='center' colspan='2'>${LANG["DATA_AT"]} ${timestampToDatetime(membersLastCentralityCalcTime)}</td></tr>
Éloïs's avatar
Éloïs committed
77
			<tr><td align='center'>${LANG["MEAN_LENGTH_PATH"]}</td><td align='center'><b>${(meanShortestsPathLength).toFixed(2)}</b></td></tr>
78
79
80
			<tr><td align='center'>${LANG["MEAN_CENTRALITY"]}</td><td align='center'><b>${meanCentrality.toFixed(2)}</b></td></tr>
			<tr><td align='center'>${LANG["NUMBER_OF_PAIRS_MEMBER"]}</td><td align='center'>${(membersListFiltered.length*(membersListFiltered.length-1))}</td></tr>
			<tr><td align='center'>${LANG["NUMBER_OF_EXIST_PATH"]}</td><td align='center'><b>${nbShortestsPath}</b></td></tr>
Éloïs's avatar
Éloïs committed
81
			<tr><td align='center'><b>${LANG["PROPORTION_OF_EXIST_PATH"]}</b></td><td align='center'><font color="red"><b>${((nbShortestsPath/(membersListFiltered.length*(membersListFiltered.length-1)))*100).toFixed(2)}%</b></font></td></tr>
82
83
84
85
		</table>
	`}
`}
<br>
86
87
	<table border="1">
		<tr><td align='center' colspan='3'>${LANG["DATA_AT"]} ${timestampToDatetime(membersLastUptime)}</td></tr>
Éloïs's avatar
Éloïs committed
88
89
90
91
		<tr><td align='center'>${LANG["meanMembersReachedByMembers"]}</td><td align='center'>${LANG["SENTRIES_REACHED"]}</td><td align='center'>${LANG["MEMBERS_REACHED"]}</td></tr>
		<tr><td align='center'>${LANG["SENTRY_CERT"]}</td><td align='center'>${(meansMembersQuality.meanSentriesReachedBySentries).toFixed(2)}%</td><td align='center'>${(meansMembersQuality.meanMembersReachedBySentries).toFixed(2)}%</td></tr>
		<tr><td align='center'>${LANG["MEMBER_CERT"]}</td><td align='center'><font ${(meansMembersQuality.meanSentriesReachedByMembers<xpercent) ? 'color="DarkRed"' : 'color="blue"' }><b>${meansMembersQuality.meanSentriesReachedByMembers}%</b></font></td><td align='center'><b>${meansMembersQuality.meanMembersReachedByMembers}%</b></td></tr>
		<tr><td align='center'><b>${LANG["MEAN_QUALITY"]}</b></td><td align='center'><font color="red"><b>${(meansMembersQuality.meanSentriesReachedByMembers/(xpercent*100)).toFixed(2)}</b></font></td><td align='center'><b>${(meansMembersQuality.meanMembersReachedByMembers/(xpercent*100)).toFixed(2)}</b></td></tr>
92
93
94
		<tr><td align='center'><b>${LANG["PROPORTION_MEMBERS_WITH_QUALITY_UPPER_1"]}</b></td><td align='center'><font color="red"><b>${(proportionMembersWithQualityUpper1*100).toFixed(2)}%</b></font></td><td align='center'><b>${(proportionMembersWithQualityUpper1IfNoSentries*100).toFixed(2)}%</b></td></tr>
	</table>
	<br>
Éloïs's avatar
Éloïs committed
95

Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
96
<!-- Afficher le currentBlockchainTimestamp -->
97
98
<i>${LANG["CURRENT_BLOCKCHAIN_TIME"]} : ${timestampToDatetime(currentBlockchainTimestamp)}.<br>
<!-- Afficher le nombre de membres et de membres référents -->
99
<b>${membersListFiltered.length}</b> ${LANG["MEMBERS"]} ${LANG["OF_WHICH"]} <b>${countSentries}</b> ${LANG['ARE_REFERRING_MEMBERS']} (<b>${((countSentries/membersListFiltered.length)*100).toFixed(2)}%</b>).</i><br>
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
100
<br>
Éloïs's avatar
Éloïs committed
101
102
103
<!-- Afficher le filtre des membres -->
${LANG["MEMBER_FILTER"]} : <input type="text" name="filter" id="filter" value="" maxlength="20" onchange="filterRows(document.getElementById('table'),1,0,this.value);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();"/><br>
</form>
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
104
105

<!-- On parcour tout les membres pour afficher ceux dont la date d'expiration est dans moins de 'd' jours -->
Éloïs's avatar
Éloïs committed
106
<b>${LANG["TABLE_TITLE"]} ${days} ${LANG["DAYS"]} :</b>
Éloïs's avatar
Éloïs committed
107
<table id="table" border="1">
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
108
109
  <!-- Printer les nom des colonnes -->
  <tr>
Éloïs's avatar
Éloïs committed
110
    <td align="center" style="display :none"></td>
Éloïs's avatar
Éloïs committed
111
112
113
114
    <td align="center">${LANG["COL_UID"]}</td>
    <td align="center">${LANG["COL_IDTY_WRITTEN_TIME"]}</td>
    <td align="center">${LANG["COL_LAST_RENEWAL"]}</td>
    <td align="center">${LANG["COL_EXPIRE_MEMBERSHIP"]}</td>
Éloïs's avatar
Éloïs committed
115
    <td align='center'>${LANG['COL_DISTANCE']}</td>
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
116
    <td style="background:#000000">-</td>
Éloïs's avatar
Éloïs committed
117
    <td align="left" colspan="${nbMaxCertifs}">${(mode=='emitted') ? LANG['COL_LIST_EMITTED_CERT']:LANG['COL_LIST_RECEIVED_CERT']} (${sort_by == 'lastSig' ? LANG["LAST2OLDEST"] : LANG["OLDEST2LAST"]})</td>
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
118
119
120
121
122
123
  </tr>
  ${membersListFiltered
    .map( member=> `
      <!-- Printer la ligne -->
      <tr>
        ${(member.proportion = proportion(member.expireMembershipTimestamp,msValidity,0,120),'')}
Éloïs's avatar
Éloïs committed
124
125
        <td align="center" style="display :none">${member.uid}</td>
        <td align="center" style="background:hsla(${member.proportion}, 100%, 50%, 1)"><b>${member.uid}</b><br>
126
127
          
          ${(member.isSentry) ? `<font color="blue">${LANG['REFERRING_MEMBER']} : ${LANG['YES']}</font>`:`${LANG['REFERRING_MEMBER']} : ${LANG['NO']}`}<br>
128
            ${LANG['QUALITY_EXT']} : <b>${(typeof(membersQuality(member.wotb_id))=='undefined') ? `0.00`:membersQuality(member.wotb_id)}</b><br>
129
130
131
          <b>${(membersLastCentralityCalcTime==0) ? `${LANG['CENTRALITY']} : ?`:`
						${LANG['CENTRALITY']} : <b>${(typeof(membersCentrality[member.wotb_id])=='undefined') ? `0`:membersCentrality[member.wotb_id]}
					`}</b><br>
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
132
          ->${member.certifications.length}
133
134
          ${pendingSigs == "yes" && typeof(member.pendingCertifications) != 'undefined' 
            ? ` (+${member.pendingCertifications.length})` 
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
135
136
137
            : ''}
        </td>
        <td align="center" style="background:hsla(${member.proportion}, 100%, 50%, 1)">
Éloïs's avatar
Éloïs committed
138
          <span data-tip="${timestampToDatetime(member.idtyWrittenTimestamp)}">#${member.idtyWrittenBloc}</span>
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
139
140
        </td>
        <td align="center" style="background:hsla(${member.proportion}, 100%, 50%, 1)">
Éloïs's avatar
Éloïs committed
141
          <span data-tip="${timestampToDatetime(member.lastRenewalTimestamp)}">#${member.lastRenewalWrittenBloc}</span>
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
142
143
144
        </td>
        <td align="center" style="background:hsla(${member.proportion}, 100%, 50%, 1)">
          ${timestampToDatetime(member.expireMembershipTimestamp)}</td>
Éloïs's avatar
Éloïs committed
145
        <td align='center' style="background:hsla(${member.proportion}, 100%, 50%, 1)">
146
147
148
149
150
          
						<font color="${member.detailedDistance.isOutdistanced ? 'red' : 'blue' }">
							${member.detailedDistance.isOutdistanced ? LANG['COL_DISTANCE_isOutdistanced'] : LANG['COL_DISTANCE_isNotOutdistanced'] }
								<br>${member.percentSentriesReached}% (${member.detailedDistance.nbSuccess}/${member.detailedDistance.nbSentries})
						</font>
Éloïs's avatar
Éloïs committed
151
        </td>
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
152
153
154
        <td style="background:#000000">-</td>
  
        <!-- Printer les certifications en piscine -->
155
156
        ${pendingSigs == "yes" && typeof(member.pendingCertifications) != 'undefined' ?
            member.pendingCertifications.map( cert=> `
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
157
              <!-- Printer la certification -->
158
159
              <td align="center" style="background:${(cert.validBlockStamp) ? cert.colorPending=color(cert.expires_on,idtyWindow,250) : cert.colorPending='#FF8000'}">
								<b>${cert.protagonist}</b><br>
Éloïs's avatar
Éloïs committed
160
161
                <span data-tip="${LANG['EXPIRE_TIME']}">${timestampToDatetime(cert.timestampExpire)}</span><br>
                
162
163
164
165
166
167
                ${LANG["EMITTED"]} #${cert.blockNumber}<br>
                ${ ( !cert.validBlockStamp || cert.timestampWritable > currentBlockchainTimestamp ) ? `
									<font color="DarkRed">[${ (cert.validBlockStamp) ? timestampToDatetime(cert.timestampWritable):LANG['INVALID_BLOCKSTAMP']}]</font>
								` : `
									<font color='green'>[${LANG['CERT_AVAILABLE']}]</font>
								`}
Éloïs's avatar
Éloïs committed
168
                </font>
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
169
170
171
172
173
              </td>
            `).join('') 
        :''}
    
        <!-- Printer les certifications écrites en blockchain -->
174
        ${member.certifications.map( cert=> `
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
175
          <!-- Printer la certification -->
176
177
          <td align="center" style="background:hsla(${proportion(cert.timestampExpire,sigValidity,0,120)}, 100%, 50%, 1 )">
            <b>${(mode=='emitted') ? cert.receiver:cert.issuer}</b><br>
Éloïs's avatar
Éloïs committed
178
            <span data-tip="${LANG['EXPIRE_TIME']}">${timestampToDatetime(cert.timestampExpire)}</span><br>
179
            ${LANG["WRITTEN"]} #${cert.writtenBloc}
Thomas Di Grégorio's avatar
Thomas Di Grégorio committed
180
181
182
183
184
185
186
187
          </td>
        `).join('')}
      </tr>
    `).join('')
  }
</table><br>

<hr>