- conditions = conditions_nonempty
-
-
- # @changesets = Changeset.find(:all, :order => "closed_at DESC", :conditions => ['closed_at < ?', DateTime.now], :limit=> 20)
-
-
- #@edit_pages, @edits = paginate(:changesets,
- # :include => [:user, :changeset_tags],
- # :conditions => conditions,
- # :order => "changesets.created_at DESC",
- # :per_page => 20)
- #
-
- @edits = Changeset.find(:all,
- :order => "changesets.created_at DESC",
- :conditions => conditions,
- :limit => 20)
-
- end
-
- ##
- # list edits (changesets) belonging to a user
- def list_user
- user = User.find_by_display_name(params[:display_name], :conditions => {:visible => true})
-
- if user
- @display_name = user.display_name
- if not user.data_public? and @user != user
- @edits = nil
- render
+ if request.format == :atom and params[:page]
+ redirect_to params.merge({ :page => nil }), :status => :moved_permanently
+ else
+ changesets = conditions_nonempty(Changeset.scoped)
+
+ if params[:display_name]
+ user = User.find_by_display_name(params[:display_name])
+
+ if user and user.active?
+ if user.data_public? or user == @user
+ changesets = changesets.where(:user_id => user.id)
+ else
+ changesets = changesets.where("false")
+ end
+ elsif request.format == :html
+ @title = t 'user.no_such_user.title'
+ @not_found_user = params[:display_name]
+ render :template => 'user/no_such_user', :status => :not_found
+ end
+ end
+
+ if params[:bbox]
+ bbox = params[:bbox]
+ elsif params[:minlon] and params[:minlat] and params[:maxlon] and params[:maxlat]
+ bbox = params[:minlon] + ',' + params[:minlat] + ',' + params[:maxlon] + ',' + params[:maxlat]
+ end
+
+ if bbox
+ changesets = conditions_bbox(changesets, bbox)
+ bbox = BoundingBox.from_s(bbox)
+ bbox_link = render_to_string :partial => "bbox", :object => bbox
+ end
+
+ if user
+ user_link = render_to_string :partial => "user", :object => user
+ end
+
+ if user and bbox
+ @title = t 'changeset.list.title_user_bbox', :user => user.display_name, :bbox => bbox.to_s
+ @heading = t 'changeset.list.heading_user_bbox', :user => user.display_name, :bbox => bbox.to_s
+ @description = t 'changeset.list.description_user_bbox', :user => user_link, :bbox => bbox_link
+ elsif user
+ @title = t 'changeset.list.title_user', :user => user.display_name
+ @heading = t 'changeset.list.heading_user', :user => user.display_name
+ @description = t 'changeset.list.description_user', :user => user_link
+ elsif bbox
+ @title = t 'changeset.list.title_bbox', :bbox => bbox.to_s
+ @heading = t 'changeset.list.heading_bbox', :bbox => bbox.to_s
+ @description = t 'changeset.list.description_bbox', :bbox => bbox_link