Changeset 1844

Show
Ignore:
Timestamp:
05/31/07 22:48:03 (1 year ago)
Author:
antoine
Message:

Define application header: unicode (utf-8) and application/xhtml+xml for recent navigators

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternd/trunk/spike/ui/app/controllers/application.rb

    r1840 r1844  
    33 
    44class ApplicationController < ActionController::Base 
    5   # Pick a unique cookie name to distinguish our session data from others' 
    6   session :session_key => '_alternc_session_id' 
     5        session :session_key => 'alternc_session_id' 
     6        before_filter :set_header 
     7         
     8        def set_header 
     9                if session[:test_xhtml].nil? 
     10                        if @request.env['HTTP_ACCEPT'].include?("application/xhtml+xml") 
     11                                session[:test_xhtml] = true 
     12                        else 
     13                                session[:test_xhtml] = false 
     14                        end 
     15                end 
     16                if session[:test_xhtml] 
     17                        headers["Content-Type"] = "application/xhtml+xml; charset=utf-8" 
     18                else 
     19                        headers["Content-Type"] = "text/html; charset=utf-8" 
     20                end 
     21        end 
    722end