-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathimagecci.jsp
76 lines (69 loc) · 3.01 KB
/
imagecci.jsp
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
<%--
@(#)imagecci.jsp 0.03 07/02/2018
Copyright (C) 2011 - 2022 MER-C
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
--%>
<%@ include file="security.jspf" %>
<%@ include file="datevalidate.jspf" %>
<%
request.setAttribute("toolname", "Image contribution surveyor");
String homewiki = ServletUtils.sanitizeForAttributeOrDefault(request.getParameter("wiki"), "en.wikipedia.org");
String user = request.getParameter("user");
if (user != null)
request.setAttribute("contenttype", "text");
boolean transferred = (request.getParameter("transferred") != null);
%>
<%@ include file="header.jspf" %>
<%
List<String> survey = null;
if (user != null)
{
WMFWiki wiki = sessions.sharedSession(homewiki);
ContributionSurveyor surveyor = new ContributionSurveyor(wiki);
surveyor.setDateRange(earliest_odt, latest_odt);
surveyor.setFooter("Survey URL: " + request.getRequestURL() + "?" + request.getQueryString());
surveyor.setSurveyingTransferredFiles(transferred);
survey = surveyor.outputContributionSurvey(List.of(user), false, false, true);
// TODO: output as ZIP (not straightforward: requires rewrite as Java Servlet)
response.setHeader("Content-Disposition", "attachment; filename="
+ URLEncoder.encode(user, StandardCharsets.UTF_8) + ".txt");
out.print(String.join("\n", survey));
return;
}
%>
<p>
This tool generates a listing of a user's image uploads for use at <a
href="//en.wikipedia.org/wiki/WP:CCI">Contributor copyright investigations.</a>
<p>
<form action="./imagecci.jsp" method=GET>
<table>
<tr>
<td>User to survey:
<td><input type=text name=user value="<%= ServletUtils.sanitizeForAttribute(user) %>" required>
<tr>
<td>Home wiki:
<td><input type=text name="wiki" value="<%= homewiki %>" required>
<tr>
<td>Include uploads from:
<td><input type=date name=earliest value="<%= earliest %>"> to
<input type=date name=latest value="<%= latest %>"> (inclusive)
</table>
<input type=checkbox name=transferred value="<%= transferred ? " checked" : "" %>">Include transferred files
(may be inaccurate depending on username)
<br>
<input type=submit value="Survey user">
</form>
<%
if (user != null && survey.isEmpty())
request.setAttribute("error", "ERROR: User " + ServletUtils.sanitizeForHTML(user) + " does not exist!");
%>
<%@ include file="footer.jspf" %>