-
Notifications
You must be signed in to change notification settings - Fork 0
/
wikiwork.cgi
218 lines (177 loc) · 5.08 KB
/
wikiwork.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#!/usr/bin/perl
# WikiWork statistics calculator
# Copyright (C) 2007-2008 Scott V. Nazelrod
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# See <http://www.gnu.org/licenses/> for a copy of the GPL.
$version = "0.4.1";
require "formparser.lib";
&parseform;
$fa = $formdata{'fa'};
$a = $formdata{'a'};
$ga = $formdata{'ga'};
$b = $formdata{'b'};
$c = $formdata{'c'};
$start = $formdata{'start'};
$stub = $formdata{'stub'};
$eds = $formdata{'eds'};
$subs = $formdata{'subs'};
$upper = $fa + $a + $ga;
$lower = $b + $c + $start + $stub;
$total = $fa + $a + $ga + $b + $c + $start + $stub;
#percentages
$fa_pct = $fa/$total * 100;
$a_pct = $a/$total * 100;
$ga_pct = $ga/$total * 100;
$b_pct = $b/$total * 100;
$c_pct = $c/$total * 100;
$start_pct = $start/$total * 100;
$stub_pct = $stub/$total * 100;
$upper_pct = $upper/$total * 100;
$lower_pct = $lower/$total * 100;
#rounded %s
$fa_pctrd= sprintf("%.2f", $fa_pct);
$a_pctrd= sprintf("%.2f", $a_pct);
$ga_pctrd= sprintf("%.2f", $ga_pct);
$b_pctrd= sprintf("%.2f", $b_pct);
$c_pctrd= sprintf("%.2f", $c_pct);
$start_pctrd= sprintf("%.2f", $start_pct);
$stub_pctrd= sprintf("%.2f", $stub_pct);
$upper_pctrd= sprintf("%.2f", $upper_pct);
$lower_pctrd= sprintf("%.2f", $lower_pct);
#wikiwork stats
$wikiwork = $a + 2*$ga + 3*$b + 4*$c + 5*$start + 6*$stub;
$rel = $wikiwork/$total;
$rel_rounded = sprintf("%.3f", $rel); #rounded to 3 dec places
#rel bar positioning
#$rel40 = $rel*40;
#$rel40_round = sprintf("%.0f", $rel40);
#$rel_pos = $rel40_round."px";
#extra stats
if( $eds != 0 )
{
$ww_percapita = $wikiwork / $eds;
$capitastring = "<li><b>ω per capita</b> = $ww_percapita</li>";
}
if( $subs != 0)
{
$ww_subprojs = $wikiwork / $subs;
$subprojstring = "<li><b>ω per capita</b> = $ww_subprojs</li>";
}
print << "DOC";
Content-type:text/html\n\n
<!--Output by WikiWork Calculator v.$version by Scott Nazelrod-->
<html>
<head>
<link rel="stylesheet" href="../style.css" type="text/css" />
<title>WikiWork calculator</title>
<style type="text/css">
table.wikitable,
table.prettytable {
margin: 1em 1em 1em 0;
background: #f9f9f9;
border: 1px #aaa solid;
border-collapse: collapse;
}
table.wikitable th, table.wikitable td,
table.prettytable th, table.prettytable td {
border: 1px #aaa solid;
padding: 0.2em;
}
table.wikitable th,
table.prettytable th {
background: #f2f2f2;
text-align: center;
}
table.wikitable caption,
table.prettytable caption {
margin-left: inherit;
margin-right: inherit;
font-weight: bold;
}
table.wikitable code {
background-color: transparent;
}
.relbar {
position:relative;
width:200px;
height:20px;
}
#pointer {
position:absolute;
top:-5px;
left:$rel_pos;
}
</style>
</head>
<body>
<h1 id="title">Results</h1>
<table class="wikitable" style="text-align: center; float:left">
<tr>
<th style="text-align: center;">Article class</th>
<th style="text-align: center;">Articles</th>
<th style="text-align: center;">Percent</th>
</tr>
<tr><th style="background: #6699ff; text-align: center;"><img alt="Featured article" src="fa.png"/> FA</th>
<td>$fa</td>
<td>$fa_pctrd %<!--$fa_pct --></td>
</tr>
<tr>
<th style="background: #66ffff; text-align: center;">A</th>
<td>$a</td>
<td>$a_pctrd %<!--$a_pct --></td>
</tr>
<tr>
<th style="background: #66ff66; text-align: center;"><img alt="Good article" src="ga.png"/> GA</th>
<td>$ga</td>
<td>$ga_pctrd %<!--$ga_pct --></td>
</tr>
<tr>
<th style="background: #c8fb7b; text-align: center;">B</th>
<td>$b</td>
<td>$b_pctrd %<!--$b_pct --></td>
</tr>
<tr>
<th style="background: #ffff66; text-align: center;">C</th>
<td>$c</td>
<td>$c_pctrd %<!--$c_pct --></td>
</tr>
<tr>
<th style="background: #ffaa66; text-align: center;">Start</th>
<td>$start</td>
<td>$start_pctrd %<!--$start_pct --></td>
</tr>
<tr>
<th style="background: #ff6666; text-align: center;">Stub</th>
<td>$stub</td>
<td>$stub_pctrd %<!--$stub_pct --></td>
</tr>
<tr>
<th style="background: transparent; text-align: center">Total</th>
<td>$total</td>
<td/>
</tr>
</table>
<h2>WikiWork statistics</h2>
<ul>
<li><b>ω</b> = $wikiwork</li>
<li><b>Ω</b> = $rel_rounded <!--$rel --></li>
$capitastring
$subprojstring
<li><b>Upper half:</b> (articles that are FA, A, and GA classes): $upper_pctrd%
<li><b>Lower half:</b> (articles that are B, C, Start, Stub classes): $lower_pctrd%
</ul>
<!--<br class="clear"/>-->
<!--<h2>Graphical analysis</h2>-->
<!--<h2>Ω</h2>-->
<!--<div class="relbar"><img src="wgradient.png" alt="Ω"/><img src="wpointer.png" alt="$rel_rounded" id="pointer"/></div>-->
<p><a href="wikiwork.html" id="relpointer">Return to input page</a> - <a href="index.html">Back to Programs</a></p>
</body>
</html>
DOC