aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/i18n/de.yml21
-rw-r--r--web/i18n/en.yml21
-rw-r--r--web/lib/api/v4/project.rb66
-rw-r--r--web/lib/api/v4/projects.rb53
-rw-r--r--web/lib/api/v4/tag.rb63
-rw-r--r--web/lib/projects.rb51
-rw-r--r--web/lib/ui/projects.rb31
-rw-r--r--web/lib/ui/taginfo.rb7
-rw-r--r--web/public/css/taginfo.css5
-rw-r--r--web/public/img/sources/projects.16.pngbin0 -> 951 bytes
-rw-r--r--web/public/img/sources/projects.24.pngbin0 -> 1309 bytes
-rw-r--r--web/public/img/sources/projects.32.pngbin0 -> 2658 bytes
-rw-r--r--web/public/img/sources/projects.48.pngbin0 -> 4733 bytes
-rw-r--r--web/public/js/taginfo.js38
-rwxr-xr-xweb/taginfo.rb5
-rw-r--r--web/views/key.erb6
-rw-r--r--web/views/project.erb46
-rw-r--r--web/views/projects.erb8
-rw-r--r--web/views/tag.erb6
-rw-r--r--web/views/taginfo/index.erb1
-rw-r--r--web/views/taginfo/projects.erb40
-rw-r--r--web/viewsjs/key.js.erb26
-rw-r--r--web/viewsjs/project.js.erb35
-rw-r--r--web/viewsjs/projects.js.erb23
-rw-r--r--web/viewsjs/tag.js.erb26
25 files changed, 576 insertions, 2 deletions
diff --git a/web/i18n/de.yml b/web/i18n/de.yml
index 7b07685..45e4596 100644
--- a/web/i18n/de.yml
+++ b/web/i18n/de.yml
@@ -38,6 +38,8 @@ taginfo:
reports: Reports
international: International
apidoc: API-Dokumentation
+ project: Projekt
+ projects: Projekte
test: Test
map: Karte
maps: Karten
@@ -168,6 +170,8 @@ pages:
<p>Taginfo bekommt Informationen über die verschiedenen Sprachen dieser Welt, ihre Codes, Namen, usw. aus diversen Datenbanken der <a class="extlink" href="http://www.iana.org/">IANA</a> und vom <a class="extlink" href="http://www.unicode.org/">Unicode Consortium</a>.</p>
josm: |
<p>Icons und Stile werden aus der Konfiguration des Editors <a class="extlink" href="http://josm.openstreetmap.de/">JOSM</a> übernommen.</p>
+ projects: |
+ <p>Projekte, die OSM-Tags in irgendeiner Weise nutzen, zum Beispiel Editoren, Karten, Router, usw. Siehe auch die <a href="/projects">Projektliste</a>.</p>
updates:
title: Aktualisierung
intro: Die Taginfo-Daten werden regelmäßig aktualisiert.
@@ -223,6 +227,9 @@ pages:
no_information: Keine Informationen
roles_less_than_one_percent: Keine Roles mit mehr als 1%
empty_role: Role ist leer
+ projects:
+ intro: |
+ Diese Tabelle zeigt alle Projekte, die taginfo kennt, und die OSM-Tags in irgendeiner Weise nutzen.
key:
description_from_wiki: Beschreibung dieses Keys aus dem Wiki (falls vorhanden in der gewählten Sprache, sonst auf Englisch).
no_description_in_wiki: Keine deutschsprachige Beschreibung dieses Keys im Wiki. (Siehe auch im "Wiki"-Tab.)
@@ -264,6 +271,8 @@ pages:
choice: |
Stil auswählen:
no_styles: Keine JOSM-Stilregeln für diesen Key.
+ projects:
+ title: Projekte, die diesen Key benutzen
tag:
description_from_wiki: Beschreibung dieses Tags aus dem Wiki (falls vorhanden in der gewählten Sprache, sonst auf Englisch).
no_description_in_wiki: Keine deutschsprachige Beschreibung dieses Tags im Wiki. (Siehe auch im "Wiki"-Tab.)
@@ -298,6 +307,8 @@ pages:
choice: |
Stil auswählen:
no_styles: Keine JOSM-Stilregeln für diesen Tag.
+ projects:
+ title: Projekte, die diesen Tag benutzen
relation:
name: Relation-Typ
description_from_wiki: Beschreibung dieses Relations-Types aus dem Wiki (falls vorhanden in der gewählten Sprache, sonst auf Englisch).
@@ -325,6 +336,16 @@ pages:
none_found: Keine Wiki-Seiten für diesen Relation-Typ vorhanden.
create: Wiki-Seite für diesen Relation-Typ anlegen
wiki_page: Wiki-Seite
+ project:
+ overview:
+ project_name: Projektname
+ project_url: Projekt-URL
+ description: Beschreibung
+ documentation_url: Dokumentation
+ last_update: Letzte Aktualisierung
+ tags:
+ title: Tags, die von diesem Projekt verwenden werden
+ intro: Die folgenden Daten wurden von dem Projekt zur Verfügung gestellt. Sie sind nicht notwendigerweise komplett. Für Details schau bitte in die Projekt-Dokumentation.
flexigrid:
pagetext: Seite
diff --git a/web/i18n/en.yml b/web/i18n/en.yml
index 3c2d478..8b6963c 100644
--- a/web/i18n/en.yml
+++ b/web/i18n/en.yml
@@ -39,6 +39,8 @@ taginfo:
reports: Reports
international: International
apidoc: API Documentation
+ project: Project
+ projects: Projects
test: Test
map: Map
maps: Maps
@@ -243,6 +245,8 @@ pages:
<p>Taginfo gets information about the different languages of the world, their codes, names, etc. from several <a class="extlink" href="http://www.iana.org/">IANA</a> and <a class="extlink" href="http://www.unicode.org/">Unicode</a> registries.</p>
josm: |
<p>Icons and styles are taken from the <a class="extlink" href="http://josm.openstreetmap.de/">JOSM editor</a> configuration.</p>
+ projects: |
+ <p>Projects that use OSM tags in some way, such as editors, maps, routers, etc. See <a href="/projects">the project list</a>.</p>
updates:
title: Updates
intro: The taginfo data is updated regularly from the sources.
@@ -293,6 +297,9 @@ pages:
no_information: No information
roles_less_than_one_percent: no roles with more than 1%
empty_role: empty role
+ projects:
+ intro: |
+ This table shows all projects known to taginfo that use OSM tags in some way.
key:
description_from_wiki: Description of this key from the wiki (if available in your chosen language, otherwise in English).
no_description_in_wiki: No English language description for this key in the wiki. (See also the "Wiki" tab.)
@@ -334,6 +341,8 @@ pages:
choice: |
Choose style:
no_styles: No JOSM styles for this key.
+ projects:
+ title: Projects using this key
tag:
description_from_wiki: Description of this tag from the wiki (if available in your chosen language, otherwise in English).
no_description_in_wiki: No English language description for this tag in the wiki. (See also the "Wiki" tab.)
@@ -368,6 +377,8 @@ pages:
choice: |
Choose style:
no_styles: No JOSM styles for this tag.
+ projects:
+ title: Projects using this tag
relation:
name: Relation type
description_from_wiki: Description of this relation type from the wiki (if available in your chosen language, otherwise in English).
@@ -395,6 +406,16 @@ pages:
none_found: No wiki page available for this relation type.
create: Create wiki page for this relation type
wiki_page: Wiki page
+ project:
+ overview:
+ project_name: Project name
+ project_url: Project URL
+ description: Description
+ documentation_url: Documentation
+ last_update: Last update
+ tags:
+ title: Tags used by this project
+ intro: This data is supplied by the project and not necessarily complete. Please see the project documentation for details.
flexigrid:
pagetext: Page
diff --git a/web/lib/api/v4/project.rb b/web/lib/api/v4/project.rb
new file mode 100644
index 0000000..94eeadc
--- /dev/null
+++ b/web/lib/api/v4/project.rb
@@ -0,0 +1,66 @@
+# web/lib/api/v4/project.rb
+class Taginfo < Sinatra::Base
+
+ api(4, 'project/tags', {
+ :description => 'Get list of all keys/tags used by a project.',
+ :parameters => { :project => 'Project ID' },
+ :paging => :optional,
+ :sort => %w( tag ),
+ :result => paging_results([
+ [:key, :STRING, 'Key'],
+ [:value, :STRING, 'Value'],
+ [:description, :STRING, 'Description'],
+ [:doc_url, :STRING, 'Documentation URL'],
+ [:icon_url, :STRING, 'Icon URL']
+ ]),
+ :example => { :page => 1, :rp => 10, :sortname => 'key', :sortorder => 'asc' },
+ :ui => '/projects/id_editor'
+ }) do
+ project_id = params[:project]
+
+ q = like_contains(params[:query])
+ total = @db.count('projects.project_tags').
+ condition("project_id=?", project_id).
+ condition_if("key LIKE ? ESCAPE '@' OR value LIKE ? ESCAPE '@'", q, q).
+ get_first_value().to_i
+
+ res = @db.select('SELECT * FROM projects.project_tags').
+ condition("project_id=?", project_id).
+ condition_if("key LIKE ? ESCAPE '@' OR value LIKE ? ESCAPE '@'", q, q).
+ order_by(@ap.sortname, @ap.sortorder) { |o|
+ o.tag :key
+ o.tag :value
+ }.
+ paging(@ap).
+ execute()
+
+ return JSON.generate({
+ :page => @ap.page,
+ :rp => @ap.results_per_page,
+ :total => total,
+ :url => request.url,
+ :data => res.map{ |row| {
+ :key => row['key'],
+ :value => row['value'],
+ :description => row['description'],
+ :doc_url => row['doc_url'],
+ :icon_url => row['icon_url']
+ }}
+ }, json_opts(params[:format]))
+ end
+
+ api(4, 'project/icon', {
+ :description => 'Access logo icon for project.',
+ :parameters => { :project => 'Project ID' },
+ :result => 'PNG image.',
+ :example => { :project => 'osmcoastline' },
+ :ui => '/projects'
+ }) do
+ project_id = params[:project]
+ content_type :png
+ @db.select('SELECT icon FROM projects.projects').
+ condition('id = ?', project_id).
+ get_first_value()
+ end
+
+end
diff --git a/web/lib/api/v4/projects.rb b/web/lib/api/v4/projects.rb
new file mode 100644
index 0000000..2cbb7fb
--- /dev/null
+++ b/web/lib/api/v4/projects.rb
@@ -0,0 +1,53 @@
+# web/lib/api/v4/projects.rb
+class Taginfo < Sinatra::Base
+
+ api(4, 'projects/all', {
+ :description => 'Get list of all projects using OSM tags known to taginfo.',
+ :parameters => { :status => 'Only show projects with given status (default is "OK")', :query => 'Only show projects matching this query (substring match, optional).' },
+ :paging => :optional,
+ :sort => %w( name ),
+ :result => paging_results([
+ [:id, :STRING, 'Project id'],
+ [:name, :STRING, 'Project name'],
+ [:url, :STRING, 'Project URL'],
+ [:description, :STRING, 'Project description']
+ ]),
+ :example => { :page => 1, :rp => 10, :sortname => 'name', :sortorder => 'asc' },
+ :ui => '/projects'
+ }) do
+ if params[:status]
+ status = params[:status]
+ else
+ status = 'OK'
+ end
+
+ q = like_contains(params[:query])
+ total = @db.count('projects.projects').
+ condition("fetch_result=?", status).
+ condition_if("name LIKE ? ESCAPE '@' OR description LIKE ? ESCAPE '@'", q, q).
+ get_first_value().to_i
+
+ res = @db.select('SELECT * FROM projects.projects').
+ condition("fetch_result=?", status).
+ condition_if("name LIKE ? ESCAPE '@' OR description LIKE ? ESCAPE '@'", q, q).
+ order_by(@ap.sortname, @ap.sortorder) { |o|
+ o.name 'lower(name)'
+ }.
+ paging(@ap).
+ execute()
+
+ return JSON.generate({
+ :page => @ap.page,
+ :rp => @ap.results_per_page,
+ :total => total,
+ :url => request.url,
+ :data => res.map{ |row| {
+ :id => row['id'],
+ :name => row['name'],
+ :url => row['project_url'],
+ :description => row['description'],
+ }}
+ }, json_opts(params[:format]))
+ end
+
+end
diff --git a/web/lib/api/v4/tag.rb b/web/lib/api/v4/tag.rb
index 152569a..f2ca53b 100644
--- a/web/lib/api/v4/tag.rb
+++ b/web/lib/api/v4/tag.rb
@@ -248,4 +248,67 @@ class Taginfo < Sinatra::Base
return get_wiki_result(res)
end
+ api(4, 'tag/projects', {
+ :description => 'Get projects using a given key or tag.',
+ :parameters => {
+ :key => 'Tag key (required).',
+ :value => 'Tag value (optional).',
+ :query => 'Only show results where the value matches this query (substring match, optional).'
+ },
+ :paging => :optional,
+ :sort => %w( project_name key value ),
+ :result => paging_results([
+ [:project_id, :STRING, 'Project ID'],
+ [:project_name, :STRING, 'Project name'],
+ [:key, :STRING, 'Key'],
+ [:value, :STRING, 'Value'],
+ [:description, :STRING, 'Description'],
+ [:doc_url, :STRING, 'Documentation URL'],
+ [:icon_url, :STRING, 'Icon URL']
+ ]),
+ :example => { :key => 'highway', :value => 'residential', :page => 1, :rp => 10, :sortname => 'project_name', :sortorder => 'asc' },
+ :ui => '/keys/highway=residential#projects'
+ }) do
+ key = params[:key]
+ value = params[:value]
+ q = like_contains(params[:query])
+ total = @db.select('SELECT count(*) 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).
+ 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').
+ condition('key = ?', key).
+ condition_if('value = ? OR VALUE IS NULL', value).
+ condition_if("value LIKE ? ESCAPE '@' OR name LIKE ? ESCAPE '@'", q, q).
+ order_by(@ap.sortname, @ap.sortorder) { |o|
+ o.project_name 'p.name'
+ o.project_name :key
+ o.project_name :value
+ o.key :key
+ o.key :value
+ o.value :value
+ o.value :key
+ }.
+ paging(@ap).
+ execute()
+
+ return JSON.generate({
+ :page => @ap.page,
+ :rp => @ap.results_per_page,
+ :total => total.to_i,
+ :url => request.url,
+ :data => res.map{ |row| {
+ :project_id => row['project_id'],
+ :project_name => row['name'],
+ :key => row['key'],
+ :value => row['value'],
+ :description => row['description'],
+ :doc_url => row['doc_url'],
+ :icon_url => row['icon_url']
+ } }
+ }, json_opts(params[:format]))
+ end
+
end
diff --git a/web/lib/projects.rb b/web/lib/projects.rb
new file mode 100644
index 0000000..01536a2
--- /dev/null
+++ b/web/lib/projects.rb
@@ -0,0 +1,51 @@
+# web/lib/projects.rb
+class Project
+
+ @@projects = Array.new
+
+ @@attrs = [:id, :json_url, :fetch_date, :fetch_status, :fetch_json, :fetch_result, :data_format, :data_updated, :data_url, :name, :project_url, :doc_url, :icon_url, :description, :contact_name, :contact_email]
+
+ @@attrs.each do |attr|
+ attr_reader attr
+ end
+
+ # Enumerate all available projects
+ def self.each
+ @@projects.each do |project|
+ yield project
+ end
+ end
+
+ # Enumerate all available projects
+ def self.each_with_index
+ @@projects.each_with_index do |project, n|
+ yield project, n
+ end
+ end
+
+ # The number of available sources
+ def self.size
+ @@projects.size
+ end
+
+ def self.init
+ db = SQL::Database.new.attach_sources
+
+ db.select("SELECT * FROM projects.projects").execute() do |row|
+ @@projects << Project.new(row)
+ end
+
+ db.close
+ end
+
+ def self.get(id)
+ @@projects.select{ |p| p.id == id }[0]
+ end
+
+ def initialize(row)
+ @@attrs.each do |s|
+ instance_variable_set("@#{s}", row[s.to_s])
+ end
+ end
+
+end
diff --git a/web/lib/ui/projects.rb b/web/lib/ui/projects.rb
new file mode 100644
index 0000000..b2eec53
--- /dev/null
+++ b/web/lib/ui/projects.rb
@@ -0,0 +1,31 @@
+# web/lib/ui/projects.rb
+class Taginfo < Sinatra::Base
+
+ get '/projects' do
+ @title = t.taginfo.projects
+ javascript_for(:flexigrid)
+ javascript "#{ r18n.locale.code }/projects"
+ erb :projects
+ end
+
+ get %r{^/projects/(.*)} do |project|
+ if params[:project].nil?
+ @project_id = project
+ else
+ @project_id = params[:project]
+ end
+
+ @project = Project.get(@project_id)
+
+ if @project
+ @title = [h(@project.name), t.taginfo.projects]
+ end
+
+ section :projects
+
+ javascript_for(:flexigrid)
+ javascript "#{ r18n.locale.code }/project"
+ erb :project
+ end
+
+end
diff --git a/web/lib/ui/taginfo.rb b/web/lib/ui/taginfo.rb
index 2d3d6e6..710f48f 100644
--- a/web/lib/ui/taginfo.rb
+++ b/web/lib/ui/taginfo.rb
@@ -106,4 +106,11 @@ class Taginfo < Sinatra::Base
erb :'taginfo/apidoc'
end
+ get '/taginfo/projects' do
+ @title = t.taginfo.projects
+ @section = 'taginfo'
+ @section_title = t.taginfo.meta
+ erb :'taginfo/projects'
+ end
+
end
diff --git a/web/public/css/taginfo.css b/web/public/css/taginfo.css
index a5bae87..797074f 100644
--- a/web/public/css/taginfo.css
+++ b/web/public/css/taginfo.css
@@ -558,7 +558,7 @@ table.drilldown td#feature {
/* ========== */
table.desc {
- background-color: #b8b8b0;
+ background-color: #ddddd4;
border-radius: 4px;
padding: 6px;
width: 100%;
@@ -574,8 +574,9 @@ table.desc > tbody > tr > th {
table.desc > tbody > tr > td {
vertical-align: top;
- background-color: #e8e8e4;
+ background-color: #f8f8f8;
padding: 2px 4px;
+ border-radius: 1px;
}
table.apiresults {
diff --git a/web/public/img/sources/projects.16.png b/web/public/img/sources/projects.16.png
new file mode 100644
index 0000000..205216d
--- /dev/null
+++ b/web/public/img/sources/projects.16.png
Binary files differ
diff --git a/web/public/img/sources/projects.24.png b/web/public/img/sources/projects.24.png
new file mode 100644
index 0000000..c959426
--- /dev/null
+++ b/web/public/img/sources/projects.24.png
Binary files differ
diff --git a/web/public/img/sources/projects.32.png b/web/public/img/sources/projects.32.png
new file mode 100644
index 0000000..4759626
--- /dev/null
+++ b/web/public/img/sources/projects.32.png
Binary files differ
diff --git a/web/public/img/sources/projects.48.png b/web/public/img/sources/projects.48.png
new file mode 100644
index 0000000..ff82029
--- /dev/null
+++ b/web/public/img/sources/projects.48.png
Binary files differ
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js
index 23a0ad7..88f3745 100644
--- a/web/public/js/taginfo.js
+++ b/web/public/js/taginfo.js
@@ -73,6 +73,10 @@ function url_for_rtype(rtype) {
}
}
+function url_for_project(id) {
+ return '/projects/' + encodeURIComponent(id);
+}
+
function url_for_wiki(title, options) {
var path = '//wiki.openstreetmap.org/';
if (options && options.edit) {
@@ -193,6 +197,14 @@ function link_to_rtype(rtype, attr) {
);
}
+function link_to_project(id, name, attr) {
+ return /*img({ src: '/api/v4/project/icon?project=' + id, alt: '' }) + ' ' +*/ link(
+ url_for_project(id),
+ html_escape(name),
+ attr
+ );
+}
+
function link_to_wiki(title, options) {
if (title == '') {
return '';
@@ -205,6 +217,14 @@ function link_to_wiki(title, options) {
);
}
+function link_to_url(url) {
+ return link(
+ encodeURI(url),
+ html_escape(url.replace(/^http:\/\//, '')),
+ { target: '_blank', 'class': 'extlink' }
+ );
+}
+
/* ============================ */
function html_escape(text) {
@@ -685,6 +705,21 @@ function comparison_list_change(key, value) {
return false;
}
+/* ============================ */
+
+function project_tag_desc(description, icon, url) {
+ var out = '';
+ if (icon) {
+ out += img({src: icon, alt: '', width: 16, height: 16}) + ' ';
+ }
+ if (description) {
+ out += html_escape(description) + ' ';
+ }
+ if (url) {
+ out += '[' + link(url, 'More...', { target: '_blank', 'class': 'extlink' }) + ']'
+ }
+ return out;
+}
/* ============================ */
@@ -758,6 +793,9 @@ jQuery(document).ready(function() {
case 75: // k
window.location = '/keys';
break;
+ case 80: // p
+ window.location = '/projects';
+ break;
case 82: // r
window.location = '/relations';
break;
diff --git a/web/taginfo.rb b/web/taginfo.rb
index 5ad8b66..58a7fe9 100755
--- a/web/taginfo.rb
+++ b/web/taginfo.rb
@@ -53,6 +53,7 @@ require 'lib/language.rb'
require 'lib/sql.rb'
require 'lib/sources.rb'
require 'lib/reports.rb'
+require 'lib/projects.rb'
require 'lib/api.rb'
require 'lib/langtag/bcp47.rb'
@@ -63,6 +64,7 @@ TaginfoConfig.read
#------------------------------------------------------------------------------
DATA_UNTIL = SQL::Database.init('../../data');
+Project.init
class Taginfo < Sinatra::Base
@@ -204,6 +206,8 @@ class Taginfo < Sinatra::Base
load 'lib/api/v4/josm.rb'
load 'lib/api/v4/key.rb'
load 'lib/api/v4/keys.rb'
+ load 'lib/api/v4/project.rb'
+ load 'lib/api/v4/projects.rb'
load 'lib/api/v4/relation.rb'
load 'lib/api/v4/relations.rb'
load 'lib/api/v4/search.rb'
@@ -220,6 +224,7 @@ class Taginfo < Sinatra::Base
load 'lib/ui/embed.rb'
load 'lib/ui/help.rb'
load 'lib/ui/keys.rb'
+ load 'lib/ui/projects.rb'
load 'lib/ui/relation.rb'
load 'lib/ui/reports.rb'
load 'lib/ui/search.rb'
diff --git a/web/views/key.erb b/web/views/key.erb
index 7e51f31..91c79fa 100644
--- a/web/views/key.erb
+++ b/web/views/key.erb
@@ -41,6 +41,7 @@
<li><a href="#map"><%= h(t.taginfo.map) %></a></li>
<li><a href="#wiki"><%= h(t.sources.wiki.name) %></a></li>
<li><a href="#josm"><%= h(t.sources.josm.name) %></a></li>
+ <li><a href="#projects"><%= h(t.taginfo.projects) %></a></li>
</ul>
<div id="overview">
<div style="float: right; text-align: center; padding-left: 20px;">
@@ -116,6 +117,11 @@
<p class="empty"><%= h(t.pages.key.josm.no_styles) %></p>
<% end %>
</div>
+ <div id="projects">
+ <h2><%= h(t.pages.key.projects.title) %></h2>
+ <table id="grid-projects">
+ </table>
+ </div>
</div>
<iframe id="josmiframe" name="josmiframe"></iframe>
<% javascript do
diff --git a/web/views/project.erb b/web/views/project.erb
new file mode 100644
index 0000000..0b7dea4
--- /dev/null
+++ b/web/views/project.erb
@@ -0,0 +1,46 @@
+<div class="pre">
+ <h1><%= h(@project.name) %></h1>
+ <p><%= h(@project.description) %></p>
+</div>
+<div id="tabs">
+ <ul class="no-print">
+ <li><a href="#overview"><%= h(t.taginfo.overview) %></a></li>
+ <li><a href="#tags"><%= h(t.osm.tags) %></a></li>
+ </ul>
+ <div id="overview">
+ <table class="desc">
+ <tr><th><%= h(t.pages.project.overview.project_name) %>:</th><td><%= h(@project.name) %></td></tr>
+ <tr><th><%= h(t.pages.project.overview.project_url) %>:</th><td id="project_url"></td></tr>
+ <tr><th><%= h(t.pages.project.overview.description) %>:</th><td><%= h(@project.description) %></td></tr>
+<% if @project.doc_url %>
+ <tr><th><%= h(t.pages.project.overview.documentation_url) %>:</th><td id="doc_url"></td></tr>
+<% end %>
+ <tr><th><%= h(t.pages.project.overview.last_update) %>:</th><td><%= h(@project.data_updated) %></td></tr>
+ </table>
+ </div>
+ <div id="tags">
+ <h2><%= h(t.pages.project.tags.title) %></h2>
+ <p><%= h(t.pages.project.tags.intro) %></p>
+ <table id="grid-tags">
+ </table>
+ </div>
+</div>
+<% javascript do
+ JS.raw(<<"JAVASCRIPT")
+function page_init2() {
+ var project = #{ @project_id.to_json },
+ project_url = #{ @project.project_url.to_json },
+ doc_url = #{ @project.doc_url.to_json };
+
+ if (project_url) {
+ jQuery('#project_url').html(link_to_url(project_url));
+ }
+ if (doc_url) {
+ jQuery('#doc_url').html(link_to_url(doc_url));
+ }
+
+ init_tabs([project]);
+}
+JAVASCRIPT
+end
+%>
diff --git a/web/views/projects.erb b/web/views/projects.erb
new file mode 100644
index 0000000..ec95947
--- /dev/null
+++ b/web/views/projects.erb
@@ -0,0 +1,8 @@
+<div class="pre">
+ <h1 class="section"><%= h(t.taginfo.projects) %></h1>
+ <p><%= h(t.pages.projects.intro) %></p>
+</div>
+<div class="box resize">
+ <table id="grid-projects">
+ </table>
+</div>
diff --git a/web/views/tag.erb b/web/views/tag.erb
index 1ae5274..de9453c 100644
--- a/web/views/tag.erb
+++ b/web/views/tag.erb
@@ -40,6 +40,7 @@
<li><a href="#map"><%= h(t.taginfo.map) %></a></li>
<li><a href="#wiki"><%= h(t.sources.wiki.name) %></a></li>
<li><a href="#josm"><%= h(t.sources.josm.name) %></a></li>
+ <li><a href="#projects"><%= h(t.taginfo.projects) %></a></li>
</ul>
<div id="overview">
<% if @image_url %>
@@ -113,6 +114,11 @@
<p class="empty"><%= h(t.pages.key.josm.no_styles) %></p>
<% end %>
</div>
+ <div id="projects">
+ <h2><%= h(t.pages.tag.projects.title) %></h2>
+ <table id="grid-projects">
+ </table>
+ </div>
</div>
<iframe id="josmiframe" name="josmiframe"></iframe>
<% javascript do
diff --git a/web/views/taginfo/index.erb b/web/views/taginfo/index.erb
index 81d3862..3139642 100644
--- a/web/views/taginfo/index.erb
+++ b/web/views/taginfo/index.erb
@@ -9,6 +9,7 @@
<li><a href="/taginfo/translations">Translations Overview</a></li>
<li><a href="/taginfo/i18n">Translated Texts</a></li>
<li><a href="/taginfo/config">Configuration</a></li>
+ <li><a href="/taginfo/projects">Projects</a></li>
</ul>
<h2>Software Version</h2>
<p><%= @commit %></p>
diff --git a/web/views/taginfo/projects.erb b/web/views/taginfo/projects.erb
new file mode 100644
index 0000000..dd07ed6
--- /dev/null
+++ b/web/views/taginfo/projects.erb
@@ -0,0 +1,40 @@
+<h1 class="section">Projects</h1>
+
+<table class="list">
+ <tr>
+ <th>Icon</th>
+ <th>Project ID<br/>Project Name</th>
+ <th>Fetch Date<br/>Updated</th><th>Code</th><th>Res</th>
+ <th>JSON URL<br/>Data URL</th><th>Fmt<br/>Vers</th>
+ <th>Project URL<br/>Doc URL</th><th>Contact</th>
+ <th>Description</th>
+ </tr>
+<% Project.each_with_index do |project, n| c = (n%2!=0) ? ' even' : '' %>
+ <tr>
+ <td class="tc<%= c %> nowrap">
+ <img src="<%= h(project.icon_url) %>" width="16" height="16" alt=""/>
+ </td>
+ <td class="<%= c %> nowrap">
+ <a href="/projects/<%= h(project.id) %>"><%= h(project.id) %></a><br/>
+ <%= h(project.name) %>
+ </td>
+ <td class="<%= c %> nowrap">
+ <%= h(project.fetch_date) %><br/>
+ <%= h(project.data_updated) %>
+ </td>
+ <td class="tc<%= c %> nowrap"><%= h(project.fetch_status) %></td>
+ <td class="tc<%= c %> nowrap"><%= h(project.fetch_result) %></td>
+ <td class="<%= c %> nowrap">
+ <a href="<%= h(project.json_url) %>"><%= h(project.json_url) %></a><br/>
+ <a href="<%= h(project.data_url) %>"><%= h(project.data_url) %></a>
+ </td>
+ <td class="tc<%= c %> nowrap"><%= h(project.data_format) %></td>
+ <td class="<%= c %> nowrap">
+ <a href="<%= h(project.project_url) %>"><%= h(project.project_url) %></a><br/>
+ <a href="<%= h(project.doc_url) %>"><%= h(project.doc_url) %></a>
+ </td>
+ <td class="<%= c %> nowrap"><%= h(project.contact_name) %><br/><%= h(project.contact_email) %></td>
+ <td class="<%= c %>"><%= h(project.description) %></td>
+ </tr>
+<% end %>
+</table>
diff --git a/web/viewsjs/key.js.erb b/web/viewsjs/key.js.erb
index f40af36..ad9937d 100644
--- a/web/viewsjs/key.js.erb
+++ b/web/viewsjs/key.js.erb
@@ -1,6 +1,7 @@
<%
osm = @trans.t.osm
misc = @trans.t.misc
+ taginfo = @trans.t.taginfo
page = @trans.t.pages.key
%>
var create_flexigrid_for = {
@@ -143,6 +144,31 @@ var create_flexigrid_for = {
return data;
}
});
+ },
+ projects: function(key, filter_type) {
+ create_flexigrid('grid-projects', {
+ url: '/api/4/tag/projects?key=' + encodeURIComponent(key),
+ colModel: [
+ { display: '<%= h(taginfo.project) %>', name: 'project_name', width: 200, sortable: true },
+ { display: '<%= h(osm.tag) %>', name: 'key', width: 220, sortable: true },
+ { display: '<%= h(misc.description) %>', name: 'description', width: 600, sortable: false, align: 'left' }
+ ],
+ searchitems: [
+ { display: '<%= h(taginfo.project) %>/<%= h(osm.value) %>', name: 'project_value' }
+ ],
+ sortname: 'key',
+ sortorder: 'asc',
+ preProcess: function(data) {
+ data.rows = jQuery.map(data.data, function(row, i) {
+ 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) + '=*'),
+ project_tag_desc(row.description, row.icon_url, row.doc_url)
+ ] };
+ });
+ return data;
+ }
+ });
}
};
diff --git a/web/viewsjs/project.js.erb b/web/viewsjs/project.js.erb
new file mode 100644
index 0000000..59af6dd
--- /dev/null
+++ b/web/viewsjs/project.js.erb
@@ -0,0 +1,35 @@
+<%
+ osm = @trans.t.osm
+ misc = @trans.t.misc
+ %>
+var create_flexigrid_for = {
+ tags: function(project) {
+ create_flexigrid('grid-tags', {
+ url: '/api/4/project/tags?project=' + encodeURIComponent(project),
+ colModel: [
+ { display: '<%= h(osm.tag) %>', name: 'tag', width: 260, sortable: true },
+ { display: '<%= h(misc.description) %>', name: 'description', width: 800, sortable: false, align: 'left' }
+ ],
+ searchitems: [
+ { display: '<%= h(osm.key) %>/<%= h(osm.value) %>', name: 'key_value' }
+ ],
+ sortname: 'tag',
+ sortorder: 'asc',
+ preProcess: function(data) {
+ 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) + '=*'),
+ project_tag_desc(row.description, row.doc_url, row.icon_url)
+ ] };
+ });
+ delete data.data;
+ return data;
+ }
+ });
+ }
+};
+
+function page_init() {
+ up = function() { window.location = '/projects'; }
+ page_init2();
+}
diff --git a/web/viewsjs/projects.js.erb b/web/viewsjs/projects.js.erb
new file mode 100644
index 0000000..55878c9
--- /dev/null
+++ b/web/viewsjs/projects.js.erb
@@ -0,0 +1,23 @@
+function page_init() {
+ create_flexigrid('grid-projects', {
+ url: '/api/4/projects/all',
+ colModel: [
+ { display: '<%= h(@trans.t.taginfo.project) %>', name: 'name', width: 300, sortable: true },
+ { display: '<%= h(@trans.t.misc.description) %>', name: 'description', width: 600, sortable: false }
+ ],
+ searchitems: [
+ { display: '<%= h(@trans.t.taginfo.project) %>/<%= h(@trans.t.misc.description) %>', name: 'name' }
+ ],
+ sortname: 'name',
+ sortorder: 'asc',
+ preProcess: function(data) {
+ data.rows = jQuery.map(data.data, function(row, i) {
+ return { 'cell': [
+ link_to_project(row.id, row.name),
+ html_escape(row.description)
+ ] };
+ });
+ return data;
+ }
+ });
+}
diff --git a/web/viewsjs/tag.js.erb b/web/viewsjs/tag.js.erb
index f9181d4..d47906e 100644
--- a/web/viewsjs/tag.js.erb
+++ b/web/viewsjs/tag.js.erb
@@ -1,6 +1,7 @@
<%
osm = @trans.t.osm
misc = @trans.t.misc
+ taginfo = @trans.t.taginfo
page = @trans.t.pages.tag
%>
function link_to_key_or_tag(key, value) {
@@ -123,6 +124,31 @@ var create_flexigrid_for = {
return data;
}
});
+ },
+ projects: function(key, value) {
+ create_flexigrid('grid-projects', {
+ url: '/api/4/tag/projects?key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value),
+ colModel: [
+ { display: '<%= h(taginfo.project) %>', name: 'project_name', width: 200, sortable: true },
+ { display: '<%= h(osm.tag) %>', name: 'key', width: 220, sortable: true },
+ { display: '<%= h(misc.description) %>', name: 'description', width: 600, sortable: false, align: 'left' }
+ ],
+ searchitems: [
+ { display: '<%= h(taginfo.project) %>/<%= h(osm.value) %>', name: 'project_value' }
+ ],
+ sortname: 'key',
+ sortorder: 'asc',
+ preProcess: function(data) {
+ data.rows = jQuery.map(data.data, function(row, i) {
+ 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) + '=*'),
+ project_tag_desc(row.description, row.icon_url, row.doc_url)
+ ] };
+ });
+ return data;
+ }
+ });
}
};