presetnames={}; presetnames['point']={}; presetnames['way']={}; presetnames['POI']={}
presettype=''
presetcategory=''
-
# StringIO.open(txt) do |file|
File.open("#{RAILS_ROOT}/config/potlatch/presets.txt") do |file|
file.each_line {|line|
File.open("#{RAILS_ROOT}/config/potlatch/colours.txt") do |file|
file.each_line {|line|
t=line.chomp
- if (t=~/(\w+)\t+([^\t]+)\t+([^\t]+)\t+([^\t]+)/) then
+ if (t=~/(\w+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/) then
tag=$1
if ($2!='-') then colours[tag]=$2.hex end
if ($3!='-') then casing[tag]=$3.hex end
end
}
end
- [presets,presetmenus,presetnames,colours,casing,areas]
+
+ # Read auto-complete
+ autotags={}; autotags['point']={}; autotags['way']={}; autotags['POI']={};
+ File.open("#{RAILS_ROOT}/config/potlatch/autocomplete.txt") do |file|
+ file.each_line {|line|
+ t=line.chomp
+ if (t=~/^(\w+)\/(\w+)\s+(.+)$/) then
+ tag=$1; type=$2; values=$3
+ if values=='-' then autotags[type][tag]=[]
+ else autotags[type][tag]=values.split(',').sort.reverse end
+ end
+ }
+ end
+
+ [presets,presetmenus,presetnames,colours,casing,areas,autotags]
end
# ----- whichways(left,bottom,right,top)
def getway_old(args)
RAILS_DEFAULT_LOGGER.info(" Message: getway_old (server is #{SERVER_URL})")
- if SERVER_URL=="www.openstreetmap.org" then return -1,"Revert is not currently enabled on the OpenStreetMap server." end
+# if SERVER_URL=="www.openstreetmap.org" then return -1,"Revert is not currently enabled on the OpenStreetMap server." end
objname,wayid,version,baselong,basey,masterscale=args
wayid = wayid.to_i
EOF
histlist=ActiveRecord::Base.connection.select_all(sql)
histlist.each { |row|
- if row['data_public'] then user=row['display_name'] else user='anonymous' end
+ if row['data_public'].to_i==1 then user=row['display_name'] else user='anonymous' end
history<<[row['version'],row['timestamp'],row['visible'],user]
}
[history]