Re: How can I modify fields on different rows with one form.

2007-01-01 Thread simacole


Thanks a lot, I have a rought idea of what i need to do. I presume from
this that I can't use the html checkbox helper to generate the checkbox
ids?

On Jan 2, 2:02 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:

I haven't done multi-row edit forms in Cake, but I've done them in
ordinary PHP procedural code. What you have to do is create a form
which displays all the rows you want to see at one time, with 
fields for the values you want to be editable. This is much like the
ordinary list view generated by bake, but with some of the output
values replaced by input fields.

The PHP code for all this turns out to be somewhat tedious. I'd love to
have bake generate it all for me!

Anyway, what follows would typically be generated by your PHP code, but
for these examples I am just supplying the html. I would appreciate any
corrections to the inevitable mistakes I will now proceed to make.

Take a look at the organization of an ordinary single-value Edit form
and its controller function, as generated by bake. Our multi-row
controller will be a variant of that concept. For a single-row zipcode
entry form for the customers table, we might have this:


Enter your Zipcode: 



PHP passes the input value $zipcode to the controller as part of the
$_POST array, but the Cake library helps even more by and arranging the
data so that the controller just has to do this:

if($this->Customer->save($this->data)) {
  $this->Session->setFlash('Your new customer information has been
saved');

}But to input three rows of zipcodes, going back to the form, we would
have this:


Mr. Smith's Zipcode: 
Ms. Parta's Zipcode: 
Mr. Archer's Zipcode: 


In a multi-row controller, instead of saving one zipcode value in one
database row, we have to save three zipcode values in three database
rows. That means calling save() three times with three different
primary keys of the customers table.

Therefore we should pass those primary keys in corresponding array
positions, so that the controller will know in which row to store each
value. Suppose that the primary keys for customers Smith, Parta and
Archer are 1017, 1035, and 1050.



Mr. Smith's Zipcode: 


Ms. Parta's Zipcode: 


Mr. Archer's Zipcode: 


I know it looks peculiar to have a field called, say, "zipcode[1]" or
"id[2]", but PHP is smart and will use those names to create an array
$zipcode and an array $id, containing the entered values, in the
correct array locations.

After the user clicks OK, PHP hands your controller the $zipcode[]
array and the $id[] array as part of the $_POST[] array. Your
controller code then has to save each zipcode value from the $zipcode[]
array into the database row specified by the $id[] array. For example,
the value entered for $zipcode[2] goes with the database row whose id
is $id[2], that is, 1035.

So your multi-row controller can't just have this:

$this->Customer->save($this->data)

Instead the controller has to do three separate saves, with the data
prepared correctly for each save. I won't try to write the controller
code here, but I hope the above gives the basic idea of how to make it
work. Probably there is a way to combine all the rows of the id[] and
zipcode[] arrays, and then just call save() one time, but I don't know
how to do it.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Translation per plugin

2007-01-01 Thread Larry E. Masters aka PhpNut

I have not implemented this yet, but see if there is a ticket on the trac
site for it, and if not add an enhancement ticket.

--
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Translation per plugin

2007-01-01 Thread 2000Man


Anyone knows if this is already possible with Cake 1.2?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using ACL to limit access to data

2007-01-01 Thread Dr. Tarique Sani


On 1/2/07, Langdon Stevenson <[EMAIL PROTECTED]> wrote:

This implies heavily that limiting the number of Acos is the key.  Can
you give an example of how a user may accumulate large numbers of Acos?


Yes, if you see to my previous example - getting in findAll* which
pictures/albums/categories a user is allowed to see (depending which
group she belongs to) you will soon have a large number of ACOs


I think that you are probably right.  The question then becomes: is this
a problem?  If so, why is it a problem?


The problem for me is what would be a DRY way to do this. I very
easily can do it the usual way by adding criteria to findAll or even
some funky bindModel stuff, but this way there is access restriction
code in almost every controller / model.

This for a large project soon gets to be P2C2E (Process too
Complicated to Explain) unless explained in great details at every
step.

May be it needs inversion of approach to solve it

Cheers
Tarique

--
=
PHP Applications for E-Biz: http://www.sanisoft.com
Cheesecake-Photoblog: http://cheesecake-photoblog.org
=

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using ACL to limit access to data

2007-01-01 Thread Langdon Stevenson


Hi Tarique


This would mean no need to query Acos for findAll queries, other than at
login (at which time you select all of their Acos and store them in a
session or cache).


We will very quickly run out of memory if session is kept in memory,
if not reading large number of ACOs from cache/file based session
would be *almost* just as expensive as queries from a database.


This implies heavily that limiting the number of Acos is the key.  Can 
you give an example of how a user may accumulate large numbers of Acos? 
  (Other than a "superuser" who would logically have access to everything


I ask this not to be argumentative, only to try to get a better 
understanding of the issue.  I may well be facing the same problems as 
you, only I haven't realised it yet! :-)




After that it is just a matter of limiting the
number of Acos included in an IN () clause to a reasonable number,
possibly based on model type, or some other criteria.


As soon as we introduce 'some other criteria' the solution becomes app
specific. I am getting more and more inclined to believe that access
restriction to data will always have to be based on app specific
criteria.


I think that you are probably right.  The question then becomes: is this 
a problem?  If so, why is it a problem?


Are you intending for your Cake app to share its security data with 
other applications?  If your application essentially stands alone, then 
surely it won't matter if its Acos are application specific?


Regards,
Langdon

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Reverse recursive findAllThreaded queries?

2007-01-01 Thread gremlin


gwoo that is the model I used. Nothing I have found works to lookup the
id of a category  when the category tree is passed via the url as
params. The function crazylegs wrote is logically sound but why would I
execute N queries to get to the id only to use it to do lookups against
other tables?

Just to clarify the logic is all in the model. The controller is only
calling the model function and passing the params in.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How can I modify fields on different rows with one form.

2007-01-01 Thread [EMAIL PROTECTED]


I haven't done multi-row edit forms in Cake, but I've done them in
ordinary PHP procedural code. What you have to do is create a form
which displays all the rows you want to see at one time, with 
fields for the values you want to be editable. This is much like the
ordinary list view generated by bake, but with some of the output
values replaced by input fields.

The PHP code for all this turns out to be somewhat tedious. I'd love to
have bake generate it all for me!

Anyway, what follows would typically be generated by your PHP code, but
for these examples I am just supplying the html. I would appreciate any
corrections to the inevitable mistakes I will now proceed to make.

Take a look at the organization of an ordinary single-value Edit form
and its controller function, as generated by bake. Our multi-row
controller will be a variant of that concept. For a single-row zipcode
entry form for the customers table, we might have this:


Enter your Zipcode: 



PHP passes the input value $zipcode to the controller as part of the
$_POST array, but the Cake library helps even more by and arranging the
data so that the controller just has to do this:

if($this->Customer->save($this->data)) {
 $this->Session->setFlash('Your new customer information has been
saved');
}

But to input three rows of zipcodes, going back to the form, we would
have this:


Mr. Smith's Zipcode: 
Ms. Parta's Zipcode: 
Mr. Archer's Zipcode: 


In a multi-row controller, instead of saving one zipcode value in one
database row, we have to save three zipcode values in three database
rows. That means calling save() three times with three different
primary keys of the customers table.

Therefore we should pass those primary keys in corresponding array
positions, so that the controller will know in which row to store each
value. Suppose that the primary keys for customers Smith, Parta and
Archer are 1017, 1035, and 1050.



Mr. Smith's Zipcode: 


Ms. Parta's Zipcode: 


Mr. Archer's Zipcode: 


I know it looks peculiar to have a field called, say, "zipcode[1]" or
"id[2]", but PHP is smart and will use those names to create an array
$zipcode and an array $id, containing the entered values, in the
correct array locations.

After the user clicks OK, PHP hands your controller the $zipcode[]
array and the $id[] array as part of the $_POST[] array. Your
controller code then has to save each zipcode value from the $zipcode[]
array into the database row specified by the $id[] array. For example,
the value entered for $zipcode[2] goes with the database row whose id
is $id[2], that is, 1035.

So your multi-row controller can't just have this:

$this->Customer->save($this->data)

Instead the controller has to do three separate saves, with the data
prepared correctly for each save. I won't try to write the controller
code here, but I hope the above gives the basic idea of how to make it
work. Probably there is a way to combine all the rows of the id[] and
zipcode[] arrays, and then just call save() one time, but I don't know
how to do it.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using ACL to limit access to data

2007-01-01 Thread Dr. Tarique Sani


On 1/1/07, Langdon Stevenson <[EMAIL PROTECTED]> wrote:

This would mean no need to query Acos for findAll queries, other than at
login (at which time you select all of their Acos and store them in a
session or cache).


We will very quickly run out of memory if session is kept in memory,
if not reading large number of ACOs from cache/file based session
would be *almost* just as expensive as queries from a database.


After that it is just a matter of limiting the
number of Acos included in an IN () clause to a reasonable number,
possibly based on model type, or some other criteria.


As soon as we introduce 'some other criteria' the solution becomes app
specific. I am getting more and more inclined to believe that access
restriction to data will always have to be based on app specific
criteria.

Can anyone tell if the newly introduced Behaviours in 1.2 would be
helpful in this regard?

Cheers
Tarique

--
=
PHP Applications for E-Biz: http://www.sanisoft.com
Cheesecake-Photoblog: http://cheesecake-photoblog.org
=

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: How can I modify fields on different rows with one form.

2007-01-01 Thread Mariano Iglesias


Just check which of those checkboxes have been checked, and for those which
weren't unset the appropriate $this->data field before calling
model->save(). For example if you have a checkbox named Post/check_title to
allow user to specify if the field Post/title should be saved then it should
be something like:

if (!empty($this->data))
{
if (!isset($this->data['Post']['check_title']) ||
$this->data['Post']['check_title'] != 1)
{
unset($this->data['Post']['title']);
}

// Some more...

$this->Post->save($this->data);
}

This way only checked fields will be sent to save(). Beware of mandatory
field validation, though.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 


BAKE ON!


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de simacole
Enviado el: Lunes, 01 de Enero de 2007 11:16 p.m.
Para: Cake PHP
Asunto: How can I modify fields on different rows with one form.


A complete NewB question here. In a lot of the basic tutorials there
are examples of forms that modify one record in a database table.
However, what I can't see to get my brain around is how, using the html
checkbox helper, I can create a form that allows me to modify one field
on different rows. Basically, the user should be able to click
checkboxes in a single view and on submit have them update the fields
in the respective rows on the database.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to do arguments before Controller/Action in a URL?

2007-01-01 Thread [EMAIL PROTECTED]


I have a site that has different sections and I want to make them
appear like different sections, but use the same controllers and
actions. For example, I have this site...

http://www.forumsite.com/

with the sample controllers and actions...

http://www.forumsite.com/posts/view/
http://www.forumsite.com/users/view/

But, I want to have different sections using an argument that every
controller has access to like this:

http://www.forumsite.com/cars/posts/view/
http://www.forumsite.com/comicbooks/posts/view/
http://www.forumsite.com/programming/posts/view/

Is this possible with custom routes? ...or something else?

Thanks in advance!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: New to Cake, Missing View Errors (?)

2007-01-01 Thread Derrick Shields


I figured it out.

A reference for anyone who runs into this error in the future:

I had to change the permissions on the view.php file located in the
/cake core to 755.  For some reason, the version of Cake I had
downloaded had the incorrect permissions set.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



CakePHP programming problem

2007-01-01 Thread PHPBABY3


Hello,

I know how to program in PHP and am trying to learn CakePHP.  Here is a
small project that I need to do that is representative.

1. Create a button that will appear on all pages in the application at
a particular location using CSS, and that does as follows.

2. Read 2 fields CHOICE and FIND.
  a. The top one, CHOICE, is a drop-down list with the same 16 choices
each time.
Function ddlits() returns the list of 16 literal values that are
displayed.
  b. The bottom one FIND is a text field with no default, so it is
blank initially.

3. By special rules used only here, we translate (2) into a list of
(Query#,SQL Query) pairs.
Function qrz($choice,$find) = list of ($qnm,$sqry) pairs of Query# and
Query.

4. Execute (3) and accumulate the results into []=(Query#,Tuple).  That
is, we have a function runsql($sqry) = list of tuples returned by query
$sqry.

5. Translate (Query#,Tuple) => (Display,URL) by function
qtdis($qnm,$tuple)=($display,$url) to create a list of links to
display.

6. Display the (Display,URL) pairs as links.

Can someone tell me how to implement this in CakePHP?  Please be
explicit: I have to write what and store it where and do what to get
the button to appear on the existing pages?

Thanks,

Peter


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How can I modify fields on different rows with one form.

2007-01-01 Thread simacole


A complete NewB question here. In a lot of the basic tutorials there
are examples of forms that modify one record in a database table.
However, what I can't see to get my brain around is how, using the html
checkbox helper, I can create a form that allows me to modify one field
on different rows. Basically, the user should be able to click
checkboxes in a single view and on submit have them update the fields
in the respective rows on the database.

If there is an easy way to do this I would be grateful if someone could
point me in the right direction.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using requireAuth and requirePost

2007-01-01 Thread [EMAIL PROTECTED]


I figured it out,

I was inheriting the Security component from my custom AppController.
It seems if you inherit it that way in your subclass, the auth code
generated differs from the one in the session.
I added Security into my subclassed controller's component list and it
worked fine.

Michael

On Jan 1, 4:47 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

It seems like I'm over complicating using requireAuth/RequirePost, and
I can't get it to work the way I expect.

I would like to use one action, instead of two, to display the form and
actually save the data.

Here's my code:

function beforeFilter()
{
switch ($this->action)
{
case 'admin_add':
if ($this->data)
{
pr($this->data);
pr($this->Session->read('_Token'));

$this->Security->requireAuth('admin_add');

$this->Security->requirePost('admin_add');
}
break;
}
}

It craps on requireAuth, but requirePost works fine. The key generated
in the form doesn't match the one in the session. I assume thats why it
doesn't work.

Here's the output

Array
(
[_Token] => Array
(
[key] => fc55e5fc21f9c3811957c917adce50c722b97f1d
)

[Zone] => Array
(
[name] => Blah
[comment] => Blah blah
)

)

Array
(
[key] => 777e318608c817c385d09ed1528d1b69322d4c12
[expires] => 1167691891
[allowedControllers] => Array
(
)

[allowedActions] => Array
(
)

)

Please educate me.

Michael



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: mysql my.cnf utf8 directives not working for cakephp

2007-01-01 Thread rdoggsv


Problem solved adding character_set_client=utf8 to the my.cnf so it
looks like this

.
#utf8
init-connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_spanish_ci
character_set_client=utf8
.

running centos 4.4 with stock mysql-server apache and php.

Thank you


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Can CakePHP do this?

2007-01-01 Thread Mariano Iglesias


Cakesheet should be:

http://cakephp.org/files/cakesheet.pdf

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 


BAKE ON!


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de gwoo
Enviado el: Lunes, 01 de Enero de 2007 07:59 p.m.
Para: Cake PHP
Asunto: Re: Can CakePHP do this?

am() is a basic Cake function.

Download the CakeSheet
http://cakephp.org/cakesheet.pdf


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can CakePHP do this?

2007-01-01 Thread skyblueink


Thanks, nate & gwoo!! It works!

By the way, please replace my Model with the next correction to run the
example code. I made a mistake.




On 1 2 ,   7 59 , "gwoo" <[EMAIL PROTECTED]> wrote:

am() is a basic Cake function.

Download the CakeSheethttp://cakephp.org/cakesheet.pdf
or
Get a life sized poster of the CakeSheethttp://www.cafepress.com/cakefoundation



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can CakePHP do this?

2007-01-01 Thread gwoo


am() is a basic Cake function.

Download the CakeSheet
http://cakephp.org/cakesheet.pdf
or
Get a life sized poster of the CakeSheet
http://www.cafepress.com/cakefoundation


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can CakePHP do this?

2007-01-01 Thread skyblueink


Thanks, nate!
But what is 'am'
in $result = am($result, $this->Test->myfunction($i)); ?

Is it a PHP function or a CakePHP function (I can't figure out right
now)?


On 1 2 ,   6 23 , "nate" <[EMAIL PROTECTED]> wrote:

The problem is in pass().  If you keep set()ting a variable of the same
name, you're just going to overwrite the previous value.

  function pass() {
$result = array();
for ($i = 1; $i <= 3; $i++) {
   $result = am($result, $this->Test->myfunction($i));
}
$this->set('result',$result);
  }



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Using requireAuth and requirePost

2007-01-01 Thread [EMAIL PROTECTED]


It seems like I'm over complicating using requireAuth/RequirePost, and
I can't get it to work the way I expect.

I would like to use one action, instead of two, to display the form and
actually save the data.

Here's my code:

function beforeFilter()
{
switch ($this->action)
{
case 'admin_add':
if ($this->data)
{
pr($this->data);
pr($this->Session->read('_Token'));

$this->Security->requireAuth('admin_add');

$this->Security->requirePost('admin_add');
}
break;
}
}

It craps on requireAuth, but requirePost works fine. The key generated
in the form doesn't match the one in the session. I assume thats why it
doesn't work.

Here's the output

Array
(
   [_Token] => Array
   (
   [key] => fc55e5fc21f9c3811957c917adce50c722b97f1d
   )

   [Zone] => Array
   (
   [name] => Blah
   [comment] => Blah blah
   )

)

Array
(
   [key] => 777e318608c817c385d09ed1528d1b69322d4c12
   [expires] => 1167691891
   [allowedControllers] => Array
   (
   )

   [allowedActions] => Array
   (
   )

)

Please educate me.


Michael


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



mysql my.cnf utf8 directives not working for cakephp

2007-01-01 Thread rdoggsv


hello everyone , im having some weird problems going on with utf8 and
cakephp.

I have access to the my.cnf mysql configuration file and i have it like
this

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
#utf8
init-connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_general_ci
[mysql.server]
user=mysql
basedir=/var/lib
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

But even with the utf8 directives my pages are not showing up
correclty, i need to put

function __construct()
   {
   $this->execute("SET NAMES 'utf8'");
   parent::__construct();
   }

Inside the app_model for it to start working correctly, but i would
really like to use the mysql directives to get it working.

# mysqladmin variables | grep character
| character_set_client| utf8
  |
| character_set_connection| utf8
  |
| character_set_database  | utf8
  |
| character_set_results   | utf8
  |
| character_set_server| utf8
  |
| character_set_system| utf8
  |
| character_sets_dir  | /usr/share/mysql/charsets/
  |

# mysqladmin variables | grep collation
| collation_connection| utf8_general_ci
  |
| collation_database  | utf8_general_ci
  |
| collation_server| utf8_general_ci
  |

Can someone help me to understand what im missing :S

Thank you


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can CakePHP do this?

2007-01-01 Thread nate


The problem is in pass().  If you keep set()ting a variable of the same
name, you're just going to overwrite the previous value.

 function pass() {
   $result = array();
   for ($i = 1; $i <= 3; $i++) {
  $result = am($result, $this->Test->myfunction($i));
   } 
   $this->set('result',$result);

 }


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: New to Cake, Missing View Errors (?)

2007-01-01 Thread skyblueink


If you're following along with the blog tutorial withoit any
modifications of the example code, your intex.thtml and view.thtml
should be in app/views/posts/ instead of app/views/pages/. The error
message is already saying that ithey shoud be in
/.../httpdocs/app/views/posts/. As you know, Cake is
folder-name-critical and file-name-critical.

On 1 1 ,   1 08 , "Derrick Shields"
<[EMAIL PROTECTED]> wrote:

In case it helps anyone pondering this, I have copied the index.thtml
and view.thtml to the app/views/pages/ folder, and CakePHP CAN access
the pages now at mysite.com/pages/index (or /view) however obviously
this won't load the controller, etc...

Any ideas on why the two pages won't load in the views/posts directory?



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Can CakePHP do this?

2007-01-01 Thread skyblueink


-test.php includes next lines.


-tests_controller.php includes next lines.

Test->myfunction($i);
  $this->set('result',$result);
   }
 }

}
?>


-And, pass.thtml includes next lines.

";
}
?>

The run cakephp/tests/php gives only "colors":

red
blue
green

But, what I want is to get all of the fruits, animals, and colors as an
output:

lemon
banana
apple
lion
tiger
monkey
red
blue
green

Of course I could increase the dimension of $result array like
$result[$i][] and throw the whole information into the
View(pass.thtml). But as you know, the above code is a simple example
demonstrating my problem, and in real life it take much more time to
execute myfunction(scrapes and extracts other web pages) for the whole
run of $i. So I want to throw each $result for each $i "on the fly"
without collecting all the fruits, animals, and colors. As soon as
collecting fruits are done (the run for $i=1), fruits are listed on the
screen, and as soon as animals are collected($i=2), the animal array is
sent to View and so on.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: usage of the new validation class in 1.2.x.x.

2007-01-01 Thread gabordemeter


Thanks Nate!

The previous days I looked a bit into this and came to the conclusion
that I would like to be able to display several errors for each form
field (i.e. if the username is both using non-alphanumeric characters
as well as having more than the allowed limit of chars I would like to
see both error images displayed below my message).

The solution I found was as follows:

1) In app_model.php I now have:

class AppModel extends Model{

var $validate;

function __construct()
{
$this->validate = new Validation();
parent::__construct();
}
}

2) In my model I have something like:

function beforeValidate()
{
if 
(!$this->validate->alphaNumeric($this->data['User']['username']))
$this->invalidate('username_alphanumeric');
if
(!$this->validate->someOtherFunction($this->data['User']['username']))
$this->invalidate('username_someOtherFunction');
if ($this->validate->blank($this->data['User']['password']))
$this->invalidate('password_blank');
}

3) In  my view I have:

input('User/username', array('class'=>'signup')); ?>
tagErrorMsg('User/username_alphanumeric', 'Username
must be alphanumeric.') ?>
tagErrorMsg('User/username_blank', 'Username cannot
be someOtherFunction.') ?>

password('User/password', array('class'=>'signup'));
?>
tagErrorMsg('User/password_blank', 'Please choose a
password.') ?>

Btw, I just read the excellent article on your blog explaining the new
automagic in the form helper and will convert the above inputs to it
soon.



Ok, so is the above the right way to do what I'm trying to do? Or is
there a simpler or better way to achieve it?



Also, if I do it like the above, the entire validation happens in
beforeValidate() and I will therefore not have anything in $validate. I
would however want to do the following:

If my beforeValidate logic will invalidate one or more fields (so there
exists at least one validation error), besides displaying the
respective error messages for each field like I did above, I would also
like to have a generic message at the top of my form saying something
like "there were errors in you form...please scroll down to see
them...blah blah".

How should I do this? I tried:

   function beforeValidate()
{
if 
(!$this->validate->alphaNumeric($this->data['User']['username']))
$this->invalidate('username_alphanumeric');
if
(!$this->validate->someOtherFunction($this->data['User']['username']))
$this->invalidate('username_someOtherFunction');
if ($this->validate->blank($this->data['User']['password']))
$this->invalidate('password_blank');

   $abc = "there were errors in you form...please scroll
down to see them...blah blah";
if ($this->validationErrors) $this->set('message', $abc);
}

The above did not work. Not sure if i can $this->set() from inside a
model. If not, how can I do it?


Thanks again for your previous reply!











On Jan 1, 12:35 pm, "nate" <[EMAIL PROTECTED]> wrote:

Right now, the only way to use the new Validation class is to write
your rules like this:

var $validate = array('username' => array('rule' => 'alphaNumeric'));

You can specify other rules as follows:

'rule' => array('between', $min, $max)

'rule' => array('blank')

'rule' => array('cc', $type, $deep)
Where $type can be 'fast' (a basic check that covers all card types) or
'all' (check all cards) or an array of one or more of the following:
'amex', 'bankcard', 'diners', disc', 'electron', 'enroute', 'jcb',
'maestro', 'mc', 'solo', 'switch', 'visa' or 'voyager'.

'rule' => array('comparison', $operator, $compare)
$operator may be one of the following: 'isgreater', 'isless',
'greaterorequal', 'lessorequal', 'equalto', 'notequal', or, their
symbol equivalents: '>', '<', '>=', '<=', '==', '!='.

'rule' => array('custom', $regex)
Where $regex is a custom regular expression.

'rule' => array('date', $format)
Where $format is one of the following: 'dmy', 'mdy', 'ymd', 'dMy',
'Mdy', 'My', 'my'.  $format can also be an array containing mulitple
values.

'rule' => array('decimal', $precision)
Checks that the input is a decimal number with $precision places after
the decimal point.

'rule' => array('email', $deep)
If $deep is true, the email address will be checked for a valid host
name.

'rule' => array('minLength', $min)

'rule' => array('maxLength', $max)

'rule' => array('numeric')

'rule' => array('postal')

'rule' => array('ssn')

'rule' => array('url')

Those are the rules in a nutshell, although more will be added shortly.
 Most of them should be pretty self-explanatory.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send e

Re: usage of the new validation class in 1.2.x.x.

2007-01-01 Thread nate


Right now, the only way to use the new Validation class is to write
your rules like this:

var $validate = array('username' => array('rule' => 'alphaNumeric'));

You can specify other rules as follows:

'rule' => array('between', $min, $max)

'rule' => array('blank')

'rule' => array('cc', $type, $deep)
Where $type can be 'fast' (a basic check that covers all card types) or
'all' (check all cards) or an array of one or more of the following:
'amex', 'bankcard', 'diners', disc', 'electron', 'enroute', 'jcb',
'maestro', 'mc', 'solo', 'switch', 'visa' or 'voyager'.

'rule' => array('comparison', $operator, $compare)
$operator may be one of the following: 'isgreater', 'isless',
'greaterorequal', 'lessorequal', 'equalto', 'notequal', or, their
symbol equivalents: '>', '<', '>=', '<=', '==', '!='.

'rule' => array('custom', $regex)
Where $regex is a custom regular expression.

'rule' => array('date', $format)
Where $format is one of the following: 'dmy', 'mdy', 'ymd', 'dMy',
'Mdy', 'My', 'my'.  $format can also be an array containing mulitple
values.

'rule' => array('decimal', $precision)
Checks that the input is a decimal number with $precision places after
the decimal point.

'rule' => array('email', $deep)
If $deep is true, the email address will be checked for a valid host
name.

'rule' => array('minLength', $min)

'rule' => array('maxLength', $max)

'rule' => array('numeric')

'rule' => array('postal')

'rule' => array('ssn')

'rule' => array('url')

Those are the rules in a nutshell, although more will be added shortly.
Most of them should be pretty self-explanatory.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Filtering associations with attributes from another table

2007-01-01 Thread SuperBFG7


Hi,

I have a couple of tables which are not related through primary keys
and I don't know if and how I can get CakePHP to understand this
relation.

I have these tables:

Orders: id, item_id, itemtype_id, quantity
Items: id, name, colors
Itemtypes: id, name
Prices: id, itemtype_id, colors, price

As you can see the price depends on the item type and the colors and
therefore Prices combines Itemtypes (via itemtype_id) and Items (via
colors). I can easily associate prices with either of these 2 tables
with a belongsTo/hasOne/hasMany relation. But what I want is
associating Prices with Orders.

I can associate Items and Itemtypes with orders directly and would like
to use (pseudeoproperties) Orders.itemtype_id and Orders.item_id.colors
to get the matching row in Prices (there's only one).

Is there a way to do this?
Any help appreciated!

-- Daniel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Bake not baking Controllers

2007-01-01 Thread Mark Garrigan


Cake Version: 1.1.12.4205

Bake shows no errors. Whether I choose to build the controller
interactively or not the controller doesn't get baked. Models are being
baked just fine. I can't, of course, bake any views cause there are not
controllers baked yet.

Any thoughts?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using ACL to limit access to data

2007-01-01 Thread Langdon Stevenson


Hi Tarique

Good example.


Let me give a real-life example. The largest known installation of
Coppermine Picture Gallery (an Open Source project that I lead) has
more than 3 million pictures and approx 100,000 users.

As long as all the pictures and albums were public this was not a big
problem. However Coppermine has a concept of user albums and private
albums and password protected albums which can be or cannot be seen by
public - the webmaster turned on the private albums feature and the
hell broke loose as the queries started including criteria like "aid
NOT IN (1,5,.. long list of aids) and the looping checks were
just too much.


I see the problem alright :-)  I guess that in that situation you are 
limited by the complexity of the Aco tree.  In my case I anticipate 
including business rules that minimise the list of Acos for a user.  It 
should really be possible to limit a user to just half a dozen Acos or 
so in any given situation.


One way of doing this is to only extract Acos that are related to the 
Model that is being queried.  This could be handled by naming 
conventions.  I already do this in fact by filtering out the ":data" 
Acos.  The idea was to avoid exactly that problem of overloading the query.




Coming to cakePHP perspective - I am currently wondering on how to
exclude certain records from model->findAll* calls using the current
ACL techniques. Actions which return or affect just one record will be
no big deal atleast for some time but as the ACOs increase (in the
above case 3 million +) performance will start to slow down even in
those cases.

That said I have to agree that example given by me is a rare one but
at the same time a very plausible one.


Absolutely.  I will argue that growth of Aco numbers can be dealt with 
though.  Firstly by the method mentioned above and secondly by caching 
of the Aco data for the user.


This would mean no need to query Acos for findAll queries, other than at 
login (at which time you select all of their Acos and store them in a 
session or cache).  After that it is just a matter of limiting the 
number of Acos included in an IN () clause to a reasonable number, 
possibly based on model type, or some other criteria.


Given that, I think that the design would scale well with both large 
numbers of users and records.


However I have never had to deal with a system that holds millions of 
records, so I may be wrong.  It would be very interesting to find out.


Regards,
Langdon












--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using ACL to limit access to data

2007-01-01 Thread Dr. Tarique Sani


On 1/1/07, Langdon Stevenson <[EMAIL PROTECTED]> wrote:


Can you elaborate on your requirements a little further?  Perhaps I am
missing something?


Let me give a real-life example. The largest known installation of
Coppermine Picture Gallery (an Open Source project that I lead) has
more than 3 million pictures and approx 100,000 users.

As long as all the pictures and albums were public this was not a big
problem. However Coppermine has a concept of user albums and private
albums and password protected albums which can be or cannot be seen by
public - the webmaster turned on the private albums feature and the
hell broke loose as the queries started including criteria like "aid
NOT IN (1,5,.. long list of aids) and the looping checks were
just too much.

Coming to cakePHP perspective - I am currently wondering on how to
exclude certain records from model->findAll* calls using the current
ACL techniques. Actions which return or affect just one record will be
no big deal atleast for some time but as the ACOs increase (in the
above case 3 million +) performance will start to slow down even in
those cases.

That said I have to agree that example given by me is a rare one but
at the same time a very plausible one.

Cheers
Tarique

--
=
PHP Applications for E-Biz: http://www.sanisoft.com
Cheesecake-Photoblog: http://cheesecake-photoblog.org
=

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using ACL to limit access to data

2007-01-01 Thread Langdon Stevenson


Hi Tarique


Nice implementation - which I am sure will fit very well where the
data structure is similar to the one you have, that is where data
belongs to groups.

Would love to hear more thoughts from more people - on access control
for data in a massively multi-user systems built using cakePHP


Interesting question.  I don't see a problem though with extending this 
system.  I would do so by adding an Aco for each user (effectively 
creating their own individual group) and using the same system of 
restriction.  Given caching, or session storage of the Aco/s there 
wouldn't be any performance issue, even if you were talking about 
hundreds of thousands of users.


Can you elaborate on your requirements a little further?  Perhaps I am 
missing something?


Regards,
Langdon


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using ACL to limit access to data

2007-01-01 Thread Dr. Tarique Sani


Nice implementation - which I am sure will fit very well where the
data structure is similar to the one you have, that is where data
belongs to groups.

Would love to hear more thoughts from more people - on access control
for data in a massively multi-user systems built using cakePHP

Cheers and happy new year

Tarique

On 1/1/07, Langdon Stevenson <[EMAIL PROTECTED]> wrote:


Ok, have a look at this :-)

Warning:
1. You need a solid understanding of ACL for this to make sense.

--
=
PHP Applications for E-Biz: http://www.sanisoft.com
Cheesecake-Photoblog: http://cheesecake-photoblog.org
=

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---