From c482d9ff4ee079942153b0d23956ceabcfc2181d Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 28 Jan 2012 23:44:27 -0500 Subject: [PATCH] Work on Copyvio Detector and integration with EarwigBot copyvios.mako can now import the earwigbot package and load pages gitignored config.ts-earwigbot.json --- .gitignore | 1 + pages/copyvios.mako | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ pages/index.mako | 2 +- static/css/main.css | 7 ++++++- 4 files changed, 67 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ac9d546..6733c98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.pyc temp/ www/ +config.ts-earwigbot.json rewrite.script diff --git a/pages/copyvios.mako b/pages/copyvios.mako index e87d001..4f2b540 100644 --- a/pages/copyvios.mako +++ b/pages/copyvios.mako @@ -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'"/> +

Copyvio Detector

+

This tool attempts to detect copyright violations in Wikipedia articles.

+
+ + + + + + + + % if page: + + % else: + + % endif + + + + +
Site: + + +
Page title:
+
+ % if page: +
+ Result for ${page.title()}: +

Watch this space!

+
+ % endif <%include file="/support/footer.mako" args="environ=environ"/> diff --git a/pages/index.mako b/pages/index.mako index 0eb400d..d352430 100644 --- a/pages/index.mako +++ b/pages/index.mako @@ -4,7 +4,7 @@ tools = [ ("Home", "home", "index", True, None), - ("Copyvio Detector", "copyvios", "copyvios", False, "Blah"), + ("Copyvio Detector", "copyvios", "copyvios", True, "Blah"), ("EarwigBot Status", "earwigbot", "earwigbot", True, "Blah"), ("File Extension Checker", "extensions", "extensions", False, "Blah"), ("Contribution Surveyor", "surveyor", "surveyor", False, "Blah"), diff --git a/static/css/main.css b/static/css/main.css index 507fe81..445e1fd 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -20,7 +20,7 @@ div#header { div#container { line-height: 1.5; margin: 0 60px 100px 60px; - padding: 2px 15px 2px 15px; + padding: 2px 15px 10px 15px; border: 1px solid #777; background-color: #FFF; } @@ -64,6 +64,11 @@ table#footer-box { height: 100%; } +fieldset#result { + margin: 25px 5px 5px 5px; + border: 2px solid #676; +} + div.toolbox { margin: 15px 0 15px 0; padding: 0 6px 0 6px;