ActionController::Routing::Routes.draw do |map|
  # The priority is based upon order of creation: first created -> highest priority.
  
  # Sample of regular route:
  # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  # Keep in mind you can assign values other than :controller and :action
  
  # Sample of named route:
  # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  # This route can be invoked with purchase_url(:id => product.id)
  
  # You can have the root of your site routed by hooking up '' 
  # -- just remember to delete public/index.html.
  # map.connect '', :controller => "welcome"
  
  # Allow downloading Web Service WSDL as a file with an extension
  # instead of a file named 'wsdl'
  map.connect ':controller/service.wsdl', :action => 'wsdl'
  
  # Install the default route as the lowest priority.
  map.connect 'archives/:year/:month' ,
  :controller => 'portal' ,
  :action => 'archives' ,
#  :year => Time.now.year,
 # :month => Time.now.month,
  :requirements => {
  :year => /\d+/,
  :month => /\d+/
  } 

# TODO implement
#  map.connect 'pages/list/:type',
#    :controller => 'pages',
#    :action => 'list',
#    :requirements => {:type => /\D+/}

  map.connect 'rss/:site_folder',
    :controller => 'rss',
    :action => 'list',
    :requirements => {:site_folder => /.*/}
  map.connect ':controller/:action/:id.:format'
  map.connect ':controller/:action/:id'
  # TODO evaluate this
  map.connect ':site_folder/:id/:action',
    :controller => 'pages'
  map.connect '', :controller => 'portal', :action => 'home', :title => 'Welcome'

  # See http://rambleon.org/2007/03/07/rails-12-route-changes-are-a-pain-in-the-arse/
  # The following made sense for Apache, but not for LiteSpeed. 
  # BTW, LiteSpeed can be configured to use a custom error page
  map.connect '*path', :controller => 'other', :action => 'show404', :requirements => { :path => /.*/ }
end
