Looking for something better then requestAction?

2009-04-06 Thread Walther

Hi all

In an app that I am currently developing I wish to give the
administrator the ability to customise the home page of the app by
being able to include various other things into the home page (For
example, the admin may wish to show a welcome message which uses the
pages controller, and they may wish to show a calendar using the
calendars controller and an unlimited number of other views).

What I am currently doing is on the homepage view I do a loop through
the homepages table and call the homepages.ctp element and sends it
the relevant data for the view that needs to be displayed. The
homepage element then calls the relevant element for whatever
controller the admin has chosen, this controller may be part of a
plugin.

The homepages.ctp element looks as follows:
?php
if ($item['MenuLink']['plugin_id'] == 0)
{
$View = ClassRegistry::getObject('view');
echo $View-element('homepages/' . $item['MenuLink']['controller'],
array('item' = $item));
}
else
{
$View = ClassRegistry::getObject('view');
echo $View-element('homepages/' . $item['MenuLink']['controller'],
array('item' = $item, 'plugin' = $item['MenuLink']['Plugin']
['directory']));
}
?

As an example the homepages/pages.ctp element looks as follows:
?php $pageToShow = $this-requestAction('/pages/index/' . $item
['Homepage']['options']); ?
?php if (isset($pageToShow)) : ?
div
div id=dataInfo
Created: span class=timeago title=?php echo 
$pageToShow['Page']
['created']; ??php echo $date-prettyDate($pageToShow['Page']
['created']); ?/spanbr /
Modified: span class=timeago title=?php echo 
$pageToShow
['Page']['modified']; ??php echo $date-prettyDate($pageToShow
['Page']['modified']); ?/spanbr /
Tags: ?php echo $pageToShow['Page']['tags']; ?
/div

h1 id=nice_name?php echo $pageToShow['Page']['title']; 
?/h1
div id=content style=margin-top:10px; text-align:left;
?php
echo $pageToShow['Page']['text'];
?
/div
/div
?php else : ?
No page
?php endif; ?

It is working well. However, I realise that requestAction is quite
intensive as it acts like another server request, is there some other
method that I can use that will achieve the same outcome but use less
server resources?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem in session management in Cakephp

2009-04-06 Thread SeeVik

I found out that this problem is occuring only for users in Kenya. I
found one more case of such a website with users in Kenya who are
getting sessions mixed up.

Does anybody have any idea about this strange problem?

On Apr 6, 1:21 pm, SeeVik vikramvmalhotra1...@gmail.com wrote:
 Regarding this problem, can anybody tell me where the log files are
 stored in cakephp?

 On Apr 3, 1:43 pm, SeeVik vikramvmalhotra1...@gmail.com wrote:

  Hello all

  I have a question regarding our website built using cakephp. I have
  some idea of php but I am completely new to the frameworks. The thing
  is our company got a webapp built from a firm to manage information of
  our customers.

  But the thing is that the sessions at the customer side are somehow
  getting mixed up. Like when one user logs in, sometime later he is
  able to see the information of other customer. However, at our test
  server this problem does not happen. I read some documentation of
  cakephp and I have checked out that the session management on our
  system is being done using the default PHP mechanism.

  Can somebody help me in figuring out where the problem could be, I
  mean in what direction should I look?

  Thanks and Regards
  Vikram
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



insert multiple chekbox values

2009-04-06 Thread Ranju

hello i want to  insert  multiple chekbox values...



View File

?php echo $form-input('Moviegenre.genreid[]',array('label'=false,
'type'='checkbox','multiple'=true,'value'=$genre['Genre']['id'])); ?


Controllercode


$genreid=   $this-data['Moviegenre']['genreid'];


foreach($genreid as $key = $value)
{
$query = insert into moviegenres(genreid)values($value);
$update = $this-Moviegenre-query($query);

}

Its not work



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



Re: Problem in session management in Cakephp

2009-04-06 Thread Dr. Loboto

Your problem is unclear. What is sessions mixed up? If someone see
information of other customer maybe it is just currently logged
person?

On Apr 6, 3:42 pm, SeeVik vikramvmalhotra1...@gmail.com wrote:
 I found out that this problem is occuring only for users in Kenya. I
 found one more case of such a website with users in Kenya who are
 getting sessions mixed up.

 Does anybody have any idea about this strange problem?

 On Apr 6, 1:21 pm, SeeVik vikramvmalhotra1...@gmail.com wrote:

  Regarding this problem, can anybody tell me where the log files are
  stored in cakephp?

  On Apr 3, 1:43 pm, SeeVik vikramvmalhotra1...@gmail.com wrote:

   Hello all

   I have a question regarding our website built using cakephp. I have
   some idea of php but I am completely new to the frameworks. The thing
   is our company got a webapp built from a firm to manage information of
   our customers.

   But the thing is that the sessions at the customer side are somehow
   getting mixed up. Like when one user logs in, sometime later he is
   able to see the information of other customer. However, at our test
   server this problem does not happen. I read some documentation of
   cakephp and I have checked out that the session management on our
   system is being done using the default PHP mechanism.

   Can somebody help me in figuring out where the problem could be, I
   mean in what direction should I look?

   Thanks and Regards
   Vikram
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Updating users in group edit view

2009-04-06 Thread Givano

I've read here that hasMany doesn't work with automagic forms
automatically. So how to map, for example, checkboxes in the view file
to each group_id of users of the data array in my case?

Thanks, Ivan

On Apr 2, 5:19 pm, Givano giv...@gmail.com wrote:
 Hi All!

 I hope you can help me, I've tried everything I could but it still not
 working and should be very simple thing.

 I have Users table:
 CREATE TABLE `users` (
   `id` int(11) unsigned NOT NULL auto_increment,
   `username` varchar(50) collate utf8_unicode_ci NOT NULL,
   `realname` varchar(150) collate utf8_unicode_ci default NULL,
   `emailaddress` varchar(120) collate utf8_unicode_ci default NULL,
   `location_id` int(11) unsigned NOT NULL,
   `group_id` int(11) unsigned default NULL,
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;

 and Groups table:
 CREATE TABLE `groups` (
   `id` int(11) unsigned NOT NULL auto_increment,
   `name` varchar(120) collate utf8_unicode_ci NOT NULL,
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

 both Models are defined as

 class Group extends AppModel {
         var $name = 'Group';
         var $hasMany = array('User');

 }

 class User extends AppModel {
         var $name = 'User';
         var $belongsTo = array('Group');

 }

 and I have generated standard methods for controllers.

 My goal is to make edit view for group where I have multiple selection
 of users with criteria (all users which have the same group_id as the
 group I'm editing or have group_id is null) and on submit all selected
 users should get id of this group assigned.

 Controller function edit:
         function edit($id = null) {
                 if (!$id  empty($this-data)) {
                         $this-Session-setFlash(__('Invalid Group', true));
                         $this-redirectBack();
                 }
                 if (!empty($this-data)) {
                         if ($this-Group-save($this-data)) {
                                 $this-Session-setFlash(__('The Group has 
 been saved', true));
                                 $this-redirectBack();
                         } else {
                                 $this-Session-setFlash(__('The Group could 
 not be saved. Please,
 try again.', true));
                         }
                 }
                 if (empty($this-data)) {
                         $this-data = $this-Group-read(null, $id);
                 }
                 $users= 
 $this-Group-User-find('list','fields'='User.realname');
                 $this-set(compact('users'));
         }
 My view edit.ctp:
 div class=groups form
 ?php echo $form-create('Group');?
         fieldset
                 legend?php __('Edit Group');?/legend
         ?php
                 pr($users);
                 echo $form-input('id');
                 echo $form-input('name');
                 echo $form-input('location_id');
                 echo $form-input('User',array
 ('type'='select','multiple'='checkbox'));

         ?
         /fieldset
 ?php echo $form-end('Submit');?

 The Problem is that on submit only group object is saved, no changes
 on user data. Please, please help me on it!

 TIA,

 Ivan

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



Acl Not Denying Users

2009-04-06 Thread trevorsg

Hey guys,

I hope someone can give me some hints; this problem has had me stumped
for quite some while now. I'm sort of new to CakePHP. I'm trying to
set up my own application using ACL. I've read all of the tutorials at
the Cookbook, and I'm pretty sure I followed them correctly. I have my
database set up properly with AROs, ACOs, and aros_acos. When I use
the AclComponent::check() method to test permissions, the correct
boolean value is returned.

I created a test user and denied permissions to the root ACO node.
However, when I log in with that user, I still have full permissions
to do everything: add, edit, view, etc. It's as if ACL is not there at
all. The AuthComponent is also being used, and everything seems to be
working fine with that.

Does anyone have any suggestions or questions about my problem? Any
help is, of course, greatly appreciated.

Cheers.

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



Sessions lost

2009-04-06 Thread Deud'tens

 Hello, sorry for my english, I'm french.

I have a god damn problem with sessions of cakephp : they don't work !
When I flash to another controller/action, everything is lost. I went
into the core.php file and lowered everything possible and tried all
the session handlers :

Configure::write('Session.checkAgent', false);
Configure::write('Security.level', 'low');

etc.

But it doesnt work. I already read many discussions about this problem
but I couldnt solve it. This is a simple example of what I want to
do :

CODE

?php

class UsersController extends AppController
{
 function login()
 {
   if (!empty($this-data))
   {
 $userId = $this-User-loginVerif($this-data);
 if ($userId != null)
 {
   $this-Session-write('Login.id', $userId);
   print_r($_SESSION);//Works fine
   $this-flash(Vous vous êtes authentifié avec succès., /
quizzes/jouer);
 }
   }
 }
}
?


And the controller called by the previous action :

CODE

?php

class QuizzesController extends AppController
{
 function jouer()
 {
   echo $this-Session-read('Login.id');//Totally empty !
   $quiz = $this-Quiz-details();
   $this-set('quiz', $quiz);
 }
}
?


I know that there's already an authcomponent, but it doesnt work, for
the same reasons I guess.

Thanks for all in advance !

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



Re: Cakephp - ExtJS or YUI!

2009-04-06 Thread jmcneese

i have done a couple projects that are extjs front-ends backed by
cake.  what exactly are you trying to do?

On Apr 3, 10:35 pm, baur79 bau...@gmail.com wrote:
 Hi everyone,

 is there any of you have experience to implement this libraries into
 your Cakephp projects.
 we want to implement advanced feather of girds of those libraries.
 please light on us.

 Best regards
 Baurzhan

 Kazakhstan / megahosting.kz

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



Re: Looking for something better then requestAction?

2009-04-06 Thread Walther

I believe I've found a solution.

For each possible item that can be added to the homepage I store the
name of the controller that is called. By simply changing this to the
model name and using App::Import in the homepage model (Where I fetch
the items from the database) I have gotten rid of the requestActions.

Seems to be working quite well.

From those who are more experienced at Cake, is this a better way of
doing it?

On Apr 6, 10:51 am, Walther waltherl...@gmail.com wrote:
 Hi all

 In an app that I am currently developing I wish to give the
 administrator the ability to customise the home page of the app by
 being able to include various other things into the home page (For
 example, the admin may wish to show a welcome message which uses the
 pages controller, and they may wish to show a calendar using the
 calendars controller and an unlimited number of other views).

 What I am currently doing is on the homepage view I do a loop through
 the homepages table and call the homepages.ctp element and sends it
 the relevant data for the view that needs to be displayed. The
 homepage element then calls the relevant element for whatever
 controller the admin has chosen, this controller may be part of a
 plugin.

 The homepages.ctp element looks as follows:
 ?php
 if ($item['MenuLink']['plugin_id'] == 0)
 {
         $View = ClassRegistry::getObject('view');
         echo $View-element('homepages/' . $item['MenuLink']['controller'],
 array('item' = $item));}

 else
 {
         $View = ClassRegistry::getObject('view');
         echo $View-element('homepages/' . $item['MenuLink']['controller'],
 array('item' = $item, 'plugin' = $item['MenuLink']['Plugin']
 ['directory']));}

 ?

 As an example the homepages/pages.ctp element looks as follows:
 ?php $pageToShow = $this-requestAction('/pages/index/' . $item
 ['Homepage']['options']); ?
 ?php if (isset($pageToShow)) : ?
         div
                 div id=dataInfo
                         Created: span class=timeago title=?php echo 
 $pageToShow['Page']
 ['created']; ??php echo $date-prettyDate($pageToShow['Page']
 ['created']); ?/spanbr /
                         Modified: span class=timeago title=?php echo 
 $pageToShow
 ['Page']['modified']; ??php echo $date-prettyDate($pageToShow
 ['Page']['modified']); ?/spanbr /
                         Tags: ?php echo $pageToShow['Page']['tags']; ?
                 /div

                 h1 id=nice_name?php echo $pageToShow['Page']['title']; 
 ?/h1
                 div id=content style=margin-top:10px; text-align:left;
                         ?php
                         echo $pageToShow['Page']['text'];
                         ?
                 /div
         /div
 ?php else : ?
 No page
 ?php endif; ?

 It is working well. However, I realise that requestAction is quite
 intensive as it acts like another server request, is there some other
 method that I can use that will achieve the same outcome but use less
 server resources?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



DataBase inputs from 'input-field' url-parameter

2009-04-06 Thread fr3ezer

Hey Guys,
i have an little problem!

I wanna add in my sql-db 'ftopics' the values 'name'  'forum_id'.
The forum_id is an parameter in the URL like : 'cakeboard/topics/add/
5'. Than I wanna add an topic in forum with id 5...

Of Cource I want add a content and a subject to the topic.. In my view
I have the lines:

echo $form-create('Topic', array('action' = 'add'));
echo $form-input('subject');
echo $form-input('content');
echo $form-end('Add');

so.. ehm the user can input subject  content of the new topic with
the form.. How can I get the inputs from the view AND the forum_id
from the URL parameter ??

here is a snippet of my topic add function:

function add($forum_id = null) {
if($forum_id != null  $this-data != null){
//echo $this-data['Topic']['name'];
$this-data['Topic']['forum_id'] = $forum_id;
$this-Topic-create();
$this-Topic-save($this-data);
} else {
$this-Session-setFlash('Please insert title and 
content and the
forum_id in URL!');
}
}


At the moment I can`t add forum_id  the user-inputs to the DB in one
entry, because I only get the forum_id from parameter OR the user-
inputs..

Thanks a lot !

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



RE: Woes of ACL

2009-04-06 Thread Dave Maharaj :: WidePixels.com

In your controllers do you have something like:

function beforeFilter()
  {
  parent::beforeFilter();
  
  $this-Auth-allowedActions = array('register', 'index');// allow
public access to these only
  $this-Auth-autoRedirect = true;
}

Dave

-Original Message-
From: trevorsg [mailto:trevo...@gmail.com] 
Sent: April-06-09 2:07 AM
To: CakePHP
Subject: Woes of ACL


Hey guys,

I've been trying to solve an issue with ACL for two days now, but I just
can't find any answers.

Basically I'm trying to set up an application to work with Auth and Acl. I
followed the tutorials in the Cookbook - I created the database tables, all
of the ACOs and AROs are created. Then, I ran a deny for a particular user
on the root node. But no matter what I do, every user has access to all
parts of the application.

I have started this app from scratch twice, and I get the same outcome each
time. I think there is something fundamental that I'm missing.
The AclComponent::check() method returns the proper boolean value for
ARO/ACO pairs that I pass to it, but still users are never denied access to
any parts of the site.

Hopefully someone here can give me a steer in the right direction. I am
happy to provide code or extra information if needed.

Thanks very much for any help!

Cheers,
Trevor



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



It's all about Language - The TranslationBehaviour

2009-04-06 Thread Aurelius

Hi!

Is it possible to restrict the languages from which the
TranslationBehaviour chooses?
Is it possible to set a default language if non of the available one
matches?

thx
Aurelius

PS: Can you recommend anything whichs gets further with
translationBehaviour than the Cookbook?
Are there any Plug-ins or feature-enhancements?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



redirecting with ACL

2009-04-06 Thread atta

hi
 how can i check for group id and redirect after login to admin site
and if it was a member then public member area.
I have same login section for both Admin and members.
I am trying to do something like this.

if($this-Auth-user('group_id')== 5){
$this-Auth-loginRedirect = array('controller'='newsletters',
'action'='index'); }
else{
$this-Auth-loginRedirect = array('controller'='Pages',
'action'='display'); }


but no success.
Any help please..

atta ur rehman

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



beautiful link with pagination with search

2009-04-06 Thread catfish

new member here.

I am playing with cake now. One problem that bothers me is the search
function. The search function will process post data, when in
pagination, the paginator does not pass the search src.

For example, I would like:

site.com/search/search-string/page:1

In stead, the paginator would only show

site.com/search/page:1

The solution is:

in your view, add 'url'=$paginator-params['pass']
for example,

$paginator-numbers(array('url'=$paginator-params['pass']));

This will allow paginator to pass the search string in the link.

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



error in executing consecutive ajax calls

2009-04-06 Thread Krish

Hi All,

I have a form in which I have add and delete operations for comments
section. I am implementing them using Ajax.

My first Ajax operation (i.e. either add/ delete) is working fine.
when i go for my second Ajax operation it is not working.

For Ex:
   step 1: Adding a new comment using 'Add
Comment' .   // Ajax call is working fine.
   step 2: When i click 'Add Comment' again, It is not
adding new data.   // Ajax call is not working.

Note: when I refresh /reload  the page manually, again my first Ajax
call is executing. second call is not working.

Can anyone help me to over come this issue...

I am using CakePHP's built in Ajax helpers with prototype/
scriptaculous for my Ajax operations.

Thanks in advance...

Regards,
Krish

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



Re: Looking for something better then requestAction?

2009-04-06 Thread majna

Use elements cache :)
http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction

On Apr 6, 12:06 pm, Walther waltherl...@gmail.com wrote:
 I believe I've found a solution.

 For each possible item that can be added to the homepage I store the
 name of the controller that is called. By simply changing this to the
 model name and using App::Import in the homepage model (Where I fetch
 the items from the database) I have gotten rid of the requestActions.

 Seems to be working quite well.

 From those who are more experienced at Cake, is this a better way of
 doing it?

 On Apr 6, 10:51 am, Walther waltherl...@gmail.com wrote:

  Hi all

  In an app that I am currently developing I wish to give the
  administrator the ability to customise the home page of the app by
  being able to include various other things into the home page (For
  example, the admin may wish to show a welcome message which uses the
  pages controller, and they may wish to show a calendar using the
  calendars controller and an unlimited number of other views).

  What I am currently doing is on the homepage view I do a loop through
  the homepages table and call the homepages.ctp element and sends it
  the relevant data for the view that needs to be displayed. The
  homepage element then calls the relevant element for whatever
  controller the admin has chosen, this controller may be part of a
  plugin.

  The homepages.ctp element looks as follows:
  ?php
  if ($item['MenuLink']['plugin_id'] == 0)
  {
          $View = ClassRegistry::getObject('view');
          echo $View-element('homepages/' . $item['MenuLink']['controller'],
  array('item' = $item));}

  else
  {
          $View = ClassRegistry::getObject('view');
          echo $View-element('homepages/' . $item['MenuLink']['controller'],
  array('item' = $item, 'plugin' = $item['MenuLink']['Plugin']
  ['directory']));}

  ?

  As an example the homepages/pages.ctp element looks as follows:
  ?php $pageToShow = $this-requestAction('/pages/index/' . $item
  ['Homepage']['options']); ?
  ?php if (isset($pageToShow)) : ?
          div
                  div id=dataInfo
                          Created: span class=timeago title=?php echo 
  $pageToShow['Page']
  ['created']; ??php echo $date-prettyDate($pageToShow['Page']
  ['created']); ?/spanbr /
                          Modified: span class=timeago title=?php echo 
  $pageToShow
  ['Page']['modified']; ??php echo $date-prettyDate($pageToShow
  ['Page']['modified']); ?/spanbr /
                          Tags: ?php echo $pageToShow['Page']['tags']; ?
                  /div

                  h1 id=nice_name?php echo $pageToShow['Page']['title']; 
  ?/h1
                  div id=content style=margin-top:10px; text-align:left;
                          ?php
                          echo $pageToShow['Page']['text'];
                          ?
                  /div
          /div
  ?php else : ?
  No page
  ?php endif; ?

  It is working well. However, I realise that requestAction is quite
  intensive as it acts like another server request, is there some other
  method that I can use that will achieve the same outcome but use less
  server resources?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Interesting problem/bugg when folder is named somethingAPPsomething?

2009-04-06 Thread G. Nyman

I just encountered a quite annoying thing that took me a while (alot
longer than it should have) to figure out.

I took a working project and renamed it to wapp and suddently the
html_helper did not work. The solution is obvious now that I found out
but darn I have almost screamed out when I could not find anything
wrong with it an still it did not work.

The problem is that if app is somewhere in the project folder-name it
won't work. This problem ONLY occurs if you are not using mod_rewrite.
If I activate rewrite I seem to be able to name it whatever I want.

So, this is a bug that I should report is it not?

Have a nice day
/G. Nyman

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



Woes of ACL

2009-04-06 Thread trevorsg

Hey guys,

I've been trying to solve an issue with ACL for two days now, but I
just can't find any answers.

Basically I'm trying to set up an application to work with Auth and
Acl. I followed the tutorials in the Cookbook - I created the database
tables, all of the ACOs and AROs are created. Then, I ran a deny for a
particular user on the root node. But no matter what I do, every user
has access to all parts of the application.

I have started this app from scratch twice, and I get the same outcome
each time. I think there is something fundamental that I'm missing.
The AclComponent::check() method returns the proper boolean value for
ARO/ACO pairs that I pass to it, but still users are never denied
access to any parts of the site.

Hopefully someone here can give me a steer in the right direction. I
am happy to provide code or extra information if needed.

Thanks very much for any help!

Cheers,
Trevor

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



Re: Looking for something better then requestAction?

2009-04-06 Thread Walther

I did try using the cache, but because I may be calling the same
element a few times but with different inputs it won't work (It just
redisplays the first item for that element).

On Apr 6, 1:23 pm, majna majna...@gmail.com wrote:
 Use elements cache 
 :)http://bakery.cakephp.org/articles/view/creating-reusable-elements-wi...

 On Apr 6, 12:06 pm, Walther waltherl...@gmail.com wrote:

  I believe I've found a solution.

  For each possible item that can be added to the homepage I store the
  name of the controller that is called. By simply changing this to the
  model name and using App::Import in the homepage model (Where I fetch
  the items from the database) I have gotten rid of the requestActions.

  Seems to be working quite well.

  From those who are more experienced at Cake, is this a better way of
  doing it?

  On Apr 6, 10:51 am, Walther waltherl...@gmail.com wrote:

   Hi all

   In an app that I am currently developing I wish to give the
   administrator the ability to customise the home page of the app by
   being able to include various other things into the home page (For
   example, the admin may wish to show a welcome message which uses the
   pages controller, and they may wish to show a calendar using the
   calendars controller and an unlimited number of other views).

   What I am currently doing is on the homepage view I do a loop through
   the homepages table and call the homepages.ctp element and sends it
   the relevant data for the view that needs to be displayed. The
   homepage element then calls the relevant element for whatever
   controller the admin has chosen, this controller may be part of a
   plugin.

   The homepages.ctp element looks as follows:
   ?php
   if ($item['MenuLink']['plugin_id'] == 0)
   {
           $View = ClassRegistry::getObject('view');
           echo $View-element('homepages/' . 
   $item['MenuLink']['controller'],
   array('item' = $item));}

   else
   {
           $View = ClassRegistry::getObject('view');
           echo $View-element('homepages/' . 
   $item['MenuLink']['controller'],
   array('item' = $item, 'plugin' = $item['MenuLink']['Plugin']
   ['directory']));}

   ?

   As an example the homepages/pages.ctp element looks as follows:
   ?php $pageToShow = $this-requestAction('/pages/index/' . $item
   ['Homepage']['options']); ?
   ?php if (isset($pageToShow)) : ?
           div
                   div id=dataInfo
                           Created: span class=timeago title=?php echo 
   $pageToShow['Page']
   ['created']; ??php echo $date-prettyDate($pageToShow['Page']
   ['created']); ?/spanbr /
                           Modified: span class=timeago title=?php echo 
   $pageToShow
   ['Page']['modified']; ??php echo $date-prettyDate($pageToShow
   ['Page']['modified']); ?/spanbr /
                           Tags: ?php echo $pageToShow['Page']['tags']; ?
                   /div

                   h1 id=nice_name?php echo 
   $pageToShow['Page']['title']; ?/h1
                   div id=content style=margin-top:10px; 
   text-align:left;
                           ?php
                           echo $pageToShow['Page']['text'];
                           ?
                   /div
           /div
   ?php else : ?
   No page
   ?php endif; ?

   It is working well. However, I realise that requestAction is quite
   intensive as it acts like another server request, is there some other
   method that I can use that will achieve the same outcome but use less
   server resources?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What do ARO and ACO stand for?

2009-04-06 Thread trevorsg

ARO - access request object
ACO - access control object.

On Apr 5, 1:56 pm, bearlee brianleeu...@gmail.com wrote:
 It a novice quesiton, but these acronyms bother me if I don't know
 what they mean (my pet-peeves).

 What do ARO and ACO stand for?

 -Brian

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



Re: redirecting with ACL

2009-04-06 Thread atta

i have solved this issue like this
if($this-Auth-user('group_id')== 5){
$this-redirect(array('controller'='admin/categories',
'action'='add'));
}
else if($this-Auth-user('group_id')== 6){
$this-redirect(array('controller'='Pages', 'action'='display'));
}

but it more looks like a hack as its not telling $this-Auth-
loginRedirect anyting.

Atta

On Apr 6, 4:50 pm, atta muh.a...@gmail.com wrote:
 hi
  how can i check for group id andredirectafter login to admin site
 and if it was a member then public member area.
 I have same login section for both Admin and members.
 I am trying to do something like this.

 if($this-Auth-user('group_id')== 5){
         $this-Auth-loginRedirect = array('controller'='newsletters',
 'action'='index'); }
 else{
 $this-Auth-loginRedirect = array('controller'='Pages',
 'action'='display'); }

 but no success.
 Any help please..

 attaur rehman
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Using ACL in View?

2009-04-06 Thread Faza

Hello all,

just happily finished setup of group-based ACL in my app, thanks to 
brilliant tutorial on Cake site.

Nevertheless, despite looking around I haven't found any way (known to a 
noob like me) to use a function similiar to $this-Acl-check() in View, 
for, say, hiding certain sections of webpage to non-admin users or 
anything like that. I know, I could do it by saving users group in 
session and checking it in View, but I'm curious if there's some cake 
way to do it.

Thanks!

Regards
Jacek

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



Re: What do ARO and ACO stand for?

2009-04-06 Thread vikas

Important tutorial on ACL :

http://brolly.ca/blog/web-development/cakephp-acl-tutorial/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



how to set default setting for paginator

2009-04-06 Thread Zhuang
Hi,

I would like to set the default parameter for URL in paginator so that it
will pass the URL parameter. For example,

I want to user paginator-numbers(array('url'=$paginator-params['pass']))

I want to make it default to pass URL params. Further more, I would like to
make it default for all paginator helper such as paginator-sort,
paginator-numbers, etc.

Thanks,

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



Row-level Model Access Control for CakePHP

2009-04-06 Thread jmcneese

since i've seen it talked about in the groups many, many, MANY times:

http://jmcneese.wordpress.com/2009/04/05/row-level-model-access-control-for-cakephp/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Join query

2009-04-06 Thread Manisha

Hello All,

Here is the Controller

class userController extends AppController {

   var $name='User';

}//This is controller having model User

and I have to make a join query between two models 1)parent 2)entitie

for example:

select * from tbl_parents a, tbl_entities b where a.parent_id =
b.entity_id and b.entity_relationship='gallery' and a.deleted='no' and
b.entity_id_1='49d7c6b5-7458-42b2-8d45-18830e7ba4d1' order by
a.entity_id ASC

I am running this query manually in userController

Please give me some idea about how to make a join query in cakePHP

Manisha.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: i18n of a Page Title

2009-04-06 Thread Rob Wilkerson


On Apr 5, 10:46 pm, Miles J mileswjohn...@gmail.com wrote:
 If the file name is titles.po it would be __d('titles', 'key');

Ah. I had tried using __d(), but didn't properly understand the
relationship between the domain and the name of the po file. The
difference, as they say, makes all the difference. Now that I
understand how domains are translated it looks like things might be
working (I've only tried a trivial case so far, so I hate to get to
cocky).

Dardo and Miles...thanks. I'm now embarrassed about the amount of time
I spent struggling with this.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Woes of ACL

2009-04-06 Thread trevorsg

Unfortunately that did not work for me. I ended up using the check()
method in my app_controller to determine access:
var $userId = null;

function beforeFilter()
{

if (null != ($this-userId = $this-Auth-user('id')))
{
// what user is trying to access
$page = $this-params['controller'] . '/' . 
$this-params
['action'];

// check if user can access page.
if (!$this-Acl-check(array('User' = $this-userId), 
$page))
$this-Redirect-flashWarning('You do not have 
access to this
page.', array('controller' ='pages', 'action' = 'unauthorized'));
}
}
Where Redirect-flashWarning is a flash/redirect method in my own
RedirectComponent.

Everything seems to work just fine. Is there a reason I shouldn't use
this method?

Trevor

On Apr 6, 5:38 am, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 In your controllers do you have something like:

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

           $this-Auth-allowedActions = array('register', 'index');// allow
 public access to these only
           $this-Auth-autoRedirect = true;
                 }

 Dave



 -Original Message-
 From: trevorsg [mailto:trevo...@gmail.com]
 Sent: April-06-09 2:07 AM
 To: CakePHP
 Subject: Woes of ACL

 Hey guys,

 I've been trying to solve an issue with ACL for two days now, but I just
 can't find any answers.

 Basically I'm trying to set up an application to work with Auth and Acl. I
 followed the tutorials in the Cookbook - I created the database tables, all
 of the ACOs and AROs are created. Then, I ran a deny for a particular user
 on the root node. But no matter what I do, every user has access to all
 parts of the application.

 I have started this app from scratch twice, and I get the same outcome each
 time. I think there is something fundamental that I'm missing.
 The AclComponent::check() method returns the proper boolean value for
 ARO/ACO pairs that I pass to it, but still users are never denied access to
 any parts of the site.

 Hopefully someone here can give me a steer in the right direction. I am
 happy to provide code or extra information if needed.

 Thanks very much for any help!

 Cheers,
 Trevor
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Exists a solution for use session.security high and ajax?

2009-04-06 Thread marco.rizze...@gmail.com

Hi
I have a web application where I would use session.security at higt
level but it uses ajax call.
Is it possible to have both things working togheter?
Marco
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Join query

2009-04-06 Thread Walther

This looks like a job for model associations.

http://book.cakephp.org/view/78/Associations-Linking-Models-Together

Basically set Parent to have many Entity (Or what every relationship
is the correct one for your case)

On Apr 6, 4:07 pm, Manisha pmanisha1...@gmail.com wrote:
 Hello All,

 Here is the Controller

 class userController extends AppController {

    var $name='User';

 }//This is controller having model User

 and I have to make a join query between two models 1)parent 2)entitie

 for example:

 select * from tbl_parents a, tbl_entities b where a.parent_id =
 b.entity_id and b.entity_relationship='gallery' and a.deleted='no' and
 b.entity_id_1='49d7c6b5-7458-42b2-8d45-18830e7ba4d1' order by
 a.entity_id ASC

 I am running this query manually in userController

 Please give me some idea about how to make a join query in cakePHP

 Manisha.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controller default method

2009-04-06 Thread Toby

Thanks for this.  And thanks Brian for the comment.  Is it not better
to redirect the user though, so that they see that the action doesn't
exist (and any search engines can too)?

T

On Apr 6, 12:08 am, Miles J mileswjohn...@gmail.com wrote:
 Besides using the index action, there is no such feature. You could
 however do something like this:

 function beforeFilter() {
         if (!in_array($this-params['action'], get_class_methods($this))) {
                 $this-redirect(); // to some action
         }

 }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Row-level Model Access Control for CakePHP

2009-04-06 Thread mradosta

Good to know other people are working on this.

My implmentation presented in last cakefest (Buenos Aires 2008) well
described by Mark Story here:
http://cakedc.com/developer/mark_story/2008/12/04/martin-radosta-record-level-security-based-on-sql

The ppt or odp slides I've prepared for the cakefest (spanish version)
here:
http://www.pragtico.com.ar/downloads/cakefest-08-v2.ppt
http://www.pragtico.com.ar/downloads/cakefest-08-v2.odp

I'm working on a (plug  play) plugin version of this behavior that
I'll try to present in the next cakefest, so developers don't need to
know nothing about bitwise operations, etc, etc.

So, if you (or someone else) would like to join this project, feel
free to contact me. I'll open a github project soon.

Regards

MARTIN


On Apr 6, 10:46 am, jmcneese jmcne...@gmail.com wrote:
 since i've seen it talked about in the groups many, many, MANY times:

 http://jmcneese.wordpress.com/2009/04/05/row-level-model-access-contr...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controller default method

2009-04-06 Thread brian

On Mon, Apr 6, 2009 at 10:53 AM, Toby goo...@toby-g.net wrote:

 Thanks for this.  And thanks Brian for the comment.  Is it not better
 to redirect the user though, so that they see that the action doesn't
 exist (and any search engines can too)?

Yes, absolutely. I misunderstood what you wanted to do. In this case,
use redirect for sure. Note that you can pass an error code as well.

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



afterDelete question

2009-04-06 Thread Mike

I have the following callback in my model:

public function afterDelete() {
Cache::delete('client_' . $this-field('name'));
}

Although $this-id is set, the field function (or any similar
function, such as read(), find(), etc.) doesn't return any data. I've
had to resort to beforeDelete since it properly executes. Has anyone
run into this? Am I doing something wrong?

Thanks,
-mike

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



What is the 'right' way to solve this postgres problem?

2009-04-06 Thread cheeser...@googlemail.com

Hi Everyone,

I'm excited to be embarking on my first project using CakePHP, but
unfortunately after only 1 afternoon, I seem to have hit a real
problem.

I have several boolean fields in my postgres table which can also take
a null value.  This is because I want to make a distinction between a
user replying 'no' to a question, or just declining to answer it.
However, the database layer seems to be automatically converting the
NULL values to PHP false values.

I guess this is because CakePHP sees that the field is of type
'boolean' and so casts it to a PHP boolean type.

I really need this functionality, so I'm considering a few options,
but I want to try and do this 'right' and stick to the convention over
configuration and MVC philosophies that Cake is built around.  What do
you think is the best approach?


Override functions in the database abstraction layer to make sure NULL
values are preserved (although I'm scared this will be difficult and
break other stuff).

Create a new postgres data type to handle these 'tertiary' values...
perhaps a char(1) with the domain restricted to Y,N or X (for null).

Set the type to char(1) and build some logic into the controller to
ensure that only Y,N,X get inserted  Could have X as the default
value in the database...

Or some other approach.  I have no idea.  Please help!  Cheers, Dan

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



using elements anywhere.

2009-04-06 Thread gaurav.v.sharma

I created a simple element for displaying the topics list. This
element is working fine under the url
http://localhost/webapp/topics
but it is not working in the home page. http://localhost/webapp

I mean the element contents are not displayed on the home page as they
are displayed on the topics page.

Please help.

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



Re: Offline version of the CakePHP manual.

2009-04-06 Thread George Hickman

Dardo,

I'd be interested in that script too, if you could send me a copy that
would be a great help

Cheers
George

On Apr 5, 9:24 pm, Dardo Sordi Bogado dardoso...@gmail.com wrote:
  Dardo, if I could ask you to either send me the source or publish it,
  as it looks like a nice script to have for creating a pdf snapshot of
  the manual. Hope you don't take offence, Mike, but Dardo's version is
  just in a format that is more easy to read.

 I'll send you a copy of the source in a personal email, but I think
 that publishing its output is a derivative work and its forbidden by
 the cookbook license. So you will have to ask permission before doing
 anything with cookbook's content.

 Regards,
 - Dardo.

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



Hi i'm a new a cake im doing my first site in cake and a small problem....

2009-04-06 Thread nahom

The problem is mostly about correlation between Table
I'm trying to make a relation between 3 tables:
my first table is The Product and he has many Pictures
and each picture is taken from a Gallery

now the relation works fine the thing is how can i call My Gallery in
Product controller
I tried using USES and it didn't work so I define a has many relation
between the Product and Gallery
Now Cake lets me call from my Product controller to the Gallery
But the correlation isn't correct

Any idea How to do it write
Article will do fine as well


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



Re: Hi i'm a new a cake im doing my first site in cake and a small problem....

2009-04-06 Thread brian

Are all of the Pictures in a particular Gallery associated with a
specific Product? If so, you might want to consider associating
Gallery to Product instead of Picture to Product.

It would probably help if you posted the model associations you have now.

On Mon, Apr 6, 2009 at 8:29 AM, nahom avinoa...@gmail.com wrote:

 The problem is mostly about correlation between Table
 I'm trying to make a relation between 3 tables:
 my first table is The Product and he has many Pictures
 and each picture is taken from a Gallery

 now the relation works fine the thing is how can i call My Gallery in
 Product controller
 I tried using USES and it didn't work so I define a has many relation
 between the Product and Gallery
 Now Cake lets me call from my Product controller to the Gallery
 But the correlation isn't correct

 Any idea How to do it write
 Article will do fine as well


 


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



Re: Controller default method

2009-04-06 Thread Toby

Thanks Brian.  And thanks about the error code.

Am fairly new to CakePHP.  Have played with it for a little while, but
am working on my first commercial project with it now.

T

On Apr 6, 4:07 pm, brian bally.z...@gmail.com wrote:
 On Mon, Apr 6, 2009 at 10:53 AM, Toby goo...@toby-g.net wrote:

  Thanks for this.  And thanks Brian for the comment.  Is it not better
  to redirect the user though, so that they see that the action doesn't
  exist (and any search engines can too)?

 Yes, absolutely. I misunderstood what you wanted to do. In this case,
 use redirect for sure. Note that you can pass an error code as well.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: beautiful link with pagination with search

2009-04-06 Thread brian

On Mon, Apr 6, 2009 at 12:28 AM, catfish trusa...@gmail.com wrote:

 new member here.

 I am playing with cake now. One problem that bothers me is the search
 function. The search function will process post data, when in
 pagination, the paginator does not pass the search src.

 For example, I would like:

 site.com/search/search-string/page:1

 In stead, the paginator would only show

 site.com/search/page:1

 The solution is:

 in your view, add 'url'=$paginator-params['pass']
 for example,

 $paginator-numbers(array('url'=$paginator-params['pass']));

 This will allow paginator to pass the search string in the link.

You can also do:

$paginator-options(array('url'=$paginator-params['pass']));

.. and then you needn't include that in each of your calls to
numbers(), prev(), next(), etc.

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



Re: error in executing consecutive ajax calls

2009-04-06 Thread brian

By not working do you mean that the request is not made? I suspect
it's a javascript event binding issue. Are you updating the page?
Specifically, the add comment button/form?

I can't go into details of how to deal with this, though, as I use
jQuery and so never use Cake's ajax helper stuff. If you use Firebug,
you can at least see if the javascript is firing when you click the
button. An alert() will work in a pinch, though.

On Sun, Apr 5, 2009 at 3:45 PM, Krish senthil...@gmail.com wrote:

 Hi All,

 I have a form in which I have add and delete operations for comments
 section. I am implementing them using Ajax.

 My first Ajax operation (i.e. either add/ delete) is working fine.
 when i go for my second Ajax operation it is not working.

 For Ex:
               step 1: Adding a new comment using 'Add
 Comment' .                           // Ajax call is working fine.
               step 2: When i click 'Add Comment' again, It is not
 adding new data.       // Ajax call is not working.

 Note: when I refresh /reload  the page manually, again my first Ajax
 call is executing. second call is not working.

 Can anyone help me to over come this issue...

 I am using CakePHP's built in Ajax helpers with prototype/
 scriptaculous for my Ajax operations.

 Thanks in advance...

 Regards,
 Krish

 


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



Session Cookie and Form Probem

2009-04-06 Thread Jesse

I'm having a really weird problem that just started appearing for
me.

For some reason when I submit a form, the returned page is compltly
blank. No debugging errors or anything. After I try to submit a form,
the rest of the site will display blank pages. (If I use the URL to
move around).

I keep getting blank pages until I clean the Session Cookies (Firefox
Webdeveloper Tool). Then the site works fine again until I try to
submit a form.

Also, it appears sometimes when the form is submitted it will return
the page, but in place of the content its  the layout again. It hits
an infinite loops of inserting the layout in place of the content. I
have to hit stop clean the cookies and start over again.

Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: afterDelete question

2009-04-06 Thread brian

It doesn't return anything because it's been deleted. Your model's ID
may still be set but it no longer points to a row in the DB. So
field() comes back empty.

For your purposes, use beforeDelete(). The afterDelete() callback
would be better used (AFAIK) where you need to, say, remove images or
other files from the filesystem. With a cached file, it shouldn't be a
big deal if it's removed but (for whatever reason) the model delete
doesn't happen. That would suck with images or other files.

On Mon, Apr 6, 2009 at 7:10 AM, Mike mikerog...@gmail.com wrote:

 I have the following callback in my model:

 public function afterDelete() {
        Cache::delete('client_' . $this-field('name'));
 }

 Although $this-id is set, the field function (or any similar
 function, such as read(), find(), etc.) doesn't return any data. I've
 had to resort to beforeDelete since it properly executes. Has anyone
 run into this? Am I doing something wrong?

 Thanks,
 -mike

 


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



Re: What is the 'right' way to solve this postgres problem?

2009-04-06 Thread brian

I'm not sure this will work (or if it's the best way) but have a lok
at the 3rd param for Model::save, $fieldList. I suppose you could
create an array from the return of schema() (using just the main keys,
I mean) and unset those fields that were not answered by the user and
pass that to save().

On Mon, Apr 6, 2009 at 9:43 AM, cheeser...@googlemail.com
cheeser...@googlemail.com wrote:

 Hi Everyone,

 I'm excited to be embarking on my first project using CakePHP, but
 unfortunately after only 1 afternoon, I seem to have hit a real
 problem.

 I have several boolean fields in my postgres table which can also take
 a null value.  This is because I want to make a distinction between a
 user replying 'no' to a question, or just declining to answer it.
 However, the database layer seems to be automatically converting the
 NULL values to PHP false values.

 I guess this is because CakePHP sees that the field is of type
 'boolean' and so casts it to a PHP boolean type.

 I really need this functionality, so I'm considering a few options,
 but I want to try and do this 'right' and stick to the convention over
 configuration and MVC philosophies that Cake is built around.  What do
 you think is the best approach?


 Override functions in the database abstraction layer to make sure NULL
 values are preserved (although I'm scared this will be difficult and
 break other stuff).

 Create a new postgres data type to handle these 'tertiary' values...
 perhaps a char(1) with the domain restricted to Y,N or X (for null).

 Set the type to char(1) and build some logic into the controller to
 ensure that only Y,N,X get inserted  Could have X as the default
 value in the database...

 Or some other approach.  I have no idea.  Please help!  Cheers, Dan

 


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



Re: insert multiple chekbox values

2009-04-06 Thread jsundquist

You should be able just do a $this-Moviegenre-save($this-data)

The save function will loop through your array and save all the data
into the correct fields along with the value set by your check box.

On Apr 6, 4:10 am, Ranju hello.ra...@gmail.com wrote:
 hello i want to  insert  multiple chekbox values...

 View File

 ?php echo $form-input('Moviegenre.genreid[]',array('label'=false,
 'type'='checkbox','multiple'=true,'value'=$genre['Genre']['id'])); ?



 Controllercode

 $genreid=       $this-data['Moviegenre']['genreid'];

                 foreach($genreid as $key = $value)
                 {
                 $query = insert into moviegenres(genreid)values($value);
                 $update = $this-Moviegenre-query($query);

                 }

 Its not work
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: using elements anywhere.

2009-04-06 Thread jsundquist

What are you using to call the elements? I you can all any element
from any page just by doing

?php $this-element('(folder)/(file)');?

On Apr 6, 9:59 am, gaurav.v.sharma gaurav.v.sha...@gmail.com
wrote:
 I created a simple element for displaying the topics list. This
 element is working fine under the urlhttp://localhost/webapp/topics
 but it is not working in the home page.http://localhost/webapp

 I mean the element contents are not displayed on the home page as they
 are displayed on the topics page.

 Please help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Problem with CakePHP 1.2 AJAX and IE - chained selects work in FF not in IE

2009-04-06 Thread tarapage

Hi Everyone,

My husband  I have been trying to determine this problem for a long time
now, hoping someone can shed some insight.  We have chained selects on one
form, you choose data from the first select box, and with an observeField we
are watching with AJAX and then triggering a change to the contents of the
second select box.  This works great in FF, but in IE it does not refresh
the screen.  We have verified that the function is triggered, and the
appropriate data is being generated, IE 7 is just sitting there without
refreshing anything  

 Here is the Controller code: 

 function system_select($trading_account_id = null) {
if (isset($this-data['TradingAccount'])) {
  $this-log('system_select with TA data', LOG_DEBUG);
  $this-log('acct_id = '.
$this-data['TradingAccount']['trading_accounts'], LOG_DEBUG);
  $data = $this-data['TradingAccount'];
  $redirect =
trading_accounts/system_select/.$this-data['TradingAccount']['trading_accounts'];
}
elseif (isset($this-data['Trade'])) { // could get called from Trade
controller
  $data = $this-data['Trade'];
}

if(isset($trading_account_id)) {
$data['trading_accounts'] = $trading_account_id;
}

// Determine systems for each account
$temp_acct_id = $data['trading_accounts'];
  list($systems, $trading_systems) =
$this-TradingAccount-getTradingSystems($temp_acct_id);
$this-set(compact('trading_systems'));
$this-log($trading_systems, LOG_DEBUG);
$trading_account_id = $data['trading_accounts'];
$this-set('trading_account_id', $trading_account_id);
$this-render('system_select', 'ajax');
  }


Here is the VIEW code:


echo $form-input('trading_accounts', array( 'label' = 'Use Trading
Account:'));
echo $ajax-observeField( $formName.'TradingAccounts',
array(
'url' = array( 'controller' = $controller,
'action' = $action ),
'update' = 'systems',
'frequency' = 0.1,
'indicator' = 'Updating'
)
);
  // default_systems variable must be set as indicated above
  echo $this-element('system_chooser',
array('trading_systems'='trading_systems',
 
'trading_account_id'=$trading_account_id //selected account id
 ));


The element code is: 

echo div id=systems // This IS correctly formatted, however it isn't
showing up right in this nabble viewer...
echo $form-input('tradingSystems', array('label' = 'Add Trading
System:'));
echo $form-hidden('trading_account_id', array( 'value' =
$trading_account_id ));
echo /div;  // This is a closing div, it is NOT showing up right in this
viewer


This works in FF, but does nothing in IE  We are thinking a cache issue? 
We've tried the cake:nocache tags, didn't work.  We are clearing cache in
the controller, didn't work.  Any ideas?  This is driving us crazy :)  We
have logged the data, and when you select something in IE, it goes to the
controller, gets the information and has the appropriate data.  It just
doesn't display it in the browser...

Please help if you can, we appreciate it!
-- 
View this message in context: 
http://www.nabble.com/Problem-with-CakePHP-1.2-AJAX-and-IE---chained-selects-work-in-FF-not-in-IE-tp22911972p22911972.html
Sent from the CakePHP mailing list archive at Nabble.com.

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



simple grid paginate and search, sort

2009-04-06 Thread loguKK

Is there simple grid paginate with search and sort examples using
CakePHP 1.2
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: simple grid paginate and search, sort

2009-04-06 Thread jsundquist

Here is a good place to start.

http://www.ntatd.org/mark/?p=29

Then read this tutorial as well

http://www.ntatd.org/mark/?p=32

On Apr 6, 11:28 am, loguKK logudot...@gmail.com wrote:
 Is there simple grid paginate with search and sort examples using
 CakePHP 1.2
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: afterDelete question

2009-04-06 Thread Mike

Duh. Thanks Brian.

-mike

On Apr 6, 8:41 am, brian bally.z...@gmail.com wrote:
 It doesn't return anything because it's been deleted. Your model's ID
 may still be set but it no longer points to a row in the DB. So
 field() comes back empty.

 For your purposes, use beforeDelete(). The afterDelete() callback
 would be better used (AFAIK) where you need to, say, remove images or
 other files from the filesystem. With a cached file, it shouldn't be a
 big deal if it's removed but (for whatever reason) the model delete
 doesn't happen. That would suck with images or other files.

 On Mon, Apr 6, 2009 at 7:10 AM, Mike mikerog...@gmail.com wrote:

  I have the following callback in my model:

  public function afterDelete() {
         Cache::delete('client_' . $this-field('name'));
  }

  Although $this-id is set, the field function (or any similar
  function, such as read(), find(), etc.) doesn't return any data. I've
  had to resort to beforeDelete since it properly executes. Has anyone
  run into this? Am I doing something wrong?

  Thanks,
  -mike


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



Re: Row-level Model Access Control for CakePHP

2009-04-06 Thread brian

Thanks for posting this. I'm currently trying to work out how to do
this. I took a look at your behavior and think it'd work for me.

About the point you mentioned with Tree-based models: I'd think that
if a User needed to be granted access to some row which had a parent
that the User had been denied then the layout of your tree is wrong.
If you think about a filesystem, if user cannot read/execute some
directory, there's no point in having a file somewhere under it which
gives read perms.

My situation is that I have several Groups, and I need to restrict
which branches of a Volume tree they can see. Basically, like
filesystem tree, in fact. So, I was faced with having to fetch all
available Volume.id and pass those to my find('threaded') call, like
you mention how Mark Story put it: you have to know the answer to the
question before you even ask it. This works, but seems sub-optimal.

Anyway, I'll give this a go later. Thanks again.

On Mon, Apr 6, 2009 at 9:46 AM, jmcneese jmcne...@gmail.com wrote:

 since i've seen it talked about in the groups many, many, MANY times:

 http://jmcneese.wordpress.com/2009/04/05/row-level-model-access-control-for-cakephp/
 


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



Pagination and complex conditions

2009-04-06 Thread nga

Problem seems pretty easy from business point of view.

Situation:
I ve got 2 Models:
Item , Bucket
These models are related with buckets_items table (HABTM).
Now i want to display all Items from certain bucket or set of buckets.
conditions for bucket look like this:
$condition=array(Bucket.property=array(2,4,56,12));

Question is:
How to paginate list of Items from these certain Buckets?

Ive spend few hours already and havent found any clear solution.
Bussiness requirements seem to be easy but i can t find easy cakewise
solution .

N

code sample appreciated

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



Re: What is the 'right' way to solve this postgres problem?

2009-04-06 Thread cheeser...@googlemail.com

Thanks for the suggestion.  I see what you mean.  It might allow me to
correctly save NULL data, but I think I'm still gonna need a way to
correctly retrieve the NULLs from the database too.  Also, I'm
concerned that I'd then have to set the fieldlist manually every time
I call save(), which sounds like a disaster.  I need the save method
to just work.

On 6 Apr, 16:52, brian bally.z...@gmail.com wrote:
 I'm not sure this will work (or if it's the best way) but have a lok
 at the 3rd param for Model::save, $fieldList. I suppose you could
 create an array from the return of schema() (using just the main keys,
 I mean) and unset those fields that were not answered by the user and
 pass that to save().

 On Mon, Apr 6, 2009 at 9:43 AM, cheeser...@googlemail.com



 cheeser...@googlemail.com wrote:

  Hi Everyone,

  I'm excited to be embarking on my first project using CakePHP, but
  unfortunately after only 1 afternoon, I seem to have hit a real
  problem.

  I have several boolean fields in my postgres table which can also take
  a null value.  This is because I want to make a distinction between a
  user replying 'no' to a question, or just declining to answer it.
  However, the database layer seems to be automatically converting the
  NULL values to PHP false values.

  I guess this is because CakePHP sees that the field is of type
  'boolean' and so casts it to a PHP boolean type.

  I really need this functionality, so I'm considering a few options,
  but I want to try and do this 'right' and stick to the convention over
  configuration and MVC philosophies that Cake is built around.  What do
  you think is the best approach?

  Override functions in the database abstraction layer to make sure NULL
  values are preserved (although I'm scared this will be difficult and
  break other stuff).

  Create a new postgres data type to handle these 'tertiary' values...
  perhaps a char(1) with the domain restricted to Y,N or X (for null).

  Set the type to char(1) and build some logic into the controller to
  ensure that only Y,N,X get inserted  Could have X as the default
  value in the database...

  Or some other approach.  I have no idea.  Please help!  Cheers, Dan

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



Re: Pagination and complex conditions

2009-04-06 Thread nga

Forgot to mention i need to display Items with list of buckets they
belong to.

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



Cake-PHP friendly social network software?

2009-04-06 Thread jwerd

I am building a Cake-PHP based project but I feel instead of
reinventing the wheel, I'd like to just integrate an existing open
source social networking solution that is Cake-PHP friendly.

What I mean by friendly is:  You have integrated it in your projects
and it works wonderfully.

Please let me know of any solutions you may have used.

TIA :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



bakery application

2009-04-06 Thread greg2000

I just downloaded the source for the Bakery in order to work with
CakeBook (from http://thechaw.com/bakery)  and I am confused. It seems
like it is pretty much an empty shell of a cake app. Am I missing
something?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth with legacy database

2009-04-06 Thread Mauricio Tellez
Hi, I'm building a cake app that need to authentify agains a legacy
database. That database has a user table with users login and password data,
but the password is encrypted with MySQL's aes_encrypt. Looking at cake Auth
mechanism there is no way I can auth against this table, so I'm wondering if
I can hook some method to the auth process like this:

function check_credentials($login, $passwd) {
$data = $this-User-query(sprintf(SELECT * FROM users WHERE
username='%s' AND passwd=aes_decrypt('%s') , $login, $passwd);
if(sizeof($data)  0) {
  return true;  // The username and passwd are valid
} else {
  return false;  // The username or passwd are invalid
}
}

I know this is not the best way to do it, but maybe the easiest way. Can I
something like this? or wath other options do I have? Thanks in advance!

-- 
Mauricio Tellez

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



Re: bakery application

2009-04-06 Thread greg2000

never mind. I got it

On Apr 6, 3:07 pm, greg2000 harmel...@gmail.com wrote:
 I just downloaded the source for the Bakery in order to work with
 CakeBook (fromhttp://thechaw.com/bakery)  and I am confused. It seems
 like it is pretty much an empty shell of a cake app. Am I missing
 something?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth with legacy database

2009-04-06 Thread Alfredo Quiroga-Villamil

Perhaps one way to do it. Take a look at:

http://api.cakephp.org/class/auth-component#method-AuthComponentisAuthorized

Property: authorize
Method:   isAuthorized

Regards,

Alfredo

On Mon, Apr 6, 2009 at 3:36 PM, Mauricio Tellez
mauricio.tel...@gmail.com wrote:
 Hi, I'm building a cake app that need to authentify agains a legacy
 database. That database has a user table with users login and password data,
 but the password is encrypted with MySQL's aes_encrypt. Looking at cake Auth
 mechanism there is no way I can auth against this table, so I'm wondering if
 I can hook some method to the auth process like this:

 function check_credentials($login, $passwd) {
     $data = $this-User-query(sprintf(SELECT * FROM users WHERE
 username='%s' AND passwd=aes_decrypt('%s') , $login, $passwd);
     if(sizeof($data)  0) {
   return true;  // The username and passwd are valid
     } else {
   return false;  // The username or passwd are invalid
     }
 }

 I know this is not the best way to do it, but maybe the easiest way. Can I
 something like this? or wath other options do I have? Thanks in advance!

 --
 Mauricio Tellez

 


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



Re: AuthComponent and AJAX Requests to another Controller

2009-04-06 Thread Aurelius

I checked, it seems that the Session breaks, what do I have to do so
it won't?

thx
Aurelius

On 5 Apr., 02:46, Miles J mileswjohn...@gmail.com wrote:
 Heres an example of my js and action. Btw im using jquery.

 // Js
 function deleteAvatar(user_id) {
 $.ajax({
 type: POST,
 url:  /ajax/deleteAvatar/,
 data: data[user_id]=+ user_id,
 success:

 function (response) {
 // Do something with response
 }
 });

 return false;

 }

 // Action
 function deleteAvatar() {
 $user_id = $this-Auth-user('id');
 $owner_id = $this-data['user_id'];

 if ($this-validRequest($owner_id)  $user_id == $owner_id) {
 if ($this-User-deleteAvatar($this-Auth-user())) {
 $this-_refreshAuth('avatar', '');

 echo 'pass';
 return;
 }
 }

 echo 'fail';
 return;

 }

 The echos are my js response, and validRequest() is a custom method I
 wrote.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Offline version of the CakePHP manual.

2009-04-06 Thread Mike Cook

psykro, no offence taken :)

The reason I made mine in EPUB was because that works nicely on my
Sony Reader. It isn't meant as a reference manual, but something I
just browse through while on the train to work -- yeah I know, while
most people are reading Terry Pratchett or something of the like, I'm
reading the CakePHP CookBook!

Mike

On Apr 5, 9:44 pm, psykro psy...@gmail.com wrote:
 Thanks Mike and Dardo, both look like good options.

 Dardo, if I could ask you to either send me the source or publish it,
 as it looks like a nice script to have for creating a pdf snapshot of
 the manual. Hope you don't take offence, Mike, but Dardo's version is
 just in a format that is more easy to read.

 I'm still trying to figure out if there is a way one can get a copy of
 the data for the manual to be able to use that in conjunction with the
 source code to have a fully functional offline version of the
 cookbook. does anyone know if this is something that just wont
 happen ? Perhaps I should mail ad7six and ask him ?

 On Apr 5, 7:11 pm, Dardo Sordi Bogado dardoso...@gmail.com wrote:

  Psykro,

  I've a script that I use to build a pdf version of the manual for
  those times when I'm offline.

  The script is in bash, the syntax highlighting in php and uses htmldoc
  (www.htmldoc.or) for nice pdf output.

  If you or anyone is interested I could send you the source or publish
  it in github.

  This is the sample 
  outputhttp://rapidshare.com/files/217764669/the-manual-2009-03-26.pdf.html

  Regards,
  - Dardo.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake-PHP friendly social network software?

2009-04-06 Thread Graham Weldon

Try this:

http://noserub.com

Cheers,
Graham


jwerd wrote:
 I am building a Cake-PHP based project but I feel instead of
 reinventing the wheel, I'd like to just integrate an existing open
 source social networking solution that is Cake-PHP friendly.

 What I mean by friendly is:  You have integrated it in your projects
 and it works wonderfully.

 Please let me know of any solutions you may have used.

 TIA :)
 
   


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



Re: AuthComponent and AJAX Requests to another Controller

2009-04-06 Thread Miles J

Set the session security to medium, if its on high it doesnt work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Weird ACL update problem....

2009-04-06 Thread Matt
bump?

On Apr 1, 9:00 am, Matt mmanai...@gmail.com wrote:
 I have a really weird issue here... I have a supplier update
 controller action that checks whether or not the user has update
 permission, if not, it displays an error message, and redirects to the
 controller index page. Here's the code:

 $aroAlias = User::.$userid;
                         $acoAlias = Supplier::.$id;
                         if ($this-Acl-check($aroAlias, $acoAlias, 'update'))
                         {
                                 $this-set('supplier', 
 $this-Supplier-read(null, $id));
                                 if (!empty($this-data))
                                 {
                                         if 
 ($this-Supplier-save($this-data))
                                         {
                                                 
 $this-Session-setFlash(__('The Supplier has been saved',
 true));
                                                 
 $this-redirect(array('action'='index'));
                                         }
                                         else
                                         {
                                                 
 $this-Session-setFlash(__('The Supplier could not be saved.
 Please, try again.', true));
                                         }
                                 }
                                 if (empty($this-data)) {
                                         $this-data = 
 $this-Supplier-read(null, $id);
                                 }
                                 $users = $this-Supplier-User-find('list');
                                 $this-set(compact('users'));
                         }
                         else
                         {
                                 $this-Session-setFlash(__('You are not 
 permitted to edit this
 supplier.', true));
                                 $this-redirect(array('action'='index'));
                         }

 Now the weird this is, that on first try for an authorized user, it
 works, but then, if you refresh the page, or save changes, 7 out of 10
 times, I get the 'You are not permitted to edit this supplier' error,
 but it never redirects... and updates changes no problem...

 Am I missing something?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Grabbing only records with associated records in a linked table

2009-04-06 Thread mattalexx

Page is also attached to a bunch of other things. I want to grab a
page and everything else.

On Apr 5, 11:39 pm, mscdex msc...@gmail.com wrote:
 Why not also have PageSnippet belongs to Page? That way you can then
 just do a find on PageSnippet instead and get the associated Pages.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



$ajax-form does not post anything?

2009-04-06 Thread Steven

Hey All,

This is my first attempt with an $ajax-form, and I am calling it from
within an element. Anyway, when I use this code:

?php
echo $form-create('vote', array('url' = '/polls/vote', 'action' =
'add'));
echo $form-input('sometestvalue', array('type' = 'hidden', 'value'
= test));
echo $form-end('Vote!');
?

The data gets posted, and everything is working as I would expect.
When I use:

?php
echo $ajax-form(array('type' = 'vote',
'options' = array(
'model'='PollChoice',
'update'='test',
'url' = array(
'controller' = 'polls',
'action' = 'vote'
)
)
));
echo $form-input('sometestvalue', array('type' = 'hidden', 'value'
= test));
echo $form-end('Vote!');
?

The function vote gets executed, and the div refreshes, but no data
has been posted. I have confirmed this obviously using $this-data in
the controller, and also with firebug.

Can anyone see what I am doing wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: paginateCount and SELECT DISTINCT

2009-04-06 Thread ahmedhelmy007

i think that the answer is at the end of this page:
http://book.cakephp.org/view/249/Custom-Query-Pagination

On 1 أبريل, 22:58, depi erik.gye...@gmail.com wrote:
 BUMP.

 I'm wondering too.
 It is pity that DISTINCT not applies to COUNT as well.
 I'm trying to solve this issue as well. However if I replace the
 paginateCount() method in my model, then it will be replaced for all
 my pagination queries, isn't it?
 I don't think this is the best solution out there. Any more usable
 hints would be really appreciated.

 On Mar 16, 8:15 pm, Fibra fabricio.sod...@gmail.com wrote:

  Hello everyone, how are you?

  If you ever had the misfortune of finding yourself in the need of
  using the $paginate variable with a DISTINCT operation, you must have
  found out that the returned amount of records is not correct! It
  returns the COUNT of all the records (ignoring the DISTINCT in the
  fields array) instead of the COUNT(DISTINCT id), for example.

  I've been looking all over the web for a solution to this particular
  case of pagination but they all involved rewriting thepaginateCount
  method for a particular case of pagination, which is not what I want
  (I want cake to keep doing all the magic for me :D ). So, I've been
  playing with the cake lib, and found a way to solve it, however... I
  assume it might have side effects, and would like your opinion on the
  matter, whether this can be implemented in a cleaner way or if I'm
  totally off track.

  So, in the controller.php find method, I've placed (REplaced,
  actually) this code (Line 1030):

                  if (method_exists($object, 'paginateCount')) {
                          $count = $object-paginateCount($conditions, 
  $recursive, $extra);
                  } else {
                          $parameters = compact('conditions');
                          if ($recursive != $object-recursive) {
                                  $parameters['recursive'] = $recursive;
                          }
                          //$count = $object-find('count', 
  array_merge($parameters,
  $extra)); //OLD LINE
                          $count = $object-find('count', $fields); //NEW LINE
                  }

  In my controller, the code for the paginate variable is as follows:

                  var $paginate = array(
                          'limit' = 25,
                          'order' = array(
                                  'User.created' = 'desc'
                          ),
                          'joins' = array(
                                  'LEFT JOIN user_areas AS Areas ON User.id = 
  Areas.user_id',
                                  'LEFT JOIN user_tools AS Tools ON User.id = 
  Tools.user_id',
                                  'LEFT JOIN user_careers AS Careers ON 
  User.id = Careers.user_id'
                          ),
                          'fields' = array(
                                  'DISTINCT User.id',
                                  'User.dni',
                                  'User.name',
                                  'User.email',
                                  'User.password',
                                  'User.interviewed',
                                  'User.keywords',
                                  'User.birthday',
                                  'User.cv',
                                  'User.filetype',
                                  'User.comment',
                                  'User.province_id',
                                  'User.town',
                                  'User.remuneration',
                                  'User.created',
                                  'User.modified',
                                  'User.admin',
                                  'Province.id',
                                  'Province.country_id',
                                  'Province.name',
                                  'UserSecondary.id',
                                  'UserSecondary.user_id',
                                  'UserSecondary.secondary_id',
                                  'UserSecondary.institute',
                                  'UserSecondary.status_id'
                          )
                  );

  So, I would like to hear some thoughts please.

  Thanks in advance!


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



Re: Problem in session management in Cakephp

2009-04-06 Thread SeeVik

@Dr. Loboto

 Your problem is unclear. What is sessions mixed up?
For every person who logs in, there are some session variables stored
in an object built-in in PHP called Session. So one customer somehow
gets allocated the session variables of some other person.

 If someone see information of other customer maybe it is just currently 
 logged person?

But how can one person see the information of other customer. The
customer is entering his own username and password, matching is done
correctly. Then how can he see the account information of some other
person after logging in?

Thanks and Regards
Vikram

On Apr 6, 6:31 pm, Dr. Loboto drlob...@gmail.com wrote:
 Your problem is unclear. What is sessions mixed up? If someone see
 information of other customer maybe it is just currently logged
 person?

 On Apr 6, 3:42 pm, SeeVik vikramvmalhotra1...@gmail.com wrote:

  I found out that this problem is occuring only for users in Kenya. I
  found one more case of such a website with users in Kenya who are
  getting sessions mixed up.

  Does anybody have any idea about this strange problem?

  On Apr 6, 1:21 pm, SeeVik vikramvmalhotra1...@gmail.com wrote:

   Regarding this problem, can anybody tell me where the log files are
   stored in cakephp?

   On Apr 3, 1:43 pm, SeeVik vikramvmalhotra1...@gmail.com wrote:

Hello all

I have a question regarding our website built using cakephp. I have
some idea of php but I am completely new to the frameworks. The thing
is our company got a webapp built from a firm to manage information of
our customers.

But the thing is that the sessions at the customer side are somehow
getting mixed up. Like when one user logs in, sometime later he is
able to see the information of other customer. However, at our test
server this problem does not happen. I read some documentation of
cakephp and I have checked out that the session management on our
system is being done using the default PHP mechanism.

Can somebody help me in figuring out where the problem could be, I
mean in what direction should I look?

Thanks and Regards
Vikram
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $ajax-form does not post anything?

2009-04-06 Thread Steven

Update.

?php
echo $form-create('vote',array('onSubmit'='return false'));
echo $form-input('vote.poll_id', array('type' = 'hidden', 'value' =
mook));
echo $ajax-submit('Vote!', array('url'='/polls/vote/',
'update'='test'));
?

Changed to using the code, and nothing changed. However have noticed
the code works great in internet explorer. But not in firefox or
safari.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How does css/js compression work?

2009-04-06 Thread Miles J

Im a bit confused on how to get this installed and working. And I did
not find any information in the guide.

I understand that we place scripts like cssminify in vendors, but what
do we do after that.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $ajax-form does not post anything?

2009-04-06 Thread Steven

Fixed, I removed all formatting IE tables, and it worked. No idea why!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Custom Redirect

2009-04-06 Thread Dave Maharaj :: WidePixels.com
How can I direct a visitor to a specific page. 
 
What I have is:
posts/index (public)
posts/view/ (registered logged in members only)
 
I need to direct non-logged in visitors who try to view a post to be
directed to a page other than the $this-Auth-loginAction
 
In the posts_controller the only allowed action is index,
 
$this-Auth-allowedActions = array('index');
 
 do I need to allow 'view' and in the view function check there for Auth
login credentials and allow / re-direct from there?
 
Thanks,
 
Dave 

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



containable, bindModel, and record-level ACL (oh my!)

2009-04-06 Thread brian

I have a model, Volume, for which I want to limit access from Group,
using record-level ACL. Volume is also stored using MPTT
(TreeBehavior). So far, I've been able to create the entries in aros,
acos,  aros_acos.

Now, what I need to do is figure out a way to display the Volume tree
(easy) but, along with the Volume threaded data, fetch each Volume's
permissions wrt a specific Group. This is so that an admin can see at
a glance which Volumes a Group has access to by queerying against a
specific Group. I plan on using this tree to grant/deny access.

I can grab the Aco key for each Volume but can't figure out how to get
from that to the Group's permissions. The following code leaves me
with the proper tree and, for each Volume, its Aco. But there's no
join applied for Permission (aros_acos) nor Aro.

Anyone have any ideas?

$this-bindModel(
array(
'belongsTo' = array(
'Aco' = array(
'foreignKey' = false,
'conditions' = array(
'Aco.model' = 'Volume',
'Aco.foreign_key = Volume.id'
)
)
)
)
);

$filters = array(
'fields' = array(
'Volume.id',
'Volume.parent_id',
'Volume.lft',
'Volume.rght',
'Volume.name',
),
'contain' = array(
'Aco' = array(
'fields' = array('Aco.id'),
'Permission' = array(
'Aro' = array(
'conditions' = array(
'Aro.model' = 'Group',
Aro.foreign_key = ${group_id}
)
)
)
)
)
);

return $this-find('threaded', $filters);

The returned array is like:

Array
(
  [0] = Array
(
  [Volume] = Array
(
  [id] = 1
  [parent_id] =
  [lft] = 1
  [rght] = 171
  [name] =
)

  [Aco] = Array
(
  [id] = 2
)

  [children] = Array
(
  ...

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



ExpertForum - nice and fast web 2.0 forum written in CakePHP 1.1

2009-04-06 Thread Sergei

Hello,

I 've open sourced my forum written in CakePHP 1.1 two years ago:

http://code.google.com/p/expertforum/

So if you need to integrate some forum into your CakePHP application,
or just need some forum code, this project is for you.


Sergei.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---