[Radiant] How to use current_user in tags

2008-10-21 Thread Vincent Pérès
Hello,

I need to use the current_user in Radius tags. In fact it is working on
my computer which is running with MAC OS (and previously on my Windows
environment), but not on my friend computer which is on Windows.

Well, what I have done :
1. create an accessor attribut 'current_user' on page model
2. extended site_controller to give the current user to my current page
:
@page.current_user = current_user
3. Then, on my tags I'm using current_user like that :
tags.local.page.current_user

And it is working on my computer. We have exactly the same project and
same database... has anyone any idea on what could broke the process? In
fact tags.local.page.current_user is nil on my computer's friend.

I will copy his and my gems list :

=
His :

ctionmailer (2.1.0)
   Service layer for easy email delivery and testing.

actionpack (2.1.0, 1.13.6)
   Web-flow and rendering framework putting the VC in MVC.

actionwebservice (1.2.6)
   Web service support for Action Pack.

activerecord (2.1.0, 1.15.6)
   Implements the ActiveRecord pattern for ORM.

activeresource (2.1.0)
   Think Active Record for web resources.

activesupport (2.1.0, 1.4.4)
   Support and utility classes used by the Rails framework.

cgi_multipart_eof_fix (2.5.0)
   Fix an exploitable bug in CGI multipart parsing.

ferret (0.11.5)
   Ruby indexing library.

fxri (0.3.6)
   Graphical interface to the RI documentation, with search engine.

fxruby (1.6.12)
   FXRuby is the Ruby binding to the FOX GUI toolkit.

gem_plugin (0.2.3)
   A plugin system based on rubygems that uses dependencies only

haml (2.0.1)
   An elegant, structured XHTML/XML templating engine. Comes with Sass,
   a similar CSS templating engine.

hpricot (0.6)
   a swift, liberal HTML parser with a fantastic library

htmlentities (4.0.0)
   A module for encoding and decoding (X)HTML entities.

json (1.1.1)
   A JSON implementation as a Ruby extension

log4r (1.0.5)
   Log4r is a comprehensive and flexible logging library for Ruby.

mime-types (1.15)
   Manages a MIME Content-Type that will return the Content-Type for a
   given filename.

mislav-will_paginate (2.3.5)
   Most awesome pagination solution for Rails

mongrel (1.1.2)
   A small fast HTTP library and server that runs Rails, Camping, Nitro
   and Iowa apps.

mysql (2.7.3)
   A win32-native build of the MySQL API module for Ruby.

radiant (0.6.9)
   A no-fluff content management system designed for small teams.

rails (2.1.0)
   Web-application framework with template engine, control-flow layer,
   and ORM.

rake (0.8.1, 0.7.3)
   Ruby based make-like utility.

RedCloth (3.301)
   a fast library for formatting Textile as HTML

rflickr (2006.02.01)
   Ruby interface to the Flickr API

rmagick (2.5.0)
   RMagick is an interface between the Ruby programming language and
   ImageMagick.

ruby-debug-base (0.10.0)
   Fast Ruby debugger - core component

ruby-debug-ide (0.1.10)
   IDE interface for ruby-debug.

ruby-openid (2.1.2)
   A library for consuming and serving OpenID identities.

solr-ruby (0.0.6)
   Ruby library for working with Apache Solr

sources (0.0.1)
   This package provides download sources for remote gem installation

sqlite3-ruby (1.2.1)
   SQLite3/Ruby is a module to allow Ruby scripts to interface with a
   SQLite database.

win32-api (1.0.4)
   A superior replacement for Win32API

win32-clipboard (0.4.3)
   A package for interacting with the Windows clipboard

win32-dir (0.3.2)
   Extra constants and methods for the Dir class on Windows.

win32-eventlog (0.4.6)
   Interface for the MS Windows Event Log.

win32-file (0.5.4)
   Extra or redefined methods for the File class on Windows.

win32-file-stat (1.2.7)
   A File::Stat class tailored to MS Windows

win32-process (0.5.3)
   Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method

win32-sapi (0.1.4)
   An interface to the MS SAPI (Sound API) library.

win32-sound (0.4.1)
   A library for playing with sound on MS Windows.

win32console (1.1.0)
   A library giving the Win32 console ANSI escape sequence support.

windows-api (0.2.0)
   An easier way to create methods using Win32API

windows-pr (0.7.2)
   Windows functions and constants bundled via Win32::API

=
Mine :
actionmailer (2.1.1, 1.3.6)
actionpack (2.1.1, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.1.1, 1.15.6)
activeresource (2.1.1)
activesupport (2.1.1, 1.4.4)
acts_as_ferret (0.4.1)
capistrano (2.0.0)
cgi_multipart_eof_fix (2.5.0, 2.2)
daemons (1.0.9, 1.0.7)
dnssd (0.6.0)
fastthread (1.0.1, 1.0)
fcgi (0.8.7)
ferret (0.11.4)
gem_plugin (0.2.3, 0.2.2)
highline (1.2.9)
hpricot (0.6)
libxml-ruby (0.3.8.4)
mislav-will_paginate (2.3.5)
mongrel (1.1.4, 1.0.1)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
rails (2.1.1, 1.2.6)
rake (0.8.3, 0.7.3)
RedCloth (3.0.4)
ruby-openid (1.1.4)
ruby-yadis (0.3.4)
rubynode (0.1.3)
solr-ruby (0.0.6)
sources (0.0.1)
sqlite3-ruby (1.2.1)
termios (0.9.4)
will_paginate (2.2.2)

Thank you very much !

Re: [Radiant] How to use current_user in tags

2008-10-21 Thread Sean Cribbs

Vincent Pérès wrote:

Hello,

I need to use the current_user in Radius tags. In fact it is working on
my computer which is running with MAC OS (and previously on my Windows
environment), but not on my friend computer which is on Windows.

Well, what I have done :
1. create an accessor attribut 'current_user' on page model
2. extended site_controller to give the current user to my current page
:
@page.current_user = current_user
3. Then, on my tags I'm using current_user like that :
tags.local.page.current_user

And it is working on my computer. We have exactly the same project and
same database... has anyone any idea on what could broke the process? In
fact tags.local.page.current_user is nil on my computer's friend.

  

Vincent,

Is your friend logged in to the admin site? Also, did you re-enable 
sessions in the SiteController?


Sean

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


[Radiant] Re: How to use current_user in tags

2008-10-21 Thread Vincent Pérès
Hello Sean,

I didn't enabled session, I created a new page type which is not using 
cache.
In fact, the problem is on site_controller level, when I'm giving the 
current user to my current page :
@page.current_user = current_user

On my computer 'current_user' exist, but the var is nil on the other 
computer.
What could enabled or disabled current_user? (it's a helper if I 
remember well)

Thanks,
Vincent
-- 
Posted via http://www.ruby-forum.com/.
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


[Radiant] Re: HAML

2008-10-21 Thread Sean Cribbs

Martin Streicher wrote:


Is there a way to author pages in HAML and SaSS in the non-admin 
sections of a Radiant site?


Martin



(Including the mailing-list in this discussion.)

What do you mean by non-admin?  If you mean regular Radiant pages, 
there is not currently the ability to use Haml.  You might want to check 
out the SnS extension or the old sass-filter-extension for Sass 
capabilities.  Writing a Haml filter should be easy, but I think you'll 
run into a lot of problems with the strictness of Haml clashing with 
Radius tags.


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


[SOLVED] Re: [Radiant] Paperclipped + flash video files.

2008-10-21 Thread Jeffrey Jones

Finally figured out what it was.

My version of Firefox (Firefox on Kubuntu linux) didn't know the 
video/x-flv mime-type so when it uploaded the file it was setting the 
content type as application/octet-stream. It appears paperclipped uses 
the browser mime-type to determine if the file is allowed to be uploaded 
or not (I assumed it checked the file).


Adding the mime-type to Firefox solved the issue.

On Kubuntu create a ~/.mime.types file with

video/x-flvflv

(The master mime-type file is /etc/mime.types)

I do not know if this affects windows Firefox or how you would add the 
mime-type in windows.


Cheers

Jeff

Jeffrey Jones wrote:

Hoi all.

Has anyone managed to upload flash video files using the paperclipped 
extension? I added video/x-flv to the allowed mime types but the FLVs 
are still getting rejected as not allowed.


Thanks

Jeff
___
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


Re: [SOLVED] Re: [Radiant] Paperclipped + flash video files.

2008-10-21 Thread justin blecher
jeff,

it's been my experience that the browser cannot be trusted for sending
the correct mime type upon upload. firefox (all platforms) has been a
particularly bad offender, and i know that IE does some funny stuff,
too. (i can't believe it's 2008 and this basic functionality is still
broken! on second thought, i can. mime types and file extensions have
always been like the wild-west.)

in our recent projects that involve uploading files, we've used
mimetype-fu http://github.com/mattetti/mimetype-fu/ for determining
the correct/canonical (as far as mimetype-fu is concerned) mime type
to avoid two situations: 1) new/unexpected file types that users
upload and 2) consistent mapping of common file types
(application/msword vs. application/vnd.ms-word vs. ???)

maybe paperclip should be patched to use mimetype-fu. it's pretty
inadequate for anything other than basic file types at the moment:

# Infer the MIME-type of the file from the extension.
def content_type
  type = (self.path.match(/\.(\w+)$/)[1] rescue octet-stream).downcase
  case type
  when %rjpe?g then image/jpeg
  when %rtiff? then image/tiff
  when %rpng, gif, bmp then image/#{type}
  when txt then text/plain
  when %rhtml? then text/html
  when csv, xml, css, js then text/#{type}
  else application/x-#{type}
  end
end

probably not the answer you're looking for, but hth,

-justin


On Tue, Oct 21, 2008 at 1:32 PM, Jeffrey Jones [EMAIL PROTECTED] wrote:
 Finally figured out what it was.

 My version of Firefox (Firefox on Kubuntu linux) didn't know the video/x-flv
 mime-type so when it uploaded the file it was setting the content type as
 application/octet-stream. It appears paperclipped uses the browser mime-type
 to determine if the file is allowed to be uploaded or not (I assumed it
 checked the file).

 Adding the mime-type to Firefox solved the issue.

 On Kubuntu create a ~/.mime.types file with

 video/x-flvflv

 (The master mime-type file is /etc/mime.types)

 I do not know if this affects windows Firefox or how you would add the
 mime-type in windows.

 Cheers

 Jeff

 Jeffrey Jones wrote:

 Hoi all.

 Has anyone managed to upload flash video files using the paperclipped
 extension? I added video/x-flv to the allowed mime types but the FLVs are
 still getting rejected as not allowed.
___
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [SOLVED] Re: [Radiant] Paperclipped + flash video files.

2008-10-21 Thread Andrew Neil
I'm very interested to hear of your experience with MIME types and  
browsers. I've just written an audio_player extension[1], which uses  
paperclip to deal with attaching audio files. The flash player that  
I'm using can only play mp3s, so I want to limit the MIME type to that  
format. I've set up some validation in the model, as follows:



http://github.com/nelstrom/radiant-audio_player-extension/tree/master/app/models/audio.rb#L12-14

I was quite puzzled when I tested the attachment of an mp3 file to an  
Audio model. Using the exact same mp3 file, I tried creating the model  
through the Radiant admin (in the browser), and I tried doing it  
through script/console (at the command line). I was able to attach the  
MP3 file by both methods, but found that the MIME type was saved as  
audio/mpeg when I uploaded through the browser, and as application/x- 
mp3 when created at the console. So it does look as though the browser  
is... opinionated, when it comes to mime types.


Luckily, paperclip seems to be happy with both of these formats, but I  
did have to broaden the conditions for my model validation to let both  
of these through.


Cheers,
Drew

[1]: http://github.com/nelstrom/radiant-audio_player-extension/tree


On 21 Oct 2008, at 22:05, justin blecher wrote:


jeff,

it's been my experience that the browser cannot be trusted for sending
the correct mime type upon upload. firefox (all platforms) has been a
particularly bad offender, and i know that IE does some funny stuff,
too. (i can't believe it's 2008 and this basic functionality is still
broken! on second thought, i can. mime types and file extensions have
always been like the wild-west.)

in our recent projects that involve uploading files, we've used
mimetype-fu http://github.com/mattetti/mimetype-fu/ for determining
the correct/canonical (as far as mimetype-fu is concerned) mime type
to avoid two situations: 1) new/unexpected file types that users
upload and 2) consistent mapping of common file types
(application/msword vs. application/vnd.ms-word vs. ???)

maybe paperclip should be patched to use mimetype-fu. it's pretty
inadequate for anything other than basic file types at the moment:

   # Infer the MIME-type of the file from the extension.
   def content_type
 type = (self.path.match(/\.(\w+)$/)[1] rescue octet- 
stream).downcase

 case type
 when %rjpe?g then image/jpeg
 when %rtiff? then image/tiff
 when %rpng, gif, bmp then image/#{type}
 when txt then text/plain
 when %rhtml? then text/html
 when csv, xml, css, js then text/#{type}
 else application/x-#{type}
 end
   end

probably not the answer you're looking for, but hth,

-justin


On Tue, Oct 21, 2008 at 1:32 PM, Jeffrey Jones [EMAIL PROTECTED] wrote:

Finally figured out what it was.

My version of Firefox (Firefox on Kubuntu linux) didn't know the  
video/x-flv
mime-type so when it uploaded the file it was setting the content  
type as
application/octet-stream. It appears paperclipped uses the browser  
mime-type
to determine if the file is allowed to be uploaded or not (I  
assumed it

checked the file).

Adding the mime-type to Firefox solved the issue.

On Kubuntu create a ~/.mime.types file with

video/x-flvflv

(The master mime-type file is /etc/mime.types)

I do not know if this affects windows Firefox or how you would add  
the

mime-type in windows.

Cheers

Jeff

Jeffrey Jones wrote:


Hoi all.

Has anyone managed to upload flash video files using the  
paperclipped
extension? I added video/x-flv to the allowed mime types but the  
FLVs are

still getting rejected as not allowed.

___
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


Re: [Radiant] parameterized_snippets extension

2008-10-21 Thread Manuel Meurer
Fixed, thanks for testing.
Please grab a fresh copy from
http://github.com/manuelmeurer/radiant-parameterized-snippets-extension/

Manuel

On Tue, Oct 21, 2008 at 12:10 PM, Simon Josi [EMAIL PROTECTED] wrote:
 I've got a case where parameters to snippets are not availabe. It
 occurs when I call a snippet with parameters from another snippet:

 Content of page Referenzen:
 r:snippet name=list_childs_as_generic_entries /

 The Referenzen page contains childs with text, image and body
 parts defined.

 Content of snippet list_childs_as_generic_entries:
 ul class=b_entries
  r:children:each
li
  h1r:link //h1
  r:snippet name=image_with_border class=box img posleft
!(photo)r:content part=image /(r:title /)!
  /r:snippet
  pr:content part=text //p
/li
  /r:children:each
 /ul

 Content of snippet image_with_border:
 divr:if_var name=class class=r:var name=class //r:if_var
  div class=topdivnbsp;/div/div
  div class=bodyr:yield //div
  div class=bottomdivnbsp;/div/div
 /div

 The class parameter is not set if a open the page Referenzen.

 If i call the snippet image_with_border directly from a page and not
 from a snippet, it works.

 Any ideas on that?

 Thx,
 /smon
 ___
 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] if_dev dev.host functionality with multi_site extension

2008-10-21 Thread Bill Barnard
I'm working on a pair of sites using the multi_site extension. Is there
a way to specify a dev host for each of the multi sites so the page
authors can view them in Draft mode?

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


Re: [Radiant] Comments Extension

2008-10-21 Thread Mohit Sindhwani

Hi Everyone

Any ideas?

Cheers,
Mohit.


Mohit Sindhwani wrote:
I'm just starting to use the comments extension and I followed the 
instructions that ere there in messages here and there and it works 
fine. (I'm going to compile it for Summer Reboot soon).


There is just one thing that comes up. Both versions (ntalbott and 
artofmission) make a clear note saying:
Relative urls will not work on comment pages if they fail validation, 
since the page gets re-rendered at a (probably) different level of the 
hierarchy. Always use absolute urls and you won’t have any issues.


But, I find that when the form is submitted with a comment, it usually 
directs to a page like:

http://localhost:3300/en/my_page/comments#comment-4

On this page also, I get errors like:
undefined method `relative_url_root’ for nil:NilClass
”Concepts

On the other hand, the main page http://localhost:3300/en/my_page/ 
works just fine!


[1] I'm wondering what is the recommended approach to prevent this 
from happening (other than relative URLs being avoided) since my pages 
are connected to one another using things like r:children:each and 
one of the good things with the CMS is the ability to not have to use 
hard coded absolute links.


[2] If I were to try to change this behaviour, where in the code 
should I look? For example, if I wanted to change the display of the 
page details and the comment together (which causes the above issue 
specifically) or to look for a better generic solution (though I'm not 
sure I'd be able to find one).


[3] Finally, I find that in the admin UI, when I click to view the 
comments, quite often, the HTML is all messed up for the page (e.g. 
the headings and fonts are larger than the regular Radiant admin UI). 
Any one else noticed that? I haven't investigated this enough, so I'm 
not yet sure why that happens.


Thanks
Mohit.


___
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


Re: [Radiant] Comments Extension

2008-10-21 Thread Mohit Sindhwani

Hi Sean

Sean Cribbs wrote:

Mohit,

My apologies for not responding sooner.  

The apology is not needed at all :)

This is something I'd like to address sooner rather than later, and do 
it in a way that is similar to what I did to the mailer extension -- 
supporting post-backs to the page rather than to a separate 
controller.  However, it looks like that specific error comes from not 
having the request available to the page -- assigning it before the 
'render' call should be sufficient.


In the meantime, try my fork which includes some of the enhancements 
from other authors and see if it solves some problems for you.

Will do!  I'll get to it tonight!

Cheers,
Mohit.
10/22/2008 | 11:25 AM.







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