summaryrefslogtreecommitdiff
path: root/sources/potlatch
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2010-10-30 22:20:30 +0200
committerJochen Topf <jochen@topf.org>2010-10-30 22:20:30 +0200
commite83097f2cfc6e3663adc009179c27bf9485c14f5 (patch)
treecfb6643d1586ab5c90bff465285f8799034dc3ed /sources/potlatch
parent1dc5013314a56a830a6d0f439866e7b18a217d5a (diff)
downloadtaginfo-e83097f2cfc6e3663adc009179c27bf9485c14f5.tar
taginfo-e83097f2cfc6e3663adc009179c27bf9485c14f5.tar.gz
More Potlatch2 support
Diffstat (limited to 'sources/potlatch')
-rwxr-xr-xsources/potlatch/import_potlatch.rb8
-rw-r--r--sources/potlatch/pre.sql20
2 files changed, 17 insertions, 11 deletions
diff --git a/sources/potlatch/import_potlatch.rb b/sources/potlatch/import_potlatch.rb
index b939cc6..61832e3 100755
--- a/sources/potlatch/import_potlatch.rb
+++ b/sources/potlatch/import_potlatch.rb
@@ -57,6 +57,10 @@ doc.elements.each('/mapFeatures/feature') do |feature_element|
on[$1.to_sym] = 1
when /^(category|help)$/
fields[element.name] = element.text.strip
+ when 'icon'
+ fields['icon_image'] = element.attributes['image']
+ fields['icon_background'] = element.attributes['background']
+ fields['icon_foreground'] = element.attributes['foreground']
end
end
@@ -64,8 +68,8 @@ doc.elements.each('/mapFeatures/feature') do |feature_element|
on = { :point => 1, :line => 1, :area => 1, :relation => 1 }
end
- db.execute('INSERT INTO features (name, category_id, help, on_point, on_line, on_area, on_relation) VALUES (?, ?, ?, ?, ?, ?, ?)',
- feature_name, fields['category'], fields['help'], on[:point], on[:line], on[:area], on[:relation])
+ db.execute('INSERT INTO features (name, category_id, help, on_point, on_line, on_area, on_relation, icon_image, icon_background, icon_foreground) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
+ feature_name, fields['category'], fields['help'], on[:point], on[:line], on[:area], on[:relation], fields['icon_image'], fields['icon_background'], fields['icon_foreground'])
end
db.execute('COMMIT');
diff --git a/sources/potlatch/pre.sql b/sources/potlatch/pre.sql
index 7f3a40b..9f79445 100644
--- a/sources/potlatch/pre.sql
+++ b/sources/potlatch/pre.sql
@@ -36,7 +36,6 @@ CREATE TABLE categories (
name TEXT
);
-
--
-- features
--
@@ -44,14 +43,17 @@ CREATE TABLE categories (
DROP TABLE IF EXISTS features;
CREATE TABLE features (
- name TEXT,
- category_id TEXT REFERENCES categories (id),
- category_name TEXT,
- help TEXT,
- on_point INTEGER,
- on_line INTEGER,
- on_area INTEGER,
- on_relation INTEGER
+ name TEXT,
+ category_id TEXT REFERENCES categories (id),
+ category_name TEXT,
+ help TEXT,
+ on_point INTEGER,
+ on_line INTEGER,
+ on_area INTEGER,
+ on_relation INTEGER,
+ icon_image TEXT,
+ icon_foreground TEXT,
+ icon_background TEXT
);
--