Naming conventions: how should I do this?

2012-05-27 Thread Jacob Brunson
Hi. I'm new to CakePHP (just started yesterday)

After playing with it for a while, I just started working on the actual 
project i want to make using Cake.

I want to make an Admin section of my site. In this admin section, there 
should be three pages:

   1. Add User (so an admin can create a new user)
   2. List Users (the admin can see all registered users)
   3. Add Item (the admin can add an 'item' to the database)

I am very unsure of what to name my Model, Controller, and Views. 
AdminsController, Admin, [add_user, list_users, add_item]? It just doesn't 
seem right.

Could someone tell me definitively how I should be doing it, and if not, 
how you THINK I should be doing it?

thanks,
-Jacob

-- 
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: Tree Behavior - only enable leaves in select dropdown

2012-05-27 Thread lowpass
You could use TreeHelper to build the select list:

http://bakery.cakephp.org/articles/AD7six/2008/01/24/tree-helper-1

Read through it a few times; it's a bit confusing at first what you need to do.

Also, this code is pretty old, so you may need to update some of it for 2.x.

On Sun, May 27, 2012 at 5:15 AM, r4zv4n  wrote:
> I have a categories tree structure (ragged) and products. With the default
> behavior (i.e. using generateTreeList() ), when adding / editing a product,
> I can assign it to categories on any level.
>
> However, I'd like to only give the user the possibility of assigning
> products to leaf level categories. I would, however, like to present the
> user with the entire tree structure, as some category names can be ambigous
> (e.g. repeated for men / women).
>
> The way I imagined this was to generate a select dropdown, but with some of
> the options disabled (all but leaves) - but I'm not really sure how to go
> about doing that. I went through the options of generateTreeList(),
> find('threaded') and any other available methods of the Tree Behavior. Nor
> do I see options for disabling elements of a select in the Form Helper.
>
> Which way would you suggest I go?
>
> 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: models editing with jquery

2012-05-27 Thread lowpass
To load the form with AJAX, call the edit action, passing the ID, with
JQuery's load(). Use the same URL that you would in a link, in other
words.

If you only want the form to be loaded, and not the regular edit view,
put the form itself inside an element. The add & edit views then load
the form with $this->element(). Use a switch to branch based on the
action:

form.ctp:
switch ($this->params['action'])
{
case 'admin_edit':
echo $this->Form->create('Post', array('action' => 'edit'));
echo $this->Form->hidden('Post.id');
break;

case 'admin_add':
default:
echo $this->Form->create('Post', array('action' => 'add'));
}

// etc.

In the controller, test to see if it's an AJAX request. If it is, set
the viewPath to point to the elements directory, then render just the
form, not the full edit view.

function beforeFilter()
{
parent::beforeFilter();

if ($this->RequestHandler->isAjax())
{
Configure::write('debug', 0);
$this->layout = 'ajax';
}
}


public function edit($id = null)
{
// other stuff ...

if ($this->RequestHandler->isAjax())
{
$this->viewPath = 'elements'.DS.'your_controller_name';
$this->render('form');
}
}


On Wed, May 23, 2012 at 6:06 PM, femi oni  wrote:
> I have a jquery page and am using load() function to load objects to
> that page but now i need to load an edit form with the existing values
> to the page. do i load the view of the object and then use
> requestAction to get the existing data?
>
> --
> 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: forwarding user to dashboard after login by prefix

2012-05-27 Thread lowpass
You could check the prefixes in your login() method and don one less
redirect. Something like:

public function login()
{
if ($user = $this->Auth->user())
{
$prefixes = Configure::read('Routing.prefixes');

if (in_array($user['Group']['name'], $prefixes)) {
$this->redirect(array(
'prefix' => $use['Group']['name'],
'controller' => 'users',
'action' => 'dashboard'
));
}
}
}

Notice I passed a route array instead of a string. This way, if you
ever want the URL to have a different format it will still work.


On Wed, May 23, 2012 at 5:21 AM, baur79  wrote:
> Hi
> i have prefixes like "admin", "student"
> and i need to use prefixed dashboards (/admin/users/dashboard,
> /student/users/dashboard)
> here my working code
>
> AppController.php
>
> function beforeFilter() {
> $this->__checkAuth();
> $this->layout = $this->__setLayout();
> }
>
> function __checkAuth() {
>         $this->Auth->authorize = array('Actions' => array('actionPath' =>
> 'controllers'));
>         $this->Auth->loginAction = '/users/login';
>         $this->Auth->logoutRedirect = array('controller' => 'users',
> 'action' => 'login');
>         $this->Auth->loginRedirect = '/users/dashboard';
>         $this->Auth->redirect = false;
>
>        $loggeduser = $this->User->findById($this->Auth->user('id'));
>         $this->Session->write('loggeduser', $loggeduser);
>
> }
>
>
> UsersController.php
>
> public function dashboard() {
> $this->layout = 'user';
>
> $prefixes = Configure::read('Routing.prefixes');
> $loggeduser = $this->Session->read('loggeduser');
> if (in_array($loggeduser['Group']['name'], $prefixes)) {
> $this->redirect('/'.$loggeduser['Group']['name'].'/users/dashboard');
> }
> }
>
>
> is it ok? or you suggest to use another logic
>
> thanks in advance
> Baurzhan
>
> --
> 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: Malformed $results from Find queries

2012-05-27 Thread lowpass
I'd have a look at DboSource::read() as well as _filterResults() and
add some logging in there.

On Mon, May 21, 2012 at 9:00 AM, Michael Salisbury
 wrote:
> Cake Version 2.1
> PHP 5.3.10
> MySQL version 5.0.95 (cpanel server) 5.1.62 (dev server)
> Apache version 2.2.22 (cpanel server) 2.2.20 (dev server)
>
> cpanel server version 11.32.2 (redHat 5.8) (problem child)
> dev server version Ubuntu 11.10 (works perfectly)
>
> My problem is very specific, when I issue find('all') or find('list')
> or any other database retrieve function I get an improperly formed
> array. To troubleshoot this I have created some custom Find types in
> one of my database Models. I then used the Debugger::dump($var)
> command to print to the screen both the $query options that are
> submitted (in the before section )and the $results returned (in the
> after section).
> I have also enabled debug to 2 so I can compare SQL queries at the
> bottom of my web page.
>
> To rule out a problem with the differing MySQL versions I pointed my
> cake database.php config at both the dev server and the cpanel server
> when testing. Yes both MySQL servers have identical copies of the
> database.
>
> Also to deal with the issue of the Debugger::dump($var) command not
> descending more than three levels I have utilized a foreach loop in my
> code.
>
>
> Below you can see that the Dev server $results array has all the
> proper Table names ('College') and it even retrieves data from a
> joined table ('Tickets')
> The Cpanel server strangely injects "(int) 0" were the name 'College'
> should be and does not retrieved the data from the joined table.
>
> Dev server dump($query)...
> array(
> 'conditions' => null,
> 'fields' => null,
> 'joins' => array(),
> 'limit' => (int) 10,
> 'offset' => null,
> 'order' => 'created DESC',
> 'page' => (int) 1,
> 'group' => null,
> 'callbacks' => true
> )
>
> Dev server dunp($results)...
> array(
> 'College' => array(
> 'id' => '14',
> 'name' => 'Rosen College of Hospitality Management',
> 'email' => 'rchm-coll...@ucf.edu',
> 'created' => '2012-03-21 18:42:05',
> 'modified' => '2012-04-19 11:25:27'
> ),
> 'Ticket' => array()
> )
> array(
> 'College' => array(
> 'id' => '13',
> 'name' => 'Interdisciplinary Studies',
> 'email' => 'is-coll...@ucf.edu',
> 'created' => '2012-03-21 18:41:47',
> 'modified' => '2012-04-19 11:25:21'
> ),
> 'Ticket' => array(
> (int) 0 => array(
> )
> )
> )
> array(
> 'College' => array(
> 'id' => '12',
> 'name' => 'Florida Interactive Entertainment Academy',
> 'email' => 'fiea-coll...@ucf.edu',
> 'created' => '2012-03-21 18:41:33',
> 'modified' => '2012-04-19 11:25:13'
> ),
> 'Ticket' => array()
> )
> array(
> 'College' => array(
> 'id' => '11',
> 'name' => 'College of Sciences',
> 'email' => 'cos-coll...@ucf.edu',
> 'created' => '2012-03-21 18:41:16',
> 'modified' => '2012-04-19 11:25:08'
> ),
> 'Ticket' => array(
> (int) 0 => array(
> ),
> (int) 1 => array(
> )
> )
> )
>
> Cpanel Server dump($query)...
> array(
> 'conditions' => null,
> 'fields' => null,
> 'joins' => array(),
> 'limit' => (int) 10,
> 'offset' => null,
> 'order' => 'created DESC',
> 'page' => (int) 1,
> 'group' => null,
> 'callbacks' => true
> )
>
> Cpanel Server dump($results)...
> array(
> (int) 0 => array(
> 'id' => '14',
> 'name' => 'Rosen College of Hospitality Management',
> 'email' => 'rchm-coll...@ucf.edu',
> 'created' => '2012-03-21 18:42:05',
> 'modified' => '2012-04-19 11:25:27'
> )
> )
> array(
> (int) 0 => array(
> 'id' => '13',
> 'name' => 'Interdisciplinary Studies',
> 'email' => 'is-coll...@ucf.edu',
> 'created' => '2012-03-21 18:41:47',
> 'modified' => '2012-04-19 11:25:21'
> )
> )
> array(
> (int) 0 => array(
> 'id' => '12',
> 'name' => 'Florida Interactive Entertainment Academy',
> 'email' => 'fiea-coll...@ucf.edu',
> 'created' => '2012-03-21 18:41:33',
> 'modified' => '2012-04-19 11:25:13'
> )
> )
> array(
> (int) 0 => array(
> 'id' => '11',
> 'name' => 'College of Sciences',
> 'email' => 'cos-coll...@ucf.edu',
> 'created' => '2012-03-21 18:41:16',
> 'modified' => '2012-04-19 11:25:08'
> )
> )
> array(
> (int) 0 => array(
> 'id' => '10',
> 'name' => 'College of Optics and Photonics',
> 'email' => 'creol-coll...@ucf.edu',
> 'created' => '2012-03-21 18:41:10',
> 'modified' => '2012-04-19 11:24:59'
> )
> )
>
>
> Help, ideas, anything! Maybe I need to troubleshoot the afterSave code
> but I'm not sure were that lives or how to manipulate it.
>
> --
> 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 re

Re: XML Issues

2012-05-27 Thread lowpass
The parser is complaining because there's a tag mismatch. It may be
worth rendering to a variable and writing it to the log to see what
Cake is outputting. Or setting $this->layout to false and then sending
a Content-type: text/plain header first to keep the browser from
attempting to parse the output.

I don't understand why you would want to output XML for your add action, though.

On Sun, May 20, 2012 at 11:26 AM, Cara  wrote:
> I am trying to write what should be a simple API using CakePHP's REST
> with XML.
>
> The code I have is very basic, still not working.  I realize it is
> very likely a simple thing like file extension or path to file, but I
> am very new to REST and limited when using XML.  any help would be
> greatly appreciated.
>
> Here is my error
> XML Parsing Error: mismatched tag. Expected: .
> Location: http://member.ozonefit.com/users/add.xml
> Line Number 62, Column 4:       
> --^
>
> Here are the files
> Routes
>        Router::mapResources('users');
>        Router::parseExtensions('xml');
>
> Users Controller
>    var $components = array('RequestHandler');
>        function add(){
>                $this->layout = 'default';
>
>                        if( $this->RequestHandler->isXML() )
>                {
>
>                        configure::write('debug',0);
>                        $users['firstname'] = 'firstname';
>                        $users['lastname'] = 'lastname';
>                        $this->set(compact('users'));
>                }
>
>        }
>
>
> layouts->xml->default.xml
> Xml->header(array('version'=>'1.1'));
>
> layouts->users->xml add.xml
> Xml->serialize($users);
>
> --
> 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: Tree Behavior - only enable leaves in select dropdown

2012-05-27 Thread r4zv4n
Well, I ended up going jQuery on it (converting all the "disabled" options 
into optgroups - cross-browser disabling): 


  $('#ProductCategoryId option').each( function(idx) {
  thisIndent = $(this).text().split('—').length - 1;
  nextIndent = $(this).next().text().split('—').length - 1;
  
  if (nextIndent > thisIndent) {
  $(this).replaceWith('');
  } 
  });

On Sunday, May 27, 2012 12:15:44 PM UTC+3, r4zv4n wrote:
>
> I have a categories tree structure (ragged) and products. With the default 
> behavior (i.e. using generateTreeList() ), when adding / editing a product, 
> I can assign it to categories on any level. 
>
> However, I'd like to only give the user the possibility of assigning 
> products to leaf level categories. I would, however, like to present the 
> user with the entire tree structure, as some category names can be ambigous 
> (e.g. repeated for men / women).
>
> The way I imagined this was to generate a select dropdown, but with some 
> of the options disabled (all but leaves) - but I'm not really sure how to 
> go about doing that. I went through the options of generateTreeList(), 
> find('threaded') and any other available methods of the Tree Behavior. Nor 
> do I see options for disabling elements of a select in the Form Helper.
>
> Which way would you suggest I go?
>
> 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: How do I resolve this error?

2012-05-27 Thread lowpass
It looks like your CAKE_CORE_INCLUDE_PATH is defined as the empty
string. Open app\webroot\index.php and look at line 81. The is where
Cake is told where to find the libs. If the runtime is reaching this
else block then you must have uncommented line 59. Check that you've
put the correct path. Is the Cake directory at the same level as app?
Or somewhere else on the server?

Actually, what version are you running?

On Fri, May 18, 2012 at 4:52 AM, yenny  wrote:
> Warning: include(cake\bootstrap.php) [function.include]: failed to
> open stream: No such file or directory in C:\xampp\htdocs\lawsocscheme
> \app\webroot\index.php on line 81
>
> --
> 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: Problem In saving data

2012-05-27 Thread lowpass
You're using the index action. That is for *listing* all Friends You
should be using the add action.

On Fri, May 18, 2012 at 7:35 AM, Teji  wrote:
> hello any 1 tell me wt is the problem in my code
> it shows me friend is inserted bt data doesnt save in Database;
> i am able to store data with scaffold.
>
> index.ctp
>
>  echo $this->Form->create('friend');
> echo $this->Form->input('Name');
> echo $this->Form->input('Mobile');
> echo $this->Form->input('Email');
> echo $this->Form->end('Save Friend');
>
> ?>
> element('sql_dump'); ?>
>
> Controller
>
>   class FriendsController extends AppController {
>  var $name = 'Friends';
> public $components = array('Session');
> //var $scaffold;
>  public function index()
>  {
>           if ($this->request->is('post'))
>           {
>            if ($this->Friend->save($this->request->data))
>                                {
>                                        $this->Session->setFlash('Your Friend 
> has been saved.');
>                                        $this->redirect(array('action' => 
> 'index'));
>                }
>                        else
>                                {
>                                        $this->Session->setFlash('Unable to 
> add your Friend.');
>                                }
>        }
>
>  }
>
> Database
>
> friends
> Column  Type    Null    Default         Comments
> id               int(10)        No
> name    varchar(30) Yes  NULL
> mobile  int(11)         Yes     NULL
> email   varchar(30) Yes         NULL
>
> --
> 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 Parsing Variable form 1 to form 2

2012-05-27 Thread lowpass
I can't figure out what you're trying to do but you have an error in
the href. If you want it to call a javascript function it should be:

href="javascript:lovparsing('');"

Also, DOM element IDs cannot begin with a number. So if your
$v['vtest']['numbercode'] value is a number you should consider
appending the value instead of prepending:

 wrote:
> Dear all my friends cake php mailing list
>
> I want to try to parsing  fields in the form 1 to form 2, but failed to
> appear in the form 2 fieldnya, the following script that I have done
>
>
>  href="add/javascript:lovparsing(' ?>');">
>
> 
>     function lovparsing(v){
>     var parentFormsecond
> =parent.document.getElementById('InpekNomorgardu');
>                 $(parentFormsecond).val(v);
>   }
>     
>
> Is there an easier solution to successfully parsing a variable to the form 2
>
> help me !!,
>
> Thank's
> Regards
>
>
>
> Barry
>
> --
> 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: Unauthorized users don't get redirected to login action

2012-05-27 Thread Dave Milsom


On Sunday, May 27, 2012 9:46:34 AM UTC-4, rihad wrote:
>
> > Trying to access an unauthorized area of the app should not log them out 
> by 
> > default and kick them to a log in page. 
>
> There's absolutely no need to log them out first. Redirecting to index 
> page is weird, the user never asked for it. But they did ask for the 
> resource they had no right to access, so presenting them with a login 
> screen gets them closer to what they really wanted. Does it make any 
> sense now?


So you want a logged in user to log in again, but not be logged out first. 
No, that makes no sense to me. 
What you should be doing is setting up your users and permissions so that 
your users have the access they need, not that they have to log in with a 
different username to access different resources. 

-- 
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: Serialization of 'Closure' is not allowed

2012-05-27 Thread José Lorenzo
Just change DebugKit configuration:

'DebugKit.Toolbar' => array('panels' => array('history' => false));

On Friday, May 18, 2012 11:44:29 AM UTC-4:30, MThomas wrote:
>
> Hi! 
>
> First of all I'm pretty new to CakePHP. Although it sometimes gives me 
> headaches I love. 
>
> On problem keeps coming up and I really do not know what it is caused 
> by. The following error keeps popping up: "[Exception] Serialization 
> of 'Closure' is not allowed". I'm using a Amazon EC2 and Ubuntu is 
> installed. 
>
> Any thoughts on this matter? 
>
> The error in more detail: 
>
> Fatal Error (256): [Exception] Serialization of 'Closure' is not 
> allowed 
> #0 /var/www/example.com/htdocs/cakephp/lib/Cake/Cache/Engine/ 
> FileEngine.php(0): serialize() 
> #1 /var/www/example.com/htdocs/cakephp/lib/Cake/Cache/Cache.php(295): 
> FileEngine->write('cake_toolbar_ca...', Array, 14400) 
> #2 /var/www/example.com/htdocs/cakephp/app/Plugin/debug_kit/Controller/ 
> Component/ToolbarComponent.php(437):
>  
>
> Cache::write('toolbar_cachee5...', Array, 'debug_kit') 
> #3 /var/www/example.com/htdocs/cakephp/app/Plugin/debug_kit/Controller/ 
> Component/ToolbarComponent.php(309):
>  
> ToolbarComponent- 
> >_saveState(Object(CakeErrorController), Array) 
> #4 [internal function]: ToolbarComponent- 
> >beforeRender(Object(CakeErrorController)) 
> #5 /var/www/example.com/htdocs/cakephp/lib/Cake/Utility/ 
> ObjectCollection.php(130): call_user_func_array(Array, Array) 
> #6 [internal function]: ObjectCollection->trigger(Object(CakeEvent)) 
> #7 /var/www/example.com/htdocs/cakephp/lib/Cake/Event/ 
> CakeEventManager.php(246): call_user_func(Array, Object(CakeEvent)) 
> #8 /var/www/example.com/htdocs/cakephp/lib/Cake/Controller/ 
> Controller.php(924): CakeEventManager->dispatch(Object(CakeEvent)) 
> #9 /var/www/example.com/htdocs/cakephp/lib/Cake/Error/ 
> ExceptionRenderer.php(285): Controller->render('error500') 
> #10 /var/www/example.com/htdocs/cakephp/lib/Cake/Error/ 
> ExceptionRenderer.php(267): ExceptionRenderer- 
> >_outputMessageSafe('error500') 
> #11 /var/www/example.com/htdocs/cakephp/lib/Cake/Error/ 
> ExceptionRenderer.php(187): ExceptionRenderer- 
> >_outputMessage('missingBehavior') 
> #12 [internal function]: ExceptionRenderer- 
> >_cakeError(Object(MissingBehaviorException)) 
> #13 /var/www/example.com/htdocs/cakephp/lib/Cake/Error/ 
> ExceptionRenderer.php(165): call_user_func_array(Array, Array) 
> #14 /var/www/example.com/htdocs/cakephp/lib/Cake/Error/ 
> ErrorHandler.php(127): ExceptionRenderer->render() 
> #15 [internal function]: 
> ErrorHandler::handleException(Object(MissingBehaviorException)) 
> #16 {main} [CORE/Cake/Error/ErrorHandler.php, line 136] 
>

-- 
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: running cake with nginx

2012-05-27 Thread José Lorenzo
Did you read documentation in the book regarding nginx?

On Sunday, May 27, 2012 6:55:33 AM UTC-4:30, braveh4rt wrote:
>
> Hi,
>
> i try run cake with nginx web server, follow the guide in the cake 
> doc...cake can running and served by php-fcgi . 
>
> the problem is my css / img / js / all static file not php file, cannot 
> load.
>
> is there any configuration for access the other static file ?
>
> i already try any google result doc, but still error 404 for the css / img 
> files..
>
> any help and pointer appreciated. 
>
> Rgds,
>
> Mulianto
>

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


Empty array on Model::save bypasses validation

2012-05-27 Thread John
On 2.1 if I do $this->Category->save($this->request->data) and $this-
>request->data is an empty array() model validation is bypassed and an
"empty" record is saved.

My model validation as baked:

class Category extends AppModel {
public $displayField = 'name';
public $validate = array(
'name' => array(
'notempty' => array(
'rule' => array('notempty'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after 
this rule
//'on' => 'create', // Limit validation to 
'create' or 'update'
operations
),
),
);
}

-- 
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: Change route, base path

2012-05-27 Thread veganista
Its not the routes that you need to change when moving the files out of 
webroot, It's the index.php in your new web root. In there you define the 
paths to your cake installation.

Your file is probably in something like /www/cake/index.php

On Sunday, May 27, 2012 6:13:12 AM UTC+2, Afif Abu Bakar wrote:
>
> Hi
>
> I've got a problem after moving my working CakePHP into new folder under 
> webroot. Previously, its working fine under webroot and can be access via 
> localhost. But I've moved the  CakePHP  files into a new subfolder under 
> webroot and I expect it to work via http://localhost/cake/.
> So now I don't have access to my CakePHP files after moved unless I move 
> it back to webroot. I knew I need to change something in Routes.php but I 
> don't know how. Can someone explain to me what to change in order for it to 
> works via http://localhost/cake?
>
>

-- 
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: MeioUpload 4.0 and CakePHP 2.1

2012-05-27 Thread Lucas Elias
Use "type":  

Example: Form->create('Users', *array('type' => 'file')*
);?>

Em quinta-feira, 29 de março de 2012 01h22min03s UTC-3, Thiago Silva 
escreveu:
>
> Hello, 
>
> I'm trying to use MeioUpload 4.0 with CakePHP 2.1, but I'm getting 
> this error: 
>
> Warning (2): finfo_file(A): failed to open stream: No such file or 
> directory [APP/Plugin/MeioUpload/Model/Behavior/ 
> MeioUploadBehavior.php, line 578] 
>
> Warning (2): mime_content_type(A) [http://php.net/function.mime- 
> content-type ]: failed to open 
> stream: No such file or directory [APP/ 
> Plugin/MeioUpload/Model/Behavior/MeioUploadBehavior.php, line 584] 
>
> Can anybody help me? 
>
> Thanks, 
> Thiago

-- 
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: GoogleMapV3 Helper issue

2012-05-27 Thread Michael Gaiser
I got it working finally. I ended up using a different branch and it
worked. Thanks

Sent from my iPhone

On 2012-05-26, at 9:23 PM, euromark  wrote:

without showing the complete code its hard to tell what you are doing wrong

no - as long as you are connected to the internet you should be fine


Am Freitag, 25. Mai 2012 21:24:57 UTC+2 schrieb Michael:
>
> Would there be any issue with the fact that I am running it from my
> local host instead of from my host?
>
 --
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: Unauthorized users don't get redirected to login action

2012-05-27 Thread rihad
> Trying to access an unauthorized area of the app should not log them out by
> default and kick them to a log in page.

There's absolutely no need to log them out first. Redirecting to index
page is weird, the user never asked for it. But they did ask for the
resource they had no right to access, so presenting them with a login
screen gets them closer to what they really wanted. Does it make any
sense now?

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


1.3->2.1 migration: aco problem

2012-05-27 Thread Rob M
Attempting to migrate my app from 1.3 to 2.1; using xampp. I'm running into 
an error in the console when I use AclExtras to recover aco ('recover aro' 
produces no error). The same error is encountered when attempting 
'aco_sync'. Would you perhaps recognize the stack trace and suggest where 
to look for solutions? Text follows:

C:\xampp\htdocs\testpeople\people>*cake AclExtras.AclExtras recover aro*


Welcome to CakePHP v2.1.3 Console
---
App : people
Path: C:\xampp\htdocs\testpeople\people\
---
Tree has been recovered, or tree did not need recovery.

C:\xampp\htdocs\testpeople\people>*cake AclExtras.AclExtras recover aco*


Welcome to CakePHP v2.1.3 Console
---
App : people
Path: C:\xampp\htdocs\testpeople\people\
---
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an 
error in your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near 'recover' at line 1
#0 C:\xampp\htdocs\cakephp\lib\Cake\Model\Datasource\DboSource.php(437): 
PDOStatement->execute(Array)
#1 C:\xampp\htdocs\cakephp\lib\Cake\Model\Datasource\DboSource.php(403): 
DboSource->_execute('recover', Array)
#2 C:\xampp\htdocs\cakephp\lib\Cake\Model\Datasource\DboSource.php(647): 
DboSource->execute('recover', Array, Array)
#3 C:\xampp\htdocs\cakephp\lib\Cake\Model\Datasource\DboSource.php(589): 
DboSource->fetchAll('recover', Array, Array)
#4 C:\xampp\htdocs\cakephp\lib\Cake\Model\Model.php(775): 
DboSource->query('recover', Array, Object(Aco))
#5 
C:\xampp\htdocs\testpeople\people\Plugin\AclExtras\Console\Command\AclExtrasShell.php(300):
 
Model->__call('recover', Array)
#6 
C:\xampp\htdocs\testpeople\people\Plugin\AclExtras\Console\Command\AclExtrasShell.php(300):
 
Aco->recover()
#7 C:\xampp\htdocs\cakephp\lib\Cake\Console\Shell.php(386): 
AclExtrasShell->recover()
#8 C:\xampp\htdocs\cakephp\lib\Cake\Console\ShellDispatcher.php(177): 
Shell->runCommand('recover', Array)
#9 C:\xampp\htdocs\cakephp\lib\Cake\Console\ShellDispatcher.php(69): 
ShellDispatcher->dispatch()
#10 C:\xampp\htdocs\cakephp\lib\Cake\Console\cake.php(41): 
ShellDispatcher::run(Array)
#11 {main}
42000

-- 
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: Unauthorized users don't get redirected to login action

2012-05-27 Thread Dave Milsom


On Saturday, May 26, 2012 3:29:33 PM UTC-4, rihad wrote:
>
>
>
> On May 25, 7:13 pm, Dave Milsom  wrote: 
> > On Friday, May 25, 2012 2:15:51 AM UTC-4, rahajiyev wrote: 
> > 
> > > On May 24, 6:52 pm, Ceeram  wrote: 
> > > > Why should a logged in user be redirected to login? 
> > 
> > > The logged in user doesn't have that specific privilege. 
> > > One would expect a login screen to appear when one has insufficient 
> > > privileges... 
> > 
> > I wouldn't expect that. 
>
> Well, you would expect to be told that you don't have the permission, 
> and be allowed to log in as the user who does have it, wouldn't you?



No, I would expect that the logged in user has the permissions they need. 
Trying to access an unauthorized area of the app should not log them out by 
default and kick them to a log in page. If that is what you chose to do, 
then go ahead. It is not a "design deficiency" by any stretch.

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


running cake with nginx

2012-05-27 Thread Phang Mulianto
Hi,

i try run cake with nginx web server, follow the guide in the cake
doc...cake can running and served by php-fcgi .

the problem is my css / img / js / all static file not php file, cannot
load.

is there any configuration for access the other static file ?

i already try any google result doc, but still error 404 for the css / img
files..

any help and pointer appreciated.

Rgds,

Mulianto

-- 
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: app/tmp permissions

2012-05-27 Thread Steve Found

On 26/05/12 06:30, Kid Noire wrote:

I'm a total newbie to Cake and believe I've put everything in their
proper folders.  Everything is green on my local host except my tmp
Directory is not writable (yellow)  I have no idea how to set
permissions and have tried chmod in terminal but really not sure even
if I'm doing this part properly.  Any step by step would be much
appreciated.  Thanks!



Assuming you are on a linux server running apache2:

The easiest (but most unsafe) method is to change to your app directory 
and do 'chmod -R 777 tmp' which makes tmp and everything below it 
readable and writeable by everyone.


A better method is to change group ownership of tmp and everthing below 
it to www-data ( or whatever group your apache server runs in ) with 
'chgrp -R www-data tmp' followed by 'chmod -R 774 tmp' This makes tmp 
read/write for you and the www-data group but readonly for everyone else


If you have access to /etc/apache2 on your system, you could also modify 
/etc/apache2/envvars and change 'APACHE_RUN_USER' and 'APACHE_RUN_GROUP' 
to be your username and group. This will make the webserver run as you. 
This is OK for local systems but you are unlikely to have access to this 
file in a hosted environment unless you have your own server.


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


Tree Behavior - only enable leaves in select dropdown

2012-05-27 Thread r4zv4n
I have a categories tree structure (ragged) and products. With the default 
behavior (i.e. using generateTreeList() ), when adding / editing a product, 
I can assign it to categories on any level. 

However, I'd like to only give the user the possibility of assigning 
products to leaf level categories. I would, however, like to present the 
user with the entire tree structure, as some category names can be ambigous 
(e.g. repeated for men / women).

The way I imagined this was to generate a select dropdown, but with some of 
the options disabled (all but leaves) - but I'm not really sure how to go 
about doing that. I went through the options of generateTreeList(), 
find('threaded') and any other available methods of the Tree Behavior. Nor 
do I see options for disabling elements of a select in the Form Helper.

Which way would you suggest I go?

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