copyvios.mako can now import the earwigbot package and load pages gitignored config.ts-earwigbot.jsonpull/24/head
@@ -1,4 +1,5 @@ | |||||
*.pyc | *.pyc | ||||
temp/ | temp/ | ||||
www/ | www/ | ||||
config.ts-earwigbot.json | |||||
rewrite.script | rewrite.script |
@@ -1,2 +1,61 @@ | |||||
<%! | |||||
from sys import path | |||||
from urlparse import parse_qs | |||||
path.insert(0, "../earwigbot") | |||||
import earwigbot | |||||
%>\ | |||||
<% | |||||
query = parse_qs(environ["QUERY_STRING"]) | |||||
try: | |||||
lang = query["lang"][0] | |||||
project = query["project"][0] | |||||
title = query["title"][0] | |||||
except (KeyError, IndexError): | |||||
page = None | |||||
else: | |||||
earwigbot.config.config.load("config.ts-earwigbot.json") | |||||
try: | |||||
site = earwigbot.wiki.get_site(lang=lang, project=project) | |||||
except earwigbot.wiki.SiteNotFoundError: | |||||
page = None | |||||
else: | |||||
page = site.get_page(title) | |||||
%>\ | |||||
<%include file="/support/header.mako" args="environ=environ, title='Copyvio Detector'"/> | <%include file="/support/header.mako" args="environ=environ, title='Copyvio Detector'"/> | ||||
<h1>Copyvio Detector</h1> | |||||
<p>This tool attempts to detect <a href="http://en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> in Wikipedia articles.</p> | |||||
<form action="${environ['PATH_INFO']}" method="get"> | |||||
<table> | |||||
<tr> | |||||
<td>Site:</td> | |||||
<td> | |||||
<select name="lang"> | |||||
<option value="en" selected="selected">en (English)</option> | |||||
</select> | |||||
<select name="project"> | |||||
<option value="wikipedia" selected="selected">Wikipedia</option> | |||||
</select> | |||||
</td> | |||||
</tr> | |||||
<tr> | |||||
<td>Page title:</td> | |||||
% if page: | |||||
<td><input type="text" name="title" size="50" value="${page.title()}" /></td> | |||||
% else: | |||||
<td><input type="text" name="title" size="50" /></td> | |||||
% endif | |||||
</tr> | |||||
<tr> | |||||
<td><button type="submit">Submit</button></td> | |||||
</tr> | |||||
</table> | |||||
</form> | |||||
% if page: | |||||
<fieldset id="result"> | |||||
<legend>Result for <a href="${page.url()}">${page.title()}</a>:</legend> | |||||
<p>Watch this space!</p> | |||||
</fieldset> | |||||
% endif | |||||
<%include file="/support/footer.mako" args="environ=environ"/> | <%include file="/support/footer.mako" args="environ=environ"/> |
@@ -4,7 +4,7 @@ | |||||
tools = [ | tools = [ | ||||
("Home", "home", "index", True, None), | ("Home", "home", "index", True, None), | ||||
("Copyvio Detector", "copyvios", "copyvios", False, "Blah"), | |||||
("Copyvio Detector", "copyvios", "copyvios", True, "Blah"), | |||||
("EarwigBot Status", "earwigbot", "earwigbot", True, "Blah"), | ("EarwigBot Status", "earwigbot", "earwigbot", True, "Blah"), | ||||
("File Extension Checker", "extensions", "extensions", False, "Blah"), | ("File Extension Checker", "extensions", "extensions", False, "Blah"), | ||||
("Contribution Surveyor", "surveyor", "surveyor", False, "Blah"), | ("Contribution Surveyor", "surveyor", "surveyor", False, "Blah"), | ||||
@@ -20,7 +20,7 @@ div#header { | |||||
div#container { | div#container { | ||||
line-height: 1.5; | line-height: 1.5; | ||||
margin: 0 60px 100px 60px; | margin: 0 60px 100px 60px; | ||||
padding: 2px 15px 2px 15px; | |||||
padding: 2px 15px 10px 15px; | |||||
border: 1px solid #777; | border: 1px solid #777; | ||||
background-color: #FFF; | background-color: #FFF; | ||||
} | } | ||||
@@ -64,6 +64,11 @@ table#footer-box { | |||||
height: 100%; | height: 100%; | ||||
} | } | ||||
fieldset#result { | |||||
margin: 25px 5px 5px 5px; | |||||
border: 2px solid #676; | |||||
} | |||||
div.toolbox { | div.toolbox { | ||||
margin: 15px 0 15px 0; | margin: 15px 0 15px 0; | ||||
padding: 0 6px 0 6px; | padding: 0 6px 0 6px; | ||||