model name collision in plugin

2010-03-11 Thread anler
hi folks, I have a model in a plugin called Section, but also have a
model in the app with the same name, the problem strikes when I try to
do the following from a helper:

ClassRegistry::init('Plugin.Section')

I'm getting the App Section model instead of the plugin model

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth flash message LAYOUT ???

2010-02-10 Thread anler
good, I'm so sorryyy, now I understand, using AuthComponent's
'auto setFlash'
mechanism is not posible to specify a layout, though, it  be changed
through
flashElement property of AuthComponent in the new 1.3 version of
cakephp.

If you really need this feature (enhance, whatever...) you can hack
the AuthComponent
itself but this is going 'against the flow' and do not advise it

On Feb 10, 9:02 am, toka...@gmail.com toka...@gmail.com wrote:
 Hi Jeremy, Anler
 thanks for your replies.

 @Jeremy: But where should I use it? Cake automaticaly do the set
 flash... the message Login failed. Invalid username or password. is
 hardcoded in the core... Should I handle your code that in login()
 function?

 @anler: I know that I may change the message, but how the layout
 wrapper?

 normaly (in other case) it is working if I call setFlash() manualy and
 I specify layout as a second param...but in this Auth case I miss any
 handle to set the layout...

 e.g.
 setFlash( $message, $layout = 'default', $params = array ( ), $key =
 'flash' )

 Thanks
 Tomas

 On Feb 9, 3:42 pm, Jeremy Burns jeremybu...@me.com wrote:

  Try something along these lines:

  $this-Session-setFlash
          (__
                  ('Message.', true),
                  true,
                  array('class' = 'flashError')
          );

  Jeremy Burns
  jeremybu...@me.com

  On 9 Feb 2010, at 14:32, toka...@gmail.com wrote:

   Hi, I am trying to set a custom layout for Auth flash message.
   setFlast() support that but it seems to be hardcoded in the core for
   case of auth messages.

   any idea how to set my own layout wrapper around this message ...

   Login failed. Invalid username or password.    ???

   thanks
   help appreciated.
   Tomas

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
   with their CakePHP related questions.

   You received this message because you are subscribed to the Google Groups 
   CakePHP group.
   To post to this group, send email to cake-php@googlegroups.com
   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this group 
   athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Question about use ACL with paginate

2010-02-10 Thread anler
Are you aking how find the allowed docs or how to paginate this result
(or both)?

I did something similar once but with a different approach, since I
was working with
'resources' instead of documents, I listed the resources and the
option 'access info'
to show the permits for that resource (this way used less db queries)

On Feb 10, 12:41 pm, marco.rizze...@gmail.com
marco.rizze...@gmail.com wrote:
 Hi
 I have this question:
 I use ACL for manage the access to documents by users.
 Now I must display a list of all documents that are accessible by the
 logged user.
 This list must be paginated.
 I have no idea about how to do this and I think to abandon the ACL and
 manage the permits with a big table with all relations (HABTM) between
 users and documents.
 I would ask if someone has any idea about this.
 Many Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: inflector - class methods - slug ????

2010-02-10 Thread anler
You want to keep the url with your letters as they are? if that is the
case, google by IDNA (International Domain Names ... or something, or
the package Net_IDNA in pear.php.net)

On Feb 10, 1:35 pm, PaulMan pho...@gmail.com wrote:
 echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û ç
 ');

 results:
 _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

 the first three chars do not work, the first and second are used many
 times in Portuguese language...

 is this a bug? does anybody have a solution?

 best regards,

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Question about use ACL with paginate

2010-02-10 Thread anler
I think the BEST way is using ACL, and yes, it's complex, but give you
reliability for free, even more
 if you are mixin groups in the coctel (group permits are inherited by
users of that group, and things like that),
 with ACL you could handle better reading and writing documents
through AuthComponent::authorize = 'crud'
(If you have time and patience I encourage you to do it this way, I
will help in anything you need ;) )

if you just want get something fast and cheap, well, I'll tell you
what I'm thinking

- Keep the model Document as flat as possible, ex in db:
   table documents(
 name .., created ..., modified ...
  )

- Instead of relating Users and Documents through a HABTM relation, in
HABTM the join table acts only as a connection between de models, but
if you feel the need of add more
information to this table, you should give her its own model because
it is participating in the application bussiness, ex:
  table line_docs(
   user_id, document_id, date_when_read, etc
  )

 model  LineDocs (or whatever name you want give him)
   hasMany = Users
   hasMany = Documents

- Let another table manage the user permits on documents
  table doc_permits(
   user__id, document_id, create?, read?, write?, delete?,
etc
  )
and check this table when somebody wants to touch or create some
document


On Feb 10, 1:41 pm, marco.rizze...@gmail.com
marco.rizze...@gmail.com wrote:
 Can you explain better what is your solution.
 I explain better my situation:

 Model :
 Group: (HABTM User)
 User:(HABTM:Group)
 Document

 I have to manage permissions to access to documents.
 Some users can modify some documents , some users can only read some
 documents(I must also register when a user reads a documents ), some
 users can't read some documents.

 To manage this is better have a HABTM relation between User and
 Document with a permission field (and with a date_when_read
 field)  ( more simple but I have to use more and more space).

 or use ACL (very very complex to use in this situation(I have to
 manage also that a user can belong to many groups) and but it uses
 less space)

 or exist another method to use (a best pattern)?

 Write all your experience about this because I think that is one of
 the big problem when project a web application
 Many Thanks
 On 10 Feb, 12:53, anler anle...@gmail.com wrote:

  Are you aking how find the allowed docs or how to paginate this result
  (or both)?

  I did something similar once but with a different approach, since I
  was working with
  'resources' instead of documents, I listed the resources and the
  option 'access info'
  to show the permits for that resource (this way used less db queries)

  On Feb 10, 12:41 pm, marco.rizze...@gmail.com

  marco.rizze...@gmail.com wrote:
   Hi
   I have this question:
   I use ACL for manage the access to documents by users.
   Now I must display a list of all documents that are accessible by the
   logged user.
   This list must be paginated.
   I have no idea about how to do this and I think to abandon the ACL and
   manage the permits with a big table with all relations (HABTM) between
   users and documents.
   I would ask if someone has any idea about this.
   Many Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: inflector - class methods - slug ????

2010-02-10 Thread anler
Sorry, I know pretty much nothing about multibyte characters but you
should
take a look at mb_* functions at php.net

On Feb 10, 2:02 pm, PaulMan pho...@gmail.com wrote:
 hello,

 echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û
 ç );
 what i want is to have the next result
 a_o_i_oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

 but the result is
 _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

 ã should be = a
 õ should be = o

 On 10 Fev, 12:41, anler anle...@gmail.com wrote:

  You want to keep the url with your letters as they are? if that is the
  case, google by IDNA (International Domain Names ... or something, or
  the package Net_IDNA in pear.php.net)

  On Feb 10, 1:35 pm, PaulMan pho...@gmail.com wrote:

   echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û ç
   ');

   results:
   _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

   the first three chars do not work, the first and second are used many
   times in Portuguese language...

   is this a bug? does anybody have a solution?

   best regards,

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth flash message LAYOUT ???

2010-02-09 Thread anler
if you are using the AuthComponent, you should change the auth message
via:

$controller-AuthComponent-loginError = __('whatever you want',
true);

this is the best way (DRY)

On Feb 9, 3:32 pm, toka...@gmail.com toka...@gmail.com wrote:
 Hi, I am trying to set a custom layout for Auth flash message.
 setFlast() support that but it seems to be hardcoded in the core for
 case of auth messages.

 any idea how to set my own layout wrapper around this message ...

  Login failed. Invalid username or password.    ???

 thanks
 help appreciated.
 Tomas

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Auth-login() Question

2010-02-09 Thread anler
hmm, I would advise you that instead of registering a user 'on the
fly', first showed him a registration form if his email does not exist
in the bd and then redirect him to wherever he were once logged in.
Anyway, for login you only must send to users controller a post data
in the conventional format

['UserModel'] = array(
'username' = 'your username', // field names depends on how you
configure the component
'password' = 'your password'
)

and the component will always set the session (if login was
succesfully)
another thing I don't get clear, your are asking how to save the
password via
Auth-login() in the Session or in th DB? in case you are asking about
the
Session, the password is never saved into it

On Feb 9, 6:45 pm, dtirer dti...@gmail.com wrote:
 So I have a site where there is a formal registration form, whereafter
 the user gets logged in automatically via the Auth-login() method.
 It stores data automatically from $this-data in the Session.

 However, I have another part of the site that deals with new users
 searching for something via an 'Items' Controller.  When they search
 using a form, they also have to submit an 'email address', along with
 what they're searching for.  What happens is, if the email doesn't
 already exist in the DB, the 'email address' gets automatically
 registered, and then the user is automatically logged in.  Here's how
 I do

 ItemsController extends AppController
 {
         if (!$this-Item-User-is_user($this-data['User']['email']))
         {
               /* do various steps to put email in the  Users
 tables ...generate random password, etc
                  After all that */

              $this-Auth-Login();
        }

 }

 Now my question, $this-data contains a) their search term, and b)
 their email address.  When i do $this-Auth-login, will it still
 automatically insert the appropriate data in the Session?  What about
 the password, which I generate in the User model?  How do I manually
 store that via $this-Auth-login()?

 Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Problems with Cakephp 1.2.6

2010-02-09 Thread anler
if you only see a blank screen verifies in php.ini that display_errors
= on

On 8 feb, 08:41, Sitthykun ly.sitthy...@gmail.com wrote:
 Hi all,

 for now I using cakePHP 1.2.6 on window vista with apache 2.2.x
 I would like to test with blog sample, but it does not work.

 I have thought it maybe I'm wrong configured. I have tried search
 solution, but I still cannot.

 please anyone help me.

 Sitthykun

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en