Sfoglia il codice sorgente

Work on Copyvio Detector and integration with EarwigBot

copyvios.mako can now import the earwigbot package and load pages
gitignored config.ts-earwigbot.json
pull/24/head
Ben Kurtovic 12 anni fa
parent
commit
c482d9ff4e
4 ha cambiato i file con 67 aggiunte e 2 eliminazioni
  1. +1
    -0
      .gitignore
  2. +59
    -0
      pages/copyvios.mako
  3. +1
    -1
      pages/index.mako
  4. +6
    -1
      static/css/main.css

+ 1
- 0
.gitignore Vedi File

@@ -1,4 +1,5 @@
*.pyc
temp/
www/
config.ts-earwigbot.json
rewrite.script

+ 59
- 0
pages/copyvios.mako Vedi File

@@ -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'"/>
<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"/>

+ 1
- 1
pages/index.mako Vedi File

@@ -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"),


+ 6
- 1
static/css/main.css Vedi File

@@ -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;


Caricamento…
Annulla
Salva