Tuesday, September 29, 2009

remove authorization from Cakephp form

Hi, I am new to Cakephp
Can you please tell me how can i remove authorization from a Cakephp form
--
View this message in context: http://www.nabble.com/remove-authorization-from-Cakephp-form-tp25675842p25675842.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

book.cakephp.org small problem

IE7 java script errors, gonna guess it has something to do with the
plain text view option, because that doesn't show up in IE7.

also this is more of a peeve but when code is copied in IE7 it copy's
non formatted on a single line, in firefox you get a numbered list the
plain text view in firefox works fine tho.


--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Containable, Pagination and HABTM

Hi!

Did you solve your problem?

I think you have a typo in the conditions element:

$this->paginate['Group'] = array(
'order' => 'Group.name
ASC',
'contain' => array(
'User' => array
(

'conditions' => array(

'User.id =' => $this->Auth->user('id')
)
)
)
);

Note the equal sign after 'User.id

Nevertheless, I dont think that this fix will solve your problem. I
need to do something like this, and the paginate function returns all
the groups, even those that haven't the user I requested for.

On 12 ago, 14:49, sunertl <sune...@gmail.com> wrote:
> Hey there,
> after hours of googling and reading tutorials I am desperate now and
> seek your help.
>
> I am working with Cake 1.2.4.8284, I have two models, User (table
> users) and Group (table group) where User HABTM Group. The join table
> is called groups_users, it contains user_id and group_id and an
> additional field called admin.
>
> I try to find all all groups a user is member of and I use paginate
> for it:
> $this->paginate['Group'] = array(
>                                                 'order' => 'Group.name ASC',
>                                                 'contain' => array(
>                                                         'User' => array(
>                                                                 'conditions' => array(
>                                                                         'User.id' => $this->Auth->user('id')
>                                                                 )
>                                                         )
>                                                 )
>                                         );
> $groups = $this->paginate('Group');
> $this->set('groups', $groups);
>
> When I use debug($groups) I get the following (wrong) result:
> [0] => Array
>         (
>             [Group] => Array
>                 (
>                     [id] => 1
>                     [name] => test
>                 )
>
>             [User] => Array
>                 (
>                     [0] => Array
>                         (
>                             [id] => 1
>                             [name] => Administrator
>                             [GroupsUser] => Array
>                                 (
>                                     [id] => 1
>                                     [admin] => 1
>                                     [group_id] => 1
>                                     [user_id] => 1
>                                 )
>
>                         )
>
>                 )
>
>         )
>
>     [1] => Array
>         (
>             [Group] => Array
>                 (
>                     [id] => 2
>                     [name] => test
>                 )
>
>             [User] => Array
>                 (
>                 )
>         )
>
> Ok, I thought, maybe the condition in the contain-clause is wrong but
> then I saw the SQL-debug in the view:
> [...]
> 13      SELECT COUNT(*) AS `count` FROM `groups` AS `Group` WHERE 1 = 1         1
> 1       0
> 14      SELECT `Group`.`id`, `Group`.`name` FROM `groups` AS `Group` WHERE
> 1 = 1 ORDER BY `Group`.`name` ASC LIMIT 20              2       2       0
> 15      SELECT `User`.`id`, `User`.`name`, `GroupsUser`.`id`,
> `GroupsUser`.`admin`, `GroupsUser`.`group_id`, `GroupsUser`.`user_id`
> FROM `users` AS `User` JOIN `groups_users` AS `GroupsUser` ON
> (`GroupsUser`.`group_id` IN (1, 2) AND `GroupsUser`.`user_id` =
> `User`.`id`) WHERE `User`.`id` = 1              1       1       0
>
> So it looks like everything works correctly but the result of the last
> SQL statement is not saved into $groups.
>
> Does anybody have a clue where I make the mistake? I tried almost each
> and every tutorial and how-to but no combination of arguments seems to
> work.
>
> I am working with Cake for almost three years now so I won't consider
> myself a newbie but I have no idea what goes wrong here...
>
> Thanks a lot in advance!

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Simple Acl controlled Application Tutorial - Problem with release 1.2.5??

I was having the same problem today. I made one change that got rid
of the problem, however, since I'm new to Acl I am not sure that the
change I made is correct.

I changed the line that you have to the following and the fatal error
went away.

$Controllers = Configure::listObjects('controller');

Now when I go to the url: http://localhost/groups/build_acl I get the
following output:

app/controllers/groups_controller.php (line 147)

Array
(
[0] => Created Aco node for Pages
[1] => Created Aco node for display
[2] => Created Aco node for Groups
[3] => Created Aco node for index
[4] => Created Aco node for view
[5] => Created Aco node for add
[6] => Created Aco node for edit
[7] => Created Aco node for delete
[8] => Created Aco node for build_acl
[9] => Created Aco node for Posts
[10] => Created Aco node for index
[11] => Created Aco node for view
[12] => Created Aco node for add
[13] => Created Aco node for edit
[14] => Created Aco node for delete
[15] => Created Aco node for Users
[16] => Created Aco node for login
[17] => Created Aco node for logout
[18] => Created Aco node for index
[19] => Created Aco node for view
[20] => Created Aco node for add
[21] => Created Aco node for edit
[22] => Created Aco node for delete
[23] => Created Aco node for Widgets
[24] => Created Aco node for index
[25] => Created Aco node for view
[26] => Created Aco node for add
[27] => Created Aco node for edit
[28] => Created Aco node for delete
)

After this I get some errors about not having a view for this
controller, but I think that is expected.

Hopefully this helps...

Eric


On Sep 29, 9:10 am, robmcvey <robmc...@gmail.com> wrote:
> We aregoing through the "Simple Acl controlled Application Tutorial"
> as per the manual.
>
> Everything is going fine until we try and run the "Automated tool for
> creating ACOs" in this section;
>
> http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs
>
> When we run this method we get the follwing Fatal Error;
>
> Fatal error: Call to undefined method App::objects()
>
> The line causing the error is;
>
> $Controllers = App::Objects('controller');
>
> I seem to remember doing this tutorial in an earlier version of cake
> without problems
>
> Anyone have any ideas whats going on? Is this a latest version bug?
>
> Thanks
>
> Rob

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Javascript libraries with images/css inside Cake Plugins

I'm trying to develop a small backend cms-plugin, which contains some
Javascript libraries like jQuery, jQuery-ui and TinyMCE. Doing this I
stumbled upon a problem I cannot seem to solve in a good way.
jQuery-ui and TinyMCE come bundled with themes, consisting of images
and css files. CakePHP doesn't seem to serve any other file than *.js
from the vendors/js folder inside my plugin though (as opposed to
everything in the /webroot/ folder), forcing me to create additional
folders for images and css in both the /img/ and /css/ folders. For
jquery-ui this is inconvenient, for TinyMCE it's a giant pain, and for
libraries like SwfUploader (or Uploadify in my case), this is simply
impossible because the swf-files don't get served from any of the
three (img, css, js) folders inside myplugin/webroot/.

So how do I bundle these libraries with my plugin without breaking
them? Is it even possible?

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Associating model aliases

On Tue, Sep 29, 2009 at 12:02 PM, Mario <mario.callisto@gmail.com> wrote:
>
> Hi Brian,
>
> thank you for your help, getting closer to an initial solution.
>
> With the following find (slightly different from yours, now profiles
> are joined with the user_id / recipient_id in Message, like it is done
> for users)
>
>    $this->data = $this->Message->find(
>      'all',
>      array(
>        'joins' => array(
>          array(
>            'type' => 'LEFT',
>            'table' => 'profiles',
>            'alias' => 'SenderProfile',
>            'conditions' => array(
>              'Message.user_id' => 'SenderProfile.user_id'
>            )
>          ),
>          array(
>            'type' => 'LEFT',
>            'table' => 'profiles',
>            'alias' => 'RecipientProfile',
>            'conditions' => array(
>              'Message.recipient_id' => 'RecipientProfile.user_id'
>            )
>          )
>        )
>      )
>    );
>
> I get the following SQL (where instead of '*' there is the complete
> list of not NULL fields)
>
> SELECT *
> FROM `messages` AS `Message`
> LEFT JOIN profiles AS `SenderProfile` ON (`Message`.`user_id` =
> 'SenderProfile.user_id')
> LEFT JOIN profiles AS `RecipientProfile` ON (`Message`.`recipient_id`
> = 'RecipientProfile.user_id')
> LEFT JOIN `users` AS `Sender` ON (`Message`.`user_id` = `Sender`.`id`)
> LEFT JOIN `users` AS `Recipient` ON (`Message`.`recipient_id` =
> `Recipient`.`id`) WHERE 1 = 1
>
> Still not working, because SenderProfile and RecipientProfile returns
> NULL fields.
>
> But if in PHPMyAdmin I change the SQL to
>
> SELECT *
> FROM `messages` AS `Message`
> LEFT JOIN profiles AS `SenderProfile` ON (`Message`.`user_id` =
> `SenderProfile`.`user_id`)
> LEFT JOIN profiles AS `RecipientProfile` ON (`Message`.`recipient_id`
> = `RecipientProfile`.`user_id`)
> LEFT JOIN `users` AS `Sender` ON (`Message`.`user_id` = `Sender`.`id`)
> LEFT JOIN `users` AS `Recipient` ON (`Message`.`recipient_id` =
> `Recipient`.`id`) WHERE 1 = 1
>
> the above mentioned fields are no longer NULL, it seems that the query
> is working.
> I just changed (almost impossible to detect...):
> 'SenderProfile.user_id' into `SenderProfile`.`user_id`
> 'RecipientProfile.user_id' into `RecipientProfile`.`user_id`


Thanks for pointing it out. I was on my 3rd pass without seeing the
difference. :-)

> Any idea how to solve this last bit?

You could try the condition as a single string:

'Message.recipient_id = RecipientProfile.user_id'

and

'Message.user_id = SenderProfile.user_id'

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: find('threaded') doesn't find any children

On Tue, Sep 29, 2009 at 12:02 PM, Chris <chris@thompsonbd.com> wrote:
>
> All you need for a threaded find is a Table.parent_id.
>
> SVN FILE: $Id: model.php 8283 2009-08-03 20:49:17Z
>
> line 2187
>
> I never said it's the way you want it.  I said it might be the way you
> want it to work, which it obviously it is since you don't have any
> issues with it, and it's not the way others want it to work.

Wrong again. That's the way I *understood* it to work. It has nothing
to do with any desire on my part.

In any case, I was referring to the conditions the OP was using.
Giving condition 'Region.id' => $regionID can ONLY return one,
specific Region.

> I can't stand when someone asks about functionality and someone
> responds with: That's not the way it works.  Read the docs, blah blah
> blah.  Maybe instead of being a manual nazi, respond with a
> modification that helps the original poster complete what they are
> looking to accomplish.

Now you're being an ass. I pointed out the page in the manual that
(gosh~) covers the OP's problem. Yeah, that's such a fascist response.

The only reason I responded was to try to help the OP. What's your
excuse?. Grow the hell up.

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---