Re: cake bakre freeze in win32?

2009-03-28 Thread rocket

sorry i mean cake bake freeze.

i mean it will lock up and throw an error after you create your
database config...

On Mar 29, 1:08 am, rocket  wrote:
> does anyone else cake bake freeze in windows vista 32bit?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



cake bakre freeze in win32?

2009-03-28 Thread rocket

does anyone else cake bake freeze in windows vista 32bit?
--~--~-~--~~~---~--~~
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: New Install - Where is the Dispatch

2009-03-28 Thread Pablo Viojo

Some basic question:

Have you configured  ROOT (must point to cake folder, if default setup
is not used) properly on webroot/index.php?

look for something like 
//define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS
LOCATED. DO NOT ADD A TRAILING DIRECTORY SEPARATOR');

or

define('ROOT', dirname(dirname(dirname(__FILE__;

Try deleting files on tmp/cache/persistent

Saludos,

Pablo Viojo
pvi...@gmail.com
http://pviojo.net
(#260 y creciendo!)


Ayudar nos hace felices!
http://needish.com  - http://helperman.org




On Sat, Mar 28, 2009 at 2:07 PM, almasty  wrote:
>
> Hi
>
> I'm getting this error
>
> Fatal error: Class 'Dispatcher' not found in /var/www/vhosts/
> shakethembones.com/httpdocs/index.php on line 87
>
> I've done a search on google and can find a couple of post about
> getting this error but no solutions
>
> I have just installed
>
> I've used the instructions here
>
> http://book.cakephp.org/view/308/Installing-CakePHP under `Advanced
> Setup: Alternative Installation Options`. I have the tmp dir with 777,
> and my include paths, openbase dir etc in a vhost file contain the
> cake lib, app and webroot just to take them off the radar in terms of
> permissions.
>
> Line 87 is a call to the Dispatcher class, which I guess is not
> included as expected.
>
> Can anyone point me in the right direction for an answer?
>
> Al
>
> >
>

--~--~-~--~~~---~--~~
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: Sessions disappearing -- load balancing problem?

2009-03-28 Thread Pablo Viojo

Are you using "sticky sessions" when balancing? (ask your system admin)

Which session.save value are you using (php, database, cache)?
(located on your core.php)

Saludos,

Pablo Viojo
pvi...@gmail.com
http://pviojo.net
(#260 y creciendo!)


Ayudar nos hace felices!
http://needish.com  - http://helperman.org




On Fri, Mar 27, 2009 at 6:20 PM, Aimee  wrote:
>
> Hi,
>
> I've written an application that collects users' answers to questions
> using sessions.  It works fine most of the time, but one of our users
> is having problems with sessions.  The sessions seems to be set
> correctly in the controller, but once the next form is submitted, the
> sessions from before don't seem to exist anymore.  It has been
> suggested that this might be caused by saving sessions based on IP,
> since we're using a load balancer.  I'm not much of a server person,
> so I'm much in the know about the effects of load balancing on my
> code.  Any thoughts or suggestions on why this might be happening or
> how to fix it?
>
> Thanks!
>
> >
>

--~--~-~--~~~---~--~~
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: ACL and Individual Users

2009-03-28 Thread rartavia

Hi, have you looked at 
http://book.cakephp.org/view/641/Simple-Acl-controlled-Application.
I think it might just be what you need to understand a way to do so,
that one actions oriented but you could use that concept for your
needs. Good luck!
--~--~-~--~~~---~--~~
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 Unexpected Behavior

2009-03-28 Thread rartavia

logout: thanks for your answer, i'm using mayorly (hah nice word) ajax
calls for my app but there are some not ajax ones and i'm using
requestAction at least one time witch is suggested using it with
cache. I'll try $this->disableCache(); under requestHandler->isAjax
maybe, i'll
look how that works. But I think the "unexpected behavior" was all
about what suggested JamesF, the camel cased action names. Now my real
problem is swfupload /controller/upload action, where my Auth->user
returns null. Again i'm using 2.2.0 Beta 5 2008-01-29

thanks
--~--~-~--~~~---~--~~
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 Unexpected Behavior

2009-03-28 Thread rartavia

logout: thanks for your answer, i'm using mayorly (hah nice word) ajax
calls for my app but there are some not ajax ones and i'm using
requestAction at least one time witch is suggested using it with
cache. I'll try $this->disableCache(); under Auth->isAjax maybe, i'll
look how that works. But I think the "unexpected behavior" was all
about what suggested JamesF, the camel cased action names. Now my real
problem is swfupload /controller/upload action, where my Auth->user
returns null. Again i'm using 2.2.0 Beta 5 2008-01-29

thanks
--~--~-~--~~~---~--~~
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 Unexpected Behavior

2009-03-28 Thread rartavia

Hi JamesF, thanks a lot for your answer. I'm kind of new to this hole
framework but at least the mayor part, if not all, of the Auth and Acl
setup got it from book.cakephp.org from reading "Simple Acl controlled
Application" (example applications) and the Auth and Acl components
docs, including the "$this->Auth->allowedActions=array
('display','index','view');" and "$this->Auth->authorize = 'actions';"
instructions. As I understand this tells auth, take control of actions
and this ones are allowed for anyone, but now that you mention it, i'm
going to try swapping their order, and i'll also try as you suggest.

What you mean with "not sure if all of your actions are in
app_controller"?
If you have no before filter in controller, dosent it executes by
default appcontroller's beforeFilter?

About the CamelCased stuff..ups, thanks for that one, that explains
the stuff with the naming.
What does remain a mistery is why using swfupload Auth->user is null
in the /uploads_controller/upload action (made ajaxly), I think i'll
post a separate topic for that, maybe someone familiar with swfupload
sees the title and have an idea... cause i dont. By the way, i'm using
2.2.0 Beta 5 2008-01-29, any ideas, anyone?

My workaround was the followin (in pseudo-code)
if(RequestHandler->isAjax) auth->allow('upload')

Thanks again
--~--~-~--~~~---~--~~
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 Unexpected Behavior

2009-03-28 Thread logout

I've noticed that the Auth component works very strange when it comes
to ajax calls. I think the session is involved here plus the fact that
if you use IE for a browser, it is caching something wrong. So in my
case I put this line:

$this->disableCache();

in the beforeFilter() function in the AppController. Then all worked
fine for me, but my app is build around ajax requests and I don't need
the cache services of the browser.

On Mar 28, 6:25 am, rartavia  wrote:
> Hello there, I'm having kind of a hard time setting up Auth Component,
> i'm getting really weird behavior. After configuring my Auth & Acl..
>
> I know its a large post, but PLEASE HELP!!
> I'm initializing with this code:
>
>         function initDB() {
>
>                 $aro = new Aro();
>                 $aros = array(
>                         0 => array('model' => 'Group', 'foreign_key' => 1),
>                         1 => array('model' => 'Group', 'foreign_key' => 2),
>                         2 => array('model' => 'Group', 'foreign_key' => 3),
>                         3 => array('parent_id' => 1, 'model' => 'User', 
> 'foreign_key' =>
> 1),
>                         4 => array('parent_id' => 2, 'model' => 'User', 
> 'foreign_key' =>
> 2),
>                         5 => array('parent_id' => 3, 'model' => 'User', 
> 'foreign_key' => 3)
>                 ); // users & groups mysql tables all ready have 3 records 
> each
>
>                 foreach($aros as $data)
>                 {
>                         $aro->create();
>                         $aro->save($data);
>                 }
>
>                 // Reads Configure::listObjects('controller') and create an 
> aco node
>                 // for each Controller with aco root Controllers/
>                 $this->buildAcl();
>
>             $group =& $this->User->Group;
>
>             // Allow admins to everything
>             $group->id = 1;
>             $this->Acl->allow($group, 'Controllers');
>
>             // Deny all to none admins
>             $group->id = 2;
>             $this->Acl->deny($group, 'Controllers');
>             $group->id = 3;
>             $this->Acl->deny($group, 'Controllers');
>
>         }
>
> In my AppController
>
>     var $components = array('Auth', 'Acl', 'RequestHandler', 'P28n');
>     var $helpers = array('html', 'javascript', 'form');
>
>     function beforeFilter() {
>         //Configure AuthComponent
>         $this->Auth->allowedActions = array('display', 'index',
> 'view');
>
>         $this->Auth->authorize = 'actions';
>         $this->Auth->loginAction = array('controller' => 'users',
> 'action' => 'login');
>         $this->Auth->logoutRedirect = array('controller' => 'users',
> 'action' => 'login');
>
>         $this->Auth->actionPath = 'Controllers/';
>
>     }
>
> It all started because I'm using swfupload and it worked quite all
> right without Auth. After auth once I logged in, got to my view, and
> when trying to upload (ajaxly through /uploaded_imgs/upload) i gotten
> for response the login page telling me there's no authorization for
> that request and I discovered that even after login, Auth->user() was
> null in that ajax call. If I called /uploaded_imgs/upload directly
> from through the address bar Auth->user() was present. However trying
> another ajax call, not with swfupload, the auth->user was also
> present.
>
> Then i went futher to see what the heak was happening, take a look at
> this stuff...
>
>         // this IS NOT allowed without login in with or without the commented
> lines
>         // note function has single word name
>         function publishment(){
>                 $this->layout = "denouncements_publish";
>                 //$data = $this->requestAction('/damages/all');
>                 //$this->set('damages', $data);
>         }
>
>         // this IS NOT allowed without login in with or without the commented
> lines
>         // note function has single word name
>         function pub(){
>                 $this->layout = "denouncements_publish";
>                 //$data = $this->requestAction('/damages/all');
>                 //$this->set('damages', $data);
>         }
>
>         // this IS allowed without login with those lines commented, how
> ever
>         // when those lines are executed aint allowed. Note 2 words function
> name
>         function publishmentTest(){
>                 $this->layout = "denouncements_publish";
>                 //$data = $this->requestAction('/damages/all');
>                 //$this->set('damages', $data);
>         }
>
>         // this IS NOT allowed without login in
>         // note function has single word name
>         function jsonfields(){
>                 $this->layout = null;
>                 $this->set('json', 
> json_encode($this->Denouncement->query("DESCRIBE
> denouncements", true)));
>         }
>
>         // this IS allowed without login in
>         // note function has multiple words name
>         function fieldNamesJson(){
>  

Re: Dynamic Dropdown Population

2009-03-28 Thread logout


This:

select('Candidate.country_id', array('options' =>
$countries), null, null, true); ?>

should be like this:

input('Candidate.country_id', array('empty' => '--
Select Country--')); ?>

You can also ommit the model name, but it will be lees explanatory.

In case you wonder, the input method will know wich type of input to
generate (in this case: a select field), since the $this->viewVars
variable contains the data in appropriate format :) (You can use debug
($this->viewVars); to see what's in store...)

On Mar 28, 3:56 pm, Sourav  wrote:
> I have 2 models: Candidate & Country. I am using the following code to
> extract data from the countries table & passing it to a dropdown on a
> view of the CandidatesController.
>
> class CandidatesController extends AppController {
>    var $name = 'Candidates';
>    var $uses = array('Candidate', 'Country');
>
>   function resume() {
>      $countries = $this->Country->find('list', array('fields' => array
> ('Country.countryname')));
>      $this->set(compact('countries'));
>   ...
>   }
>
> ---­---
> View (resume.ctp) :
> select('Candidate.country_id', array('options' =>
> $countries), null, null, true); ?>
> ---­-
>
> It is showing the output as :
>
> 
> 
> 
> Afghanistan
> Albania
> ..
> Zimbabwe
> 
> 
>
> I don't want to have the  within the list.
> Is there a way to eliminate this ? Also I want the empty select option
> to have the text "--Select Country--"
> i.e --Select Country--. How do I accomplish
> this?
>
> - Thanks
--~--~-~--~~~---~--~~
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: Weird find behavior, 300 queries when it could be achieved with only one

2009-03-28 Thread Kym

Oh well, I found a solution for those who might be interested heres
what I have done (thanks to this post who helped a lot
http://mark-story.com/posts/view/using-bindmodel-to-get-to-deep-relations?utm_source=rss)

First of all, I`m doing this find in pagination, so there was a little
more to do.

First, I configured the $paginate var:

var $paginate = array (
'Comment' => array (
'limit' => 50,
'order' => 'Comment.id ASC',
'contain' => array('User(id, nick)', 'State(nick)')
)
);

Second, instead of using the Containable Behavior (wich is wonderfull
for 1 level of recursive findings, but really ugly for more levels), I
used the bind/unbindModel way, unbinding unecessarie relations and
forcing cake to use joins by seting foreignKey to false and providing
conditions:

$this->News->Comment->unbindModel(array('hasMany' => array('Thumb'),
'belongsTo' => array('News')), false);
$this->News->Comment->bindModel(
array('belongsTo' => array(
'User' => array('foreignKey' => false, 'conditions' => array
('User.id = Comment.user_id')),
'State' => array('foreignKey' => false, 'conditions' => array
('User.state_id = State.id'))
)), false);
$comments = $this->paginate('Comment', array('Comment.news_id' =>
$id));

This will produce this wonderfull single query, which gather al the
information I need:

SELECT `Comment`.`id`, `Comment`.`user_id`, `Comment`.`news_id`,
`Comment`.`body`, `Comment`.`created`, `Comment`.`modified`,
`Comment`.`thumbs`, `Comment`.`is_hided`, `User`.`id`, `User`.`nick`,
`State`.`nick` FROM `comments` AS `Comment` LEFT JOIN `users` AS
`User` ON (`User`.`id` = `Comment`.`user_id`) LEFT JOIN `states` AS
`State` ON (`User`.`state_id` = `State`.`id`) WHERE
`Comment`.`news_id` = 1 ORDER BY `Comment`.`id` ASC LIMIT 50

Just a note, for bind/unbindModel to work in the paginate methord you
need to set its second parameter to false.

Thats it.


On 28 mar, 10:58, Fábio "Kym" Nascimento 
wrote:
> Hello there, I just subscribed to this group, nice to met you guys
> cakephp's addicts.
>
> I'm relatively new to cakephp, like 3-4 months but I just love it,
> after 3 years developing solo php, the famous "spaghetti code", start
> using and learning cake was just wonderfull. Just a point here, I
> heard a lot about how cake documentation sucks. Of course I think it
> could be better, but it doenst just suck at all, easier or harder,
> sooner or later I was always able to find what I needed, until now.
>
> My scenario is the following:
>
> News hasMany Comment
> Comment belongsTo User
> User belongsTo State
>
> Its a very simple scenario, where I need to find all comments for a
> given news and for each comment I want to know its User.nick and its
> User.State.nick.  Using the Containable behavior its very simple:
>
> $this->Comment->contain('User.id', 'User.nick', 'User.country_id',
> 'User.State.id', 'User.State.nick');
> or
> $this->Comment->contain
> ('User' => array('fields' => array('User.id', 'User.nick',
> 'User.state_id'),
> 'State' => array('fields' => array('id', 'nick';
> or.. there are many sintaxes you can use, I have tried then all
> $comments = $this->Comment->find('all', array('conditions' =>
> 'Comment.news_id' => 1
>
> So far so good, this could be achieved with only 1 query, Comment left
> join Users and User left join States, BUT, even if cakephp finds and
> returns what I need, its done with a lot more queries, heres what
> cakephp does:
>
> First, cake selects all comments and its users information:
>
> SELECT `Comment`.`id`, `Comment`.`user_id`, `Comment`.`news_id`,
> `Comment`.`body`, `Comment`.`created`, `Comment`.`modified`,
> `Comment`.`thumbs`, `Comment`.`is_hided`, `User`.`id`, `User`.`nick`,
> `User`.`state_id` FROM `comments` AS `Comment` LEFT JOIN `users` AS
> `User` ON (`Comment`.`user_id` = `User`.`id`) WHERE
> `Comment`.`news_id` = 1 ORDER BY `Comment`.`id` ASC LIMIT 50
>
> Then, it selects comment by comment, user by user, its state
> information:
>
> SELECT `User`.`id`, `User`.`nick`, `User`.`state_id` FROM `users` AS
> `User` WHERE `User`.`id` = 1
> SELECT `State`.`id`, `State`.`nick` FROM `states` AS `State` WHERE
> `State`.`id` = 25
>
> I have a page with 50 comments, that means 100 extra more queries to
> retrieve the State.nick. Imagine a scenario where 100 users are doing
> this ate the very same time, its 1000 more queries in a second.
>
> After I detected that, I really cant understand why find just doesnt
> LEFT JOIN the States table too and eliminate all those unecessarie
> queries. Here what I expected from find:
>
> SELECT `Comment`.`id`, `Comment`.`user_id`, `Comment`.`news_id`,
> `Comment`.`body`, `Comment`.`created`, `Comment`.`modified`,
> `Comment`.`thumbs`, `Comment`.`is_hided`, `User`.`id`, `User`.`nick`,
> `User`.`state_id`, `State`.`nick`
>         FROM `comments` AS `Comment`
>         LEFT JOIN `users` AS `User`
>         ON (`Comment`.`us

Re: ACL and Individual Users

2009-03-28 Thread brian

Maybe ACL isn't really needed for this. You could have a users_courses
table that defined the cut-off date.

On Sat, Mar 28, 2009 at 3:49 PM, Dave Maharaj :: WidePixels.com
 wrote:
> Can someone help me understand how / if possible to define individual user
> permissions using ACL? Is there a good site that explains it? I read thru
> the Lord of the Rings and see you can define the permissions by hard coding
> it. But for my application the permissions need to be created / deleted or
> modified based on USERS specific criteria.
>
> I have the USERS as GROUPS defined so each USER in that particular group has
> access to what parts of the site.
>
> But say JEFF and TOM are in GROUP 1 but I want JEFF to be allowed to access
> a part (edit function in the controller lets say) that no other GROUP 1 user
> has access to.
>
> Make it easier to understand would be a situation like this:
> JEFF, TOM, BILL are all USERS belongTo Group 1
> they can access courses_controller (index)
> There are 100's of courses to choose from
>
> JEFF pays to complete the COURSE on DREAMWEAVER and has 30 days access to
> that specific COURSE for 30 days then the access is denied.
> TOM pays for the PHOTOSHOP COURSE which is 14 days and AJAX COURSE which is
> 21 days
>
> Now with hundreds of courses and hundreds of users how would you maintain
> something like this? So they have access for a limited time depending on the
> seminar length then revoke access after the time has passed? Its the USERS
> themselves who determine access they have based on choosing the COURSE.
>
> Thanks
>
> Dave
> >
>

--~--~-~--~~~---~--~~
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: complex model associations

2009-03-28 Thread muszek

I implemented it and it works with one rather important drawback -
HABTM queries are made separately and I think I can't use sort in
pagination.

I was thinking... there's always only one associated instance in this
HABTM relationship (a ticket has only one value of color).  If it was
possible to use belongsTo instead of HABTM, it would be one query.  Is
it possible to use belongsTo when there is no foreign_key, but a
joinTable instead?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Error in trying to make the blog tutorial

2009-03-28 Thread Baggypants

Hi guys,

I am new to using cakephp and am using a WAMP server on my desktop
computer while running it.  I have uncommented the line in httpd.conf
to use the pretty URL's since for some reason even though my
mod_rewrite looks enabled the CSS / images were missing on my cake
start page.

Anyhow, I am having trouble with the blog.  I see this error when
trying to access:
http://localhost/cake_1_2/index.php/posts/index

But I did create the Controller..so I'm not sure what it is talking
about.  I think this may be an error due to something with mod_rewrite
or the pretty URLs?

Missing Controller

Error: PostsController could not be found.

Error: Create the class PostsController below in file: app\controllers
\posts_controller.php



Notice: If you want to customize this error message, create app\views
\errors\missing_controller.ctp

--~--~-~--~~~---~--~~
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: action parameters lost after data validation

2009-03-28 Thread JamesF

this should have been more obvious but

echo $form->input('id', array("type" => "hidden","value" => $this->data
['Model']['id']));

solution made sure my edit form stayed an edit form and didn't lose
it's parameters

On Mar 27, 5:20 pm, JamesF  wrote:
> i am having the same problem withvalidationmaking me lose my action
> parameters.
>
> still trying to figure out best way to pass back action parameter
> after failedvalidation.
>
> On Mar 18, 12:08 pm, koala kid  wrote:
>
> > Thanks for your reply.
>
> > Myvalidationhas become a little more complicated since yesterday as
> > I am trying to validate 1 field but that field belongs to related
> > model. In that case where should I perform thevalidationand how
> > would I pass the ID back most effectively.
>
> > On Mar 17, 8:50 pm, brian  wrote:
>
> > > On Tue, Mar 17, 2009 at 4:12 PM,koalakid wrote:
>
> > > > Hi,
>
> > > > I am fairly new to cake and I'm making some fixes for a client on a
> > > > CMS tool someone developed for them using cake. I am trying to add a
> > > > customvalidationrule on one of the forms but if it fails the ID
> > > > parameter in the URL is beinglostand theeditfails to update.
>
> > > > Do I have to explicitly pass the ID back along?
>
> > > I doubt thatvalidationhas anything directly to do with it. I'm
> > > guessing youraction/method has an $id as a parameter and theform
> > >actiondoes not include it. If you're using $form->create() can you
> > > post that? Also the method itself. It's possible that it's being set
> > > the first time around but, whenvalidationfails and theformis
> > > re-displayed, the ID var isn't set again.
--~--~-~--~~~---~--~~
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: Titles for drop-down lists

2009-03-28 Thread JamesF

didn't know about this method!! gotta try it out
thanks!

On Mar 28, 11:12 am, Smelly Eddie  wrote:
> An easier option might be to create the superlist method for the form
> helper.  You can call it with much less code and it will show as many
> concatenated fields as you want, and even use cascading lists.  It
> overrides the default list method in form helper.
>
> the result is like
>
> Select Name
> | - Last Name
> | - - John
> | - - Mary
> | - Diff Last Name
> | - - Pete
> | - - Ellen
>
> http://teknoid.wordpress.com/2008/09/04/findlist-with-three-or-combin...
>
> On Mar 27, 6:24 pm, JamesF  wrote:
>
> > ---
> > in your controller: (i'll assume users_controller.php)
> > ---
>
> > function user_list()  //whatever function you are using
>
> >                         {
> >                                         $conditions = 'ORDER BY 
> > User.first_name ASC'; //order our list to
> > make sure its alphabetical by first name
> >                                         $this->set('users', 
> > $this->User->find('all', array ('conditions'=>
> > $conditions )));    //send the list of users to the view as $users
> >                         }
>
> > this should pull the list of names if your models are set up properly
>
> > -
> > in your view:
> > -
> >  > //app/views/users/user_list.ctp
>
> > echo $form->create('Users', array('type' => 'post', 'action' =>
> > 'userwhateveraction'));  // use formhelper to create the form called
> > "Users" going to whatever action you choose
> > ?>
>
> >          >         ?>
>
> >                 
> >          User Name
> >                 
>
> >                 
> >         //foreach goes through array $users you set in controller
>
> >                         foreach ($users as $user):
>
> >             //option value defaults to associated user id
>
> >                         echo '' 
> > . $user['User']
> > ['first_name'] . ' ' . $user['User']['last_name'] .'';
> >                         endforeach;
>
> >         ?>
>
> >         
> >                 
>
> >  > echo $form->end('Submit'); // close the form
> > ?>
>
> > hope this helps!
> > in this example make sure your table is called 'users' (including
> > whatever option prefix you may have set up in core cfg) and your
> > primary key is 'id'. first name is 'first_name' and last name is
> > 'last_name'.
>
> > On Mar 27, 5:37 pm, dubiousandrew  wrote:
>
> > > I have a first_name field and a last_name filed in my user table.
> > > When a form has a 'select a user' from a drop down list the list is
> > > populated with user ids.  I want to show first_name + last_name
> > > instead of user_ids.  Is there a way to do this without creating
> > > another field in my user table called 'name'?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ACL and Individual Users

2009-03-28 Thread Dave Maharaj :: WidePixels.com
Can someone help me understand how / if possible to define individual user
permissions using ACL? Is there a good site that explains it? I read thru
the Lord of the Rings and see you can define the permissions by hard coding
it. But for my application the permissions need to be created / deleted or
modified based on USERS specific criteria. 
 
I have the USERS as GROUPS defined so each USER in that particular group has
access to what parts of the site.
 
But say JEFF and TOM are in GROUP 1 but I want JEFF to be allowed to access
a part (edit function in the controller lets say) that no other GROUP 1 user
has access to.
 
Make it easier to understand would be a situation like this:
JEFF, TOM, BILL are all USERS belongTo Group 1
they can access courses_controller (index)
There are 100's of courses to choose from
 
JEFF pays to complete the COURSE on DREAMWEAVER and has 30 days access to
that specific COURSE for 30 days then the access is denied.
TOM pays for the PHOTOSHOP COURSE which is 14 days and AJAX COURSE which is
21 days
 
Now with hundreds of courses and hundreds of users how would you maintain
something like this? So they have access for a limited time depending on the
seminar length then revoke access after the time has passed? Its the USERS
themselves who determine access they have based on choosing the COURSE.
 
Thanks
 
Dave

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Translate Behavior should handle an element has several translations

2009-03-28 Thread esezako

I'm doing a multi-language dictionary.
If multiple terms of language A (TA1, TA2, TA3) have the same
translation in language B, I must take care that all versions of the
term in B (TB1, TB2, TB2) are synchronized.
Could Translate Behavior do this for me?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Translate Behavior should handle a created and modified fields

2009-03-28 Thread esezako

Translate Behavior should make the creation and modification dates of
the translations automatically, as is done in a model without this
behavior. I expected this feature only writing this in the model: var
$actsAs = array('Translate' => array
('translate_field','created','modified'));

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



New Install - Where is the Dispatch

2009-03-28 Thread almasty

Hi

I'm getting this error

Fatal error: Class 'Dispatcher' not found in /var/www/vhosts/
shakethembones.com/httpdocs/index.php on line 87

I've done a search on google and can find a couple of post about
getting this error but no solutions

I have just installed

I've used the instructions here

http://book.cakephp.org/view/308/Installing-CakePHP under `Advanced
Setup: Alternative Installation Options`. I have the tmp dir with 777,
and my include paths, openbase dir etc in a vhost file contain the
cake lib, app and webroot just to take them off the radar in terms of
permissions.

Line 87 is a call to the Dispatcher class, which I guess is not
included as expected.

Can anyone point me in the right direction for an answer?

Al

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



CakePHP Multilevel Users

2009-03-28 Thread Zorancho

Hi to all
I am building a multilevel users application, but i don't want to use
the Auth or ACL components, cause they give me so much troubles, i
want to manage to create the whole thing with using my own functions
so i can have different groups of users like Administrators, Managers
and the common Users. So i was wondering if i could use in the
core.php:
Configure::write('Routing.admin', 'admin');
Configure::write('Routing.manager', 'manager');

and then in the controllers to have actions like admin_add,
manager_add, admin_delete, manager_delete etc...
Is this possible to do in cake? How safe would be to place this kind
of made application in production?
Also, another question is about javascript, i personally prefer to
work with MooTools (which i find much easier to understand than
Prototype or Jquery) and could i use that one with CakePHP? Has anyone
ever used them together? I have never found any real world example of
using MooTools and CakePHP together, so i was having doubts. Thanks 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Weird find behavior, 300 queries when it could be achieved with only one

2009-03-28 Thread Kym

Hello there, I just subscribed to this group, nice to met you guys
cakephp's addicts.

I'm relatively new to cakephp, like 3-4 months but I just love it,
after 3 years developing solo php, the famous "spaghetti code", start
using and learning cake was just wonderfull. Just a point here, I
heard a lot about how cake documentation sucks. Of course I think it
could be better, but it doenst just suck at all, easier or harder,
sooner or later I was always able to find what I needed, until now.

My scenario is the following:

News hasMany Comment
Comment belongsTo User
User belongsTo State

Its a very simple scenario, where I need to find all comments for a
given news and for each comment I want to know its User.nick and its
User.State.nick.  Using the Containable behavior its very simple:

$this->Comment->contain('User.id', 'User.nick', 'User.country_id',
'User.State.id', 'User.State.nick');
or
$this->Comment->contain
('User' => array('fields' => array('User.id', 'User.nick',
'User.state_id'),
'State' => array('fields' => array('id', 'nick';
or.. there are many sintaxes you can use, I have tried then all
$comments = $this->Comment->find('all', array('conditions' =>
'Comment.news_id' => 1

So far so good, this could be achieved with only 1 query, Comment left
join Users and User left join States, BUT, even if cakephp finds and
returns what I need, its done with a lot more queries, heres what
cakephp does:

First, cake selects all comments and its users information:

SELECT `Comment`.`id`, `Comment`.`user_id`, `Comment`.`news_id`,
`Comment`.`body`, `Comment`.`created`, `Comment`.`modified`,
`Comment`.`thumbs`, `Comment`.`is_hided`, `User`.`id`, `User`.`nick`,
`User`.`state_id` FROM `comments` AS `Comment` LEFT JOIN `users` AS
`User` ON (`Comment`.`user_id` = `User`.`id`) WHERE
`Comment`.`news_id` = 1 ORDER BY `Comment`.`id` ASC LIMIT 50

Then, it selects comment by comment, user by user, its state
information:

SELECT `User`.`id`, `User`.`nick`, `User`.`state_id` FROM `users` AS
`User` WHERE `User`.`id` = 1
SELECT `State`.`id`, `State`.`nick` FROM `states` AS `State` WHERE
`State`.`id` = 25

I have a page with 50 comments, that means 100 extra more queries to
retrieve the State.nick. Imagine a scenario where 100 users are doing
this ate the very same time, its 1000 more queries in a second.

After I detected that, I really cant understand why find just doesnt
LEFT JOIN the States table too and eliminate all those unecessarie
queries. Here what I expected from find:

SELECT `Comment`.`id`, `Comment`.`user_id`, `Comment`.`news_id`,
`Comment`.`body`, `Comment`.`created`, `Comment`.`modified`,
`Comment`.`thumbs`, `Comment`.`is_hided`, `User`.`id`, `User`.`nick`,
`User`.`state_id`, `State`.`nick`
FROM `comments` AS `Comment`
LEFT JOIN `users` AS `User`
ON (`Comment`.`user_id` = `User`.`id`)
LEFT JOIN `states` AS `State`
ON (`State`.`id` = `User`.`id`)
WHERE `Comment`.`news_id` = 1
ORDER BY `Comment`.`id` ASC

I'm not a PHP guru, but i tried to read the find's soure code, unhappy
I cant still realize why thats happening. And this happens a lot,
anytime you try to find deep models more than 1 level, that happens,
the find method is able to return what I expect, but very far from the
best way.

I thought about use my custom query, but I dont think its the best
way. And this is a very critical problem, any project that have a lot
of users access will suffer because of that.

Sorry for my bad english, but does anyone have a clue, a tip, or
something that might help? Is there a way to do this that the find
method is forced to JOIN tables instead of generating single queries
to fill the results?

Thanks in advance
Kym

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Dynamic Dropdown Population

2009-03-28 Thread Sourav

I have 2 models: Candidate & Country. I am using the following code to
extract data from the countries table & passing it to a dropdown on a
view of the CandidatesController.

class CandidatesController extends AppController {
   var $name = 'Candidates';
   var $uses = array('Candidate', 'Country');

  function resume() {
 $countries = $this->Country->find('list', array('fields' => array
('Country.countryname')));
 $this->set(compact('countries'));
  ...
  }

--
View (resume.ctp) :
select('Candidate.country_id', array('options' =>
$countries), null, null, true); ?>


It is showing the output as :




Afghanistan
Albania
..
Zimbabwe



I don't want to have the  within the list.
Is there a way to eliminate this ? Also I want the empty select option
to have the text "--Select Country--"
i.e --Select Country--. How do I accomplish
this?

- Thanks




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cake PHP 1.2 - Need Help For Posting Mulitple Checkboxes

2009-03-28 Thread keyurvaghani

Hello Friends,

I am keyur vaghani and working on cake php 1.2.

Please help me out from following issue on cake php 1.2 related to
post values of selected multiple check boxes.

I want to list multiple check boxes with same name on different rows
and post its values as array with selected (checked) check boxes, but
it couldn't and only get post value as last selected control check box
element value.

Because It will generate auto hidden element with each different row
check box control and here the original check box control name is
generated with array and it is correct like [Model][fieldname][] but
it couldn't generate this array name of hidden control that's why i am
facing major trouble while posting.

for example,
" Test Check Box Option1");
e($form->select('ProfilePermissionsMaster.permission',
$options,NULL,array('multiple'=> 'checkbox' , 'separator'=>' 
','value'=>'1')));

$options2=array(1=>" Test Check Box Option2");
e($form->select('ProfilePermissionsMaster.permission',
$options2,NULL,array('multiple'= >'checkbox' , 'separator'=>' 
','value'=>'2')));

$options3=array(1=>" Test Check Box Option3");
e($form->select('ProfilePermissionsMaster.permission',
$options,NULL,array('multiple'=> 'checkbox' , 'separator'=>' 
','value'=>'3')));

?>

It want post values like as below, but couln't get it ??

Array( [ProfilePermissionsMaster] =>Array(

[permission] => Array
(
[0] => 1
[1] => 2
[2] => 3
)


)

)

as well as when ever i set value attribute, it will display checked
check box why?

Thanks and Regards,
Keyur.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Complex Query Question

2009-03-28 Thread bakerLeo

I am stuck on a query problem :
These are the tables involved :

Group
id
name

User
id
name

Groups_Users   (for HABTM)
   id
   group_id
   user_id

Now i have an admin system that lets the admin view the group and all
the related users.
Which is working fine. However, I want to do the OPPOSITE.
View the group and display ALL the users that are not in that group.
How would I structure my $find statement?

Obviously, this is wrong but it is what i need it to do :
$users = $this->User->find('all',array('conditions'=>

array('NOT'=>array('User.id' =>
'GroupsUser.user_id')))

);

This next set of code, is what i want it to do, but not have to
explicitly declare the user ids
This would return all users NOT 1,2,3,4.

$filter = array(1,2,3,4);
 $users = $this->User->find('all',array
('conditions'=>
 array('NOT'=>array('User.id' =>
$filter)))
);

would appreciate all help.

--~--~-~--~~~---~--~~
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: Best Practise: Protecting against unallowed save()

2009-03-28 Thread brian

On Sat, Mar 28, 2009 at 12:07 PM, Aurelius  wrote:
>
> That works only if the model is DIRECTLY associated with Users, but
> not e.g. here:
>
> User hasMany Blogs hasMany Entries
>
> I can't believe theres no standard-function for this, isn't is one of
> the normallest things,
> that there can be User, which have stuff to edit, but ONLY there one
> (=99% of big websites)

public function edit()
{
if (!empty($this->data))
{
// ...
}

if (empty($this->data))
{
$filters = array(
'conditions' => array(
'Whatever.user_id' => $this->Auth->user('id')
)
);
$this->data = $this->Whatever->find('first', $filters);
}
}

As I said, use the SecurityComponent to ensure that your hidden fields
are not adjusted by the user.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



complex model associations

2009-03-28 Thread muszek

Hi,

I'm writing an open source app, something similar to Trac.  I have a
slightly different approach to bug tracking - dynamic "ticket
attributes" - instead of having a few fixed attribs (ticket priority,
severity, component, milestone, etc.), project's owner creates them by
himself.  For example, in his project every ticket may have an
associated city, color or priority.
I'm not sure how to accomplish model associations properly, so here I
am.

My models (only those related to the issue):
 * Project (that's another difference - Trac doesn't handle multiple
projects and that's basically why I'm doing this), hasMany Ticket and
Attribute
 * Ticket
 * Attiribute (for example "city", "color", "priority"), hasMany
AttributeValue
 * AttributeValue ("London", "Manchester", etc.)

The problem is that "City" is not a hard-coded model, but a one of
values of Attribute model.  This is the solution I'm thinking of:
 * In TicketsController::beforeFilter() I'm loading a Project with
associated models.  $project = $this->Ticket->Project->read($id);  It
contains all attributes.  Then I'm doing $this->Ticket->bind for every
existing Attribute that this project has.  Something like this (typing
it right now, probably has errors):
foreach($project['Attribute'] as $attr) {
$this->Ticket->bindModel(
array('hasAndBelongsToMany' => array(
$attr['name'] => array( // of course I'd have to 
validate attribute
names to make sure they are valid key names (but that's irrelevant
now).
'className' => 'AttributeValue',
'joinTable' => 'tickets_attribute_values',
'foreignKey' => 'ticket_id',
'associationForeignKey' => 'attribute_value_id',
'unique' => true,
'conditions' => 
array($attr['name']'.attribute_id' => $attr
['id']),
)
)
);
}

Does that sound reasonable?  Is it how it should be done?  If not, how
should I do it so that other Cake kids won't laugh at me?
My needs are pretty standard: I'm gonna want to paginate through
tickets, create filters ("only tickets from London and Manchester"),
create and edit tickets.  I've already coded all of this, but with
fixed models (Priority, Severity, etc.).

cheers,
muszek - Mateusz Mucha

--~--~-~--~~~---~--~~
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: Best Practise: Protecting against unallowed save()

2009-03-28 Thread Aurelius

That works only if the model is DIRECTLY associated with Users, but
not e.g. here:

User hasMany Blogs hasMany Entries

I can't believe theres no standard-function for this, isn't is one of
the normallest things,
that there can be User, which have stuff to edit, but ONLY there one
(=99% of big websites)

thx
Aurelius

On 28 Mrz., 14:58, JamesF  wrote:
> whoops hit enter too quick:
>
> continuing the function
> 
>
> if ($this->Model->data['Model']['user_id'] == $auth_id ) // make sure
> to use == not =
>
> {
>       //render logic if authorized
>
> }
>
> else
>
> {
>
> $this->redirect('/');  //redirect unauthorized
>
> now this all breaks down when using validation on your forms
> im still working on that part! =]
>
> hope this is a start
>
> }
>
> On Mar 28, 9:54 am, JamesF  wrote:
>
> > first make sure the thing you are saving has a foreign key with the
> > user id associated with it.
> > i usually would deny access with the Auth component to the action that
> > i don't want a non logged in user to use.
>
> > simple acl to check if the record belongs to current logged in user:
>
> > put some kind of check in your action to read the user_id of the
> > record you are about to loadif it fails use cakes' redirect
> > function redirect the user to a location of some kind. if it passes
> > allow the record to be displayed.
>
> > i.e.
>
> > function read ($id = null)
> > {
> > $this->Model->id = $id; //gets id of item from url parameter
> > $auth_id = $this->Auth->user('id');   //make sure your controller is
> > using Auth or this wont work)
>
> > $this->Model->read(); // reads record
>
> > On Mar 27, 9:05 pm, Aurelius  wrote:
>
> > > I'm working about 2 month with Cake, but its my first bigger app.
> > > I want to write my own security function which would check before each
> > > save() if the save model is associated to the logged in user, what
> > > would be the best way to do that?
>
> > > My Ideas till now:
> > > a beforeSave() function in Appmodel:
> > >   + DRY
> > >   + relative secure
> > >   - if I use more than one save() its inefficient (I have up till 8 on
> > > one page)
> > >   - I don't have a clue how I can check newly created ones with no id
>
> > > a beforeSave(9 in each Modell:
> > >  - even more crappy than above
>
> > > a validation-function in the controller
> > >  - not DRY
> > >  - more code
> > >  + could work with allready readed data
>
> > > I believe that there must be more peaple out there with the same
> > > problem, are there any finished solutions?
>
> > > Any Ideas or thoughts are welcome!
>
> > > thx
> > > Aurelius
--~--~-~--~~~---~--~~
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: ACL for groups

2009-03-28 Thread brian

It "clearly states" that, does it? Would you mind pointing out that
line? I've just read that section for probably the 5th time and I
don't see it. I'm more than willing to admit that I'm still missing
it, though, as this entire subject has been rather confusing.

On Sat, Mar 28, 2009 at 11:07 AM, Smelly Eddie  wrote:
>
> Yes if you read the ACL section of the manual it clearly states to use
> null for the top level group.
>
> It is advisable in my opinion to make one group 'entire_site' and give
> yourself unfettered access without having to declare things
> individually. THis group would have a parent id of nul.
>
>
>
> On Mar 27, 12:44 pm, brian  wrote:
>> Thanks for the link but it doesn't explain what I'm looking for, which
>> is the DB table schema. I'm familiar with MPTT (and have used it
>> before) but Cake's parent_id has me confused.
>>
>> But I thought to look at db_acl.sql, which shows parent_id DEFAULT
>> NULL so I'll go with that.
>>
>> On Fri, Mar 27, 2009 at 5:27 AM, djiize  wrote:
>>
>> > For nested groups, you should read this post:
>> >http://edwardawebb.com/programming/php-programming/cakephp/nested-tre...
>>
>> > In ACL, I (personnaly) think it's a good idea to have a ROOT group,
>> > even if you don't use it now, maybe later ;)
>>
>> > If you don't want one, a NULL value should suffice.
>>
>> > On 27 mar, 05:16, brian  wrote:
>> >> I need to have nested groups, so the table has a parent_id column.
>> >> But, should top-level groups have a NULL parent_id? Or would there
>> >> have to be a ROOT group, so to speak? I'm having a real hard time
>> >> sorting all this out.
> >
>

--~--~-~--~~~---~--~~
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: Titles for drop-down lists

2009-03-28 Thread Smelly Eddie

An easier option might be to create the superlist method for the form
helper.  You can call it with much less code and it will show as many
concatenated fields as you want, and even use cascading lists.  It
overrides the default list method in form helper.

the result is like

Select Name
| - Last Name
| - - John
| - - Mary
| - Diff Last Name
| - - Pete
| - - Ellen

http://teknoid.wordpress.com/2008/09/04/findlist-with-three-or-combined-fields/

On Mar 27, 6:24 pm, JamesF  wrote:
> ---
> in your controller: (i'll assume users_controller.php)
> ---
>
> function user_list()  //whatever function you are using
>
>                         {
>                                         $conditions = 'ORDER BY 
> User.first_name ASC'; //order our list to
> make sure its alphabetical by first name
>                                         $this->set('users', 
> $this->User->find('all', array ('conditions'=>
> $conditions )));    //send the list of users to the view as $users
>                         }
>
> this should pull the list of names if your models are set up properly
>
> -
> in your view:
> -
>  //app/views/users/user_list.ctp
>
> echo $form->create('Users', array('type' => 'post', 'action' =>
> 'userwhateveraction'));  // use formhelper to create the form called
> "Users" going to whatever action you choose
> ?>
>
>                  ?>
>
>                 
>          User Name
>                 
>
>                 
>         //foreach goes through array $users you set in controller
>
>                         foreach ($users as $user):
>
>             //option value defaults to associated user id
>
>                         echo '' . 
> $user['User']
> ['first_name'] . ' ' . $user['User']['last_name'] .'';
>                         endforeach;
>
>         ?>
>
>         
>                 
>
>  echo $form->end('Submit'); // close the form
> ?>
>
> hope this helps!
> in this example make sure your table is called 'users' (including
> whatever option prefix you may have set up in core cfg) and your
> primary key is 'id'. first name is 'first_name' and last name is
> 'last_name'.
>
> On Mar 27, 5:37 pm, dubiousandrew  wrote:
>
> > I have a first_name field and a last_name filed in my user table.
> > When a form has a 'select a user' from a drop down list the list is
> > populated with user ids.  I want to show first_name + last_name
> > instead of user_ids.  Is there a way to do this without creating
> > another field in my user table called 'name'?
--~--~-~--~~~---~--~~
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: ACL for groups

2009-03-28 Thread Smelly Eddie

Yes if you read the ACL section of the manual it clearly states to use
null for the top level group.

It is advisable in my opinion to make one group 'entire_site' and give
yourself unfettered access without having to declare things
individually. THis group would have a parent id of nul.



On Mar 27, 12:44 pm, brian  wrote:
> Thanks for the link but it doesn't explain what I'm looking for, which
> is the DB table schema. I'm familiar with MPTT (and have used it
> before) but Cake's parent_id has me confused.
>
> But I thought to look at db_acl.sql, which shows parent_id DEFAULT
> NULL so I'll go with that.
>
> On Fri, Mar 27, 2009 at 5:27 AM, djiize  wrote:
>
> > For nested groups, you should read this post:
> >http://edwardawebb.com/programming/php-programming/cakephp/nested-tre...
>
> > In ACL, I (personnaly) think it's a good idea to have a ROOT group,
> > even if you don't use it now, maybe later ;)
>
> > If you don't want one, a NULL value should suffice.
>
> > On 27 mar, 05:16, brian  wrote:
> >> I need to have nested groups, so the table has a parent_id column.
> >> But, should top-level groups have a NULL parent_id? Or would there
> >> have to be a ROOT group, so to speak? I'm having a real hard time
> >> sorting all this out.
--~--~-~--~~~---~--~~
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: RABC vs. ACL Smackdown

2009-03-28 Thread brian

It's RBAC. I'm not really equipped to properly address the question,
though. See here:

http://en.wikipedia.org/wiki/Role-based_access_control

And check the links at the bottom of the page.

On Sat, Mar 28, 2009 at 10:35 AM, aranworld  wrote:
>
> Some guy left a comment on a blog that said that I shouldn't be using
> CakePHP, because its use of ACL is very antiquated.  The guy was
> obviously trying to promote his own PHP framework that uses RABC
> instead.  After reading about RABC, though, I'm having a bit of a hard
> time understanding the difference between RABC and CakePHP's
> implementation of ACL.  Can someone help me understand what the
> difference is?
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Row limit in IE???

2009-03-28 Thread Cahlan

I've never run into this problem before.

I have a very simple cake site that spits out a pretty long table of
data. For whatever reason, when the database gets "too" big, IE stops
displaying the page and gives a "Internet Explorer cannot display the
webpage" message. The page works fine in Firefox.

The amount of rows being shown in the table is 1,231. Didn't seem to
me like a ridiculous size.

I know, pagination would be better, believe me I tried to convince the
client of this.

Any ideas? Would it be related to a PHP setting? Seems like something
specific to IE is limiting the max page size that can be viewed or
something.

Any help or tips mucho appreciated!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RABC vs. ACL Smackdown

2009-03-28 Thread aranworld

Some guy left a comment on a blog that said that I shouldn't be using
CakePHP, because its use of ACL is very antiquated.  The guy was
obviously trying to promote his own PHP framework that uses RABC
instead.  After reading about RABC, though, I'm having a bit of a hard
time understanding the difference between RABC and CakePHP's
implementation of ACL.  Can someone help me understand what the
difference is?

--~--~-~--~~~---~--~~
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: Get all USER info

2009-03-28 Thread Dave Maharaj :: WidePixels.com

Thanks for the suggestion.

I just installed the toolbar and that has what I was looking for. It shows
all the info related to the particular user.

Dave 

-Original Message-
From: brian [mailto:bally.z...@gmail.com] 
Sent: March-28-09 11:18 AM
To: cake-php@googlegroups.com
Subject: Re: Get all USER info


Do you mean like this?

$this->User->find(
'first',
array(
'conditions' => array(
'User.id' => $user_id
),
'contain' => array(
'Post',
'Message'
'Question'
)
)
)

On Fri, Mar 27, 2009 at 7:44 PM, Dave Maharaj :: WidePixels.com
 wrote:
> I know this is a noobie question. I cant remember how to display all 
> the user info in the array. I see the Auth array but I want to see all 
> the messages / posts / questions that the user has entered in the site.
>
> Can someone please help me.I tried debug but that did nothing...I just 
> cant remember how to do it.
>
> Thanks
>
> Dave
> >
>



--~--~-~--~~~---~--~~
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: Best Practise: Protecting against unallowed save()

2009-03-28 Thread JamesF

whoops hit enter too quick:

continuing the function


if ($this->Model->data['Model']['user_id'] == $auth_id ) // make sure
to use == not =

{
  //render logic if authorized

}

else

{

$this->redirect('/');  //redirect unauthorized

now this all breaks down when using validation on your forms
im still working on that part! =]

hope this is a start

}
On Mar 28, 9:54 am, JamesF  wrote:
> first make sure the thing you are saving has a foreign key with the
> user id associated with it.
> i usually would deny access with the Auth component to the action that
> i don't want a non logged in user to use.
>
> simple acl to check if the record belongs to current logged in user:
>
> put some kind of check in your action to read the user_id of the
> record you are about to loadif it fails use cakes' redirect
> function redirect the user to a location of some kind. if it passes
> allow the record to be displayed.
>
> i.e.
>
> function read ($id = null)
> {
> $this->Model->id = $id; //gets id of item from url parameter
> $auth_id = $this->Auth->user('id');   //make sure your controller is
> using Auth or this wont work)
>
> $this->Model->read(); // reads record
>
> On Mar 27, 9:05 pm, Aurelius  wrote:
>
> > I'm working about 2 month with Cake, but its my first bigger app.
> > I want to write my own security function which would check before each
> > save() if the save model is associated to the logged in user, what
> > would be the best way to do that?
>
> > My Ideas till now:
> > a beforeSave() function in Appmodel:
> >   + DRY
> >   + relative secure
> >   - if I use more than one save() its inefficient (I have up till 8 on
> > one page)
> >   - I don't have a clue how I can check newly created ones with no id
>
> > a beforeSave(9 in each Modell:
> >  - even more crappy than above
>
> > a validation-function in the controller
> >  - not DRY
> >  - more code
> >  + could work with allready readed data
>
> > I believe that there must be more peaple out there with the same
> > problem, are there any finished solutions?
>
> > Any Ideas or thoughts are welcome!
>
> > thx
> > Aurelius
--~--~-~--~~~---~--~~
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: Best Practise: Protecting against unallowed save()

2009-03-28 Thread brian

I guess this would depend on your models, and how they're associated
with a particular User. You could write a routine in
AppModel::beforeSave() that checks for existence of
$data[$this->alias]['user_id'] and, if there, check that against the
session ..

Wait--can't get the session from the model.

Another tack would be to use SecurityComponent, which will add a
hidden field to your forms that will ensure that your other hidden
fields haven't been changed. So, you could then check the session in
your controller action before even displaying the form.

http://book.cakephp.org/view/175/Security-Component

On Fri, Mar 27, 2009 at 9:05 PM, Aurelius  wrote:
>
> I'm working about 2 month with Cake, but its my first bigger app.
> I want to write my own security function which would check before each
> save() if the save model is associated to the logged in user, what
> would be the best way to do that?
>
> My Ideas till now:
> a beforeSave() function in Appmodel:
>  + DRY
>  + relative secure
>  - if I use more than one save() its inefficient (I have up till 8 on
> one page)
>  - I don't have a clue how I can check newly created ones with no id
>
> a beforeSave(9 in each Modell:
>  - even more crappy than above
>
> a validation-function in the controller
>  - not DRY
>  - more code
>  + could work with allready readed data
>
> I believe that there must be more peaple out there with the same
> problem, are there any finished solutions?
>
> Any Ideas or thoughts are welcome!
>
> thx
> Aurelius
> >
>

--~--~-~--~~~---~--~~
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: Best Practise: Protecting against unallowed save()

2009-03-28 Thread JamesF

first make sure the thing you are saving has a foreign key with the
user id associated with it.
i usually would deny access with the Auth component to the action that
i don't want a non logged in user to use.

simple acl to check if the record belongs to current logged in user:

put some kind of check in your action to read the user_id of the
record you are about to loadif it fails use cakes' redirect
function redirect the user to a location of some kind. if it passes
allow the record to be displayed.

i.e.

function read ($id = null)
{
$this->Model->id = $id; //gets id of item from url parameter
$auth_id = $this->Auth->user('id');   //make sure your controller is
using Auth or this wont work)

$this->Model->read(); // reads record





On Mar 27, 9:05 pm, Aurelius  wrote:
> I'm working about 2 month with Cake, but its my first bigger app.
> I want to write my own security function which would check before each
> save() if the save model is associated to the logged in user, what
> would be the best way to do that?
>
> My Ideas till now:
> a beforeSave() function in Appmodel:
>   + DRY
>   + relative secure
>   - if I use more than one save() its inefficient (I have up till 8 on
> one page)
>   - I don't have a clue how I can check newly created ones with no id
>
> a beforeSave(9 in each Modell:
>  - even more crappy than above
>
> a validation-function in the controller
>  - not DRY
>  - more code
>  + could work with allready readed data
>
> I believe that there must be more peaple out there with the same
> problem, are there any finished solutions?
>
> Any Ideas or thoughts are welcome!
>
> thx
> Aurelius
--~--~-~--~~~---~--~~
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: Get all USER info

2009-03-28 Thread brian

Do you mean like this?

$this->User->find(
'first',
array(
'conditions' => array(
'User.id' => $user_id
),
'contain' => array(
'Post',
'Message'
'Question'
)
)
)

On Fri, Mar 27, 2009 at 7:44 PM, Dave Maharaj :: WidePixels.com
 wrote:
> I know this is a noobie question. I cant remember how to display all the
> user info in the array. I see the Auth array but I want to see all the
> messages / posts / questions that the user has entered in the site.
>
> Can someone please help me.I tried debug but that did nothing...I just cant
> remember how to do it.
>
> Thanks
>
> Dave
> >
>

--~--~-~--~~~---~--~~
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 Unexpected Behavior

2009-03-28 Thread JamesF

not sure if all of your actions are in app_controller but i noticed
something

  function beforeFilter() {
//Configure AuthComponent
$this->Auth->allowedActions = array('display', 'index',
'view');

$this->Auth->authorize = 'actions';
$this->Auth->loginAction = array('controller' => 'users',
'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'login');

$this->Auth->actionPath = 'Controllers/';


i use $this->Auth->allow('display', 'index', 'view');not $this->Auth-
>allowedActions

also this line  $this->Auth->authorize = 'actions'; .not sure what
thats doing there whenever i call  $this->Auth->authorize  it looks
like  $this->Auth->authorize = 'controller'; and is used in tandem
with a function isAuthorized() in the controller.

also if you are denying or allowing settings in another controller
make sure you include this:

function beforeFilter() {
parent::beforeFilter();  // inherits app_controller allow deny
settings

ALSO make sure your action names are NOT CamelCased.  Auth->allow and
Auth->deny don't work unless the action is oneword or one_word.not
oneWord


hope this helps
!!


On Mar 28, 12:25 am, rartavia  wrote:
> Hello there, I'm having kind of a hard time setting up Auth Component,
> i'm getting really weird behavior. After configuring my Auth & Acl..
>
> I know its a large post, but PLEASE HELP!!
> I'm initializing with this code:
>
>         function initDB() {
>
>                 $aro = new Aro();
>                 $aros = array(
>                         0 => array('model' => 'Group', 'foreign_key' => 1),
>                         1 => array('model' => 'Group', 'foreign_key' => 2),
>                         2 => array('model' => 'Group', 'foreign_key' => 3),
>                         3 => array('parent_id' => 1, 'model' => 'User', 
> 'foreign_key' =>
> 1),
>                         4 => array('parent_id' => 2, 'model' => 'User', 
> 'foreign_key' =>
> 2),
>                         5 => array('parent_id' => 3, 'model' => 'User', 
> 'foreign_key' => 3)
>                 ); // users & groups mysql tables all ready have 3 records 
> each
>
>                 foreach($aros as $data)
>                 {
>                         $aro->create();
>                         $aro->save($data);
>                 }
>
>                 // Reads Configure::listObjects('controller') and create an 
> aco node
>                 // for each Controller with aco root Controllers/
>                 $this->buildAcl();
>
>             $group =& $this->User->Group;
>
>             // Allow admins to everything
>             $group->id = 1;
>             $this->Acl->allow($group, 'Controllers');
>
>             // Deny all to none admins
>             $group->id = 2;
>             $this->Acl->deny($group, 'Controllers');
>             $group->id = 3;
>             $this->Acl->deny($group, 'Controllers');
>
>         }
>
> In my AppController
>
>     var $components = array('Auth', 'Acl', 'RequestHandler', 'P28n');
>     var $helpers = array('html', 'javascript', 'form');
>
>     function beforeFilter() {
>         //Configure AuthComponent
>         $this->Auth->allowedActions = array('display', 'index',
> 'view');
>
>         $this->Auth->authorize = 'actions';
>         $this->Auth->loginAction = array('controller' => 'users',
> 'action' => 'login');
>         $this->Auth->logoutRedirect = array('controller' => 'users',
> 'action' => 'login');
>
>         $this->Auth->actionPath = 'Controllers/';
>
>     }
>
> It all started because I'm using swfupload and it worked quite all
> right without Auth. After auth once I logged in, got to my view, and
> when trying to upload (ajaxly through /uploaded_imgs/upload) i gotten
> for response the login page telling me there's no authorization for
> that request and I discovered that even after login, Auth->user() was
> null in that ajax call. If I called /uploaded_imgs/upload directly
> from through the address bar Auth->user() was present. However trying
> another ajax call, not with swfupload, the auth->user was also
> present.
>
> Then i went futher to see what the heak was happening, take a look at
> this stuff...
>
>         // this IS NOT allowed without login in with or without the commented
> lines
>         // note function has single word name
>         function publishment(){
>                 $this->layout = "denouncements_publish";
>                 //$data = $this->requestAction('/damages/all');
>                 //$this->set('damages', $data);
>         }
>
>         // this IS NOT allowed without login in with or without the commented
> lines
>         // note function has single word name
>         function pub(){
>                 $this->layout = "denouncements_publish";
>                 //$data = $this->requestAction('/damages/all');
>                 //$this->set('damages', $data);
>         }
>
>         // this IS allowe

Re: Call a function right before execute any other function

2009-03-28 Thread brian

use AppController::beforeFilter()

On Fri, Mar 27, 2009 at 5:01 PM, Jason  wrote:
>
> Hi all,
>
> I'm writing a facebook app, using flash & PHP. I need to verify that
> the flash is called inside facebook, therefore I need to call a
> function verify() in PHP which do something to verify that the request
> is legit. I don't want to use
>
> if ($this->verify()) {
> //do stuff
> }
>
> for every single version. I believe I need to change something in the
> core of CakePHP but don't know where to begin. Anyone who familiar
> with the core could help me?
>
> Thanks,
> Jason
>
> >
>

--~--~-~--~~~---~--~~
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: Help! How to order by created desc with findAllByName( ) method

2009-03-28 Thread JamesF

when i first started cakephp i used the findby methods because they
seemed intuitive. find 'all' seems to be much more flexible and i use
that instead on most queries.

On Mar 27, 4:00 pm, cpeele  wrote:
> Hey guys,
>
> I am trying to just get a list of Products ordered by created desc but
> I can't seem to get it.
>
> Products have a "name" field so I am using findAllByName($name). I
> have tried various things but can't seem to get it.
>
> Any help would be greatly appreciated. Thanks!
> 
>         function view($name)
>         {
>                 $projects = $this->Project->findAllByName($name);
>                 $this->set('projects', $projects);
>                 $this->set('projectName', $name);
>         }
> -
--~--~-~--~~~---~--~~
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: Building a nearly 100% AJAX app - questions

2009-03-28 Thread logout

Thanks a lot for the answer :)  By the way, your stories (in your
personal site) became part of my guides through the web programming
jungle. And the disign rocks! :)To be honest, I will hardly find much
time to study any other tool. I want to stick with Cake because of its
very consistent logic and ease of use, combined with the powerful way
to bind the app logic with the database. I am shure there are better
solutions for building an ajax app, but I intend to proove that I can
do one with Cake too... :) After all, this is my very first Web app.
The good news is that it will be a proprietary system and will be used
only by a few guys :) But the business model is kind of messy - 23
models so far. Anyway, I might stick to the Prototype.js for now...
(Hey, I used to build custom GUI apps for DOS a long time ago without
any framework to help, so a little glitch won't stop me at all :) )

On Mar 28, 6:01 am, mark_story  wrote:
> You're in for a long uphill battle :)  Ajax can get tricky and messy
> very quickly as you've found out, and you have to deal with cross
> browser issues.  So its not an easy fight by any means.  Both jQuery
> and Prototype are good libraries and they offer much of the same
> features. Its really a matter of personal choice and what tool you
> think is going to work best for you.  The ajax helper is only intended
> as way to sprinkle some javascript into your application.  Attempting
> to build a large Javascript application with only the helper would be
> foolish. If you are feeling lost and without structure, perhaps find
> some more dynamic sites and pick apart their source.  Or look into
> client side MVC implementations like Jamal or JsMVC.  There are also
> extensive ui toolkits for dojo, YUI, and ExtJS which can help a lot as
> well.
>
> -Mark
>
> On Mar 27, 11:04 am, logout  wrote:
>
>
>
> > Hi, Bakers!
>
> > I've been digging in CakePHP over a month (I am new to PHP, SQL, CSS,
> > JavaScript, AXAJ, and almost whatever Web related programming You may
> > think of). In case you wander, I've been programming controllers in
> > pure C (some of you may heared of this ancient language).
>
> > So I had to read tons of electronic paper (oh, my poor eyes, and what
> > was that word 'pillow' standing for?)
>
> > But so far, so good. I had a lot of troubles (maybe I'll document them
> > some day) with making this AJAX thing to work properly and to find
> > ways to make my app look like and behave as a desktop one.
>
> > So I have one BIG question: should I stick with the Prototype library,
> > or should I invest some more time in mastering the jQuery and use it
> > instead? Prototype does the job for now, but I "hear" that jQuery is
> > simpler and more convenient to use. I must decide quickly, because the
> > clock is ticking and I have an application to build. The Ajax Helper
> > is helpful, but I guess not enough, according to some people.
>
> > Also, I want to ask if there is a better way to "tickle" the fields of
> > a form (i.e. to modify their content/value and properties after an
> > ajax request) than to return javascript by the view (which script is
> > "thrown away" after its evaluation/execution). I still use the MVC
> > paradigm for the job, but I need to set values and properties
> > dynamicly in the form, preserving the form's actual view and data
> > (with the ability to use the embeded validation mechanism, provided by
> > the model) until final submition.
> > What I mean is populating a "combo" with options based on the choice
> > made in another "combo", enableing other fields when it is time for
> > them to be used, inserting other items in a list and evaluating some
> > totals to be put in some input fields automatically. And some choices
> > made should be validated at submission (like checking for empty
> > fields, for example). Also I don't want to do extra quering the
> > database and rendering the form over and over at every change, keeping
> > track of the work done so far (what's the point in doing ajax requests
> > then?).
>
> > So, as we know, putting logic in the view is a bad thing, but how you
> > execute dynamic scripts, if they are not in the returned content? And
> > by dynamac I mean script, that will do it's job after the ajax call
> > and then vanish into oblivion.
>
> > Or am I just too confused with this soup of technologies, trying to
> > consolidate them in the context of Cake... The next month or so my
> > life will still suck a lot.
>
> > P.S. Why there is a word "nearly" in the caption? Because only the
> > login form is not ajaxed, and the logged user/admin is redirected to
> > the main view. Everything else is happening in that main view.
>
> > P.S.S. Sorry for the long post...- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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 unsubscri

Cake PHP 1.2 - Need Help For Posting Mulitple Checkboxes

2009-03-28 Thread keyurvaghani

Hello Friends,

I am keyur vaghani and working on cake php 1.2.

Please help me out from following issue on cake php 1.2 related to
post values of selected multiple check boxes.

I want to list multiple check boxes with same name on different rows
and post its values as array with selected (checked) check boxes, but
it couldn't and only get post value as last selected control check box
element value.

Because It will generate auto hidden element with each different row
check box control and here the original check box control name is
generated with array and it is correct like [Model][fieldname][] but
it couldn't generate this array name of hidden control that's why i am
facing major trouble while posting.

for example,
" Test Check Box Option1");
e($form->select('ProfilePermissionsMaster.permission',
$options,NULL,array('multiple'=> 'checkbox' , 'separator'=>' 
','value'=>'1')));

$options2=array(1=>" Test Check Box Option2");
e($form->select('ProfilePermissionsMaster.permission',
$options2,NULL,array('multiple'= >'checkbox' , 'separator'=>' 
','value'=>'2')));

$options3=array(1=>" Test Check Box Option3");
e($form->select('ProfilePermissionsMaster.permission',
$options,NULL,array('multiple'=> 'checkbox' , 'separator'=>' 
','value'=>'3')));

?>

It want post values like as below, but couln't get it ??

Array( [ProfilePermissionsMaster] =>Array(

[permission] => Array
(
[0] => 1
[1] => 2
[2] => 3
)


)

)

as well as when ever i set value attribute, it will display checked
check box why?

Thanks and Regards,
Keyur.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cake PHP 1.2 - Need Help For Posting Mulitple Checkboxes

2009-03-28 Thread keyurvaghani

Hello Friends,

I am keyur vaghani and working on cake php 1.2.

Please help me out from following issue on cake php 1.2 related to
post values of selected multiple check boxes.

I want to list multiple check boxes with same name on different rows
and post its values as array with selected (checked) check boxes, but
it couldn't and only get post value as last selected control check box
element value.

Because It will generate auto hidden element with each different row
check box control and here the original check box control name is
generated with array and it is correct like [Model][fieldname][] but
it couldn't generate this array name of hidden control that's why i am
facing major trouble while posting.

for example,
" Test Check Box Option1");
e($form->select('ProfilePermissionsMaster.permission',
$options,NULL,array('multiple'=> 'checkbox' , 'separator'=>' 
','value'=>'1')));

$options2=array(1=>" Test Check Box Option2");
e($form->select('ProfilePermissionsMaster.permission',
$options2,NULL,array('multiple'= >'checkbox' , 'separator'=>' 
','value'=>'2')));

$options3=array(1=>" Test Check Box Option3");
e($form->select('ProfilePermissionsMaster.permission',
$options,NULL,array('multiple'=> 'checkbox' , 'separator'=>' 
','value'=>'3')));

?>

It want post values like as below, but couln't get it ??

Array( [ProfilePermissionsMaster] =>Array(

[permission] => Array
(
[0] => 1
[1] => 2
[2] => 3
)


)

)

as well as when ever i set value attribute, it will display checked
check box why?

Thanks and Regards,
Keyur.

--~--~-~--~~~---~--~~
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: Simple Auth Login System (Code Included) -- Need Tips

2009-03-28 Thread Miles J

This should be in your AppController beforeFilter(): $this->Auth-
>loginRedirect = array('controller' => 'users', 'action' => 'cms');
Also what is $Auth, and where is it coming from?

http://www.milesj.me/blog/read/5/using-cakephps-auth-component
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



getSelectionId error

2009-03-28 Thread misterjinx

Hello all,

I'm building a search form using the autocomplete helper. i'm doing
the search after some text and everithing is working fine, but i want
the input element, on submit, to submit the id of the specific text
element from the databse. i found here an example to add
afterUpdateElement => getSelectionId, in the options array of the
autocomplete method. then i define this function to get the id of the
li element and transmit it to the input text, but i'm still getting an
error, telling me getSelectionId function is not defined. here's the
code:


autoComplete
( 'Contact.lastname', array( 'controller' => 'contacts', 'action' =>
'autoCompleteByName' ), array( 'afterUpdateElement' =>
'getSelectionId' ) ); ?>



   function getSelectionId(text, li) {
alert (li.id);
document.getElementById('ContactLastname').value=li.id;
}



i don' know what's the problem and i can't find anything in the
manual. does anyone sees the problem?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---