HTML Tidy Component

2011-12-01 Thread Thiago Belem
Folks,

I've just finished the HTML Tidy
Component,
it helps you to sanitize, clean and solve several HTML markup issues
automatically.

Just include it in your list of components you'll get a clean and valid
output.

I would like to hear from everyone, including suggestions for improvement
in the component and unit tests.

Regards,
--
***Thiago Belem*
Desenvolvedor
Rio de Janeiro - RJ - Brasil

+55 (21) 8865.9250
thiagobelem.net
cont...@thiagobelem.net

*Skype / gTalk **»* thiago.belem.web
*LinkedIn* *»* br.linkedin.com/in/thiagobelem/pt*
Assando Sites*, curso de CakePHP *»* assando-sites.com.br

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How to remove entries from two tables, from a controller delete() function

2011-12-01 Thread Tilen Majerle
no problem :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/12/2 GG 

> Wow, CakePhp is legit. Thank you Tilen Majerie.
>
> On Dec 1, 2:38 pm, Tilen Majerle  wrote:
> > http://book.cakephp.org/2.0/en/models/associations-linking-models-tog...
> > look
> > for hasMany association :)
> > --
> > Lep pozdrav, Tilen Majerlehttp://majerle.eu
> >
> > 2011/12/1 Tilen Majerle 
> >
> >
> >
> >
> >
> >
> >
> > > do you have associations created ?
> >
> > > you should have something like that
> >
> > > Class hasMany Period
> > > Class hasMany Post
> > > Period hasMany Post (add here assocation key "dependent" => true) //so
> > > this will delete all posts for given period_id when you delete some
> period
> > > where Post.period_id = Period.id
> >
> > > Period belongsTo Class
> > > Post belongsTo Class
> > > Post belongsTo Period
> >
> > > am i right ? :)
> >
> > > I hope you understand :)
> >
> > > --
> > > Lep pozdrav, Tilen Majerle
> > >http://majerle.eu
> >
> > > 2011/12/1 GG 
> >
> > >> Right now, my PeriodsController.php delete() function, deletes entries
> > >> in my periods table. (Not a problem).
> > >> My PostsController.php delete() function, deletes entries in my posts
> > >> table. (Also not a problem.)
> > >> (The problem) = I would like my PeriodsController.php delete(), to
> > >> also delete any posts (in my posts table), where they have a matching
> > >> period_id.
> >
> > >> ///Example: I am a teacher who has a science class. I post homework
> > >> under my science period. When I want go to delete the science class
> > >> period, I would like it to also delete all of the posts I made under
> > >> that class period...
> >
> > >> So..
> >
> > >> I have a periods table:
> >
> > >> period_id | title | user_id
> >
> > >> I also have a posts table:
> >
> > >>id | title | body | created | modified | user_id | period_id
> >
> > >> Here is my PeriodsController.php
> >
> > >> function delete($id) {
> > >>if (!$this->request->is('post')) {
> > >>throw new MethodNotAllowedException();
> > >>}
> >
> > >>if($this->isActionable($id)){
> > >>if ($this->Period->delete($id)) {
> > >>$this->Session->setFlash('Class successfully
> deleted.');
> > >>$this->redirect(array('controller' => 'posts',
> 'action' =>
> > >> 'index'));
> > >>}
> > >>} else {
> > >>$this->Session->setFlash('You cannot delete that
> > >> class.');
> > >>$this->redirect(array('controller' => 'posts',
> > >> 'action' =>
> > >> 'index'));
> > >>}
> > >>}
> >
> > >> Here is my PostsController.php
> >
> > >> function delete($id) {
> > >>if (!$this->request->is('post')) {
> > >>throw new MethodNotAllowedException();
> > >>}
> >
> > >>if($this->isActionable($id)){
> > >>if ($this->Post->delete($id)) {
> > >>$this->Session->setFlash('Post successfully deleted.');
> > >>$this->redirect(array('action' => 'index'));
> > >>}
> > >>} else {
> > >>$this->Session->setFlash('You cannot delete that
> > >> post.');
> > >>$this->redirect(array('action' => 'index'));
> > >>}
> > >>}
> >
> > >> Any help is greatly appreciated. Thanks!
> >
> > >> --
> > >> Our newest site for the community: CakePHP Video Tutorials
> > >>http://tv.cakephp.org
> > >> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > >> others with their CakePHP related questions.
> >
> > >> To unsubscribe from this group, send email to
> > >> cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > >> athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Same Old?

2011-12-01 Thread Larry E. Masters
http://cakedc.com/jobs

But please do not apply

Why are you looking specifically for CakePHP jobs anyway? If you know PHP look 
for a PHP position and then discuss using CakePHP as a platform. You may also 
be surprised at the number of positions in PHP development that will list 
CakePHP experience as a requirement, but not the only requirement. As a person 
who hires developers often I do not base my hiring on CakePHP experience alone.


Thank you,

--  
Larry E. Masters
Founder CakePHP
http://www.cakephp.org





On Wednesday, November 30, 2011 at 12:05 AM, Krissy Masters wrote:

>  
> Wondering why you look at Krop /  Craigslist/ Authentic Jobs no one wants 
> Cake?  
>  
>  
> 1 in 1000 jobs looks for Cake? Wonder why? Cake board with Cake or what ever 
> it is has zero new job offers?
>  
>  
>   
>  
>  
> Is there a reason? Same as before im going to get banned fron the Cake Board 
> fine, open a new account because you need people like me to support but just 
> don’t question right!  
>  
>  
> Drupal has 100 job offers, WordPress Developers / Designers…. Where is Cake?
>  
>  
> Why does no one want Cake?
>  
>  
>   
>  
>  
> There are zero companies looking for Cake developers if I am wrong show me 1 
> who is hiring!
>  
>  
>   
>  
>  
> K
>  
>  
>   
>  
>  
>   
>  
>  
>   
>  
>  
>  
> --  
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org  
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>   
>   
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com 
> (mailto:cake-php+unsubscr...@googlegroups.com) For more options, visit this 
> group at http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Same Old?

2011-12-01 Thread Dr. Tarique Sani
I have followed your previous rants and people have told you before.
You are comparing Apples to Oranges

Wordpress & Drupal are CMS which solve a specific problem - people who
have used them will want developers who are familiar with *that*
particular software. CakePHP does not solve 1 specific problem, it can
be used for almost anything - so from my point of view all those
1000's jobs who do not specify any particular software are potential
CakePHP jobs.


Also as far as Wordpress jobs are concerned most of them are low-end
"make my theme work" or "make me a theme" jobs

Drupal is a slightly better scene but just so...

Lastly - what is your point? Repeatedly posting will not change things
for you It is you who has to change, either adopt or find whatever
works for you

Cheers
Tarique

On Wed, Nov 30, 2011 at 11:35 AM, Krissy Masters
 wrote:
> Wondering why you look at Krop /  Craigslist/ Authentic Jobs no one wants
> Cake?
>
> 1 in 1000 jobs looks for Cake? Wonder why? Cake board with Cake or what ever
> it is has zero new job offers?
>
>
>
> Is there a reason? Same as before im going to get banned fron the Cake Board
> fine, open a new account because you need people like me to support but just
> don’t question right!
>
> Drupal has 100 job offers, WordPress Developers / Designers…. Where is Cake?
>
> Why does no one want Cake?
>
>
>
> There are zero companies looking for Cake developers if I am wrong show me 1
> who is hiring!
>
>
>
> K
>
>
>
>
>
>
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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



-- 
=
PHP for E-Biz: http://sanisoft.com
=

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Same Old?

2011-12-01 Thread John Hardy
perhaps all the positions are filled.

at my company, we use cake.

would you want a job working on drupal modules anyway?!? yuk!

and wordpress? leave that for the rookies. we build web apps ;)

Perhaps you need to search for 'MVC'

show your mastery of the meta-pattern and transition everything to cake :)

Sent from my iPhone

On Nov 29, 2011, at 10:05 PM, "Krissy Masters"  
wrote:

> Wondering why you look at Krop /  Craigslist/ Authentic Jobs no one wants 
> Cake?
> 1 in 1000 jobs looks for Cake? Wonder why? Cake board with Cake or what ever 
> it is has zero new job offers?
>  
> Is there a reason? Same as before im going to get banned fron the Cake Board 
> fine, open a new account because you need people like me to support but just 
> don’t question right!
> Drupal has 100 job offers, WordPress Developers / Designers…. Where is Cake?
> Why does no one want Cake?
>  
> There are zero companies looking for Cake developers if I am wrong show me 1 
> who is hiring!
>  
> K
>  
>  
>  
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Is this it?

2011-12-01 Thread mark_story
Yes, this is the primary mailing list for the community.

There are also other community resources:

* http://ask.cakephp.org - Community question and answer site.
* http://tv.cakephp.org - Community screencasts and conference videos.
* http://bakery.cakephp.org - Community articles and blog.

There are also a pile of blogs, books and tutorials.  Not having a
'forum' is intentional.  The mailing list works well, and allows
people to read the mailing list on non-web-browser clients.  Something
that no forum I know of can offer.  Several people have tried to
create forums, and not many of them have gained any traction.

-Mark

On Nov 30, 6:38 pm, David Mitchell <01mitc...@gmail.com> wrote:
> is this the only official forum type chat there is for CakePHP?
> this framework is one of the most popular frameworks there is and they
> don't have there own forum?
> am I missing something.
>
> David

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Open a new tab from the controller

2011-12-01 Thread Anup Kale
Hi,

I have a form that outputs a PDF file in a new window. This works fine
but now i have to validate the data and once the data is validated
then want the output rendered in the new window, otherwise the error
message should be displayed in the parent window.

Anybody have a solution. I am in time crunch.

Thank you

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Filtering Component - Correct way of filtering results between two dates

2011-12-01 Thread web_rene
I am quite new to CakePHp and the MVC way of thinking.

Up to know I was able to create resultsetfiltering by the use of the Filter
Component by Nik Chankov. 

The way I am using it, is to call it in my Controller, saving the condition
statement and passing it to the Paginator. 

Now, I have one column which holds a 'created_at' date and I want to give
the user a possibility to enter a start date and an end date and to pass it
to the filter component.

I tried creating two input text fields 'created_after' and 'created_before'
and to join these to an array[created_at][BETWEEN] in my controller since
the Filter Component handles 'BETWEEN' arrays.

Unfortunatelly, if I do not unset the original values I get a SQL Error
since the component will create a statement including 'created_after' and
created_before' which are not defined in my database. But if I do unset
created_before and _after, they won't be saved to the session ( this is
handled by filtering component aswell ) and I can not use Paginator anymore.

What would be the correct way of doing this? Please give me advise how and
into which direction I should proceed to solve this issue... I am kind of
stuck and I would love to somehow add this to the Filtering and not to
create a hack in my Controller...

thanks!

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Filtering-Component-Correct-way-of-filtering-results-between-two-dates-tp5039403p5039403.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Selenium Integration Tests with fixtures in CakePHP 2.0

2011-12-01 Thread Anheng
How to do Selenium Integration Tests with fixtures in CakePHP 2.0?

I'd like to implement and run Selenium tests on my local testing
environment. To put the application in a defined state, I need to use
fixtures. How can I do this with CakePHP 2.0?
Is there a base class available that somehow extends
PHPUnit_Extensions_SeleniumTestCase but also lets me use CakePHP's
fixtures?

Thanks,

Anheng

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Ajax + CakePHP

2011-12-01 Thread NiReiC
Pourquoi est-ce aussi compliqué de faire de l'Ajax avec CakePHP ?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Same Old?

2011-12-01 Thread Krissy Masters
Wondering why you look at Krop /  Craigslist/ Authentic Jobs no one wants
Cake? 

1 in 1000 jobs looks for Cake? Wonder why? Cake board with Cake or what ever
it is has zero new job offers?

 

Is there a reason? Same as before im going to get banned fron the Cake Board
fine, open a new account because you need people like me to support but just
don't question right! 

Drupal has 100 job offers, WordPress Developers / Designers.. Where is Cake?

Why does no one want Cake?

 

There are zero companies looking for Cake developers if I am wrong show me 1
who is hiring!

 

K

 

 

 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Installation CakePHP 2.0n on a shared host

2011-12-01 Thread Moritz
I have exactly the same problem. Is there any solution?

On 3 Nov., 08:46, berni  wrote:
> Hello all
>
> After messing up with the installation of CakePHP 2.0x in 
> aSharedHostingenvironement,
> searching for solutions and playing around with different suggestions,
> that did not
> appear as a solution, I tried to catch the real problem.
>
> Ok. That's now my way to ask for a solution
>
> 1.  I installed both branches :  1.3.13 and 2.01 onto the the Host
>
> 2.  I put a copy of default home.ctp into my app/view/pages and
> changed the
>     original a little bit to print out the settings instead of the
> links
>     given in the original.
>
> 3.  I changed the three .htaccess adding RewriteBase as suggested by
> Cake
>     so the only difference between them is the last RewriteRule
> showing
>     index.php?url=$1 in version 1.3.13
>     index.php?/$1    in version 2.0.1
>
> 4.  I set my domainroot in both cases to : mydomain/app/
> webroot
>
> 5.  Starting with 1.3.13 everything works fine calling either
>    www.mydomainorwww.mydomain/pages/home
>
>     Setting WWW_ROOT : path-to-cake13/app/webroot/
>     Setting ROOT : path-to-cake13
>     Setting APP_DIR : app
>     Setting WEBROOT_DIR : webroot
>     Setting CORE_PATH :
>     Setting CAKE_CORE_INCLUDE_PATH : path-to-cake13
>     Setting include_path : path-to-cake13:path-to-cake13/app/:.:/usr/
> local/lib/php
>
> 6.  Starting with 2.0.1 it's getting weird
>
>    www.mydomainis ok  showing these settings
>
>     Setting WWW_ROOT : path-to-cake20/app/webroot/
>     Setting ROOT : path-to-cake20
>     Setting APP_DIR : app
>     Setting WEBROOT_DIR : webroot
>     Setting CORE_PATH : path-to-cake20/lib/
>     Setting CAKE_CORE_INCLUDE_PATH : path-to-cake20/lib
>     Setting include_path : path-to-cake20/lib:.:/usr/local/lib/
> php
>
>    www.mydomain/pages/home comes up with Missing Controller Message
>
>     looking at the source of the generated html, I found this for
> example
>
>         
>     
>     
>
> In my opinion the change from Url to Path had some implications that
> are not yet
> reflected through all of your code. But you are the one, that can find
> the
> real answer.
>
> Cake is great.
>
> You may help a lot of people, I think, if you can solve this problem.
> Hope my notes above are helpfull for you.
>
> Bernhard

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Installation CakePHP 2.0n on a shared host

2011-12-01 Thread Moritz
I have exactly the same problem. Is there any solution?

On 3 Nov., 08:46, berni  wrote:
> Hello all
>
> After messing up with the installation of CakePHP 2.0x in 
> aSharedHostingenvironement,
> searching for solutions and playing around with different suggestions,
> that did not
> appear as a solution, I tried to catch the real problem.
>
> Ok. That's now my way to ask for a solution
>
> 1.  I installed both branches :  1.3.13 and 2.01 onto the the Host
>
> 2.  I put a copy of default home.ctp into my app/view/pages and
> changed the
>     original a little bit to print out the settings instead of the
> links
>     given in the original.
>
> 3.  I changed the three .htaccess adding RewriteBase as suggested by
> Cake
>     so the only difference between them is the last RewriteRule
> showing
>     index.php?url=$1 in version 1.3.13
>     index.php?/$1    in version 2.0.1
>
> 4.  I set my domainroot in both cases to : mydomain/app/
> webroot
>
> 5.  Starting with 1.3.13 everything works fine calling either
>    www.mydomainorwww.mydomain/pages/home
>
>     Setting WWW_ROOT : path-to-cake13/app/webroot/
>     Setting ROOT : path-to-cake13
>     Setting APP_DIR : app
>     Setting WEBROOT_DIR : webroot
>     Setting CORE_PATH :
>     Setting CAKE_CORE_INCLUDE_PATH : path-to-cake13
>     Setting include_path : path-to-cake13:path-to-cake13/app/:.:/usr/
> local/lib/php
>
> 6.  Starting with 2.0.1 it's getting weird
>
>    www.mydomainis ok  showing these settings
>
>     Setting WWW_ROOT : path-to-cake20/app/webroot/
>     Setting ROOT : path-to-cake20
>     Setting APP_DIR : app
>     Setting WEBROOT_DIR : webroot
>     Setting CORE_PATH : path-to-cake20/lib/
>     Setting CAKE_CORE_INCLUDE_PATH : path-to-cake20/lib
>     Setting include_path : path-to-cake20/lib:.:/usr/local/lib/
> php
>
>    www.mydomain/pages/home comes up with Missing Controller Message
>
>     looking at the source of the generated html, I found this for
> example
>
>         
>     
>     
>
> In my opinion the change from Url to Path had some implications that
> are not yet
> reflected through all of your code. But you are the one, that can find
> the
> real answer.
>
> Cake is great.
>
> You may help a lot of people, I think, if you can solve this problem.
> Hope my notes above are helpfull for you.
>
> Bernhard

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


How to set uploaded photos size in pixel

2011-12-01 Thread CakePHP
Hi.I use cakephp version:1.2.0.5875 pre-beta

I have image hosting and have issue with uploaded image size in
PIXEL.When image pixel more 10.000x10.000 this problem for my
site.Image can not converted.I want to set limit the uploaded image
size.Please help me

@@@

http://www.w3.org/
TR/xhtml11/DTD/xhtml11.dtd">
http://www.w3.org/1999/xhtml"; version="-//W3C//DTD XHTML
1.1//EN" xml:lang="en">


...

  params) && $this-
>params['controller'] == 'upload'): ?>
link('swfupload') ?>
link('swfupload.queue') ?>
link('swfupload.fileprogress') ?>

function fileQueued(file) {
  try {
var progress = new FileProgress(file,
this.customSettings.progressTarget);
progress.setStatus("...");
progress.toggleCancel(true, this);
  } catch (ex) {
this.debug(ex);
  }

}

function fileQueueError(file, errorCode, message) {
  try {
if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED)
{
  alert("You have attempted to queue too many files.\n" +
(message === 0 ? "You have reached the upload limit." : "You may
select " + (message > 1 ? "up to " + message + " files." : "one
file.")));
  return;
}

var progress = new FileProgress(file,
this.customSettings.progressTarget);
progress.setError();
progress.toggleCancel(false);

switch (errorCode) {
  case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
  progress.setStatus("File is too big.");
  this.debug("Error Code: File too big, File name: " +
file.name + ", File size: " + file.size + ", Message: " + message);
  break;
  case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
  progress.setStatus("Cannot upload Zero Byte files.");
  this.debug("Error Code: Zero byte file, File name: " +
file.name + ", File size: " + file.size + ", Message: " + message);
  break;
  case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
  progress.setStatus("Invalid File Type.");
  this.debug("Error Code: Invalid File Type, File name: " +
file.name + ", File size: " + file.size + ", Message: " + message);
  break;
  default:
  if (file !== null) {
progress.setStatus("Unhandled Error");
  }
  this.debug("Error Code: " + errorCode + ", File name: " +
file.name + ", File size: " + file.size + ", Message: " + message);
  break;
}
  } catch (ex) {
this.debug(ex);
  }
}

function fileDialogComplete(numFilesSelected, numFilesQueued) {
  try {
if (numFilesSelected > 0) {
 
document.getElementById(this.customSettings.cancelButtonId).disabled =
false;
  $("finish_uploading_button").hide();
}

/* I want auto start the upload and I can do that here */
this.startUpload();
  } catch (ex)  {
this.debug(ex);
  }
}

function uploadStart(file) {
  try {
/* I don't want to do any file validation or anything,  I'll
just update the UI and
return true to indicate that the upload should start.
It's important to update the UI here because in Linux no
uploadProgress events are called. The best
we can do is say we are uploading.
*/
var progress = new FileProgress(file,
this.customSettings.progressTarget);
progress.setStatus("...");
progress.toggleCancel(true, this);
  }
  catch (ex) {}

  return true;
}

function uploadProgress(file, bytesLoaded, bytesTotal) {
  try {
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);

var progress = new FileProgress(file,
this.customSettings.progressTarget);
progress.setProgress(percent);
progress.setStatus("...");
  } catch (ex) {
this.debug(ex);
  }
}

function uploadSuccess(file, serverData) {
  try {
var progress = new FileProgress(file,
this.customSettings.progressTarget);
progress.setComplete();
progress.setStatus(".");
progress.toggleCancel(false);
  } catch (ex) {
this.debug(ex);
  }
}

function uploadError(file, errorCode, message) {
  try {
var progress = new FileProgress(file,
this.customSettings.progressTarget);
progress.setError();
progress.toggleCancel(false);

switch (errorCode) {
  case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
  progress.setStatus("Upload Error: " + message);
  this.debug("Error Code: HTTP Error, File name: " + file.name
+ ", Message: " + message);
  break;
  case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
  progress.setStatus("Upload Failed.");
  this.debug("Error Code: Upload Failed, File name: " +
file.name + ", File size: " + file

Re: find('first') - How to limit contained tables results

2011-12-01 Thread web_rene
Thanks! This was exactly what I was searching for. 
Unfortunatelly I was not able to find this answer somewhere in the
Documentation... same as many other questions. 

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/find-first-How-to-limit-contained-tables-results-tp4777899p5039410.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How to show different text in a view depending on the has_many association

2011-12-01 Thread ineffabilis
Your code is quite messy...

Anyways:



Hope this helps...

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


HABTM & read.

2011-12-01 Thread Morgan De Clerck
Hi !
I have a little problem with the HABTM associations.

Group hasManyAndBelongsTo Lesson
Lesson hasManyAndBelongsTo Group

*Groups*
groups.id | groups.name | ...

*Lessons*
lessons.id | lessons.title | ...

*Groups_Lessons*
groups_lessons.id | groups_lessons.lesson_id | groups_lessons.group_id

I have write this the Lesson model :

class Lesson extends AppModel {
> public $name = 'Lesson';
> public $hasAndBelongsToMany = array(
> 'Groups' =>
> array(
> 'className'  => 'Group',
> 'joinTable'  => 'groups_lessons',
> 'foreignKey' => 'lesson_id',
> 'associationForeignKey'  => 'group_id'
> )
> );
> }


and this Group model :

class Group extends AppModel {
> public $name = 'Group';
>
> public $hasAndBelongsToMany = array(
> 'Lessons' =>
> array(
> 'className'  => 'Lesson',
> 'joinTable'  => 'groups_lessons',
> 'foreignKey' => 'group_id',
> 'associationForeignKey'  => 'lesson_id',
> )
> );
>
> }


In the index of my lesson controller, I realize a $this->Lesson->find('all') 
call.
I have 2 SQL query :

SELECT "Lesson"."id" AS "Lesson__id", "Lesson"."teacher_id" AS 
> "Lesson__teacher_id", "Lesson"."entitled" AS "Lesson__entitled", 
> "Lesson"."abbreviation" AS "Lesson__abbreviation", "Lesson"."hours" AS 
> "Lesson__hours", "Lesson"."option" AS "Lesson__option" FROM "lessons" AS 
> "Lesson" WHERE 1 = 1


> One row 

SELECT "Groups"."id" AS "Groups__id", "Groups"."holder_id" AS 
> "Groups__holder_id", "Groups"."education_id" AS "Groups__education_id", 
> "Groups"."name" AS "Groups__name", "Groups"."abbreviation" AS 
> "Groups__abbreviation", "GroupsLesson"."id" AS "GroupsLesson__id", 
> "GroupsLesson"."group_id" AS "GroupsLesson__group_id", 
> "GroupsLesson"."lesson_id" AS "GroupsLesson__lesson_id" FROM "groups" AS 
> "Groups" JOIN "groups_lessons" AS "GroupsLesson" ON 
> ("GroupsLesson"."lesson_id" = 1 AND "GroupsLesson"."group_id" = 
> "Groups"."id")


> One row 

But, when I realize a print_r on  $this->Lesson->find('all'), I have no 
group...

Array ( [0] => Array ( [Lesson] => Array ( [id] => 1 [teacher_id] => 1 
> [entitled] => Math [abbreviation] => M [hours] => 14 [option] => ) [Groups] 
> => Array ( ) ) ) 


Can you help me ?
Thanks !

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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

CakePHP 1.3 AUTH

2011-12-01 Thread Toren Valone
I am working on AUTH and have this problem. I can use the views to
Delete and list users in my database, however when I use the add
function, it just stays on the ADD window and then when i do a list it
does not list the new user. Any ideas, checked the Cake error and
access logs and the mysql logs but nothing.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Ajax + CakePHP

2011-12-01 Thread NiReiC
Pourquoi est-ce aussi compliqué de faire de l'Ajax avec CakePHP ?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Is this it?

2011-12-01 Thread David Mitchell
is this the only official forum type chat there is for CakePHP?
this framework is one of the most popular frameworks there is and they
don't have there own forum?
am I missing something.

David

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


User and admin login

2011-12-01 Thread İNGİLTERE EMRE BEY
im trying to create user login and admin login section, btw im new to
cakephp.

i have no problem for creating admin section but when i use/enable
admin prefix, i can not able to give access to user login.

what i want is when user logged in give them permission for CRUD.

i have user tabel and user group table.

user group has two rows admin and user, user table has foreign key of
user group.

can you please suggest better way of doing it or based on my setup.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: 2.04 vs 1.3

2011-12-01 Thread Miloš Vučinić
Also one more question. Am I right to assume that cheat sheet from 2.*
is the same as the one provided on 
http://cakephp.org/files/Resources/CakePHP-1.2-Cheatsheet.pdf
.

Thank you !!

Milos

On 2 дец, 00:50, Miloš Vučinić  wrote:
> Hi,
>
> just curious, so far I have developed apps in 1.3 .. I haven't done
> any job in a while cause I was studying and now I see that the new
> version is up.
>
> How different is 2.* for coding ? Can anyone suggest which version to
> use for a simple scheduling app ...
>
> Thanx!
>
> Milos

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


2.04 vs 1.3

2011-12-01 Thread Miloš Vučinić
Hi,

just curious, so far I have developed apps in 1.3 .. I haven't done
any job in a while cause I was studying and now I see that the new
version is up.

How different is 2.* for coding ? Can anyone suggest which version to
use for a simple scheduling app ...

Thanx!

Milos

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How to remove entries from two tables, from a controller delete() function

2011-12-01 Thread GG
Wow, CakePhp is legit. Thank you Tilen Majerie.

On Dec 1, 2:38 pm, Tilen Majerle  wrote:
> http://book.cakephp.org/2.0/en/models/associations-linking-models-tog...
> look
> for hasMany association :)
> --
> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> 2011/12/1 Tilen Majerle 
>
>
>
>
>
>
>
> > do you have associations created ?
>
> > you should have something like that
>
> > Class hasMany Period
> > Class hasMany Post
> > Period hasMany Post (add here assocation key "dependent" => true) //so
> > this will delete all posts for given period_id when you delete some period
> > where Post.period_id = Period.id
>
> > Period belongsTo Class
> > Post belongsTo Class
> > Post belongsTo Period
>
> > am i right ? :)
>
> > I hope you understand :)
>
> > --
> > Lep pozdrav, Tilen Majerle
> >http://majerle.eu
>
> > 2011/12/1 GG 
>
> >> Right now, my PeriodsController.php delete() function, deletes entries
> >> in my periods table. (Not a problem).
> >> My PostsController.php delete() function, deletes entries in my posts
> >> table. (Also not a problem.)
> >> (The problem) = I would like my PeriodsController.php delete(), to
> >> also delete any posts (in my posts table), where they have a matching
> >> period_id.
>
> >> ///Example: I am a teacher who has a science class. I post homework
> >> under my science period. When I want go to delete the science class
> >> period, I would like it to also delete all of the posts I made under
> >> that class period...
>
> >> So..
>
> >> I have a periods table:
>
> >>     period_id | title | user_id
>
> >> I also have a posts table:
>
> >>    id | title | body | created | modified | user_id | period_id
>
> >> Here is my PeriodsController.php
>
> >> function delete($id) {
> >>    if (!$this->request->is('post')) {
> >>        throw new MethodNotAllowedException();
> >>    }
>
> >>    if($this->isActionable($id)){
> >>            if ($this->Period->delete($id)) {
> >>                $this->Session->setFlash('Class successfully deleted.');
> >>                $this->redirect(array('controller' => 'posts', 'action' =>
> >> 'index'));
> >>            }
> >>    } else {
> >>                    $this->Session->setFlash('You cannot delete that
> >> class.');
> >>                    $this->redirect(array('controller' => 'posts',
> >> 'action' =>
> >> 'index'));
> >>    }
> >>    }
>
> >> Here is my PostsController.php
>
> >> function delete($id) {
> >>    if (!$this->request->is('post')) {
> >>        throw new MethodNotAllowedException();
> >>    }
>
> >>    if($this->isActionable($id)){
> >>            if ($this->Post->delete($id)) {
> >>                $this->Session->setFlash('Post successfully deleted.');
> >>                $this->redirect(array('action' => 'index'));
> >>            }
> >>    } else {
> >>                    $this->Session->setFlash('You cannot delete that
> >> post.');
> >>                    $this->redirect(array('action' => 'index'));
> >>    }
> >>    }
>
> >> Any help is greatly appreciated. Thanks!
>
> >> --
> >> Our newest site for the community: CakePHP Video Tutorials
> >>http://tv.cakephp.org
> >> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> >> others with their CakePHP related questions.
>
> >> To unsubscribe from this group, send email to
> >> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> >> athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


How use .htaccess to redirect these urls

2011-12-01 Thread Điển vũ


How can i redirect these urls ( use Htaccess):

http://example.com/webroot/posts/1/post_slug
to 
http://example.com/posts/1/post_slug

i read and do a lot but can't . Please help me solve this matter.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How to remove entries from two tables, from a controller delete() function

2011-12-01 Thread Tilen Majerle
http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html
look
for hasMany association :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/12/1 Tilen Majerle 

> do you have associations created ?
>
> you should have something like that
>
> Class hasMany Period
> Class hasMany Post
> Period hasMany Post (add here assocation key "dependent" => true) //so
> this will delete all posts for given period_id when you delete some period
> where Post.period_id = Period.id
>
> Period belongsTo Class
> Post belongsTo Class
> Post belongsTo Period
>
> am i right ? :)
>
> I hope you understand :)
>
> --
> Lep pozdrav, Tilen Majerle
> http://majerle.eu
>
>
>
> 2011/12/1 GG 
>
>> Right now, my PeriodsController.php delete() function, deletes entries
>> in my periods table. (Not a problem).
>> My PostsController.php delete() function, deletes entries in my posts
>> table. (Also not a problem.)
>> (The problem) = I would like my PeriodsController.php delete(), to
>> also delete any posts (in my posts table), where they have a matching
>> period_id.
>>
>>
>> ///Example: I am a teacher who has a science class. I post homework
>> under my science period. When I want go to delete the science class
>> period, I would like it to also delete all of the posts I made under
>> that class period...
>>
>>
>> So..
>>
>> I have a periods table:
>>
>> period_id | title | user_id
>>
>>
>>
>> I also have a posts table:
>>
>>id | title | body | created | modified | user_id | period_id
>>
>>
>>
>> Here is my PeriodsController.php
>>
>> function delete($id) {
>>if (!$this->request->is('post')) {
>>throw new MethodNotAllowedException();
>>}
>>
>>if($this->isActionable($id)){
>>if ($this->Period->delete($id)) {
>>$this->Session->setFlash('Class successfully deleted.');
>>$this->redirect(array('controller' => 'posts', 'action' =>
>> 'index'));
>>}
>>} else {
>>$this->Session->setFlash('You cannot delete that
>> class.');
>>$this->redirect(array('controller' => 'posts',
>> 'action' =>
>> 'index'));
>>}
>>}
>>
>>
>> Here is my PostsController.php
>>
>> function delete($id) {
>>if (!$this->request->is('post')) {
>>throw new MethodNotAllowedException();
>>}
>>
>>if($this->isActionable($id)){
>>if ($this->Post->delete($id)) {
>>$this->Session->setFlash('Post successfully deleted.');
>>$this->redirect(array('action' => 'index'));
>>}
>>} else {
>>$this->Session->setFlash('You cannot delete that
>> post.');
>>$this->redirect(array('action' => 'index'));
>>}
>>}
>>
>>
>>
>> Any help is greatly appreciated. Thanks!
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> 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
>>
>
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How to remove entries from two tables, from a controller delete() function

2011-12-01 Thread Tilen Majerle
do you have associations created ?

you should have something like that

Class hasMany Period
Class hasMany Post
Period hasMany Post (add here assocation key "dependent" => true) //so this
will delete all posts for given period_id when you delete some period where
Post.period_id = Period.id

Period belongsTo Class
Post belongsTo Class
Post belongsTo Period

am i right ? :)

I hope you understand :)

--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/12/1 GG 

> Right now, my PeriodsController.php delete() function, deletes entries
> in my periods table. (Not a problem).
> My PostsController.php delete() function, deletes entries in my posts
> table. (Also not a problem.)
> (The problem) = I would like my PeriodsController.php delete(), to
> also delete any posts (in my posts table), where they have a matching
> period_id.
>
>
> ///Example: I am a teacher who has a science class. I post homework
> under my science period. When I want go to delete the science class
> period, I would like it to also delete all of the posts I made under
> that class period...
>
>
> So..
>
> I have a periods table:
>
> period_id | title | user_id
>
>
>
> I also have a posts table:
>
>id | title | body | created | modified | user_id | period_id
>
>
>
> Here is my PeriodsController.php
>
> function delete($id) {
>if (!$this->request->is('post')) {
>throw new MethodNotAllowedException();
>}
>
>if($this->isActionable($id)){
>if ($this->Period->delete($id)) {
>$this->Session->setFlash('Class successfully deleted.');
>$this->redirect(array('controller' => 'posts', 'action' =>
> 'index'));
>}
>} else {
>$this->Session->setFlash('You cannot delete that
> class.');
>$this->redirect(array('controller' => 'posts', 'action'
> =>
> 'index'));
>}
>}
>
>
> Here is my PostsController.php
>
> function delete($id) {
>if (!$this->request->is('post')) {
>throw new MethodNotAllowedException();
>}
>
>if($this->isActionable($id)){
>if ($this->Post->delete($id)) {
>$this->Session->setFlash('Post successfully deleted.');
>$this->redirect(array('action' => 'index'));
>}
>} else {
>$this->Session->setFlash('You cannot delete that
> post.');
>$this->redirect(array('action' => 'index'));
>}
>}
>
>
>
> Any help is greatly appreciated. Thanks!
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


How to remove entries from two tables, from a controller delete() function

2011-12-01 Thread GG
Right now, my PeriodsController.php delete() function, deletes entries
in my periods table. (Not a problem).
My PostsController.php delete() function, deletes entries in my posts
table. (Also not a problem.)
(The problem) = I would like my PeriodsController.php delete(), to
also delete any posts (in my posts table), where they have a matching
period_id.


///Example: I am a teacher who has a science class. I post homework
under my science period. When I want go to delete the science class
period, I would like it to also delete all of the posts I made under
that class period...


So..

I have a periods table:

 period_id | title | user_id



I also have a posts table:

id | title | body | created | modified | user_id | period_id



Here is my PeriodsController.php

function delete($id) {
if (!$this->request->is('post')) {
throw new MethodNotAllowedException();
}

if($this->isActionable($id)){
if ($this->Period->delete($id)) {
$this->Session->setFlash('Class successfully deleted.');
$this->redirect(array('controller' => 'posts', 'action' =>
'index'));
}
} else {
$this->Session->setFlash('You cannot delete that class.');
$this->redirect(array('controller' => 'posts', 'action' =>
'index'));
}
}


Here is my PostsController.php

function delete($id) {
if (!$this->request->is('post')) {
throw new MethodNotAllowedException();
}

if($this->isActionable($id)){
if ($this->Post->delete($id)) {
$this->Session->setFlash('Post successfully deleted.');
$this->redirect(array('action' => 'index'));
}
} else {
$this->Session->setFlash('You cannot delete that post.');
$this->redirect(array('action' => 'index'));
}
}



Any help is greatly appreciated. Thanks!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Set auto login data

2011-12-01 Thread Tilen Majerle
which cake version are you using ?

and, for hashing method use AuthComponent::password instead :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/12/1 heohni 

> Hi,
>
> when I want to add a new user, I want to add an "auto" login value for
> username and password.
>
> The user is entering some data into a form which I can validate and
> before I do the
> if ($this->User->save($this->data)) {
>
> I need to set the fields for username and password, right?
>
> I tried:
> $this->data['User']['username'] = 'test1';
> $this->data['User']['password'] = 'test2';
>
> In my model I have
> function beforeSave(){
>$this->hashPasswords(NULL, TRUE);
>return true;
>}
> function hashPasswords($data){
>if(isset($this->data['User']['password'])){
>$this->data['User']['password'] = Security::hash($this-
> >data['User']['password'], NULL, TRUE);
>return $this->data;
>}
>return $this->data;
>}
>
> But for some reason both database fields ALWAYS are empty :-(
>
> What I am doing wrong?
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best image resize and crop helper

2011-12-01 Thread Miles J
This should be done when the image is uploaded.

On Dec 1, 8:08 am, phpMagpie  wrote:
> I'm using SLIR2:http://code.google.com/p/smart-lencioni-image-resizer/
>
> HTH, Paul.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Validation problems

2011-12-01 Thread Toby G
Hi there,

Version: 1.3.12

I seem to be having a problem with the 'numeric' validation rule on an
associated Model's fields.  For some reason it is not validating '10'
as a valid numeric value.

Here are the validation rules for the (PhysicalTicket) no_of_tickets
field in question...

'no_of_tickets' => array(
'numeric' => array(
'rule' => array('numeric'),
'message' => 'Please provide the number of 
tickets you require',
'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after 
this rule
//'on' => 'create', // Limit validation to 
'create' or 'update'
operations
),
'between' => array(
'rule' => array('between', 1, 9),
'message' => 'Please provide the number of 
tickets you require
(between 1 & 9 can be booked at a time)',
'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after 
this rule
//'on' => 'create', // Limit validation to 
'create' or 'update'
operations
),
),

And here is the data being validated (using saveAll)...

Array
(
[Booking] => Array
(
[event_id] => 17
[booking_type] => is_physical_tickets
[post_to_wall] => 1
)

[PhysicalTicket] => Array
(
[name] => Toby Griffiths
[phone_no] =>
[no_of_tickets] => 10
)

[submit] => Request tickets
[add_more_text] => SOMETHING RANDOM
)

The validation error show is "Please provide the number of tickets you
require" rather than the expected "'Please provide the number of
tickets you require (between 1 & 9 can be booked at a time)"

Any help with this one would be great.

Thanks,

T

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Send Email problem with multiple receivers

2011-12-01 Thread MetZ
ooh.. sorry... Cake 1.3.13 ;)

Thanks for your time this far!

-Tom


On 1 Des, 10:19, euromark  wrote:
> if you are using the new EmailLib in 2.0 you should be using the
> setter methods:
> $this->Email->to()
> etc
>
> On 1 Dez., 06:36, Graham Weldon  wrote:
>
>
>
>
>
>
>
> > What CakePHP version are you on?
>
> > Cheers,
> > Graham Weldonhttp://grahamweldon.com
> > e. gra...@grahamweldon.com
> > p. (+61) 0407 017 293
> > Skype: grahamweldon
>
> > On Thursday, 1 December 2011 at 4:20 PM, MetZ wrote:
> > > Hi..
> > > Tried it, did not work either, only the first email in array get the
> > > email.
>
> > > Any other suggestions??
>
> > > -Tom
>
> > > On 1 Des, 06:03, Graham Weldon http://gmail.com)> 
> > > wrote:
> > > > Have you tried an array of email address?
>
> > > > $this->Email->to = array('du...@rmail.com (http://rmail.com)', 
> > > > 'du...@email.com (http://email.com)');
>
> > > > Cheers,
> > > > Graham Weldonhttp://grahamweldon.com
> > > > e. gra...@grahamweldon.com (http://grahamweldon.com)
> > > > p. (+61) 0407 017 293
> > > > Skype: grahamweldon
>
> > > > On Thursday, 1 December 2011 at 4:02 PM, MetZ wrote:
> > > > > Hi all!
>
> > > > > I am having a problem, when sending email with multiple reveivers in
> > > > > $this->Email->to
>
> > > > > It will only send to one adress (the first one =>
> > > > > email_numb...@gmail.com (mailto:email_numb...@gmail.com 
> > > > > (http://gmail.com))), why is that? any suggestions!?!
>
> > > > > $this->Email->to = 'email_numb...@gmail.com 
> > > > > (mailto:email_numb...@gmail.com), email_numb...@gmail.com 
> > > > > (mailto:email_numb...@gmail.com (http://gmail.com))';
> > > > > $this->Email->subject = 'Ma Subject!';
> > > > > $this->Email->from = Configure::read('App.noreply');
> > > > > $this->Email->template = 'new_notify';
> > > > > $this->Email->sendAs = 'both';
> > > > > $this->Email->send();
> > > > > $this->Email->reset();
>
> > > > > --
> > > > > Our newest site for the community: CakePHP Video 
> > > > > Tutorialshttp://tv.cakephp.org
> > > > > Check out the new CakePHP Questions 
> > > > > sitehttp://ask.cakephp.organdhelpothers with their CakePHP related 
> > > > > questions.
>
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com 
> > > > > (mailto:cake-php+unsubscr...@googlegroups.com) For more options, 
> > > > > visit this group athttp://groups.google.com/group/cake-php
>
> > > --
> > > Our newest site for the community: CakePHP Video 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best image resize and crop helper

2011-12-01 Thread phpMagpie
I'm using SLIR2:
http://code.google.com/p/smart-lencioni-image-resizer/

HTH, Paul.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

2011-12-01 Thread zuha
Ah put up the answer a bit too fast.   Here's a better version, where I 
changed...

Line 275 in /lib/Cake/Routing/Dispatcher.php from... 

$fileFragment = implode(DS, $parts);


to...

 $fileFragment = urldecode(implode(DS, $parts));



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

2011-12-01 Thread zuha
ah, found it.  In case anyone else stumbles on this, I changed 

Line 277 & 278 in /lib/Cake/Routing/Dispatcher.php from...

if (file_exists($path . $fileFragment)) {
>$assetFile = $path . $fileFragment;
> }


to..

if (file_exists($path . str_replace('%20', ' ', $fileFragment))) {
>   $assetFile = $path . str_replace('%20', ' ', $fileFragment);
> }

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Is the CakePHP book search not working?

2011-12-01 Thread Yves S. Garret
I'm working on trying to get LDAP to do authentication for my app.  Having
a heck of a time...

I figured I'd at least give a cursory look at the book and see what I find
(I didn't expect anything to show up).  I searched and found 7 - 9 results
right away!  Alright!

I click on the first and do a search for the string "ldap" and find
nothing.  I move on to the next and find nothing.  I go through all of the
examples and don't find a single instance of the string "ldap".  None.
 Now, I can understand if there is no info in the book and the search
function returns nothing, but why show up a bunch of unrelated results?
 Seems like either it is a bug or not the best thought out search.  Anyone
run into a similar issue?

P.S.: I did this with the 1.3 CakePHP book only, I have no idea about the
rest.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

2011-12-01 Thread zuha
#1 They can't be moved.  #2  Yeah spaces are bad, I get it, but this is a 
legacy issue not a "moving forward" issue.  


Does anyone have any insight as to where Cake checks to see if the file 
exists, and returns the file to the browser if it does when using Themes. 
 I'm happy to hack the core to make this work.  

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How Check validate before save

2011-12-01 Thread phpMagpie
Adding 'validate'=>'only' will never save as your asking the function to 
only validate the data.

If 'incorrect' data is passing validating then you have something wrong 
with your validation rules.

Paul.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Blog with posts and comments

2011-12-01 Thread phpMagpie
Not sure what it is you are struggling with ... if you want to add a 
comment to a Post then echo a form with a hidden field containing 
Comment.post_id.

If wanting to view a Post and it's comments then:
$this->set('post', $this->Post->find('first', array(
  'conditions'=>array('Post.id'=>$id),
  'contain'=>array('Comment')
)));

And then loop through $post['Comment'] in the view showing each comment.

You might also want to take a look at CakeDC's comments plugin:
https://github.com/CakeDC/comments

HTH, Paul.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best image resize and crop helper

2011-12-01 Thread Vinícius Moraes de Araújo
http://code.google.com/p/timthumb/

Atenciosamente,

Vinícius Moraes


2011/12/1 Alex Bovey 

> Hi all,
>
> What's everyone's favourite method (helper or otherwise) or resizing
> and cropping images?
>
> Thanks,
>
> Alex
>
> --
> Alex Bovey
> Web Developer | Alex Bovey Consultancy Ltd
> Registered in England & Wales no. 6471391 | VAT no. 934 8959 65
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Spaces in Filenames (Theme / Themed / Upgrade Cake 1.3 to Cake 2.0)

2011-12-01 Thread euromark
or not using any spaces in filenames (bad thing to do anyway^^)


On 1 Dez., 07:40, Graham Weldon  wrote:
> The alternative is moving your assets to the web root, instead of symlinking 
> them, I guess.
>
> Cheers,
> Graham Weldonhttp://grahamweldon.com
> e. gra...@grahamweldon.com
> p. (+61) 0407 017 293
> Skype: grahamweldon
>
>
>
>
>
>
>
> On Thursday, 1 December 2011 at 5:03 PM, zuha wrote:
> > I don't believe symlink will be possible (or at a minimum would be a big 
> > annoyance) because I run an unlimited number of apps from custom 
> > directories and each one contains its own theme directory.   I would much 
> > rather just figure out where to do something like...
>
> > $fileName = str_replace('%20', ' ', $fileName);
>
> > ...to get it to show, but can't find where to do that in the core.  I tried 
> > ThemeView.php, View.php, Helper.php, MediaView.php, CakeResponse.php and no 
> > luck.
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com 
> > (mailto:cake-php+unsubscr...@googlegroups.com) For more options, visit this 
> > group athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: any one else having trouble with table prefixes in 2.0?

2011-12-01 Thread euromark
yep - I applied a hack.
see my ticket for details:
http://cakephp.lighthouseapp.com/projects/42648/tickets/2277-caketestmodels-in-test-cases-do-not-set-model-tableprefix
and
http://cakephp.lighthouseapp.com/projects/42648/tickets/2206

or simply use the file from my current cake rep:
https://github.com/dereuromark/cakephp/blob/2.0hacked/lib/Cake/Model/Model.php#L705



On 1 Dez., 12:15, Mattia Manzati  wrote:
> I have the same problem on Cake 2.0.4. Any way to solve?
>
> On 31 Ott, 17:27, euromark  wrote:
>
>
>
>
>
>
>
> > OK... it happens on normal views as well
> > just a simple find(first) with 2 contained hasMany relations
>
> > same problem
> > even worse - it has nothing to do with the cache here (cache
> > deactivated)
> > joins seem to kill the site_ prefix!
> > this is quite a problem since the whole application seems to be pretty
> > non-functional now
>
> > On 31 Okt., 14:37, euromark  wrote:
>
> > > if the model cache is renewed everything is fine
> > > but as soon as cake uses the model cache the table prefix is lost and
> > > causes sql errors
>
> > > the prefix is "site_"
>
> > > query with cached data from /tmp/cache/models:
>
> > > Error:SQLSTATE[42S02]: Base table or view not found: 1146 Table
> > > 'cake.addresses' doesn't exist
>
> > > SQL Query: SELECT `Address`.`id`, `Address`.`foreign_id`,
> > > `Address`.`model`, `Address`.`country_id`, `Address`.`first_name`,
> > > `Address`.`last_name`, `Address`.`street`, `Address`.`postal_code`,
> > > `Address`.`city`, `Address`.`lat`, `Address`.`lng`,
> > > `Address`.`last_used`, `Address`.`formatted_address`,
> > > `Address`.`type_id`, `Address`.`created`, `Address`.`modified` FROM
> > > `addresses` AS `Address` WHERE `Address`.`foreign_id` = 4 AND
> > > `Address`.`model` = 'Restaurant'
>
> > > Notice: If you want to customize this error message, create site/View/
> > > Errors/pdo_error.ctp
>
> > > Stack Trace
>
> > > #0 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(436):
> > > PDOStatement->execute(Array)
> > > #1 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(403):
> > > DboSource->_execute('SELECT `Address...', Array)
> > > #2 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(645):
> > > DboSource->execute('SELECT `Address...', Array, Array)
> > > #3 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(1205):
> > > DboSource->fetchAll('SELECT `Address...', false)
> > > #4 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(1226):
> > > DboSource->queryAssociation(Object(Restaurant), Object(Address),
> > > 'hasOne', 'Address', Array, Array, true, Array, 0, Array)
> > > #5 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(1065):
> > > DboSource->queryAssociation(Object(Coupon), Object(Restaurant),
> > > 'belongsTo', 'Restaurant', Array, Array, true, Array, 1, Array)
> > > #6 /srv/www/.../trunk/lib/Cake/Model/Model.php(2458): 
> > > DboSource->read(Object(Coupon), Array)
>
> > > #7 /srv/www/.../trunk/site/Plugin/Tools/Lib/MyModel.php(417): 
> > > Model->find('all', Array, NULL, NULL)
>
> > > #8 /srv/www/.../trunk/site/Controller/CouponsController.php(470):
> > > MyModel->find('all', Array)
> > > #9 [internal function]: CouponsController->homepage()
> > > #10 /srv/www/.../trunk/lib/Cake/Controller/Controller.php(473):
> > > ReflectionMethod->invokeArgs(Object(CouponsController), Array)
> > > #11 /srv/www/.../trunk/lib/Cake/Routing/Dispatcher.php(107):
> > > Controller->invokeAction(Object(CakeRequest))
> > > #12 /srv/www/.../trunk/lib/Cake/Routing/Dispatcher.php(89): 
> > > Dispatcher->_invoke(Object(CouponsController), Object(CakeRequest),
>
> > > Object(CakeResponse))
> > > #13 /srv/www/.../trunk/site/webroot/index.php(96): 
> > > Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
>
> > > #14 {main}
>
> > > it should have been
> > > "FROM `site_addresses` AS `Address`"

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Form input Automagic on hasAndBelongsToMany when the model is not the model for the form?

2011-12-01 Thread phpMagpie
Can you show us an echo debug of your data array?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Has many problem

2011-12-01 Thread phpMagpie
> It's normalized because data1, data2 and data3 are always the same 
fields, they don't change with the process :)

Just because it works for you 'now' does not make it normalized ... a 
normalized database would work for processes with 1 or 1,000 data relations.

What happens if you need more data stored per process or need to store 
extra data for each Process <-> Data relation, you would need to alter the 
dbase, forms, views etc. hence this is not normalised.

Glad you got your head around editing hasMany records though :)

Paul.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Best image resize and crop helper

2011-12-01 Thread Alex Bovey
Hi all,

What's everyone's favourite method (helper or otherwise) or resizing
and cropping images?

Thanks,

Alex

-- 
Alex Bovey
Web Developer | Alex Bovey Consultancy Ltd
Registered in England & Wales no. 6471391 | VAT no. 934 8959 65

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Set auto login data

2011-12-01 Thread heohni
Hi,

when I want to add a new user, I want to add an "auto" login value for
username and password.

The user is entering some data into a form which I can validate and
before I do the
if ($this->User->save($this->data)) {

I need to set the fields for username and password, right?

I tried:
$this->data['User']['username'] = 'test1';
$this->data['User']['password'] = 'test2';

In my model I have
function beforeSave(){
$this->hashPasswords(NULL, TRUE);
return true;
}
function hashPasswords($data){
if(isset($this->data['User']['password'])){
$this->data['User']['password'] = Security::hash($this-
>data['User']['password'], NULL, TRUE);
return $this->data;
}
return $this->data;
}

But for some reason both database fields ALWAYS are empty :-(

What I am doing wrong?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: js/css compression helpers for cakephp 2.0

2011-12-01 Thread majna
There's a shell task for that I think.

On Wednesday, November 30, 2011 10:30:28 PM UTC+1, euromark wrote:
>
> I only thing I am wondering about that plugin is, whether it supports
> assert compression by using the default
> $this->Html->css/script syntax
> Or if one would have to completely rewrite all views/layouts here. (to
> $this->AssetCompress->...)
> From the look into the code and docs it seems this is necessary (no
> beforeRender hook to catch them and automatically process them if the
> helper is included etc).
>
>
> On 30 Nov., 20:46, mikeottinger  wrote:
> > Thanks guys, I'll give Mark Story's plugin a try
> > (https://github.com/markstory/asset_compress/tree/2.0). This supports 
> YUI
> > Compression which I was particularly looking for. Thanks for the info.
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: any one else having trouble with table prefixes in 2.0?

2011-12-01 Thread Mattia Manzati
I have the same problem on Cake 2.0.4. Any way to solve?

On 31 Ott, 17:27, euromark  wrote:
> OK... it happens on normal views as well
> just a simple find(first) with 2 contained hasMany relations
>
> same problem
> even worse - it has nothing to do with the cache here (cache
> deactivated)
> joins seem to kill the site_ prefix!
> this is quite a problem since the whole application seems to be pretty
> non-functional now
>
> On 31 Okt., 14:37, euromark  wrote:
>
>
>
>
>
>
>
> > if the model cache is renewed everything is fine
> > but as soon as cake uses the model cache the table prefix is lost and
> > causes sql errors
>
> > the prefix is "site_"
>
> > query with cached data from /tmp/cache/models:
>
> > Error:SQLSTATE[42S02]: Base table or view not found: 1146 Table
> > 'cake.addresses' doesn't exist
>
> > SQL Query: SELECT `Address`.`id`, `Address`.`foreign_id`,
> > `Address`.`model`, `Address`.`country_id`, `Address`.`first_name`,
> > `Address`.`last_name`, `Address`.`street`, `Address`.`postal_code`,
> > `Address`.`city`, `Address`.`lat`, `Address`.`lng`,
> > `Address`.`last_used`, `Address`.`formatted_address`,
> > `Address`.`type_id`, `Address`.`created`, `Address`.`modified` FROM
> > `addresses` AS `Address` WHERE `Address`.`foreign_id` = 4 AND
> > `Address`.`model` = 'Restaurant'
>
> > Notice: If you want to customize this error message, create site/View/
> > Errors/pdo_error.ctp
>
> > Stack Trace
>
> > #0 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(436):
> > PDOStatement->execute(Array)
> > #1 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(403):
> > DboSource->_execute('SELECT `Address...', Array)
> > #2 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(645):
> > DboSource->execute('SELECT `Address...', Array, Array)
> > #3 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(1205):
> > DboSource->fetchAll('SELECT `Address...', false)
> > #4 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(1226):
> > DboSource->queryAssociation(Object(Restaurant), Object(Address),
> > 'hasOne', 'Address', Array, Array, true, Array, 0, Array)
> > #5 /srv/www/.../trunk/lib/Cake/Model/Datasource/DboSource.php(1065):
> > DboSource->queryAssociation(Object(Coupon), Object(Restaurant),
> > 'belongsTo', 'Restaurant', Array, Array, true, Array, 1, Array)
> > #6 /srv/www/.../trunk/lib/Cake/Model/Model.php(2458): 
> > DboSource->read(Object(Coupon), Array)
>
> > #7 /srv/www/.../trunk/site/Plugin/Tools/Lib/MyModel.php(417): 
> > Model->find('all', Array, NULL, NULL)
>
> > #8 /srv/www/.../trunk/site/Controller/CouponsController.php(470):
> > MyModel->find('all', Array)
> > #9 [internal function]: CouponsController->homepage()
> > #10 /srv/www/.../trunk/lib/Cake/Controller/Controller.php(473):
> > ReflectionMethod->invokeArgs(Object(CouponsController), Array)
> > #11 /srv/www/.../trunk/lib/Cake/Routing/Dispatcher.php(107):
> > Controller->invokeAction(Object(CakeRequest))
> > #12 /srv/www/.../trunk/lib/Cake/Routing/Dispatcher.php(89): 
> > Dispatcher->_invoke(Object(CouponsController), Object(CakeRequest),
>
> > Object(CakeResponse))
> > #13 /srv/www/.../trunk/site/webroot/index.php(96): 
> > Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
>
> > #14 {main}
>
> > it should have been
> > "FROM `site_addresses` AS `Address`"

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How to show different text in a view depending on the has_many association

2011-12-01 Thread BenJsno
hello,
if i understand your view display several posts
if your jointable is named fav_posts_users for exemple
you should have in your post model :
var $hasAndBelongsToMany = array(
'Favorite' => array(
'className' => 'User',
'joinTable' => 'fav_posts_users',
'foreignKey' => 'post_id',
'associationForeignKey' => 'user_id',
'unique' => true
),
);
in your user model :
var $hasAndBelongsToMany = array(
'Favorite' => array(
'className' => 'Post',
'joinTable' => 'fav_posts_users',
'foreignKey' => 'user_id',
'associationForeignKey' => 'post_id',
'unique' => true
),
);

and in your view :

foreach ($posts as $post):
   if ($this->Session->check(Auth.User)):
  // Loop through the posts favorites
  foreach($post['Favorite'] as $favorite):
if ($favorite['user_id'] == $this->Session-
>read('Auth.User.id')):
/* ITS YOUR FAVORITE */
else:
/*** BUTTON TO ADD TO FAVORITES ***/
endif;
  endforeach;
   else:
/*** BUTTON TO ADD TO FAVORITES ***/
   endif;
endforeach;



On 1 déc, 01:04, andrewperk  wrote:
> Hello, I'm having a hard time displaying different text in a view
> depending on if a user who is logged in has marked the post as a
> favorite or not.
>
> Users can have many posts, posts belong to users.
> Users can have many favorites, favorites belong to users and posts.
>
> In my index view I loop through all posts and display the post.
>
> Inside that I loop, I then loop through all the favorites of that
> post. Remember sometimes a post may not have any favorites so the
> $post['Favorite] array might be empty. I want to display different
> text if the post is a favorite of the logged in user. I do this by
> comparing the current favorite's user_id to the logged in user's id.
>
> Where I run into problems is when a post is marked as a favorite by 2
> or more users. When this happens the Favorite array for the post
> associations contains multiple users and thus I end up with both of my
> different texts being displayed instead of just one or the other.
>
> So if the post is a favorite I want to tell the user its already their
> favorite.
>
> If the post is not a favorite, I want to display a button so they can
> add it as a favorite.
>
> And if they are not logged in, they get a link describing to them what
> favorites are.
>
> Here's my view code:
>
> ***
>
> 
>      // Check for logged in user
>     if ($logged_in): ?>
>        // Loop through the posts favorites
>         
>                                     // If favorite matches user id tell them its a
> favorite
>                      if ($favorite['user_id'] == $current_user['id']): ?>
>                             * ITS YOUR FAVORITE *
>                                          else: ?>
>                         *** BUTTON TO ADD TO FAVORITES ***
>                     
>        
>  // Favorites array might be empty
>  if (empty($post['Favorite'])): ?>
>            *** BUTTON TO ADD TO FAVORITES ***
> 
> 
>     // No logged in user. Display link to describe what favorites are
>     *** LINK Favorites Description ***
> 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


[ASK: Installer script cakephp] Preventing index (plugin) to checking database.php

2011-12-01 Thread thom
Hello, it's been a while since my last time here.

Well, I'm currently adopting croogo for cakephp's installer 'style'.
FYI, Croogo is using plugin 'install' to setup the database etc.

Here are what I did :
1. Copying the install plugin
2. Edited route.php

##app/config/route.php
#start

if (!file_exists(CONFIGS.'settings.yml')) {
        Router::connect('/', array('plugin' => 'install' ,'controller'
=> 'install'));
    }else{
Router::connect('/', array('controller' => 'users', 'action' => 'login'));
}

#end
#

3. create file database.php.default inside /app/config
4. make /app/config writeable
5. Edited app_controller by adding layout helpers


But, I still couldn't get the welcome screen. I am just facing error
if the database.php is not present yet.

#Error message I got

Warning (2): include_once(/var/www/simpus22/app/config/database.php)
[http://php.net/function.include-once]: failed to open stream: No such
file or directory [CORE/cake/libs/model/connection_manager.php, line
23]

Warning (2): include_once() [http://php.net/function.include]: Failed
opening '/var/www/simpus22/app/config/database.php' for inclusion
(include_path='/var/www/simpus22:/var/www/simpus22/app/:.:/usr/share/php:/usr/share/pear')
[CORE/cake/libs/model/connection_manager.php, line 23]

Fatal Error (256): ConnectionManager::getDataSource - Non-existent
data source default [CORE/cake/libs/model/connection_manager.php, line
102]



Here is the code of the install_controller.php
(app/plugins/install/controller/) :
https://github.com/croogo/croogo/blob/master/plugins/install/controllers/install_controller.php

The question is, how to prevent the plugin to access/ look for
database.php which about to be created in InstallController::index(),
so I could see the index's layout? The index is just showing message
if the app is fulfill basic requirement or not.

Note : if I provide database.php inside app/config/, it run smoothly.

Thank you for any responses.

--
Regards,,,
thom
http://mynameisthom.blogspot.com

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: js/css compression helpers for cakephp 2.0

2011-12-01 Thread Sam Sherlock
true but that being the case has other benefits too.

and asset_compress has many options and you can customize it to your every
whim *almost*



On 30 November 2011 21:30, euromark  wrote:

> I only thing I am wondering about that plugin is, whether it supports
> assert compression by using the default
> $this->Html->css/script syntax
> Or if one would have to completely rewrite all views/layouts here. (to
> $this->AssetCompress->...)
> From the look into the code and docs it seems this is necessary (no
> beforeRender hook to catch them and automatically process them if the
> helper is included etc).
>
>
> On 30 Nov., 20:46, mikeottinger  wrote:
> > Thanks guys, I'll give Mark Story's plugin a try
> > (https://github.com/markstory/asset_compress/tree/2.0). This supports
> YUI
> > Compression which I was particularly looking for. Thanks for the info.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Write unit test for a controller that uses AuthComponent in CakePHP 2.0.3

2011-12-01 Thread elitalon
After doing a `debug($this->User)` in UsersController I have found
that it's not a mocked model.

So what am I exactly mocking using `$this->generate()`?

On Nov 30, 1:41 pm, elitalon  wrote:
> I have posted this question in StackOverflow and Jose Lorenzo answered
> me this:
>
>     "The actual correct answer should be using mock objects instead of
> actually login the user in manually:
>
>     $this->controller = $this->generate('Users', array(
>         'components' => array('Auth' => array('user')) //We mock the
> Auth Component here
>     ));
>     $this->controller->Auth->expects($this->once())->method('user') //
> The method user()
>         ->with('id') //Will be called with first param 'id'
>         ->will($this->returnValue(2)) //And will return something for
> me
>     $this->testAction('/users/edit/2', array('method' => 'get'));"
>
> He is actually right but I'm still having problem when dealings with
> models. For example, suppose I am testing an action that uses `save`
> and `create` methods of a model. I tried to configure the expectations
> like this:
>
> $this->Users->User->expects($this->once())->with('save')->will($this->returnValue(true));
>
> $this->testAction('/signup', array('data' => $data));
>
> The action actually calls `save` to create a new User, but PHPUnit
> says that it was never called. I have created `$this->Users`
> controller in `ControllerTestCase::setUp()` like this:
>
> $this->Users = $this->generate('Users', array(
>   'components' => array('Session', 'Auth' => array('user'))
>   'models' => 'User'
> ));
>
> According to documentation, not passing any arguments to a mocked
> models implies every method is stubbed. So what am I doing wrong here?
>
> Thanks!
>
> On Nov 23, 1:25 pm, Shukuboy  wrote:
>
>
>
>
>
>
>
> > The only thing I can suggest is to add the mocked method to your
> > generate function :
>
> > $this->Users = $this->generate('Users', array(      'components'
> > => array('Session', 'Auth' => array('user') )    ));
>
> > Not sure if it would mock the method otherwise.
>
> > On Nov 23, 6:13 am,elitalon wrote:
>
> > > I am using the ControllerTestCase, so I have modified the generated
> > > controller using the following code, which is a slightly modified
> > > version of your suggested approach:
> > >     $this->Users = $this->generate('Users', array(      'components'
> > > => array('Session', 'Auth')    ));    
> > > $this->Users->Auth->expects($this->once())      ->method('user')      
> > > ->with('id')      -
> > > >will($this->returnValue(1));
>
> > > But it still fails. I completely agree with AuthComponent being
> > > inconsisten between the website usage and testing. I have flagged a
> > > ticket and I'm in discussion with Mark Story about that.
> > > On Nov 22, 7:04 pm, Shukuboy  wrote:
>
> > > > Hi,
>
> > > > I've also had to deal with testing controllers that use Auth
> > > > lately.    Auth has improved heaps since 1.3 but it still seems to be
> > > > coupled with various bits and pieces of the core, and hence you might
> > > > get different behaviours between the website and testing.
>
> > > > I recommend mocking out Auth and getting it to return the value you
> > > > expect, in this case if your logged in user is 1, you can use
> > > > something like this :
> > > > $Users->Auth->expects($this->once())->method('user')
> > > >        -> with( 'id' )
> > > >         ->will($this->returnValue(1));
>
> > > > Check out
> > > > -http://book.cakephp.org/2.0/en/development/testing.html#using-mocks-w...
> > > > and if you need more info on phpunit :
> > > > -http://www.phpunit.de/manual/current/en/test-doubles.html#test-double...
>
> > > > The new move to phpunit in Cake 2, was a great idea.  It's quite
> > > > powerful and allows you to do almost everything you need while unit
> > > > testing.
>
> > > > Hope this helps,
> > > > Shuku

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Send Email problem with multiple receivers

2011-12-01 Thread euromark
if you are using the new EmailLib in 2.0 you should be using the
setter methods:
$this->Email->to()
etc


On 1 Dez., 06:36, Graham Weldon  wrote:
> What CakePHP version are you on?
>
> Cheers,
> Graham Weldonhttp://grahamweldon.com
> e. gra...@grahamweldon.com
> p. (+61) 0407 017 293
> Skype: grahamweldon
>
>
>
>
>
>
>
> On Thursday, 1 December 2011 at 4:20 PM, MetZ wrote:
> > Hi..
> > Tried it, did not work either, only the first email in array get the
> > email.
>
> > Any other suggestions??
>
> > -Tom
>
> > On 1 Des, 06:03, Graham Weldon http://gmail.com)> 
> > wrote:
> > > Have you tried an array of email address?
>
> > > $this->Email->to = array('du...@rmail.com (http://rmail.com)', 
> > > 'du...@email.com (http://email.com)');
>
> > > Cheers,
> > > Graham Weldonhttp://grahamweldon.com
> > > e. gra...@grahamweldon.com (http://grahamweldon.com)
> > > p. (+61) 0407 017 293
> > > Skype: grahamweldon
>
> > > On Thursday, 1 December 2011 at 4:02 PM, MetZ wrote:
> > > > Hi all!
>
> > > > I am having a problem, when sending email with multiple reveivers in
> > > > $this->Email->to
>
> > > > It will only send to one adress (the first one =>
> > > > email_numb...@gmail.com (mailto:email_numb...@gmail.com 
> > > > (http://gmail.com))), why is that? any suggestions!?!
>
> > > > $this->Email->to = 'email_numb...@gmail.com 
> > > > (mailto:email_numb...@gmail.com), email_numb...@gmail.com 
> > > > (mailto:email_numb...@gmail.com (http://gmail.com))';
> > > > $this->Email->subject = 'Ma Subject!';
> > > > $this->Email->from = Configure::read('App.noreply');
> > > > $this->Email->template = 'new_notify';
> > > > $this->Email->sendAs = 'both';
> > > > $this->Email->send();
> > > > $this->Email->reset();
>
> > > > --
> > > > Our newest site for the community: CakePHP Video 
> > > > Tutorialshttp://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > > others with their CakePHP related questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com 
> > > > (mailto:cake-php+unsubscr...@googlegroups.com) For more options, visit 
> > > > this group athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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