summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2013-01-09 20:58:00 +0100
committerJochen Topf <jochen@topf.org>2013-01-09 20:58:00 +0100
commitbf125273103ba07d17792ad8aad0bfc102450fdc (patch)
tree0dc61c3cf2650df99b71423a3d1930a2137a2f6c
parent4b16701a684b3ea7f8443f02312533c8b8527f70 (diff)
downloadtaginfo-bf125273103ba07d17792ad8aad0bfc102450fdc.tar
taginfo-bf125273103ba07d17792ad8aad0bfc102450fdc.tar.gz
Better display of wiki import errors
-rwxr-xr-xsources/wiki/get_wiki_data.rb4
-rw-r--r--web/lib/ui/test.rb1
-rw-r--r--web/views/test/wiki_import.erb31
3 files changed, 27 insertions, 9 deletions
diff --git a/sources/wiki/get_wiki_data.rb b/sources/wiki/get_wiki_data.rb
index fa71ec3..35600bb 100755
--- a/sources/wiki/get_wiki_data.rb
+++ b/sources/wiki/get_wiki_data.rb
@@ -276,8 +276,8 @@ File.open(dir + '/tagpages.list') do |wikipages|
if !ititle.nil? && ititle.match(%r{^(file|image):(.*)$}i)
page.image = "File:#{$2}"
else
- puts "invalid image: #{reason} #{page.title} #{ititle}"
- db.execute('INSERT INTO invalid_image_titles (reason, page_title, image_title) VALUES (?, ?, ?)', reason, page.title, ititle)
+ puts "invalid image: page='#{page.title}' image='#{ititle}'"
+ db.execute('INSERT INTO invalid_image_titles (page_title, image_title) VALUES (?, ?)', page.title, ititle)
page.image = ''
end
end
diff --git a/web/lib/ui/test.rb b/web/lib/ui/test.rb
index 2be2af0..59c3416 100644
--- a/web/lib/ui/test.rb
+++ b/web/lib/ui/test.rb
@@ -22,6 +22,7 @@ class Taginfo < Sinatra::Base
section :test
@title = ['Wiki Import', 'Test']
@invalid_page_titles = @db.select('SELECT * FROM invalid_page_titles').execute()
+ @invalid_image_titles = @db.select('SELECT * FROM invalid_image_titles').execute()
erb :'test/wiki_import'
end
diff --git a/web/views/test/wiki_import.erb b/web/views/test/wiki_import.erb
index f061b2f..98c1d28 100644
--- a/web/views/test/wiki_import.erb
+++ b/web/views/test/wiki_import.erb
@@ -2,12 +2,29 @@
<h1 class="section">Wiki Import</h1>
</div>
<div class="box">
- <table>
- <% @invalid_page_titles.each do |row| %>
- <tr>
- <td><%= row['reason'] %></td>
- <td><%= row['title'] %></td>
- </tr>
- <% end %>
+ <h2>Invalid page titles</h2>
+ <table class="list">
+ <tr>
+ <th>Reason</th><th>Page title</th>
+ </tr>
+<% @invalid_page_titles.each do |row| %>
+ <tr>
+ <td><%= h(row['reason']) %></td>
+ <td><%= h(row['title']) %></td>
+ </tr>
+<% end %>
+ </table>
+
+ <h2 style="margin-top: 20px">Invalid image titles</h2>
+ <table class="list">
+ <tr>
+ <th>Page title</th><th>Image title</th>
+ </tr>
+<% @invalid_image_titles.each do |row| %>
+ <tr>
+ <td><%= h(row['page_title']) %></td>
+ <td><%= h(row['image_title']) %></td>
+ </tr>
+<% end %>
</table>
</div>