[Radiant] authentication state and shared_layout question

2009-10-30 Thread qutic development
Hopefully someone can help me with this:

I am developing a visitor extension with signup, login, logout using  
restful_authentication plugin and the shared_layout extension to use  
radiant layout with my own controllers. This works all fine.

Now I need a radiant tag rendering 'login, signup' if the visitor is  
not logged in and 'logout' if the visitor is logged in.

The problem is that I do not have access to the session in the tag  
helper... For normal radiant pages I use this in my visitor_extension.rb

def activate
   Page.class_eval do
 attr_accessor :visitor_logged_in
   end
   SiteController.class_eval do
 include AuthenticatedSystem # for visitor authentication
 after_filter :store_location # for 'redirect_back_or_default'  
method
 def show_page
   ...some code before
   @page.visitor_logged_in = visitor_logged_in?
   ...some code after
 end
   end
end

Now I can access page.visitor_logged_in in the tag helper - but not  
for my own controllers.

Is there a way to get the session data in the tag helper? If not: how  
can I add this to the shared_layout extension?

I am using no cache ;-) And don´t want to use JavaScript!

Thanks a lot
jerry
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] (stack level too deep) on admin pages

2009-10-30 Thread Sean Cribbs
That's helpful, but not entirely accurate.  I encountered this problem 
in development mode when an extension that uses alias_method_chain gets 
reloaded but its previous amc was not removed from the class.  Thus you 
get it aliasing the method over and over.  In most cases I was able to 
run in production mode locally, which removed the problem.

Sean

Nicholas Henry wrote:
 Hello James:

 The issue is not specifically Radiant, but more to do with how your
 Ruby installation has been compiled:

 http://stackoverflow.com/questions/242617/how-to-increase-stack-size-for-a-ruby-app-recursive-app-getting-stack-level-too

 Admittedly, my solution to the problem was to install Ruby Enterprise
 Edition and all was well.

 HTH,
 Nicholas

 On Thu, Oct 29, 2009 at 12:08 PM, James Smith james.sm...@m247.com wrote:
   
 Hi,

 Radiant 0.8.1 is installed, rails 2.3.4, ruby 1.8 running with mongrel.

 The main site itself works, with all the content in place etc.  But once I 
 log into the admin pages, I receive a stack level too deep error and I'm 
 totally lost with it.

 It was working until a Radiant update was completed.

 Full error:

 Processing Admin::PagesController#index (for 89.238.157.212 at 2009-10-29 
 15:27:21) [GET]
  Parameters: {action=index, controller=admin/pages}
 Rendering template within layouts/application
 Rendering admin/pages/index

 ActionView::TemplateError (stack level too deep) on line #1 of 
 /usr/local/lib/ruby/gems/1.8/gems/radiant-0.8.1/app/views/admin/pages/_node.html.haml:
 1: %tr.node{:id = page-#{page.id}, :class 
 =level-#{level}#{children_class}#{virtual_class}}
 2:   - render_region :node, :locals = {:page = page, :level = level, 
 :simple = simple} do |node|
 3: - node.title_column do
 4:   %td.page{:style = padding-left: #{padding_left(level)}px}

(eval):3:in `all_hashes'
(eval):3:in `each_hash'
(eval):3:in `all_hashes'
radiant (0.8.1) app/helpers/admin/node_helper.rb:38:in `children_class'
radiant (0.8.1) app/views/admin/pages/_node.html.haml:1:in 
 `_run_haml_47usr47local47lib47ruby47gems47146847gems47radiant45046846147app47views47admin47pages47_node46html46haml_locals_level_node_object_page_simple'
radiant (0.8.1) 
 vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:12:in 
 `render'
radiant (0.8.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:57:in 
 `non_haml'
radiant (0.8.1) 
 vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:12:in 
 `render'
radiant (0.8.1) app/helpers/admin/node_helper.rb:6:in `render_node'
radiant (0.8.1) app/views/admin/pages/_node.html.haml:25:in 
 `_run_haml_47usr47local47lib47ruby47gems47146847gems47radiant45046846147app47views47admin47pages47_node46html46haml_locals_level_node_object_page_simple'
radiant (0.8.1) app/views/admin/pages/_node.html.haml:24:in 
 `_run_haml_47usr47local47lib47ruby47gems47146847gems47radiant45046846147app47views47admin47pages47_node46html46haml_locals_level_node_object_page_simple'
radiant (0.8.1) 
 vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:12:in 
 `render'
radiant (0.8.1) vendor/plugins/haml/rails/./lib/haml/helpers.rb:57:in 
 `non_haml'
radiant (0.8.1) 
 vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:12:in 
 `render'
radiant (0.8.1) app/helpers/admin/node_helper.rb:6:in `render_node'
radiant (0.8.1) app/views/admin/pages/index.html.haml:19:in 
 `_run_haml_47usr47local47lib47ruby47gems47146847gems47radiant45046846147app47views47admin47pages47index46html46haml'
radiant (0.8.1) 
 vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:14:in 
 `render'
radiant (0.8.1) 
 vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:14:in 
 `render'
radiant (0.8.1) lib/radiant/resource_responses.rb:18:in `response_for'
radiant (0.8.1) app/controllers/admin/pages_controller.rb:16:in `index'
radiant (0.8.1) 
 vendor/plugins/haml/rails/./lib/sass/plugin/rails.rb:19:in `process'

 Rendering /usr/home/prime/public_html/radiant/public/500.html (500 Internal 
 Server Error)

 Regards,
 James Smith,
 UH Hosting, a division of M247 Ltd
 www.uh-hosting.co.ukhttp://www.uh-hosting.co.uk/

 Phone: +44 (0) 1618 500 8945
 Mobile: +44 (0) 7745 137 724

 Registered in England and Wales Company Number 04968341
 Registered and Postal address: 1 Ball Green, Cobra Court, Stretford, 
 Manchester M32 0QT

 ___
 Radiant mailing list
 Post:   Radiant@radiantcms.org
 Search: http://radiantcms.org/mailing-list/search/
 Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

 
 ___
 Radiant mailing list
 Post:   Radiant@radiantcms.org
 Search: http://radiantcms.org/mailing-list/search/
 Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

   

___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: 

Re: [Radiant] JRuby1.3.1 Rack Cache Error

2009-10-30 Thread Sean Cribbs
That looks like you don't have write access to the directory that 
Rack::Cache is trying to write the file to.  The default in Radiant 
0.8.1 is tmp/cache inside your instance.  Make sure that it exists, and 
is writable by the user running JRuby.

Sean

小泉 剛 wrote:
 Hello!

 Ruby  JRuby1.3.1
 Rails 2.3.4
 WebServer Webrick


 Radiant 0.8.1 Admin Page is OK



 site view   error occurs.

 Error cause is cached.  Where should be mended? 




 Processing SiteController#show_page (for 127.0.0.1 at 2009-10-29
 16:02:37) [GET]
   Parameters: {controller=site, action=show_page, url=/}
   User Load (0.0ms)   SELECT * FROM `users` WHERE
 (`users`.`id` = 1) ORDER BY name
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_mtime
 Cache read: Radiant.cache_file
 Cache read: Radiant::Config
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_mtime
 Cache read: Radiant.cache_file
 Cache read: Radiant::Config
   Page Load (0.0ms)   SELECT * FROM `pages` WHERE
 (`pages`.`parent_id` IS NULL) LIMIT 1
   Layout Load (0.0ms)   SELECT * FROM `layouts` WHERE
 (`layouts`.`id` = 1) ORDER BY name
   Snippet Load (15.0ms)   SELECT * FROM `snippets`
 WHERE (`snippets`.`name` = 'header') ORDER BY name LIMIT 1
   PagePart Load (0.0ms)   SELECT * FROM `page_parts`
 WHERE (`page_parts`.page_id = 1) ORDER BY id, name
   PagePart Load (0.0ms)   SELECT * FROM `page_parts`
 WHERE (`page_parts`.`name` = 'body') AND (`page_parts`.page_id = 1)
 ORDER BY id LIMIT 1
   CACHE (0.0ms)   SELECT * FROM `pages` WHERE
 (`pages`.`parent_id` IS NULL) LIMIT 1
   Page Load (0.0ms)   SELECT * FROM `pages` WHERE
 (`pages`.`slug` = 'articles') AND (`pages`.parent_id = 1) ORDER BY
 virtual DESC, title ASC LIMIT 1
   Page Load (0.0ms)   SELECT * FROM `pages` WHERE
 (`pages`.`id` = 1) 
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_file
 Cache read: Radiant.cache_mtime
 Cache read: Radiant.cache_file
 Cache read: Radiant::Config
   Page Load (0.0ms)   SELECT * FROM `pages` WHERE
 (`pages`.parent_id = 4 AND ((virtual = 0) and (status_id = 100))) ORDER
 BY published_at DESC, virtual DESC, title ASC LIMIT 5
   Page Load (0.0ms)   SELECT * FROM `pages` WHERE
 (`pages`.`id` = 4) 
   CACHE (0.0ms)   SELECT * FROM `pages` WHERE
 (`pages`.`id` = 1) 
   CACHE (0.0ms)   SELECT * FROM `users` WHERE
 (`users`.`id` = 1) ORDER BY name
   PagePart Load (0.0ms)   SELECT * FROM `page_parts`
 WHERE (`page_parts`.page_id = 5) ORDER BY id, name
   PagePart Load (0.0ms)   SELECT * FROM `page_parts`
 WHERE (`page_parts`.`name` = 'body') AND (`page_parts`.page_id = 5)
 ORDER BY id LIMIT 1
   PagePart Load (0.0ms)   SELECT * FROM `page_parts`
 WHERE (`page_parts`.`name` = 'extended') AND (`page_parts`.page_id = 5)
 ORDER BY id LIMIT 1
   CACHE (0.0ms)   SELECT * FROM `page_parts` WHERE
 (`page_parts`.`name` = 'extended') AND (`page_parts`.page_id = 5) ORDER
 BY id LIMIT 1
   CACHE (0.0ms)   SELECT * FROM `pages` WHERE
 (`pages`.`id` = 4) 
   CACHE (0.0ms)   SELECT * FROM `pages` WHERE
 (`pages`.`id` = 1) 
   CACHE (0.0ms)   SELECT * FROM `users` WHERE
 (`users`.`id` = 1) ORDER BY name
   PagePart Load (0.0ms)   SELECT * FROM `page_parts`
 WHERE (`page_parts`.page_id = 6) ORDER BY id, name
   PagePart Load (0.0ms)   SELECT * FROM `page_parts`
 WHERE (`page_parts`.`name` = 'body') AND (`page_parts`.page_id = 6)
 ORDER BY id LIMIT 1
   PagePart Load (0.0ms)   SELECT * FROM `page_parts`
 WHERE (`page_parts`.`name` = 'extended') AND (`page_parts`.page_id = 6)
 ORDER BY id LIMIT 1
   CACHE (0.0ms)   SELECT * FROM `page_parts` WHERE
 (`page_parts`.`name` = 'extended') AND (`page_parts`.page_id = 6) ORDER
 BY id LIMIT 1
   PagePart Load (0.0ms)   SELECT * FROM `page_parts`
 WHERE (`page_parts`.`name` = 'extended') AND (`page_parts`.page_id = 1)
 ORDER BY id LIMIT 1
   Snippet Load (0.0ms)   SELECT * FROM `snippets` WHERE
 (`snippets`.`name` = 'footer') ORDER BY name LIMIT 1
 Completed in 265ms (DB: 15) | 200 [http://localhost/]
 /!\ FAILSAFE /!\  Thu Oct 29 16:02:37 +0900 2009
   Status: 500 Internal Server Error
   指定されたパスが見つかりません。

 C:/tools/jruby-1.3.1/lib/ruby/gems/1.8/gems/radiant-0.8.1/vendor/rack-cache/lib/rack/cache/metastore.rb:223:in
 `open'

 

[Radiant] Mailer extension

2009-10-30 Thread María Paula Mariani
Hello!

I'm trying to process two forms placed in the same page with Mailer
extension. Should I create 2 mailer extended pages? I'm differentiating the
forms using different id's, is it the right way?

Thanks very much!

-- 
Paula
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Sphinx Extension help

2009-10-30 Thread Josh French
 This works fine as all the news gets indexed, however I'm struggling
 to search the news article.  When I do a search terms that has
 NewsArticles in it I get the following error message

Hi John,

The Sphinx Search extension was initially built to work with arbitrary  
models but the actual results page is a late addition and so may need  
some tweaking. Can you paste a little more of the stack trace where  
you're getting the undefined method `request' error? I suspect it's  
just that the results tags are expecting Page objects and your  
NewsArticle pages don't conform to some assumption. (I am assuming  
that NewsArticle is *not* a Page subclass -- is that correct?)

  does it mean that the tags are being
 indexed and as such and class or id attributes etc might appear

I *think* the strip_html option operates before your content gets  
indexed, but you might want to verify that with the Sphinx folks.

 One final question, there doesn't appear to be a link tag in the
 extension's tag class.  Do I need to write my own 'link' tag to link
 to the correct page?

In your case, you'll need to because you have polymorphic results  
objects. There's no way of knowing if your models have methods like  
link, url, or slug, so I can't supply tags that automatically expose  
the proper links.

In the simple case however -- a search that returns Page objects only  
-- within an r:results:each block you should be able to call any tag  
that a Page responds to, like r:url or r:title.

Josh
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


[Radiant] Application Error -- and a fix

2009-10-30 Thread Jeff Casimir
Radianteers,

I've been going NUTS trying to debug a new Radiant instance.  I was
getting the message about Application Error where the error was
thrown in the Dispatcher or other Ruby code.  Nothing was showing up
in the app's production.log file nor my apache/phusion log file.

I messed with config files, copying things over from working apps, and
just wasn't getting anywhere.  Google searches weren't helping until I
saw something about permissions and it got me thinking.

I ran the radiant generator then CHOWNed the folder over to
www-data:www-data so Apache could have R/W access to it, what could
the problem be?

I forgot the -R, making it recursive.  The child folders were still
owned by the generating user.  When Rack was trying to create a cache
folder and cache files, it was crashing, causing this error message.

The solution was just to do sudo chown -R www-data:www-data
my_radiant_folder.  Now everything is golden.

- Jeff

---
Jeff Casimir
Jumpstart Lab by Casimir Creative, LLC
http://jumpstartlab.com
@jumpstartlab on twitter
Rails Jumpstart - Oct 31  Nov 1 - Intro to Ruby on Rails
SQL Jumpstart - Nov 14  15 - Intro to Database Design and SQL
WebDev Jumpstart - Dec 5  6 - Beginning HTML  CSS for Web Design
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


[Radiant] latest (0.8.x compatible) page_attachments woes

2009-10-30 Thread john muhl
it seems 8105853c35071712ab130e668d14e813a95f5ebe broke at least the
saving of file titles/descriptions and causes PAGE_ATTACHMENTS_SIZES
hash to be ignored. reverting that commit makes everything working
again. anyone else seeing similar behavior on the 0.8.1 branch?
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Re: [Radiant] authentication state and shared_layout question (solved)

2009-10-30 Thread qutic development
Maybe some is interested in the solution of my problem:

I am using a cattr_accessor (class) instead of a attr_accessor  
(instance) - that´s it ;-)

___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant