]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/amf_controller.rb
Have a nice translated alt and title for the sotm and donation.
[rails.git] / app / controllers / amf_controller.rb
index 18ecb13231f8b36a561bc3c872aefaa7b36e050d..5bc5e2832f400126f047abce8d03f526c5ab6bdc 100644 (file)
@@ -127,8 +127,10 @@ class AmfController < ApplicationController
           results[index]=[-5,nil]
         else
           case message
-            when 'putway';                       r=putway(renumberednodes,*args)
-                                                               renumberednodes=r[4]
+            when 'putway';                       orn=renumberednodes.dup
+                                  r=putway(renumberednodes,*args)
+                                                               renumberednodes=r[4].dup
+                                                               r[4].delete_if { |k,v| orn.has_key?(k) }
                                                                if r[2] != r[3] then renumberedways[r[2]] = r[3] end
                                                                results[index]=AMF.putdata(index,r)
             when 'putrelation';                results[index]=AMF.putdata(index,putrelation(renumberednodes, renumberedways, *args))
@@ -176,6 +178,7 @@ class AmfController < ApplicationController
       cs = Changeset.new
       cs.tags = cstags
       cs.user_id = user.id
+      if !closecomment.empty? then cs.tags['comment']=closecomment end
       # smsm1 doesn't like the next two lines and thinks they need to be abstracted to the model more/better
       cs.created_at = Time.now.getutc
       cs.closed_at = cs.created_at + Changeset::IDLE_TIMEOUT
@@ -448,10 +451,12 @@ class AmfController < ApplicationController
 
   # Get a relation with all tags and members.
   # Returns:
-  # 0. relation id,
-  # 1. hash of tags,
-  # 2. list of members,
-  # 3. version.
+  # 0. success code?
+  # 1. object type?
+  # 2. relation id,
+  # 3. hash of tags,
+  # 4. list of members,
+  # 5. version.
   
   def getrelation(relid) #:doc:
     begin
@@ -475,7 +480,7 @@ class AmfController < ApplicationController
         rels.push([rel.id, rel.tags, rel.members, rel.version])
       end
     else
-      RelationTag.find(:all, :limit => 11, :conditions => ["match(v) against (?)", searchterm] ).each do |t|
+      RelationTag.find(:all, :limit => 11, :conditions => ["v like ?", "%#{searchterm}%"] ).each do |t|
       if t.relation.visible then
              rels.push([t.relation.id, t.relation.tags, t.relation.members, t.relation.version])
            end
@@ -590,9 +595,7 @@ class AmfController < ApplicationController
     if pointlist.length < 2 then return -2,"Server error - way is only #{points.length} points long." end
 
     originalway = originalway.to_i
-logger.info("received #{pointlist} for #{originalway}")
        pointlist.collect! {|a| a.to_i }
-logger.info("converted to #{pointlist}")
 
     way=nil    # this is returned, so scope it outside the transaction
     nodeversions = {}
@@ -632,11 +635,9 @@ logger.info("converted to #{pointlist}")
 
       # -- Save revised way
 
-logger.info("renumberednodes is #{renumberednodes.inspect}")
          pointlist.collect! {|a|
              renumberednodes[a] ? renumberednodes[a]:a
          } # renumber nodes
-logger.info("saving with #{pointlist}")
       new_way = Way.new
       new_way.tags = attributes
       new_way.nds = pointlist
@@ -690,9 +691,10 @@ logger.info("saving with #{pointlist}")
   # Refuses save if the node has since become part of a way.
   # Returns array with:
   # 0. 0 (success),
-  # 1. original node id (unchanged),
-  # 2. new node id,
-  # 3. version.
+  # 1. success message,
+  # 2. original node id (unchanged),
+  # 3. new node id,
+  # 4. version.
 
   def putpoi(usertoken, changeset_id, version, id, lon, lat, tags, visible) #:doc:
     user = getuser(usertoken)