Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 6e5535f

Browse files
committed
If modopts->[web]->hide_empty_stats is false, show all stats
including lame zero values. Otherwise, only show stats with non-zero values. Set settings.hide_empty_stats to true if it is undefined in modopts.
1 parent 3089f23 commit 6e5535f

File tree

2 files changed

+65
-36
lines changed

2 files changed

+65
-36
lines changed

web/lib/init.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,7 @@ if (typeof settings.forum_extended_ascii !== 'boolean') {
6363
if (typeof settings.active_node_list !== 'boolean') {
6464
settings.active_node_list = true;
6565
}
66+
67+
if (typeof settings.hide_empty_stats !== 'boolean') {
68+
settings.hide_empty_stats = true;
69+
}

web/sidebar/.examples/003-systemStats.xjs

Lines changed: 61 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@
99
<h4>System Info</h4>
1010
<table class="table table-condensed table-responsive table-striped">
1111
<tbody>
12+
1213
<tr>
1314
<th scope="row"><?xjs write(_sill.label_sysop); ?></th>
1415
<td><?xjs write(system.operator); ?></td>
1516
</tr>
17+
1618
<tr>
1719
<th scope="row"><?xjs write(_sill.label_location); ?></th>
1820
<td><?xjs write(system.location); ?></td>
1921
</tr>
22+
2023
<tr>
2124
<th scope="row"><?xjs write(_sill.label_users); ?></th>
2225
<td><?xjs write(system.stats.total_users); ?></td>
2326
</tr>
27+
2428
<tr>
2529
<th scope="row"><?xjs write(_sill.label_nodes); ?></th>
2630
<td>
@@ -30,49 +34,70 @@
3034
<span title="Available" class="text-success sb-nodes-available"><?xjs write(system.nodes - _sb_niu); ?></span>)
3135
</td>
3236
</tr>
37+
3338
<tr>
3439
<th scope="row"><?xjs write(_sill.label_uptime); ?></th>
3540
<td><?xjs write(system.secondstr(time() - system.uptime)); ?></td>
3641
</tr>
42+
3743
<tr>
3844
<th scope="row"><?xjs write(_sill.label_calls_total); ?></th>
3945
<td><?xjs write(system.stats.total_logons); ?></td>
4046
</tr>
41-
<tr>
42-
<th scope="row"><?xjs write(_sill.label_calls_today); ?></th>
43-
<td><?xjs write(system.stats.logons_today); ?></td>
44-
</tr>
45-
<tr>
46-
<th scope="row"><?xjs write(_sill.label_files_total); ?></th>
47-
<td><?xjs write(system.stats.total_files); ?></td>
48-
</tr>
49-
<tr>
50-
<th scope="row"><?xjs write(_sill.label_files_uploaded_today); ?></th>
51-
<td>
52-
<?xjs write(system.stats.files_uploaded_today); ?>
53-
<?xjs write(_sill.stat_suffix_files); ?>
54-
<br>
55-
(<?xjs write(system.stats.bytes_uploaded_today); ?>
56-
<?xjs write(_sill.stat_suffix_bytes); ?>)
57-
</td>
58-
</tr>
59-
<tr>
60-
<th scope="row"><?xjs write(_sill.label_files_downloaded_today); ?></th>
61-
<td>
62-
<?xjs write(system.stats.files_downloaded_today); ?>
63-
<?xjs write(_sill.stat_suffix_files); ?>
64-
<br>
65-
(<?xjs write(system.stats.bytes_downloaded_today); ?>
66-
<?xjs write(_sill.stat_suffix_bytes); ?>)
67-
</td>
68-
</tr>
69-
<tr>
70-
<th scope="row"><?xjs write(_sill.label_messages_total); ?></th>
71-
<td><?xjs write(system.stats.total_messages); ?></td>
72-
</tr>
73-
<tr>
74-
<th scope="row"><?xjs write(_sill.label_messages_posted_today); ?></th>
75-
<td><?xjs write(system.stats.messages_posted_today); ?></td>
76-
</tr>
47+
48+
<?xjs if (!settings.hide_empty_stats || system.stats.logons_today) { ?>
49+
<tr>
50+
<th scope="row"><?xjs write(_sill.label_calls_today); ?></th>
51+
<td><?xjs write(system.stats.logons_today); ?></td>
52+
</tr>
53+
<?xjs } ?>
54+
55+
<?xjs if (!settings.hide_empty_stats || system.stats.total_files) { ?>
56+
<tr>
57+
<th scope="row"><?xjs write(_sill.label_files_total); ?></th>
58+
<td><?xjs write(system.stats.total_files); ?></td>
59+
</tr>
60+
<?xjs } ?>
61+
62+
<?xjs if (!settings.hide_empty_stats || system.stats.files_uploaded_today) { ?>
63+
<tr>
64+
<th scope="row"><?xjs write(_sill.label_files_uploaded_today); ?></th>
65+
<td>
66+
<?xjs write(system.stats.files_uploaded_today); ?>
67+
<?xjs write(_sill.stat_suffix_files); ?>
68+
<br>
69+
(<?xjs write(system.stats.bytes_uploaded_today); ?>
70+
<?xjs write(_sill.stat_suffix_bytes); ?>)
71+
</td>
72+
</tr>
73+
<?xjs } ?>
74+
75+
<?xjs if (!settings.hide_empty_stats || system.stats.files_downloaded_today) { ?>
76+
<tr>
77+
<th scope="row"><?xjs write(_sill.label_files_downloaded_today); ?></th>
78+
<td>
79+
<?xjs write(system.stats.files_downloaded_today); ?>
80+
<?xjs write(_sill.stat_suffix_files); ?>
81+
<br>
82+
(<?xjs write(system.stats.bytes_downloaded_today); ?>
83+
<?xjs write(_sill.stat_suffix_bytes); ?>)
84+
</td>
85+
</tr>
86+
<?xjs } ?>
87+
88+
<?xjs if (!settings.hide_empty_stats || system.stats.total_messages) { ?>
89+
<tr>
90+
<th scope="row"><?xjs write(_sill.label_messages_total); ?></th>
91+
<td><?xjs write(system.stats.total_messages); ?></td>
92+
</tr>
93+
<?xjs } ?>
94+
95+
<?xjs if (!settings.hide_empty_stats || system.stats.messages_posted_today) { ?>
96+
<tr>
97+
<th scope="row"><?xjs write(_sill.label_messages_posted_today); ?></th>
98+
<td><?xjs write(system.stats.messages_posted_today); ?></td>
99+
</tr>
100+
<?xjs } ?>
101+
77102
</tbody>
78103
</table>

0 commit comments

Comments
 (0)