app/controllers/layers_controller.rb
#method returns json or xml representation of a layers maps
method returns json or xml representation of a layers maps
method returns json or xml representation of a layers maps
def maps
  paginate_params = {
    :page => params[:page],
    :per_page => 50,
    :order => :map_type
  }
  show_warped = params[:show_warped]
  unless show_warped == "0"
    lmaps = @layer.maps.warped.paginate(paginate_params)
  else
    lmaps = @layer.maps.paginate(paginate_params)
  end
    respond_to do |format|
    format.json {render :json =>{:stat => "ok",
      :current_page => lmaps.current_page,
      :per_page => lmaps.per_page,
      :total_entries => lmaps.total_entries,
      :total_pages => lmaps.total_pages,
      :items => lmaps.to_a}.to_json(:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id,  :map, :thumbnail]), :callback => params[:callback] }
    format.xml {render :xml => lmaps.to_xml(:root => "maps",:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id,  :map, :thumbnail])  {|xml|
      xml.tag!'total-entries', lmaps.total_entries
      xml.tag!'per-page', lmaps.per_page
      xml.tag!'current-page',lmaps.current_page} }
    end
  end
def maps paginate_params = { :page => params [ :page ] , :per_page => 50 , :order => :map_type } show_warped = params [ :show_warped ] unless show_warped == "0" lmaps = @layer . maps . warped . paginate ( paginate_params ) else lmaps = @layer . maps . paginate ( paginate_params ) end respond_to do | format | format . json { render :json => { :stat => "ok" , :current_page => lmaps . current_page , :per_page => lmaps . per_page , :total_entries => lmaps . total_entries , :total_pages => lmaps . total_pages , :items => lmaps . to_a } . to_json ( :except => [ :content_type , :size , :bbox_geom , :uuid , :parent_uuid , :filename , :parent_id , :map , :thumbnail ] ) , :callback => params [ :callback ] } format . xml { render :xml => lmaps . to_xml ( :root => "maps" , :except => [ :content_type , :size , :bbox_geom , :uuid , :parent_uuid , :filename , :parent_id , :map , :thumbnail ] ) { | xml | xml . tag! 'total-entries' , lmaps . total_entries xml . tag! 'per-page' , lmaps . per_page xml . tag! 'current-page' , lmaps . current_page } } end end
method returns json or xml representation of a layers maps
method returns json or xml representation of a layers maps
#format.json {render :json =>lmaps.to_json(:stat => "ok",:except => [:content_type, :size, :bbox_geom, :uuid, :parent_uuid, :filename, :parent_id,  :map, :thumbnail])}