summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2010-11-06 21:46:16 +0100
committerJochen Topf <jochen@topf.org>2010-11-06 21:46:16 +0100
commita12227eb394955dfdff2a6032b75156754f8f804 (patch)
treeb4bbde64da694d60badfb416cceead5aed51237b
parent79f4ec1fa8238cce85ed2379544cb347fa965f57 (diff)
downloadtaginfo-a12227eb394955dfdff2a6032b75156754f8f804.tar
taginfo-a12227eb394955dfdff2a6032b75156754f8f804.tar.gz
Finished report: Frequently Used Keys Without Wiki Page
-rw-r--r--sources/master/master.sql4
-rw-r--r--web/lib/api/reports.rb8
-rw-r--r--web/views/reports/frequently_used_keys_without_wiki_page.erb15
3 files changed, 19 insertions, 8 deletions
diff --git a/sources/master/master.sql b/sources/master/master.sql
index 74fc146..331a464 100644
--- a/sources/master/master.sql
+++ b/sources/master/master.sql
@@ -46,8 +46,8 @@ INSERT INTO db.keys (key) SELECT DISTINCT k FROM josm.josm_style_rules WHERE k
-- potlatch XXX
-- INSERT INTO db.keys (key) SELECT DISTINCT key FROM merkaartor.keys WHERE key NOT IN (SELECT key FROM db.keys);
-UPDATE db.keys SET in_wiki=1 WHERE key IN (SELECT distinct key FROM wiki.wikipages);
-UPDATE db.keys SET in_wiki_en=1 WHERE key IN (SELECT distinct key FROM wiki.wikipages WHERE lang='en');
+UPDATE db.keys SET in_wiki=1 WHERE key IN (SELECT distinct key FROM wiki.wikipages WHERE value IS NULL);
+UPDATE db.keys SET in_wiki_en=1 WHERE key IN (SELECT distinct key FROM wiki.wikipages WHERE value IS NULL AND lang='en');
UPDATE db.keys SET in_josm=1 WHERE key IN (SELECT distinct k FROM josm.josm_style_rules);
-- potlatch XXX
UPDATE db.keys SET in_merkaartor=1 WHERE key IN (SELECT key FROM merkaartor.keys);
diff --git a/web/lib/api/reports.rb b/web/lib/api/reports.rb
index 2044ca3..798f96b 100644
--- a/web/lib/api/reports.rb
+++ b/web/lib/api/reports.rb
@@ -3,16 +3,20 @@
class Taginfo < Sinatra::Base
get '/api/2/reports/frequently_used_keys_without_wiki_page' do
+
min_count = params[:min_count].to_i || 10000
+
+ english = (params[:english] == '1') ? '_en' : ''
+
total = @db.count('db.keys').
condition('count_all > ?', min_count).
- condition('in_wiki = 0').
+ condition("in_wiki#{english} = 0").
condition_if("key LIKE '%' || ? || '%'", params[:query]).
get_first_value().to_i
res = @db.select('SELECT * FROM db.keys').
condition('count_all > ?', min_count).
- condition('in_wiki = 0').
+ condition("in_wiki#{english} = 0").
condition_if("key LIKE '%' || ? || '%'", params[:query]).
order_by([:key, :count_all, :values_all, :users_all], params[:sortname], params[:sortorder]).
paging(params[:rp], params[:page]).
diff --git a/web/views/reports/frequently_used_keys_without_wiki_page.erb b/web/views/reports/frequently_used_keys_without_wiki_page.erb
index d915dcf..f4c59ba 100644
--- a/web/views/reports/frequently_used_keys_without_wiki_page.erb
+++ b/web/views/reports/frequently_used_keys_without_wiki_page.erb
@@ -8,8 +8,8 @@ redirect to a different wiki page instead. To do this put just one line with
<tt style="background-color: #f0f0f0; padding: 0 2px;">#REDIRECT [[<i>page name</i>]]</tt>
in the wiki page.</p>
-<form>
- <input type="checkbox" name="english" id="english" value="0"/> Also show keys that have no English language wiki page but a page in some other language.
+<form method="" type="GET">
+ <input type="checkbox" name="english" id="english"<%= params[:english] == '1' ? ' checked="checked"' : '' %>/> Also show keys that have no English language wiki page but a page in some other language.
</form>
<p></p>
@@ -17,9 +17,10 @@ in the wiki page.</p>
</table>
<script type="text/javascript">
+var grid;
jQuery(document).ready(function() {
- jQuery('#keys').flexigrid({
- url: '/api/2/reports/frequently_used_keys_without_wiki_page',
+ grid = jQuery('#keys').flexigrid({
+ url: '/api/2/reports/frequently_used_keys_without_wiki_page?english=' + <%= params[:english] == '1' ? '1' : '0' %>,
method: 'GET',
dataType: 'json',
colModel: [
@@ -55,5 +56,11 @@ in the wiki page.</p>
return data;
}
});
+ jQuery('#english').bind('click', function() {
+ jQuery('#keys').flexOptions({
+ url: '/api/2/reports/frequently_used_keys_without_wiki_page?english=' + (jQuery('#english')[0].checked ? '1' : '0')
+ });
+ jQuery('#keys').flexReload();
+ });
});
</script>