diff options
-rw-r--r-- | sources/db/pre.sql | 2 | ||||
-rw-r--r-- | web/i18n/de.yml | 88 | ||||
-rw-r--r-- | web/i18n/en.yml | 85 | ||||
-rw-r--r-- | web/i18n/es.yml | 4 | ||||
-rw-r--r-- | web/i18n/fr.yml | 4 | ||||
-rw-r--r-- | web/i18n/hu.yml | 4 | ||||
-rw-r--r-- | web/i18n/pl.yml | 4 | ||||
-rw-r--r-- | web/i18n/pt-BR.yml | 4 | ||||
-rw-r--r-- | web/i18n/pt.yml | 4 | ||||
-rw-r--r-- | web/i18n/ru.yml | 4 | ||||
-rw-r--r-- | web/i18n/uk.yml | 4 | ||||
-rw-r--r-- | web/i18n/vi.yml | 4 | ||||
-rw-r--r-- | web/lib/api/v4/keys.rb | 8 | ||||
-rw-r--r-- | web/lib/reports.rb | 1 | ||||
-rw-r--r-- | web/public/css/taginfo.css | 46 | ||||
-rw-r--r-- | web/public/js/taginfo.js | 33 | ||||
-rw-r--r-- | web/views/reports/characters_in_keys.erb | 51 | ||||
-rw-r--r-- | web/views/reports/wiki_images.erb | 26 | ||||
-rw-r--r-- | web/viewsjs/reports/characters_in_keys.js.erb | 45 | ||||
-rw-r--r-- | web/viewsjs/reports/wiki_images.js.erb | 15 |
20 files changed, 279 insertions, 157 deletions
diff --git a/sources/db/pre.sql b/sources/db/pre.sql index 9ee7126..eab3e47 100644 --- a/sources/db/pre.sql +++ b/sources/db/pre.sql @@ -79,8 +79,6 @@ CREATE TABLE tags ( count_nodes INTEGER DEFAULT 0, count_ways INTEGER DEFAULT 0, count_relations INTEGER DEFAULT 0, - object_type VARCHAR(1), -- (n)ode, (w)ay, (r)elation - object_id INTEGER, in_wiki INTEGER DEFAULT 0, in_projects INTEGER DEFAULT 0 ); diff --git a/web/i18n/de.yml b/web/i18n/de.yml index 9659510..b4b89c3 100644 --- a/web/i18n/de.yml +++ b/web/i18n/de.yml @@ -479,9 +479,11 @@ reports: characters_in_keys: name: Zeichen in Keys intro: | - Alle gültigen Unicode-Zeichen dürfen in OSM-Keys vorkommen. Typischerweise - werden aber nur Kleinbuchstaben (a-z) und der Unterstrich (_) benutzt. Manchmal - kommt dazu der Doppelpunkt (:) als Trennzeichen. + Alle gültigen Unicode-Zeichen dürfen in OSM-Keys vorkommen. + Typischerweise werden aber nur Kleinbuchstaben (a-z) und der + Unterstrich (_) benutzt. Manchmal kommt dazu der Doppelpunkt (:) + als Trennzeichen. Dieser Report teilt alle Keys nach den Zeichen, + die darin benutzt werden, in Kategorien ein. statistics: tab: Statistik title: Statistik-Übersicht @@ -491,32 +493,70 @@ reports: plain: Nur lateinische Kleinbuchstaben (<span class="char">a</span> bis <span class="char">z</span>) und Unterstrich (<span class="char">_</span>), erstes und letztes Zeichen sind Buchstaben. colon: Wie A, aber mit einem oder mehreren Doppelpunkten (<span class="char">:</span>). letters: Wie B, aber mit Großbuchstaben oder Buchstaben aus anderen Alphabeten. - space: Wie C, aber mit mindestens einem Whitespace-Zeichen (Leerzeichen, Tabulator, Neue Zeile, Wagenrücklauf, oder aus anderen Alphabeten) - problem: Wie C, enthält aber die möglicherweise problematischen Zeichen <span class="char">=+/&<>;'"?%#@\,</span>. + space: Key mit mindestens einem Whitespace-Zeichen (Leerzeichen, Tabulator, Neue Zeile, Wagenrücklauf, oder aus anderen Alphabeten). + problem: Key enthält möglicherweise problematische Zeichen <span class="char">=+/&<>;'"?%#@\,</span>. rest: Alles andere. total: Summe - whitespace: + plain: + tab: Einfach + title: Einfache keys + intro: | + <p>Keys, die nur lateinische Kleinbuchstaben (<span + class="char">a</span> bis <span class="char">z</span>) und + den Unterstrich (<span class="char">_</span>) enthalten. Das + erste und letzte Zeichen müssen Buchstaben sein. Die meisten + einfachen Keys sollten in diese Kategorie fallen.</p> + colon: + tab: Doppelpunkt + title: Keys mit Doppelpunkt + intro: | + <p>Keys, die einen oder mehrere Doppelpunkte (<span + class="char">:</span>) enthalten zusätzlich zu lateinischen + Kleinbuchstaben (<span class="char">a</span> bis <span + class="char">z</span>) und dem Unterstrich (<span + class="char">_</span>). Der Doppelpunkt wird oft als + Trennzeichen für eine Hierarchie von "Unter-Keys" verwendet.</p> + letters: + tab: Buchstaben + title: Keys mit Großbuchstaben und Buchstaben aus anderen Alphabeten. + intro: | + <p>Kleinbuchstaben aus dem lateinischen Alphabet werden für + Keys üblicherweise vorgezogen. Manchmal werden aber auch + Großbuchstaben benutzt (z.B. für bekannte Abkürzungen) oder + Buchstaben aus anderen Alphabeten (z.B. für Keys, die nur in + einem Gebiet relevant sind, wo dieses Alphabet üblicherweise + benutzt wird).</p> + space: tab: Leerzeichen title: Keys mit Leerzeichen intro: | - <p>Keys, die Whitespace-Zeichen (Leerzeichen, Tabulator, Neue Zeile, - Wagenrücklauf, oder aus anderen Alphabeten) enthalten.<br/> - Leerräume in Keys können (da sie nicht sichtbar sind) verwirrend sein, - besonders am Anfang und am Ende der Keys. Normalerweise sollte - stattdessen ein Unterstrich (_) verwenden werden.</p> - problematic: + <p>Keys, die Whitespace-Zeichen (Leerzeichen, Tabulator, Neue + Zeile, Wagenrücklauf, oder aus anderen Alphabeten) enthalten. + Leerräume in Keys können (da sie nicht sichtbar sind) + verwirrend sein, besonders am Anfang und am Ende der Keys. + Normalerweise sollte das Whitespace entfernt oder stattdessen + ein Unterstrich (<span class="char">_</span>) verwenden + werden.</p> + problem: tab: Problematisch title: Keys mit möglicherweise problematischen Zeichen intro: | <p>Keys mit möglicherweise problematischen Zeichen: <span - class="char">=+/&<>;'"?%#@\,</span> und Control-Zeichen. Diese Zeichen - können problematisch sein, weil sie in verschiedenen Programmiersprachen - zum "Zitieren" von Zeichenketten verwendet werden oder weil sie in - XML, HTML, URLs oder anderen Zusammenhängen besondere Bedeutung - haben. Das Gleichheitszeichen (=) wird bei OSM häufig als Trennzeichen - zwischen Tag Keys und Values benutzt.<br/> - Keys, die in dieser Liste erscheinen, sind nicht unbedingt falsch. In - vielen Fällen sind sie aber das Ergebnis eines Fehlers.</p> + class="char">=+/&<>;'"?%#@\,</span> und + Control-Zeichen. Diese Zeichen können problematisch sein, weil + sie in verschiedenen Programmiersprachen zum "Zitieren" von + Zeichenketten verwendet werden oder weil sie in XML, HTML, URLs + oder anderen Zusammenhängen besondere Bedeutung haben. Das + Gleichheitszeichen (<span class="char">=</span>) wird bei OSM + häufig als Trennzeichen zwischen Tag Keys und Values + benutzt.<br/> Keys, die in dieser Liste erscheinen, sind nicht + unbedingt falsch. In vielen Fällen sind sie aber das Ergebnis + eines Fehlers.</p> + rest: + tab: Sonstige + title: Alle anderen Keys + intro: | + <p>Keys, die in keine der anderen Kategorien passen.</p> database_statistics: name: Datenbank-Statistik objects_in_db: Anzahl Objekte in der Datenbank @@ -650,4 +690,12 @@ reports: title: Tags relation_types: title: Relation-Typen + wiki_images: + name: Bilder aus dem Wiki + intro: | + Bilder, die im Wiki benutzt werden, um Keys in verschiedenen + Sprachen zu symbolisieren. Manchmal sind die Bilder in der einen + oder anderen Sprachversion besser. Manchmal ist es aber wegen + verschiedener kultureller Hintergründe oder dergleichen auch + sinnvoll, unterschiedliche Bilder zu benutzen. diff --git a/web/i18n/en.yml b/web/i18n/en.yml index 74d1fee..b906b39 100644 --- a/web/i18n/en.yml +++ b/web/i18n/en.yml @@ -459,9 +459,10 @@ reports: characters_in_keys: name: Characters in keys intro: | - Any valid Unicode character can appear in an OSM key but usually only lower - case latin letters (a-z) and the underscore (_) are used. Sometimes the colon - (:) is added as a separator character. + Any valid Unicode character can appear in an OSM key but usually + only lower case latin letters (a-z) and the underscore (_) are + used. The colon (:) is often used as a separator character. This + report categorizes all keys according the the characters they use. statistics: tab: Statistics title: Statistics overview @@ -471,33 +472,66 @@ reports: plain: Only latin lowercase letters (<span class="char">a</span> to <span class="char">z</span>) and underscore (<span class="char">_</span>), first and last characters are letters. colon: Like A but with one or more colons (<span class="char">:</span>) inside. letters: Like B but with uppercase latin letters or letters from other alphabets. - space: Like C but contains at least one whitespace character (space, tab, new line, carriage return, or from other alphabets). - problem: Like C but contains possibly problematic characters <span class="char">=+/&<>;'"?%#@\,</span>. + space: At least one whitespace character (space, tab, new line, carriage return, or from other alphabets). + problem: Contains possibly problematic characters <span class="char">=+/&<>;'"?%#@\,</span>. rest: Everything else. total: Total - whitespace: + plain: + tab: Plain + title: Plain keys + intro: | + <p>Keys containing only lowercase latin letters (<span + class="char">a</span> to <span class="char">z</span>) and the + underscore (<span class="char">_</span>). First and last + characters must be letters. Most simple keys should fall into + this category.</p> + colon: + tab: Colon + title: Keys with colon + intro: | + <p>Keys that have one or more colon (<span + class="char">:</span>) characters inside in addition to the + letters (<span class="char">a</span> to <span + class="char">z</span>) and underscores (<span + class="char">_</span>). The colon is often used as a hierarchy + separator character.</p> + letters: + tab: Letters + title: Keys with uppercase letters or letters from other scripts + intro: | + <p>Lowercase letters from the latin script are usually + preferred for keys, but sometimes uppercase letters are used + (for instance for known abbreviations) or letters from other + scripts (for instance for keys only relevant to an area where + that script is used predominantly).</p> + space: tab: Whitespace title: Keys with whitespace intro: | - <p>Keys that contain whitespace characters such as space, tab, new - line, carriage return, or whitespace characters from other - alphabets.<br/> - Whitespace in keys can be confusing, especially at the - beginning or end of the key, because they are invisible. Generally - the underscore (_) should be used instead.</p> - problematic: + <p>Keys that contain whitespace characters such as space, tab, + new line, carriage return, or whitespace characters from other + alphabets. Whitespace in keys can be confusing, especially at + the beginning or end of the key, because they are invisible. + Generally the whitespace should be removed or the underscore + (<span class="char">_</span>) used instead.</p> + problem: tab: Problematic title: Keys with possibly problematic characters intro: | <p>Keys that contain possibly problematic characters: <span class="char">=+/&<>;'"?%#@\,</span> or control - characters. These characters - can be problematic, because they are used to quote strings in - different programming languages or have special meanings in XML, HTML, - URLs, and other places. The equal sign is used often as separator - between tag keys and values.<br/> - Keys that appear in this list are not necessarily wrong though. But - in many cases they are just results of some error.</p> + characters. These characters can be problematic, because they + are used to quote strings in different programming languages or + have special meanings in XML, HTML, URLs, and other places. The + equal sign is used often as separator between tag keys and + values. Keys that appear in this list are not necessarily wrong + though. But in many cases they are just results of some error + and should be fixed.</p> + rest: + tab: Rest + title: All other keys + intro: | + <p>Keys that don't fit in any of the other categories.</p> database_statistics: name: Database statistics objects_in_db: Number of objects in the database @@ -605,7 +639,7 @@ reports: similar_keys: name: Similar keys intro: | - This reports shows keys used very often and similar keys used very + This report shows keys used very often and similar keys used very rarely. This exposes many misspellings of common keys, but is not perfect. Take care when fixing the data! Do NOT just mechanically edit those keys with search-and-replace. Look at each case individually @@ -619,7 +653,7 @@ reports: name: Historic development intro: | Development of some important statistics over time. This data has - been collected by taginfo, gaps are possible when taginfo did't run + been collected by taginfo, gaps are possible when taginfo didn't run on a day for some reason. keys: title: Unique keys @@ -627,4 +661,11 @@ reports: title: Unique tags relation_types: title: Unique relation types + wiki_images: + name: Wiki images + intro: | + Images used in the wiki to symbolize the keys in different + languages. Sometimes the image from one or the other language + variant is better. But sometimes it makes sense to have different + images because of different cultural backgrounds or so. diff --git a/web/i18n/es.yml b/web/i18n/es.yml index 3dc39e7..1faa1ba 100644 --- a/web/i18n/es.yml +++ b/web/i18n/es.yml @@ -465,7 +465,7 @@ reports: problem: Como C pero contiene caracteres posiblemente problemáticos <span class="char">=+/&<>;'"?%#@\,</span>. rest: Todo lo demás. total: Total - whitespace: + space: tab: Whitespace title: Claves con espacios en blanco intro: | @@ -475,7 +475,7 @@ reports: Espacio en blanco en las claves pueden ser confusos, especialmente al principio o al final de la clave, porque son invisibles. Generalmente puede usarse el guión abajo (_) en su lugar.</p> - problematic: + problem: tab: Problemático title: Claves con caracteres posiblemente problemáticos intro: | diff --git a/web/i18n/fr.yml b/web/i18n/fr.yml index 80b2b3d..48511a6 100644 --- a/web/i18n/fr.yml +++ b/web/i18n/fr.yml @@ -466,7 +466,7 @@ reports: problem: Comme la règle C mais peut contenir des caractères problématiques <span class="char">=+/&<>;'"?%#@\,</span>. rest: Toutes les autres possibilités. total: Total - whitespace: + space: tab: Espaces title: Clés contenant des espaces intro: | @@ -476,7 +476,7 @@ reports: Les espaces dans les clés sont sources d'erreur, en particulier au début ou la fin de la clé, car ils sont invisibles. Généralement le caractère de soulignement (<span class="char">_</span>) devrait être utilisé à la place.</p> - problematic: + problem: tab: Problématiques title: Clés avec des caractères potentiellement problématiques intro: | diff --git a/web/i18n/hu.yml b/web/i18n/hu.yml index 4ef92f1..ead6998 100644 --- a/web/i18n/hu.yml +++ b/web/i18n/hu.yml @@ -347,9 +347,9 @@ reports: problem: Mint C, de tartalmaz olyan karaktereket, amik problémát okozhatnak <span class="char">=+/&<>;'"?%#@\,</span>. rest: Bármi más. total: Összes - whitespace: + space: tab: Szököz title: Szóközt tartalmazó kulcsok - problematic: + problem: tab: Problémásak title: Problémás karaktereket tartalmazó kulcsok diff --git a/web/i18n/pl.yml b/web/i18n/pl.yml index d7e78b8..97c5e9c 100644 --- a/web/i18n/pl.yml +++ b/web/i18n/pl.yml @@ -349,13 +349,13 @@ reports: problem: Jak w C, ale zawierające problematyczne znaki <span class="char">=+/&<>;'"?%#@\,</span>. rest: Wszystko pozostałe. total: Razem - whitespace: + space: tab: Znaki niedrukowalne title: Klucze ze znakami niedrukowalnymi intro: | <p>Klucze zawierające znaki niedrukowalne takie jak spacje, tabulacje, nowe linie, znak powrotu do początku linii, albo z innych alfabetów.<br/> Znaki niedrukowalne w kluczach mogą być dezorientujące, zwłaszcza jeśli znajdują się na początku albo na końcu, gdyż są niewidoczne. Generalnie powinno się używać zamiast nich podkreślnika (_).</p> - problematic: + problem: tab: Problematyczne title: Klucze z potencjalnie problematycznymi znakami intro: | diff --git a/web/i18n/pt-BR.yml b/web/i18n/pt-BR.yml index f6e0386..e9be434 100644 --- a/web/i18n/pt-BR.yml +++ b/web/i18n/pt-BR.yml @@ -393,10 +393,10 @@ reports: characters_in_keys: rest: Todo o resto. total: Total - whitespace: + space: tab: Espaço em branco title: Chaves com espaços em branco - problematic: + problem: tab: Problemático title: Chaves com caracteres possivelmente problemáticos database_statistics: diff --git a/web/i18n/pt.yml b/web/i18n/pt.yml index 8773cf2..41ccec4 100644 --- a/web/i18n/pt.yml +++ b/web/i18n/pt.yml @@ -393,10 +393,10 @@ reports: characters_in_keys: rest: Todo o resto. total: Total - whitespace: + space: tab: Espaço em branco title: Chaves com espaços em branco - problematic: + problem: tab: Problemático title: Chaves com caracteres possivelmente problemáticos database_statistics: diff --git a/web/i18n/ru.yml b/web/i18n/ru.yml index 97cfbfb..358a377 100644 --- a/web/i18n/ru.yml +++ b/web/i18n/ru.yml @@ -327,7 +327,7 @@ reports: problem: Как в C, но содержит потенциально проблемные символы <span class="char">=+/&<>;'"?%#@\,</span>. rest: Все остальные. total: Всего - whitespace: + space: tab: Пробелы title: Ключи с пробелами и прочим intro: | @@ -336,7 +336,7 @@ reports: Такие разделители могут приводить к путанице, особенно если они находятся в начале или конце ключа и фактически невидимы. Обычно в качестве разделителя используют символ подчёркивания (_).</p> - problematic: + problem: tab: Проблемные title: Ключи с возможно проблемными символами intro: | diff --git a/web/i18n/uk.yml b/web/i18n/uk.yml index 59b0a31..3e74113 100644 --- a/web/i18n/uk.yml +++ b/web/i18n/uk.yml @@ -327,7 +327,7 @@ reports: problem: Як в C, але містить потенційно проблемні символи <span class="char">=+/&<>;'"?%#@\,</span>. rest: Усі інші. total: Всього - whitespace: + space: tab: Пробіли title: Ключі з пробілами та іншим intro: | @@ -336,7 +336,7 @@ reports: Такі роздільники можуть призводити до плутанини, особливо якщо вони знаходяться на початку або кінці ключа і фактично невидимі. Зазвичай як роздільник використовують символ підкреслення (_).</p> - problematic: + problem: tab: Проблемні title: Ключі з можливо проблемними символами intro: | diff --git a/web/i18n/vi.yml b/web/i18n/vi.yml index f176922..1104697 100644 --- a/web/i18n/vi.yml +++ b/web/i18n/vi.yml @@ -401,7 +401,7 @@ reports: problem: Giống C nhưng có các ký tự có thể gây vấn đề <span class="char">=+/&<>;'"?%#@\,</span>. rest: Những cái gì khác. total: Tổng số - whitespace: + space: tab: Khoảng cách title: Chìa khóa có khoảng cách intro: | @@ -410,7 +410,7 @@ reports: Khoảng cách trong chìa khóa có thể gây nhầm lẫn, nhất là tại đầu hoặc cuối chìa khóa, vì không nhìn thấy nó được. Nói chung, dấu gạch dưới (_) nên được dùng thay thế.</p> - problematic: + problem: tab: Gây vấn đề title: Chìa khóa có ký tự có thể gây vấn đề intro: | diff --git a/web/lib/api/v4/keys.rb b/web/lib/api/v4/keys.rb index e4f4c99..f628a5b 100644 --- a/web/lib/api/v4/keys.rb +++ b/web/lib/api/v4/keys.rb @@ -2,8 +2,12 @@ class Taginfo < Sinatra::Base @@filters = { - :characters_space => { :expr => "characters='space'", :doc => 'Only show keys with spaces.' }, - :characters_problematic => { :expr => "characters='problem'", :doc => 'Only show keys with problematic characters.' }, + :characters_plain => { :expr => "characters='plain'", :doc => 'Category A: Only show keys with latin lowercase letters (a to z) or underscore (_), first and last characters must be letters.' }, + :characters_colon => { :expr => "characters='colon'", :doc => 'Category B: Only show keys like category A but with one ore more colons (:) inside.' }, + :characters_letters => { :expr => "characters='letters'", :doc => 'Category C: Only show keys like category B but with uppercase latin letters or letters from other scripts.' }, + :characters_space => { :expr => "characters='space'", :doc => 'Category D: Only show keys with at least one whitespace character (space, tab, new line, carriage return, or from other scripts).' }, + :characters_problem => { :expr => "characters='problem'", :doc => 'Category E: Only show keys with problematic characters.' }, + :characters_rest => { :expr => "characters='rest'", :doc => 'Category F: Only show keys not fitting in category A through E.' }, :in_wiki => { :expr => "in_wiki=1", :doc => 'Only show keys that appear in the wiki.' }, :not_in_db => { :expr => "count_all=0", :doc => 'Only show keys that do not appear in the database.' } } diff --git a/web/lib/reports.rb b/web/lib/reports.rb index 71e2555..a297095 100644 --- a/web/lib/reports.rb +++ b/web/lib/reports.rb @@ -61,4 +61,5 @@ Report.new 'Wiki pages about non-existing keys', :db, :wiki Report.new 'Name tags' #disabled Report.new 'Similar keys', :db Report.new 'Historic development', :db +Report.new 'Wiki images', :wiki diff --git a/web/public/css/taginfo.css b/web/public/css/taginfo.css index bdce9b7..fd694e3 100644 --- a/web/public/css/taginfo.css +++ b/web/public/css/taginfo.css @@ -682,3 +682,49 @@ div#tagcloud a:hover { display: none; } +/* ========== */ + +table.wiki-images { + border-spacing: 4px; +} + +table.wiki-images td.key { + background-color: #ffffff; + padding: 0 10px; +} + +table.wiki-images td.images { + padding: 0; +} + +table.wiki-images td.images div.langimg { + position:relative; + width: 50px; + height: 50px; + float: left; + z-index: 0; + margin-right: 4px; +} + +table.wiki-images td.images div div { + position: absolute; + bottom: 0px; + width: 50px; + height: 12px; + text-align: center; + font-size: 80%; + line-height: 1; + z-index: 2; + background-color: #202020; + color: #ffffff; +} + +table.wiki-images td.images div img { + z-index: 1; + margin: 0 auto; + display: block; + max-width: 50px; + max-height: 50px; + top: 0; +} + diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js index 1d3994f..8a5894e 100644 --- a/web/public/js/taginfo.js +++ b/web/public/js/taginfo.js @@ -362,39 +362,6 @@ function fmt_type_icon(type, on_or_off) { }) + ' '; } -function fmt_josm_value(key, value, value_bool) { - return value ? link_to_value(key, value) : value_bool ? (html_escape(value_bool) + ' (Boolean)') : '*'; -} - -function fmt_josm_icon(style, icon) { - if (!icon) return ''; - - return img({ - src: '/api/4/josm/style/image?style=' + encodeURIComponent(style) + '&image=' + encodeURIComponent(icon), - title: html_escape(icon), - alt: '' - }); -} - -function fmt_josm_line(width, color) { - var inner = ''; - if (width > 0) { - inner = tag('div', '', { - title: html_escape(color), - style: style({ height: width + 'px', 'margin-top': (10 - Math.round(width/2)) + 'px', padding: 0, 'background-color': color }) - }); - } - return tag('div', inner); -} - -function fmt_josm_area(color) { - if (!color) return ''; - - return tag('div', '', { - title: html_escape(color), - style: style({ height: '18px', 'background-color': color }) - }); -} function fmt_type_image(type) { type = type.replace(/s$/, ''); diff --git a/web/views/reports/characters_in_keys.erb b/web/views/reports/characters_in_keys.erb index 7d8eaf3..87349bf 100644 --- a/web/views/reports/characters_in_keys.erb +++ b/web/views/reports/characters_in_keys.erb @@ -1,3 +1,14 @@ +<% +categories = [ + { category: 'A', name: 'plain', color: '#2ca02c' }, + { category: 'B', name: 'colon', color: '#98df8a' }, + { category: 'C', name: 'letters', color: '#dbdb8d' }, + { category: 'D', name: 'space', color: '#d62727' }, + { category: 'E', name: 'problem', color: '#ff9896' }, + { category: 'F', name: 'rest', color: '#aec7e8' }, +] +%> + <div class="pre"> <h1><%= h(t.reports.characters_in_keys.name) %></h1> <p><%= h(t.reports.characters_in_keys.intro) %></p> @@ -5,8 +16,10 @@ <div id="tabs"> <ul> <li><a href="#statistics"><%= h(t.reports.characters_in_keys.statistics.tab) %></a></li> - <li><a href="#whitespace"><span style="background-color: #d62727;"> </span> <%= h(t.reports.characters_in_keys.whitespace.tab) %></a></li> - <li><a href="#problematic"><span style="background-color: #ff9896;"> </span> <%= h(t.reports.characters_in_keys.problematic.tab) %></a></li> +<% categories.each do |c| %> + <li><a href="#<%= c[:name] %>"><span style="background-color: <%= c[:color] %>; border: 1px solid #ffffff;"> <%= c[:category] %> </span> + <%= h(t.reports.characters_in_keys[c[:name]].tab) %></a></li> +<% end %> </ul> <div id="statistics"> <h2><%= h(t.reports.characters_in_keys.statistics.title) %></h2> @@ -18,39 +31,31 @@ <th class="tr"><%= h(t.reports.characters_in_keys.statistics.fraction) %></th> <th class="tl"><%= h(t.reports.characters_in_keys.statistics.characters) %></th> </tr> -<% letter='A' - colors = { :A => '#2ca02c', :B => '#98df8a', :C => '#dbdb8d', :D => '#d62728', :E => '#ff9896', :F => '#aec7e8' } - %w(plain colon letters space problem rest).each_with_index do |type, n| c = (n%2!=0) ? ' even' : '' %> +<% categories.each_with_index do |category, n| c = (n%2!=0) ? ' even' : '' %> <tr> - <td class="tc<%= c %>" style="background-color: <%= colors[letter.to_sym] %>;"><%= letter %></td> - <td class="tr<%= c %>"><%= @db.stats('characters_in_keys_' + type) %></td> - <td class="tr<%= c %>"><%= sprintf '%.2f', @db.stats('characters_in_keys_' + type) * 100.0 / @db.stats('num_keys') %>%</td> - <td class="tl<%= c %>"><%= t.reports.characters_in_keys.statistics.characters_in_keys[type] %></td> + <td class="tc<%= c %>" style="background-color: <%= category[:color] %>;"><%= category[:category] %></td> + <td class="tr<%= c %>"><%= @db.stats('characters_in_keys_' + category[:name]) %></td> + <td class="tr<%= c %>"><%= sprintf '%.2f', @db.stats('characters_in_keys_' + category[:name]) * 100.0 / @db.stats('num_keys') %>%</td> + <td class="tl<%= c %>"><%= t.reports.characters_in_keys.statistics.characters_in_keys[category[:name]] %></td> </tr> -<% letter = letter.succ; end %> +<% end %> <tr> <td class="tc" style="border-top: 1px solid #000000;"></td> <td class="tr" style="border-top: 1px solid #000000;"><%= @db.stats('num_keys') %></td> <td class="tr" style="border-top: 1px solid #000000;">100%</td> - <td class="tl" style="border-top: 1px solid #000000;"><%= t.reports.characters_in_keys.statistics.characters_in_keys.total %></td> + <td class="tl" style="border-top: 1px solid #000000;"><%= h(t.reports.characters_in_keys.statistics.characters_in_keys.total) %></td> </tr> </table> </div> - <div id="whitespace"> - <h2><%= h(t.reports.characters_in_keys.whitespace.title) %></h2> +<% categories.map{ |c| c[:name] }.each do |category| %> + <div id="<%= category %>"> + <h2><%= h(t.reports.characters_in_keys[category].title) %></h2> <div class="boxpre"> - <%= t.reports.characters_in_keys.whitespace.intro %> + <%= t.reports.characters_in_keys[category].intro %> </div> - <table id="grid-whitespace"> - </table> - </div> - <div id="problematic"> - <h2><%= h(t.reports.characters_in_keys.problematic.title) %></h2> - <div class="boxpre"> - <%= t.reports.characters_in_keys.problematic.intro %> - </div> - <table id="grid-problematic"> + <table id="grid-<%= category %>"> </table> </div> +<% end %> </div> <% javascript_for(:d3) %> diff --git a/web/views/reports/wiki_images.erb b/web/views/reports/wiki_images.erb new file mode 100644 index 0000000..26dbc3e --- /dev/null +++ b/web/views/reports/wiki_images.erb @@ -0,0 +1,26 @@ +<div class="pre"> + <h1><%= h(t.reports.wiki_images.name) %></h1> + <p><%= h(t.reports.wiki_images.intro) %></p> +</div> +<div class="box"> + <table class="wiki-images"><tr><td colspan="2"> +<% lastkey = '' + @db.select("SELECT p.key, p.title, p.lang, i.width, i.height, i.image_url, i.thumb_url_prefix, i.thumb_url_suffix FROM wiki.wikipages p, wiki.wiki_images i WHERE i.image=p.image AND p.value IS NULL ORDER BY p.key, p.lang").execute() do |row| %> +<% if lastkey != row['key'] + lastkey = row['key'] %> + </td></tr><tr><td class="key"><a class="keyimg" href=""></a></td><td class="images"> +<% end %> + <div class="langimg"> + <div><%= row['lang'] %></div> +<% imagesize = 50 + if row['width'].to_i <= imagesize && row['height'].to_i <= imagesize + src = row['image_url'] + else + src = row['thumb_url_prefix'] + imagesize.to_s + row['thumb_url_suffix'] + end +%> + <a href="http://wiki.openstreetmap.org/wiki/<%= row['title'] %>"><img src="<%= src %>"/></a> + </div> +<% end %> + </td></tr></table> +</div> diff --git a/web/viewsjs/reports/characters_in_keys.js.erb b/web/viewsjs/reports/characters_in_keys.js.erb index 3dbc7c0..4d65201 100644 --- a/web/viewsjs/reports/characters_in_keys.js.erb +++ b/web/viewsjs/reports/characters_in_keys.js.erb @@ -2,41 +2,12 @@ osm = @trans.t.osm misc = @trans.t.misc %> -var create_flexigrid_for = { - whitespace: function() { - create_flexigrid('grid-whitespace', { - url: '/api/4/keys/all?filter=characters_space&include=prevalent_values', - colModel: [ - { display: '<%= h(osm.key) %>', name: 'key', width: 250, sortable: true }, - { display: '<span title="<%= h(misc.objects_tooltip) %>"><img src="/img/types/all.16.png" width="16" height="16" alt=""/> <%= h(osm.objects) %></span>', name: 'count_all', width: 150, sortable: true, align: 'center' }, - { display: '<span title="<%= h(misc.users_tooltip) %>"><%= h(osm.users) %></span>', name: 'users_all', width: 44, sortable: true, align: 'right' }, - { display: '<img src="/img/sources/wiki.16.png" width="16" height="16" alt="Wiki" title="<%= h(misc.in_wiki_tooltip) %>"/>', name: 'in_wiki', width: 20, sortable: true, align: 'center' }, - { display: '<span title="<%= h(misc.values_tooltip) %>"><%= h(osm.values) %></span>', name: 'values_all', width: 70, sortable: true, align: 'right' }, - { display: '<span title="<%= h(misc.prevalent_values_tooltip) %>"><%= h(misc.prevalent_values) %></span>', name: 'prevalent_values', width: 600, sortable: true } - ], - searchitems: [ - { display: '<%= h(osm.key) %>', name: 'key' } - ], - sortname: 'count_all', - sortorder: 'desc', - preProcess: function(data) { - data.rows = jQuery.map(data.data, function(row, i) { - return { 'cell': [ - link_to_key(row.key), - fmt_value_with_percent(row.count_all, row.count_all_fraction), - fmt_with_ts(row.users_all), - fmt_checkmark(row.in_wiki), - fmt_with_ts(row.values_all), - fmt_prevalent_value_list(row.key, row.prevalent_values) - ] }; - }); - return data; - } - }); - }, - problematic: function() { - create_flexigrid('grid-problematic', { - url: '/api/4/keys/all?filter=characters_problematic&include=prevalent_values', +var create_flexigrid_for = {}; + +['plain', 'colon', 'letters', 'space', 'problem', 'rest'].forEach(function(category) { + create_flexigrid_for[category] = function() { + create_flexigrid('grid-' + category, { + url: '/api/4/keys/all?filter=characters_' + category + '&include=prevalent_values', colModel: [ { display: '<%= h(osm.key) %>', name: 'key', width: 250, sortable: true }, { display: '<span title="<%= h(misc.objects_tooltip) %>"><img src="/img/types/all.16.png" width="16" height="16" alt=""/> <%= h(osm.objects) %></span>', name: 'count_all', width: 150, sortable: true, align: 'center' }, @@ -64,8 +35,8 @@ var create_flexigrid_for = { return data; } }); - } -}; + }; +}); function page_init() { up = function() { window.location = '/reports'; }; diff --git a/web/viewsjs/reports/wiki_images.js.erb b/web/viewsjs/reports/wiki_images.js.erb new file mode 100644 index 0000000..2e90453 --- /dev/null +++ b/web/viewsjs/reports/wiki_images.js.erb @@ -0,0 +1,15 @@ +<% + osm = @trans.t.osm + misc = @trans.t.misc + %> +function page_init() { + var keys = <%= @db.select("SELECT DISTINCT key FROM wiki.wikipages WHERE value IS NULL AND image IN (SELECT image FROM wiki.wiki_images) ORDER BY key").execute().map{ |row| row['key'] }.to_json; %>; + console.log(keys); + up = function() { window.location = '/reports'; }; + jQuery('.keyimg').each(function(index) { + console.log(index, this); + jQuery(this).attr('href', url_for_key(keys[index])); + jQuery(this).text(fmt_key(keys[index])); + }); +} + |