aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsources/projects/parse.rb16
-rw-r--r--sources/projects/pre.sql4
-rw-r--r--web/lib/api/v4/project.rb8
-rw-r--r--web/lib/api/v4/tag.rb10
-rw-r--r--web/viewsjs/key.js.erb11
-rw-r--r--web/viewsjs/project.js.erb5
-rw-r--r--web/viewsjs/tag.js.erb11
7 files changed, 56 insertions, 9 deletions
diff --git a/sources/projects/parse.rb b/sources/projects/parse.rb
index c509fae..1471d0e 100755
--- a/sources/projects/parse.rb
+++ b/sources/projects/parse.rb
@@ -65,13 +65,25 @@ projects.each do |id, json|
if data[:tags]
data[:tags].each do |d|
- db.execute("INSERT INTO project_tags (project_id, key, value, description, doc_url, icon_url) VALUES (?, ?, ?, ?, ?, ?)",
+ on = { 'node' => 0, 'way' => 0, 'relation' => 0, 'area' => 0 }
+ if d[:object_types] && d[:object_types].class == Array
+ d[:object_types].each do |type|
+ on[type] = 1
+ end
+ else
+ on = { 'node' => 1, 'way' => 1, 'relation' => 1, 'area' => 1 }
+ end
+ db.execute("INSERT INTO project_tags (project_id, key, value, description, doc_url, icon_url, on_node, on_way, on_relation, on_area) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
id,
d[:key],
d[:value],
d[:description],
d[:doc_url],
- d[:icon_url]
+ d[:icon_url],
+ on['node'],
+ on['way'],
+ on['relation'],
+ on['area'],
);
end
end
diff --git a/sources/projects/pre.sql b/sources/projects/pre.sql
index da4d66f..6e4c0de 100644
--- a/sources/projects/pre.sql
+++ b/sources/projects/pre.sql
@@ -38,6 +38,10 @@ CREATE TABLE project_tags (
project_id TEXT NOT NULL,
key TEXT NOT NULL,
value TEXT,
+ on_node INTEGER,
+ on_way INTEGER,
+ on_relation INTEGER,
+ on_area INTEGER,
description TEXT,
doc_url TEXT,
icon_url TEXT,
diff --git a/web/lib/api/v4/project.rb b/web/lib/api/v4/project.rb
index d1a197b..b1fa2e8 100644
--- a/web/lib/api/v4/project.rb
+++ b/web/lib/api/v4/project.rb
@@ -9,6 +9,10 @@ class Taginfo < Sinatra::Base
:result => paging_results([
[:key, :STRING, 'Key'],
[:value, :STRING, 'Value'],
+ [:on_node, :BOOL, 'For nodes?'],
+ [:on_way, :BOOL, 'For ways?'],
+ [:on_relation, :BOOL, 'For relations?'],
+ [:on_area, :BOOL, 'For areas?'],
[:description, :STRING, 'Description'],
[:doc_url, :STRING, 'Documentation URL'],
[:icon_url, :STRING, 'Icon URL']
@@ -42,6 +46,10 @@ class Taginfo < Sinatra::Base
:data => res.map{ |row| {
:key => row['key'],
:value => row['value'],
+ :on_node => row['on_node'].to_i == 1,
+ :on_way => row['on_way'].to_i == 1,
+ :on_relation => row['on_relation'].to_i == 1,
+ :on_area => row['on_area'].to_i == 1,
:description => row['description'],
:doc_url => row['doc_url'],
:icon_url => row['icon_url']
diff --git a/web/lib/api/v4/tag.rb b/web/lib/api/v4/tag.rb
index f2ca53b..35e4870 100644
--- a/web/lib/api/v4/tag.rb
+++ b/web/lib/api/v4/tag.rb
@@ -262,6 +262,10 @@ class Taginfo < Sinatra::Base
[:project_name, :STRING, 'Project name'],
[:key, :STRING, 'Key'],
[:value, :STRING, 'Value'],
+ [:on_node, :BOOL, 'For nodes?'],
+ [:on_way, :BOOL, 'For ways?'],
+ [:on_relation, :BOOL, 'For relations?'],
+ [:on_area, :BOOL, 'For areas?'],
[:description, :STRING, 'Description'],
[:doc_url, :STRING, 'Documentation URL'],
[:icon_url, :STRING, 'Icon URL']
@@ -278,7 +282,7 @@ class Taginfo < Sinatra::Base
condition_if("value LIKE ? ESCAPE '@' OR name LIKE ? ESCAPE '@'", q, q).
get_first_value().to_i
- res = @db.select('SELECT t.project_id, p.name, t.key, t.value, t.description, t.doc_url, t.icon_url FROM projects.projects p, projects.project_tags t ON p.id=t.project_id').
+ res = @db.select('SELECT t.project_id, p.name, t.key, t.value, t.description, t.doc_url, t.icon_url, t.on_node, t.on_way, t.on_relation, t.on_area FROM projects.projects p, projects.project_tags t ON p.id=t.project_id').
condition('key = ?', key).
condition_if('value = ? OR VALUE IS NULL', value).
condition_if("value LIKE ? ESCAPE '@' OR name LIKE ? ESCAPE '@'", q, q).
@@ -304,6 +308,10 @@ class Taginfo < Sinatra::Base
:project_name => row['name'],
:key => row['key'],
:value => row['value'],
+ :on_node => row['on_node'].to_i == 1,
+ :on_way => row['on_way'].to_i == 1,
+ :on_relation => row['on_relation'].to_i == 1,
+ :on_area => row['on_area'].to_i == 1,
:description => row['description'],
:doc_url => row['doc_url'],
:icon_url => row['icon_url']
diff --git a/web/viewsjs/key.js.erb b/web/viewsjs/key.js.erb
index e384d5b..9bf8583 100644
--- a/web/viewsjs/key.js.erb
+++ b/web/viewsjs/key.js.erb
@@ -108,9 +108,9 @@ var create_flexigrid_for = {
link_to_wiki(row.title),
html_escape(row.description),
fmt_wiki_image_popup(row.image),
- fmt_type_icon('node', row.on_node) +
- fmt_type_icon('way', row.on_way) +
- fmt_type_icon('area', row.on_area) +
+ fmt_type_icon('node', row.on_node) +
+ fmt_type_icon('way', row.on_way) +
+ fmt_type_icon('area', row.on_area) +
fmt_type_icon('relation', row.on_relation),
fmt_key_or_tag_list(row.tags_implies),
fmt_key_or_tag_list(row.tags_combination),
@@ -151,6 +151,7 @@ var create_flexigrid_for = {
colModel: [
{ display: '<%= h(taginfo.project) %>', name: 'project_name', width: 280, sortable: true },
{ display: '<%= h(osm.tag) %>', name: 'key', width: 220, sortable: true },
+ { display: '<%= h(osm.objects) %>', name: 'objects', width: 80, sortable: false },
{ display: '<%= h(page.projects.description) %>', name: 'description', width: 600, sortable: false, align: 'left' }
],
searchitems: [
@@ -163,6 +164,10 @@ var create_flexigrid_for = {
return { 'cell': [
link_to_project(row.project_id, row.project_name),
row.value ? link_to_tag(row.key, row.value) : (link_to_key(row.key) + '=*'),
+ fmt_type_icon('node', row.on_node) +
+ fmt_type_icon('way', row.on_way) +
+ fmt_type_icon('area', row.on_area) +
+ fmt_type_icon('relation', row.on_relation),
project_tag_desc(row.description, row.icon_url, row.doc_url)
] };
});
diff --git a/web/viewsjs/project.js.erb b/web/viewsjs/project.js.erb
index 59af6dd..435b07f 100644
--- a/web/viewsjs/project.js.erb
+++ b/web/viewsjs/project.js.erb
@@ -8,6 +8,7 @@ var create_flexigrid_for = {
url: '/api/4/project/tags?project=' + encodeURIComponent(project),
colModel: [
{ display: '<%= h(osm.tag) %>', name: 'tag', width: 260, sortable: true },
+ { display: '<%= h(osm.objects) %>', name: 'objects', width: 80, sortable: false },
{ display: '<%= h(misc.description) %>', name: 'description', width: 800, sortable: false, align: 'left' }
],
searchitems: [
@@ -19,6 +20,10 @@ var create_flexigrid_for = {
data.rows = jQuery.map(data.data, function(row, i) {
return { 'cell': [
row.value ? link_to_tag(row.key, row.value) : (link_to_key(row.key) + '=*'),
+ fmt_type_icon('node', row.on_node) +
+ fmt_type_icon('way', row.on_way) +
+ fmt_type_icon('area', row.on_area) +
+ fmt_type_icon('relation', row.on_relation),
project_tag_desc(row.description, row.doc_url, row.icon_url)
] };
});
diff --git a/web/viewsjs/tag.js.erb b/web/viewsjs/tag.js.erb
index 1cc6e89..34b5935 100644
--- a/web/viewsjs/tag.js.erb
+++ b/web/viewsjs/tag.js.erb
@@ -88,9 +88,9 @@ var create_flexigrid_for = {
link_to_wiki(row.title),
html_escape(row.description),
fmt_wiki_image_popup(row.image),
- fmt_type_icon('node', row.on_node) +
- fmt_type_icon('way', row.on_way) +
- fmt_type_icon('area', row.on_area) +
+ fmt_type_icon('node', row.on_node) +
+ fmt_type_icon('way', row.on_way) +
+ fmt_type_icon('area', row.on_area) +
fmt_type_icon('relation', row.on_relation),
fmt_key_or_tag_list(row.tags_implies),
fmt_key_or_tag_list(row.tags_combination),
@@ -131,6 +131,7 @@ var create_flexigrid_for = {
colModel: [
{ display: '<%= h(taginfo.project) %>', name: 'project_name', width: 280, sortable: true },
{ display: '<%= h(osm.tag) %>', name: 'key', width: 220, sortable: true },
+ { display: '<%= h(osm.objects) %>', name: 'objects', width: 80, sortable: false },
{ display: '<%= h(page.projects.description) %>', name: 'description', width: 600, sortable: false, align: 'left' }
],
searchitems: [
@@ -143,6 +144,10 @@ var create_flexigrid_for = {
return { 'cell': [
link_to_project(row.project_id, row.project_name),
row.value ? link_to_tag(row.key, row.value) : (link_to_key(row.key) + '=*'),
+ fmt_type_icon('node', row.on_node) +
+ fmt_type_icon('way', row.on_way) +
+ fmt_type_icon('area', row.on_area) +
+ fmt_type_icon('relation', row.on_relation),
project_tag_desc(row.description, row.icon_url, row.doc_url)
] };
});