<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[574] trunk/rails: Added check for cookies and messages controller</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>574</dd>
<dt>Author</dt> <dd>mwmitchell</dd>
<dt>Date</dt> <dd>2008-05-29 17:19:35 -0400 (Thu, 29 May 2008)</dd>
</dl>
<h3>Log Message</h3>
<pre>Added check for cookies and messages controller</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkrailsappcontrollersapplicationrb">trunk/rails/app/controllers/application.rb</a></li>
<li><a href="#trunkrailsappviewslayoutsapplicationhtmlerb">trunk/rails/app/views/layouts/application.html.erb</a></li>
<li><a href="#trunkrailsconfigroutesrb">trunk/rails/config/routes.rb</a></li>
<li><a href="#trunkrailsvendorgemsflareTODOtxt">trunk/rails/vendor/gems/flare/TODO.txt</a></li>
<li><a href="#trunkrailsvendorgemsflarelibflarerb">trunk/rails/vendor/gems/flare/lib/flare.rb</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkrailsappcontrollersmessages_controllerrb">trunk/rails/app/controllers/messages_controller.rb</a></li>
<li>trunk/rails/app/views/messages/</li>
<li><a href="#trunkrailsappviewsmessagesno_cookieshtmlerb">trunk/rails/app/views/messages/no_cookies.html.erb</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li>trunk/rails/vendor/gems/flare/app/</li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkrailsappcontrollersapplicationrb"></a>
<div class="modfile"><h4>Modified: trunk/rails/app/controllers/application.rb (573 => 574)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/rails/app/controllers/application.rb        2008-05-27 21:24:07 UTC (rev 573)
+++ trunk/rails/app/controllers/application.rb        2008-05-29 21:19:35 UTC (rev 574)
</span><span class="lines">@@ -11,6 +11,8 @@
</span><span class="cx">
</span><span class="cx"> helper_method :request_is_for_user_resource?
</span><span class="cx">
</span><ins>+ before_filter :require_cookies
+
</ins><span class="cx"> before_filter :set_current_user
</span><span class="cx"> before_filter :restrict_user
</span><span class="cx">
</span><span class="lines">@@ -24,6 +26,17 @@
</span><span class="cx">
</span><span class="cx"> protected
</span><span class="cx">
</span><ins>+ def require_cookies
+ if params[:cookie_check].to_s.empty?
+ session[:ok]=true
+ redirect_to :controller=>params[:controller], :action=>params[:action], :cookie_check=>true
+ else
+ if params[:controller]!='messages' and params[:action]!='no_cookies' and ! session[:ok]==true
+ redirect_to messages_path(:action=>:no_cookies, :cookie_check=>false)
+ end
+ end
+ end
+
</ins><span class="cx"> #
</span><span class="cx"> # Controller and view helper for determining if the current url is a request for a user resource
</span><span class="cx"> #
</span><span class="lines">@@ -80,7 +93,7 @@
</span><span class="cx"> # redirect to the "auth/pubcookie" url
</span><span class="cx"> #
</span><span class="cx"> def authorize!
</span><del>- redirect_to pubcookie_auth_path unless params[:controller]=='auth'
</del><ins>+ redirect_to pubcookie_auth_path if params[:controller]=='auth' and params[:controller]=='messages' and params[:action]!='no_cookies'
</ins><span class="cx"> end
</span><span class="cx">
</span><span class="cx"> end
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkrailsappcontrollersmessages_controllerrb"></a>
<div class="addfile"><h4>Added: trunk/rails/app/controllers/messages_controller.rb (0 => 574)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/rails/app/controllers/messages_controller.rb         (rev 0)
+++ trunk/rails/app/controllers/messages_controller.rb        2008-05-29 21:19:35 UTC (rev 574)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+class MessagesController < ApplicationController
+ def no_cookies
+
+ end
+end
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkrailsappviewslayoutsapplicationhtmlerb"></a>
<div class="modfile"><h4>Modified: trunk/rails/app/views/layouts/application.html.erb (573 => 574)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/rails/app/views/layouts/application.html.erb        2008-05-27 21:24:07 UTC (rev 573)
+++ trunk/rails/app/views/layouts/application.html.erb        2008-05-29 21:19:35 UTC (rev 574)
</span><span class="lines">@@ -118,7 +118,9 @@
</span><span class="cx">                         
</span><span class="cx">                         <div class="docWrap">
</span><span class="cx">                                 <div id="mainContent">
</span><del>-                                        <div><%= yield %></div>
</del><ins>+                                        <div>
+                                         <%= yield %>
+                                        </div>
</ins><span class="cx">                                 </div>
</span><span class="cx">                                 <hr />
</span><span class="cx">                                 <div id="subContent1">
</span></span></pre></div>
<a id="trunkrailsappviewsmessagesno_cookieshtmlerb"></a>
<div class="addfile"><h4>Added: trunk/rails/app/views/messages/no_cookies.html.erb (0 => 574)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/rails/app/views/messages/no_cookies.html.erb         (rev 0)
+++ trunk/rails/app/views/messages/no_cookies.html.erb        2008-05-29 21:19:35 UTC (rev 574)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+Your browser must have cookies enabled.
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkrailsconfigroutesrb"></a>
<div class="modfile"><h4>Modified: trunk/rails/config/routes.rb (573 => 574)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/rails/config/routes.rb        2008-05-27 21:24:07 UTC (rev 573)
+++ trunk/rails/config/routes.rb        2008-05-29 21:19:35 UTC (rev 574)
</span><span class="lines">@@ -25,6 +25,8 @@
</span><span class="cx"> map.flare c
</span><span class="cx"> end
</span><span class="cx">
</span><ins>+ map.messages 'messages/:action', :controller=>'messages'
+
</ins><span class="cx"> # The priority is based upon order of creation: first created -> highest priority.
</span><span class="cx">
</span><span class="cx"> # Sample of regular route:
</span></span></pre></div>
<a id="trunkrailsvendorgemsflareTODOtxt"></a>
<div class="modfile"><h4>Modified: trunk/rails/vendor/gems/flare/TODO.txt (573 => 574)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/rails/vendor/gems/flare/TODO.txt        2008-05-27 21:24:07 UTC (rev 573)
+++ trunk/rails/vendor/gems/flare/TODO.txt        2008-05-29 21:19:35 UTC (rev 574)
</span><span class="lines">@@ -3,10 +3,10 @@
</span><span class="cx"> ==Complete unit and functional test suite
</span><span class="cx"> Need to be (functional) testing against real instance of running Solr!
</span><span class="cx">
</span><del>-==Real template files for views
</del><ins>+==Real template files for views?
</ins><span class="cx"> Instead of using helpers, these files would be in app/views and would be overridable by the host framework. Problem is, if there are multiple controllers (music, catalog etc.), the directories/templates will only match for the app/views Flare has installed. Which is why the current solution (helpers) is being used.
</span><span class="cx">
</span><del>-==Prefix all Flare methods with "f_" or "flare_"
</del><ins>+==Prefix all Flare methods with "f_", "flare_" or use object instance @flare.view
</ins><span class="cx"> This would keep things very clear in the controller/helper/views code
</span><span class="cx">
</span><span class="cx"> ===Add "view" instance to @flare
</span></span></pre></div>
<a id="trunkrailsvendorgemsflarelibflarerb"></a>
<div class="modfile"><h4>Modified: trunk/rails/vendor/gems/flare/lib/flare.rb (573 => 574)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/rails/vendor/gems/flare/lib/flare.rb        2008-05-27 21:24:07 UTC (rev 573)
+++ trunk/rails/vendor/gems/flare/lib/flare.rb        2008-05-29 21:19:35 UTC (rev 574)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx"> # to be used as defaults, but can be overridden by creating a file in
</span><span class="cx"> # the main application.
</span><span class="cx"> #
</span><del>- def boot!(rails_config, framework=:rails)
</del><ins>+ def boot!(rails_config)
</ins><span class="cx"> rails_config.load_paths += load_paths
</span><span class="cx"> (rails_config.load_once_paths += load_paths) if RAILS_ENV=='production'
</span><span class="cx"> require 'action_controller_ext.rb'
</span></span></pre>
</div>
</div>
</body>
</html>