Re: How to echo Image that was uploaded through MeioUpload

2011-04-13 Thread francky06l
Maybe something like (I haven'y used meiupload, bascally replace the
img/ from file name):

echo $html-image(str_replace('img/', '', $data['model']
['filename']));



On Apr 13, 4:47 pm, Mr.Jayesh jayeshach...@gmail.com wrote:
 Hi Mates,

 As while working on my project, I am using meioupload behaviour for
 handling image upload. I have set it as per the documentation provided
 in their site. I have four fields: picture, dir, mimetype, filesize.
 There is no error in uploading. But the problem is, the picture field
 only stores the file name. I have set a folder under img to store the
 files. The files get stored correctly into the directory.

 The issue is, how will I be able to echo the image on the view. The
 echo only states the img/filename.extn . but this will not show
 the image. How can I configure the meio to store the dir name in the
 picture column so I can get proper file root.

 Is it something I am doing wrong.

 Regards,
 Jayesh

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HABTM isUnique validation throws error on join model

2011-04-13 Thread francky06l
Do you use saveAll on innoDb tables ? If not, actually set option
'atomic' = false.
Try first save with options validate = only and a second saveAll with
validate false.


On Apr 13, 12:06 am, Jeff jeffkw...@gmail.com wrote:
 I've got an odd problem.  I have tables/models names and projects with
 join table names_projects.  I have an isUnique rule on the name field
 in the names table so that I don't have repeat entries.  When I
 perform my saveAll with a new name and the validation in place I get
 the error:

 Notice (8): Undefined index: NamesProject [CORE/cake/libs/model/
 model.php, line 1701]

 And a name_id doesn't get passed to my join table insert.  However,
 when I remove the isUnique validation on the name model, I don't get
 an error and my insert has the last inserted name_id.  With the
 validation in place, the validation works, so everything seems like
 it's set up fine.  Any ideas on what's going on?

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Problems with validation

2011-04-13 Thread francky06l
A file type form will not give any extension field. In your
exemple, the field archive will be an array with fields mime,
tmp_name, name, size, error ..
If you want to validate this, you woul have to extract the extension
from the file name.. However, I would use the mime field to validate
the type of field.

Some hints here: 
http://www.jonnyreeves.co.uk/2008/06/cakephp-uploaded-file-validation-in-models/


On Apr 12, 6:50 pm, pablosky pablo00...@hotmail.com wrote:
 Hello,

 I have problems with file validation. I have several forms for
 uploading files. The validation simply does not work. And all files
 are loaded. For example, the simplest:

 var $validate = array(
         'archive' = array(
                 'extension' = array(
                         'rule' = array('extension', array('gif', 'jpeg', 
 'png', 'jpg')),
                         'message' = 'Error...'
                 )
         )
 );

 The form:

 ?php
 echo $this-Form-create('Archives', array('type' = 'file'));
 echo $this-Form-input('archive', array('type' = 'file'));
 echo $this-Form-submit(__('Save', true));
 echo $this-Form-end();
 ?

 I do not understand because it is very simple. I do not understand
 what does not.

 I do not know if anyone has had the same problem with file validation.
 Or if you know where is the problem.

 Thank you very much

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Unique pairs in HABTM validation

2011-04-13 Thread francky06l
In MySql create a constraint unique (instead of index) with the 2
fields, save will fail .. then you know.

On Apr 13, 12:20 am, Jeff jeffkw...@gmail.com wrote:
 The validation in the join model I created is being ignored.  How can
 I go about debugging the validation?

 I have additional fields in the join table in addition to the IDs.
 The HABTM saves are so elegant that I'm hesitant to break them into
 hasManys.  In what ways is keeping it a HABTM limiting and at what
 point should I switch it to two hasManys instead?

 On Apr 12, 7:00 am, euromark dereurom...@googlemail.com wrote:

  yes
  you can easily set up a model for it in order to validate
  it won't destroy the HABTM relationship

  depends on the use case
  as soon as you need more that just the IDs it already starts to make
  sense :)

  On 12 Apr., 02:29, Jeff jeffkw...@gmail.com wrote:

   I'm trying to set up validation in a join table to check that a pair
   of fields is unique in the table.  Currently the join model is being
   created automagically between the HABTM tables.  Can I create a join
   model and define the validation there?  Would it make more sense to
   break the HABTM up into two hasMany relationships?

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: copy a link

2011-04-13 Thread francky06l
Seems you break the 2,147,483,647 (INT_MAX) of the a 32 bits system.
Try to convert everything in float and then cast in integer..



On Apr 11, 5:57 pm, Spar Pater i...@sparpater.nl wrote:
 I'm trying to make a php script.
 First of all I thought it was a logical number.
 But the problem just started today.

 Spar in the Netherlands have visual magazine online. I like to copy
 that on mine.
 Thats not the problem so far.

 Every week there is another magazine.
 They started in week 4 (magazine 1)
 Until week 14 (magazine 10) it was not a problem.
 ?php
 $mytime = time() - 2419200;
         $url=http://voorbeeld.nl/;.(int)date(W, $mytime);
         $url2=/magazine.php;
         header( Location: $url$url2 );
 ?

 But in week 15 is just jumped to magazine 13 So I missed one.

 Maybe it's just one time, but I like to be a step ahead of that.

 So onhttp://spar.nl/They always have the right link. Named
 Weekaanbeidingen

 Is it possible to make a script that copy that link to use as my own
 or do I need to check it now and then?

 Thanks a lot.

 Dennis

 Sorry for my English.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Passing Variable from View to js

2011-04-13 Thread francky06l
You can also use the js helper:
?php
   // view code

$sample = array('sample' = 1, 'is' = 2, 'crazy' = 3);

echo $html-scriptStart(array('inline' = false));?

var myvar = ?php echo $js-object($sample);?;

?php echo $html-scriptEnd();?


On Apr 12, 2:21 pm, mookatt jarrod.dun...@gmail.com wrote:
 There are quite a few ways of doing this.  I typically create HTML
 elements and set their value or contents then access the element from
 javascript.

 php:
 ?php
 $v1=5;
 $v2=array('item1'=array('item1.1','item1.2','item1.3'),'item2'=array('item2.1','item2.2'));
 );

 echo div style='display:none' id='v1'$v1/div;
 echo div style='display:none' id='v2'.json_encode($v2)./div;
 ?

 Then in javascript:
 var v1=document.getElementById(v1).innerHTML;
 var v2=JSON.decode(document.getElementById(v2).innerHTML);  //
 requires the window.JSON object or a framework such as mootools/jquery
 that provides it

 On Apr 12, 6:12 am, Shashank cooldude17202...@gmail.com wrote:

  Hey Guys,

  I wanted to know that how can i pass or set a varibale in a view file
  to be used in some js file.

  Thanks

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP session ID path or other method to share the results of a url - recommendations welcome

2011-04-13 Thread francky06l
you can pass the session id on the url (preferably with a named
parameter, suppose session_id) and in the app_controller use the
Session component:

$this-Session-id($this-params['named']['session_id']);

There are other ways using the session name in core etc  also


On Apr 12, 12:07 am, OldWest ja...@jasonwydro.com wrote:
 I am looking for suggestions on a sensible Cake approach to creating a
 session id based url that I can share with others to see the same search
 results I am seeing on my end.

 I know in standard php, I would just get the session id and pass it to the
 url. But my guess Cake probably has a method or approach for this exact
 thing (my guess). I have not been able to locate anything specific yet.

 Any ideas as to the best approach to this with Cake methods? Or will I need
 to re-invent the wheel on this?

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP session data cleared on paginator sort

2011-04-13 Thread francky06l
It's probably due to the way you save the data, maybe you should merge
the existing session data with the new one ?

On Apr 12, 12:06 am, OldWest ja...@jasonwydro.com wrote:
 My session data is being saved in my form as expected.

 However, when I run a sort on any column of my results, my form session
 values are cleared.

 I am calling in my search form through en element as it's used on specific
 locations of the site.

 Does anyone know why pagination is clearing out my session? Is this standard
 Cake?

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP url path data in with pagination on first search (what am I doing wrong?)

2011-04-13 Thread francky06l
pr($this-params); in the view, then you will know what to merge with
the pagination url options

On Apr 11, 11:52 pm, OldWest ja...@jasonwydro.com wrote:
 I have a search form.

 The form values are passed to query and results are displayed as expected.

 I am using Cakes built in pagination methods.

 On the initial search, I need the url to reflect the search path values as
 when I use the sort() or Next  pagination methods.

 When I use sort() or Next , my url is formatted with the paginator
 structure like:

    // pagination to Next page note Page 2
 ...plans/search/55/22/1/0/33758/page:2

 When I do the first search I get url:

 ...plans/search/

 Here are the appropriate fragments of my search action:

 function search(
 ...
 // query and other action code here unrelated to pagination
 ...
 // start of applicable array and pagination code
 $url = array('controller' = 'plans', 'action' = 'search');
 $this-paginate = $options; // $options is my query
 $this-set('searchdetails', array_merge($url, $searchdetails)); 
 //$searchdetails isi  any array of the values entered in the search input 
 boxes. Joining my url and search details.
 $this-set('plans', $this-paginate('Plan'));

 I tried to break down the above to ONLY include what is applicable to my
 problem.

 NOTE: I am running a default order through this action in my query and its
 working fine, but is not reflected in the url.

 I need to know how to update the url to reflect the initial search input
 results. I have ALL of the array data passed to my view just fine.

 I tried recreating the path with a rather large method I wrote, but it did
 nothing but complicate my problem...

 Is there a simple Cake type solution for this? Or is this just not in Cakes
 cards currently?

 Please set me straight on this.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Auth Problem Again..

2011-04-13 Thread francky06l
It mainly depend of the Auth setting. By default you would not go
trough the login action before Auth will do, so your code is useless
since Auth will handle the login before your login code (when $this-
data is not empty).
My best guess is to handle this in beforeFilter of the user
controller, a bit like this:

// switch username to email when @ found in login name

if($this-action == 'login'  strpos($this-data['User']['username'],
'@') !== false))
{
   $this-data['User']['email'] = $this-data['User']p'username'];
   unset($this-data['User']['username']);
$this-Auth-fields['username']='email';
}


PS: Hi Mariano, so long time !!

On Apr 13, 3:27 am, mariano.iglesias mariano.igles...@cricava.com
wrote:
 I just followed the recipe from scratch and found no issues. I am able
 to log in with either a user account, or an email. Can you set DEBUG
 to 2 (in your app/config/core.php file) and paste the queries that are
 shown?

 On Apr 11, 5:42 pm, john lyles confidentia...@gmail.com wrote:

  Hi Everyone,
  I am following a recipe from 'Cakephp 1.3 Application Development
  Cookbook' ByMarianoIglesiasand I am stuck with the recipe 'Allowing
  logins with username or email' on page 16 of the book.

  The recipe works except one problem which I cannot figure out. If I
  login with the email instead of the username the loginError message
  flashes on the screen. This doesn't happen if I login using the
  username.

  I should note also that you have to do the basic auth setup before you
  can do this recipe, and the basic setup works with no issues that I
  have noticed so far.

  This is what the login action of the Users Controller looks like:

  public function login() {
    if (
      !empty($this-data) 
      !empty($this-Auth-data['User']['username']) 
      !empty($this-Auth-data['User']['password'])
    ) {
      $user = $this-User-find(
        'first', array(
          'conditions' = array(
          'User.email' = $this-Auth-data['User']['username'],
          'User.password' = $this-Auth-data['User']['password']
        ),
        'recursive' = -1
      ));
    if (!empty($user)  $this-Auth-login($user)) {
      if ($this-Auth-autoRedirect) {
        $this-redirect($this-Auth-redirect());
      }
    } else {
        $this-Session-setFlash($this-Auth-loginError, $this-Auth-

  flashElement, array(), 'auth');
    }
  }
  }

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP and foreign key

2011-04-13 Thread francky06l
Foreign key has nothing to do with innoDB, but transaction has ...

3 solutions:

- save current data before saving and roll back yourself (costive)


- accept the integrity potential defect, have a batch job to control
and correct


- have a transactional DB

On Apr 11, 6:56 pm, Mariano C. mariano.calan...@gmail.com wrote:
 My DB server doesn't support innodb engine, so I can't use Foreign key
 costraint.
 How can I assure referential intergrity? Can I do this using cakephp,
 how?

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How to echo Image that was uploaded through MeioUpload

2011-04-13 Thread francky06l
There are some basic defines such as IMG that can be used ..   If you
control the upload, the location can be controlled..

On Apr 14, 2:37 am, cricket zijn.digi...@gmail.com wrote:
 On Wed, Apr 13, 2011 at 8:17 PM, francky06l franckl...@gmail.com wrote:
  Maybe something like (I haven'y used meiupload, bascally replace the
  img/ from file name):

  echo $html-image(str_replace('img/', '', $data['model']
  ['filename']));

 No, it's not that. His problem is not having the subdirectory info.

 But, if you pass an absolute (from webroot) path, HtmlHelper doesn't
 add '/img'. So:

 echo $this-Html-image(
         $data['model']['dir'].$data['model']['filename']
 );

 Where dir is something like '/img/subdirectory/'.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HABTM isUnique validation throws error on join model

2011-04-13 Thread francky06l
Well, if you do not use innoDb, atomic is useless anyway ...
'validate' = 'only' should however make it ... Wwhat cake version are
you using ?

On Apr 14, 2:48 am, euromark dereurom...@googlemail.com wrote:
 'atomic' = false
 and
 validate = only
 can result in unexpected results^^
 I had to find out the hard way

 you cannot simply use if()
 in this case you need some hack like I came up with

 if (CommonComponent::logicalAnd($this-Model-saveAll(...,
 array('validate'='only'

 :)

 On 14 Apr., 02:28, francky06l franckl...@gmail.com wrote:

  Do you use saveAll on innoDb tables ? If not, actually set option
  'atomic' = false.
  Try first save with options validate = only and a second saveAll with
  validate false.

  On Apr 13, 12:06 am, Jeff jeffkw...@gmail.com wrote:

   I've got an odd problem.  I have tables/models names and projects with
   join table names_projects.  I have an isUnique rule on the name field
   in the names table so that I don't have repeat entries.  When I
   perform my saveAll with a new name and the validation in place I get
   the error:

   Notice (8): Undefined index: NamesProject [CORE/cake/libs/model/
   model.php, line 1701]

   And a name_id doesn't get passed to my join table insert.  However,
   when I remove the isUnique validation on the name model, I don't get
   an error and my insert has the last inserted name_id.  With the
   validation in place, the validation works, so everything seems like
   it's set up fine.  Any ideas on what's going on?

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: nocache breaks when used in loop

2011-04-13 Thread francky06l
In case of expensive Db request or computation, to me the best is to
cache the Data needed to your view or element instead of the view
itself. If the cache is expired I do not hesitate to make a
requestAction (devil word), but a requestAction with results being
cached every X few minutes can be acceptable .. I also did some
actions that delete the potential cached files when data are
modified, so you can have a cached life time 1 year, and when you
modify the data, cached is destroyed then rebuilt by the first
requestAction  until next update to data ...



On Apr 14, 3:17 am, BrianS eclecticg...@gmail.com wrote:
 On Wednesday, April 13, 2011 7:40:45 PM UTC-4, cricket wrote:

  cake:nocache
  ?php
  for ($i = 0; $i  10; $i++) {
  echo pfoo/p;
  }
  ?
  /cake:nocache

 Thanks, but this doesn't help much. As I said, the page I'm generating is
 fairly expensive computationally. Rather than get into the details of the
 view structure and where it's breaking down I provided a simplified example
 to illustrate the problem. A problem which appears to be a bug to me. But
 maybe I have a misunderstanding about how cake is creating the caching file.

 Actually, I'm finding the caching functionality to be both cumbersome and
 buggy. I imagine it works best on a very simple CMS-style site. On my site,
 however, which includes user authentication and user-specific inline content
 I'm getting varied results.

 I've been able to work around my specific issue by using a page element with
 nocache content. This content from this page element is appropriately placed
 as inline PHP in the cache file. I'm also hacking around the inability to
 use component-instantiated components by echoing out some PHP code. If
 anyone's interested in more details about what problems I'm having and how
 I'm attempting to work around them I'd be more than happy to share a less
 simplistic example.

 FYI, I'm using 1.2.9. Are there significant improvements in 1.3? I won't be
 able to switch immediately, but I have been considering it. The need for
 caching, however, is fairly pressing.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: copy a link

2011-04-13 Thread francky06l
Ryan, you are right ..

Thinking about it, the only issue I find is 'time() - 2419200'
followed by the date(W, $mytime) ..
I assume that 2419200 is 7 days in seconds ... if you do a date('W',
)  on the day of summer time at 2 o'clok, you might loose  a
week ...



On Apr 14, 3:48 am, Ryan Schmidt google-2...@ryandesign.com wrote:
 I don't see anything in the original post that has anything to do with 
 that

 On Apr 13, 2011, at 19:46, francky06l wrote:

  Seems you break the 2,147,483,647 (INT_MAX) of the a 32 bits system.
  Try to convert everything in float and then cast in integer..

  On Apr 11, 5:57 pm, Spar Pater i...@sparpater.nl wrote:
  I'm trying to make a php script.
  First of all I thought it was a logical number.
  But the problem just started today.

  Spar in the Netherlands have visual magazine online. I like to copy
  that on mine.
  Thats not the problem so far.

  Every week there is another magazine.
  They started in week 4 (magazine 1)
  Until week 14 (magazine 10) it was not a problem.
  ?php
  $mytime = time() - 2419200;
          $url=http://voorbeeld.nl/;.(int)date(W, $mytime);
          $url2=/magazine.php;
          header( Location: $url$url2 );
  ?

  But in week 15 is just jumped to magazine 13 So I missed one.

  Maybe it's just one time, but I like to be a step ahead of that.

  So onhttp://spar.nl/Theyalways have the right link. Named
  Weekaanbeidingen

  Is it possible to make a script that copy that link to use as my own
  or do I need to check it now and then?

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP and foreign key

2011-04-13 Thread francky06l
Ryan, what I meant is that it all depends of your DB, you can set a
constraint on MySql on non-innoDb .. it will be ignored as well as a
START TRANSACTION on MyISam ..

On Apr 14, 3:41 am, Ryan Schmidt google-2...@ryandesign.com wrote:
 On Apr 13, 2011, at 20:24, francky06l wrote:

  Foreign key has nothing to do with innoDB, but transaction has ...

 Sure it does. Transactions and foreign key support are both features you 
 don't have in MySQL unless you use the InnoDB engine.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: values​​.$getJSON

2011-04-13 Thread francky06l
Try $js-submit for submitting a form in Ajax, check parameters such
as 'url' and 'update' ..

On Apr 13, 7:27 pm, pedrosas pdrsas...@gmail.com wrote:
 In a view I have three inmputs add, name, country and Province, the
 Countries Provinces the filter through the method jQuery
 $. getJSON and it works to perfection.
 When I apply the same code to Edit, I have seen through the
 Firebug that it returns no data jonson, I leave below
 the code I use,, if someone could give me some idea.
 I use CakePHP 1.3.8
 Thanks

 /views/cities/add.ctp
 div class=cities form

     ?php echo $this-Html-script('list_provinces'); ?
     ?php echo $this-Form-create('City'); ?
     fieldset
         legend?php __('Add City'); ?/legend
         ?php
         echo $this-Form-input('nombre');
         echo $this-Form-input('country_id', array('options' =
 $countries, 'empty' =
             '-- Seleccione Pais --', 'id' = 'country'));
         ?
         div id=provincias style=display: none;
             ?php
             echo $this-Form-input('province_id', array('options' =
 $provinces, 'empty' =
                 '-- Seleciones Provincia --', 'id' = 'provincia'));
             ?
         /div

     /fieldset
     ?php echo $this-Form-end(__('Submit', true)); ?
 /div

 //views/cities/edit.ctp
 div class=cities form

 ?php echo $this-Html-script('list_provinces'); ?
 ?php echo $this-Form-create('City');?
         fieldset
                 legend?php __('Edit City'); ?/legend

         ?php
                 echo $this-Form-input('id');
                 echo $this-Form-input('nombre');
                  echo $this-Form-input('country_id', array('options'
 =
 $countries, 'empty' =
             '-- Seleccione Pais --', 'id' = 'country'));
         ?
                 div id=provincias 
             ?php
             echo $this-Form-input('province_id', array('options' =
 $provinces, 'empty' =
                 '-- Seleciones Provincia --', 'id' = 'provincia'));
             ?
         /div
         /fieldset
 ?php echo $this-Form-end(__('Submit', true));?
 /div

 //controllers/citiescontroller.ctp
 ?php
 class CitiesController extends AppController {

         var $name = 'Cities';
 var $components = array('RequestHandler');

    public function obtener_provincias() {

   if($this-RequestHandler-isAjax()) {
     $this-set('provinces', $this-City-Province-find('list',
                            array('conditions' =
                                        array('province.country_id' =
 $this-params['url']['countryId']),
                                  'recursive' = -1)));

   }

 }

         function index() {
                 $this-City-recursive = 0;
                 $this-set('cities', $this-paginate());
         }

         function view($id = null) {
                 if (!$id) {
                         $this-Session-setFlash(__('Invalid city',
 true));
                         $this-redirect(array('action' = 'index'));
                 }
                 $this-set('city', $this-City-read(null, $id));
         }

         function add() {
                 if (!empty($this-data)) {
                         $this-City-create();
                         if ($this-City-save($this-data)) {
                                 $this-flashSuccess('la ciudad The
 city has been saved','index');
                                 /*$this-Session-setFlash(__('The
 city has been saved', true));
                                 $this-redirect(array('action' =
 'index'));
                                 */
                         } else {
                                 $this-Session-setFlash(__('The city
 could not be saved. Please,
 try again.', true));
                         }
                 }
                 $countries = $this-City-Country-find('list');
                 $provinces = $this-City-Province-find('list');
                 $this-set(compact('countries', 'provinces'));

         }

         function edit($id = null) {
                 if (!$id  empty($this-data)) {
                         $this-Session-setFlash(__('Invalid city',
 true));
                         $this-redirect(array('action' = 'index'));
                 }
                 if (!empty($this-data)) {
                         if ($this-City-save($this-data)) {
                         //$this-flashSuccess('la ciudad The city has
 been saved','index');
                            $this-Session-setFlash(__('The city has
 been saved', true));
                            $this-redirect(array('action' =
 'index'));
                         } else {
                                 $this-Session-setFlash(__('The city
 could not be saved. Please,
 try again.', true));
                         }
                 }
                 if (empty($this-data)) {
                         $this-data = $this-City-read(null, $id);
                 }
                 $countries = $this-City-Country-find('list');
                 $provinces = $this-City-Province-find('list');
          

Re: MySQL Connection Error

2010-09-10 Thread francky06l
What is your db config, the debug line seems to be in connect
function of dbo_mysql (depends which version) ..
Are you trying to use a persistent connection ?

On Sep 10, 5:31 pm, Éber eber.frei...@gmail.com wrote:
 Hey guys...

 Sometimes I'm getting erros like this on my logs:

 2010-09-09 21:02:09 Warning: Warning (2): mysql_connect(): Lost
 connection to MySQL server at 'reading initial communication packet',
 system error: 110 in [.../cake/libs/model/datasources/dbo/
 dbo_mysql.php, line 540]
 2010-09-09 21:02:09 Warning: Warning (2): mysql_select_db() expects
 parameter 2 to be resource, boolean given in [.../cake/libs/model/
 datasources/dbo/dbo_mysql.php, line 546]
 2010-09-09 21:02:09 Warning: Warning (2): mysql_query() expects
 parameter 2 to be resource, boolean given in [.../cake/libs/model/
 datasources/dbo/dbo_mysql.php, line 588]
 2010-09-09 21:02:09 Warning: Warning (2): mysql_get_server_info()
 expects parameter 1 to be resource, boolean given in [.../cake/libs/
 model/datasources/dbo/dbo_mysql.php, line 554]
 2010-09-09 21:02:09 Warning: Warning (2): mysql_real_escape_string()
 expects parameter 2 to be resource, boolean given in [.../cake/libs/
 model/datasources/dbo/dbo_mysql.php, line 655]
 2010-09-09 21:02:09 Warning: Warning (2): mysql_query() expects
 parameter 2 to be resource, boolean given in [.../cake/libs/model/
 datasources/dbo/dbo_mysql.php, line 588]
 2010-09-09 21:02:09 Warning: Warning (2): mysql_errno() expects
 parameter 1 to be resource, boolean given in [.../cake/libs/model/
 datasources/dbo/dbo_mysql.php, line 667]
 2010-09-09 21:02:09 Warning: Warning (2): mysql_query() expects
 parameter 2 to be resource, boolean given in [.../cake/libs/model/
 datasources/dbo/dbo_mysql.php, line 588]
 2010-09-09 21:02:09 Warning: Warning (2): mysql_errno() expects
 parameter 1 to be resource, boolean given in [.../cake/libs/model/
 datasources/dbo/dbo_mysql.php, line 667]

 My database is on another server than the application and for some
 reason I guess I'm having trouble connecting to it sometimes... My
 question is... Isn't there a way to catch connection errors and
 prevent the system to perform anything when this happens?

 I guess that these errors are the cause of anoying problems I'm having
 like people being able to register with the same username... I know I
 can use UNIQUE indexes, but I don't know what else could happen with
 errors like these. Just wish I could block anyhting from being
 performed if I can't get a connection...

 Any ideas? What you guys think about it? Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: New Auth Issue

2010-09-10 Thread francky06l
Why not use the session helper in the default.ctp ?

if($session-check('Auth.User.id'))
echo User is logged;
else
  echo Not logged ..


On Sep 10, 7:38 pm, cricket zijn.digi...@gmail.com wrote:
 On Fri, Sep 10, 2010 at 11:23 AM, Chuck chivalrys...@gmail.com wrote:
  OK, after assistance from the group with setting up Auth, I'm not
  trying to test if a user is logged in or not. Before testing this, the
  behavior of the system is as follows.

  1. The login form appears at the top of every page except the users/
  login page.
  2. If I attempt to login with incorrect credentials, the form takes me
  to users/login with an error message.
  3. If I login with valid credentials, the form forwards me to pages/
  home..

  Given the above, it appears the login is working, so the next step is
  to figure out if the user is logged in or not, so I added the
  following to AppController:

  if ( $this-Auth-user() ) {
   $this-set( 'loggedin', 'the user is logged in' );
  } else {
   $this-set( 'loggedin', 'the user is not logged in' );
  }

  Then in the default.ctp file, just above the login form, I placed the
  following:

  echo  $loggedin;

  No matter whether I use valid or invalid credentials, this always come
  back, the user is not logged in.`

  Where is my mistake?

  Thanks,
  Chuck

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
  with their CakePHP related questions.

  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 
  athttp://groups.google.com/group/cake-php?hl=en

 Cached content?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Centralize Vendor Scripts

2010-09-10 Thread francky06l
Depends the version you are using, in 1.3 you can configure additional
vendors path ..

http://book.cakephp.org/view/1568/Configuration-and-application-bootstrapping

same possibility exists for 1.2, check the 1.2 book

On Sep 10, 10:25 am, and andre.sila...@googlemail.com wrote:
 Hi there,

 I want to use some scripts that should usually be saved in the vendors
 folder within the application. My problem is that I have many projects
 which use those skripts. I don't want to copy all scripts again and
 again into every new application. Is there a way in CakePHP how to
 store the scripts outside of the application and then using it?

 kind regards,

 and

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Duplicate Count Records on Update

2010-09-10 Thread francky06l
Well, that's the way cake's handles it ... Now if you have the query
cache enabled on MySql, the second COUNT should cost 0 ..
You can try using updateAll ... that should not make extra query ..

On Sep 10, 3:10 pm, Wilhelm wilhelm.ellm...@gmail.com wrote:
 Hi,

 I would like to first of all apologize if this has been answered
 before by all my searching I could not find out, ( possible google
 skills lacking )

 So I am busy running CakePHP 1.3.3 and noticed something a little
 strange when performing a update. Looking at the run queries I have
 noticed that there are two Select Count(*) queries. Do some research I
 did find out that there is a reason for the one to have better error
 detection but I think the second one is a little excessive. I have
 stopped short of reporting this as a bug as I would would first like
 to check that I am not missing something in my implementation.

 The php script
 $this-Campaign-Mo-id = $moId;
 $this-Campaign-Mo-save( array( 'Mo' =
 array( 'field_one'=1,'field_two'=2 ) ) );

 Debug Report
 SELECT COUNT(*) AS `count` FROM `mos` AS `Mo` WHERE `Mo`.`id` = 91
 SELECT COUNT(*) AS `count` FROM `mos` AS `Mo` WHERE `Mo`.`id` = 91
 UPDATE `mos` SET `field_one` = 1, `field_two` = 2, `modified` =
 '2010-09-10 12:56:28' WHERE `mos`.`id` = 91

 Any help will greatly be appreciated.

 Kind Regards
 Wilhelm

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Cookie path getting set to /app/webroot--not honoring $this-path

2010-09-10 Thread francky06l
Maybe this can help:

http://bakery.cakephp.org/articles/view/how-to-bend-cakephp-s-session-handling-to-your-needs

On Sep 10, 5:54 am, Sam s...@masterscommission360.com wrote:
 It sounds like you've been living my life... As far as htaccess files
 go- are all of them stock(I think there are at least 3). Also, are you
 using the standard folder setup?

 On Sep 9, 4:56 pm, carl67lp ccander...@gmail.com wrote:

  I'm trying to fix a zillion bugs with a script a client bought (don't
  ask).  One of the last major ones is an authentication issue.  Seems
  that the path of the cookie is getting set to /app/webroot -- and it
  should be simply / according to $this-path (set in the app
  controller, as well as hard-coded in the cookie.php file, by default).

  I suspect that this might have to do with an issue with .htaccess
  files, but the ones I'm using are stock from a clean CakePHP
  download.  (If it matters, the script /might/ be using Cake 1.1 libs,
  rather than 1.2.)  In other words, I'm seeing plenty of links getting
  rendered with /app/webroot in the URL.

  This wouldn't be a huge issue if /everything/ lived under /app/webroot
  (if the cookie referenced that path), but sadly some links in the
  script don't use CakePHP's html helper--and thus, things are
  occasionally hard-coded.

  So, my problem is two-fold:

  a. The cookie path isn't getting set correctly.
  b. All of my CakePHP-generated URLs are getting /app/webroot prepended
  to them.

  If I can fix (a) to give me the base path (/) I'd be okay; I'd really
  prefer to solve (b), but I think it's a tougher nut to crack.

  Any thoughts?  I'm getting near to my wits' end on this one.  And yes,
  I've looked at the documentation, done the Google searches, and
  everything--nothing seems to work.

  --Carl

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 to Login with Simple Acl controlled Application tutorial cakephp 1.3 - Lost session

2010-09-10 Thread francky06l
Check about this in config/core.php

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

Set also the Security.level to medium


On Sep 9, 11:28 pm, Sanza mass...@creativebrains.it wrote:
 I have already worked with cakephp 1.2 and i have made some
 applications without problems about the acl but when i decided to use
 the new cakephp 1.3 i found this problem.

 Note: I have triple checked all steps of the tutorial Simple Acl
 controlled Application for cakephp 1.3, restart completely many times
 the project but i have always the same problem.

 The problem: when i try to log in I come always redirected to the
 login page WITHOUT a flash message like Login failed. Invalid
 username or password..

 The strange thing is that with Firefox (mac, windows, linux all with
 default cookie settings) work perfectly, but with Safari Mac, Chrome
 Mac, IE 8.0.xx, Chrome Win don't work.

 Also changing the cookie settings to Accept all, accept always etc
 etc don't work.

 Debugging seems that the session is lost between the login page and
 the next page maybe caused by the cookie that is not stored...

 Any help or suggestions?

 Thanks Massimo

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: limiting auth allow('display') to just one page

2010-09-10 Thread francky06l
Seems like a story of CRUD with Acl, if your user as an ARO whose
parent it's the department, and all user of this department have same
ARO parent, any ACO (your model / record) can be checked on
ACL using the crud

On Sep 9, 10:45 pm, cricket zijn.digi...@gmail.com wrote:
 On Thu, Sep 9, 2010 at 4:29 PM, calzone calz...@gmail.com wrote:
  Thanks.

  I am using ACL, but not terribly comfortable with it.  I'm still
  trying to figure out how to make it grant ownership of content that
  is created by one user so only he can see it, or for other content,
  that is created by a user belonging one department so that other
  departments can't see stuff that doesn't belong to them (while still
  allowing users from the managers group to see all the departments they
  oversee, and superadmins to see everything).  At the same time, the
  concepts of departments is a separate lookup table from the actual
  groups table for the ACL permissions.

 Yes, it's a huge can of worms.



  I thought ACL only kicked in after the user has authenticated and that
  before that happens, for unauthenticated guests, you are stuck with
  whatever Auth allows or denies.

 Yes, that's what I meant about actions vs parameters. But, if you need
 a fine-grained system to grant access to the pages, what I suggested
 won't work. I thought you only had 2 classes of users: those who could
 see all pages, and those who should only see 'home'. If you need to
 grant different access to some pages for already-authenticated users
 you'll need to either use ACL or something you roll yourself.

 Actually, on second thought, I suppose that the approach I suggested
 would still work. But you'll still need some ACL business in your
 display() action.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 helper for updating a div

2010-09-10 Thread francky06l
Can you check first if your ajax call is running (using Firebug on FF
or same) .. Long time I haven;t work with prototype, I prefer
jQuery ...

On Sep 9, 3:44 pm, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 thx Dmitry...i tried to implement sth, based on your proposal

 ok for testing purpose i created an ajax view called   neat

 ?php

                 echo if you see this, ajax works;
  ?

 and this is my ajax link in a view called render_attachment

                                 echo $ajax-link('x', array('controller' = 
 'links', 'action' =
 'test'), array('update' = 'divi'));

                                 echo $ajax-div('divi');
                                 echo $ajax-divEnd('divi');

 now the test() fct in my controller looks like this

         function test()
         {
                 $this-render('neat', 'ajax');
         }

 but nothing happens...no if you see this, ajax works text appears
 from the view i tried to render with ajax..

 any idea whats going wrong here?

 thank you :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 can't connect to DB but only shows an error that there's missing a table!

2010-09-10 Thread francky06l
MySql on Mac probably ?

On Sep 9, 2:13 pm, Joshua Muheim psybea...@gmail.com wrote:
 OK, at least I now found out what was the problem for CakePHP not
 being able to connect to MySQL: more coincidentally I found the
 following link:

 http://soledadpenades.com/2006/08/06/wrong-location-of-mysqlsock/

 that states that CakePHP looks in

 /var/mysql/mysql.sock

 for the mysql socket, and that normally this one is in

 /tmp/mysql.sock.

 So I created a soft link, and now it works. But I am very disappointed
 with the error messages in CakePHP...

 On Thu, Sep 9, 2010 at 2:00 PM, psybear83 psybea...@gmail.com wrote:
  Hi everybody

  I have overtaken a CakePHP application that I have to optimize now. I
  have installed it on my computer, but I could't get it to run properly
  yet.

  It tells me that  Database table acos for model Aco was not found.,
  but the real problem is, that it can't connect to the DB! Somehow it
  doesn't complain about that, but as soon as there's a table needed, it
  notices that there isn't any.

  I guess this is quite unclean, IMHO it should complain that it can't
  connect to the DB.

  Is this normal?

  Thanks for help
  Josh

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
  with their CakePHP related questions.

  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 
  athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: CakeFest IV - America - Help us pick a location!

2009-11-18 Thread francky06l
West coast !!!
San Francisco - LA ...

Cheers

On Nov 17, 4:51 pm, Sourav souravbas...@gmail.com wrote:
 In my view San Jose, California would be the ideal location. It is the
 heart of Silicon Valley, nice weather  one of the safest cities in
 America.

 On Nov 13, 8:43 am, Graham Weldon gra...@grahamweldon.com wrote:

  Hi all,

  The CakePHP team has been considering the location for the next  
  upcoming CakeFest.
  We've decided to bring it back home to the United Sates of America.
  Thus far we haven't chosen a location for the event, but to ensure we  
  reach as many people as possible, we'd like your opinion on where we  
  should host the event.

  Essentially, our choices are:
  - USA East Coast
  - USA West Coast
  - USA Central

  If I have missed another location that you feel might be more popular  
  or accessible to interested attendees, feel free to suggest it.
  We're keen to hear peoples thoughts on it.

  Cheers,

  Graham Weldon (AKA: Predominant)

  e. gra...@grahamweldon.com
  w.http://grahamweldon.com

--

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-...@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=.




Re: Does anybody know how can I limit the join table fields when I user joins condition?

2009-04-01 Thread francky06l

Looking at your user/task description Isn'it a simple User hasMany
Task ? In such case, containable can do the job  ..
unless I am missing something

On Apr 1, 2:58 pm, joshua josh...@gmail.com wrote:
 Yes, we can use containable to get the task's users. But if there is a user
 , I want to find all the tasks he owns. How can I do?

 User table:
 id | name

 Task table:
 id | user_id | name

 We can't count on containable to help us to find the relate tasks. And I
 count on 'join' to  help me to do this. Any suggestions?



 On Wed, Apr 1, 2009 at 2:09 AM, Amit a...@amitvaria.com wrote:

  I highly recommend checking out the Containable behavior:

 http://book.cakephp.org/view/474/Containable

  It will simplify this code and let you easily add fields.

  On Mar 31, 8:28 am, joshua josh...@gmail.com wrote:
   For example:
   One task has many users.
   
           $condition = array();
           $condition['joins'] = array(
               array(
                   'table' = 'users',
                   'alias' = 'User',
                   'type' = 'inner',
                   'foreignKey' = 'user_id',
                   'conditions'= array('User.id =
   Task.user_id','User.deleted=0')
           ));
   
   I just want to find the user name , not all the fields in User table. I
  try
   to add the 'fields' property in this array, but it seems not.
   --
   Thanks
   Joshua

 --
 Thanks
 Joshua
--~--~-~--~~~---~--~~
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: Does anybody know how can I limit the join table fields when I user joins condition?

2009-03-31 Thread francky06l

Use the 'fields' options for your field and add 'User.name' in it
maybe ?

hth

On Mar 31, 3:28 pm, joshua josh...@gmail.com wrote:
 For example:
 One task has many users.
 
         $condition = array();
         $condition['joins'] = array(
             array(
                 'table' = 'users',
                 'alias' = 'User',
                 'type' = 'inner',
                 'foreignKey' = 'user_id',
                 'conditions'= array('User.id =
 Task.user_id','User.deleted=0')
         ));
 
 I just want to find the user name , not all the fields in User table. I try
 to add the 'fields' property in this array, but it seems not.
 --
 Thanks
 Joshua
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Validation is consuming all memory resources

2008-11-23 Thread francky06l

Hi All,

I am working on an application that updates really a lot of data in a
shell process.
Customer are sending very big files of data that I need to match and
update .. so far so good 

I realized that after a while (about 40 000 records) my application
runs out of memory (32 Mb) ... I have 3 millions records to update ..
Digging around, I discover that the validation are consuming the
memory.
I did simple test such as commented this line (nb: 2346 on rev: 7847)
in core model.php:

$valid = $Validation-dispatchMethod($rule, $ruleParams);

I use memory_get_usage(true) every 1000 records, when the above is NOT
commented (actually if the validation is true or false does not
matter) the memory grows slowly .. but double after 10 000 records.
When the above line is commented in model.php the memory is stable
(same amount after 3 millions records).
Again I use this in a shell, so memory should be quite stable since
all objects are instantiated after few records, but it always failed
when trying to allocate memory for validation.php). I guess RC2 did
not have this problem, I did validate 3 millions records before ...
but now a bit stuck around 40 000 (about 8 models are involved in
transactional mode).

Maybe someone of the core team has an idea about this ? Easy to
reproduce, just validate 1000 times the same data .. and watch the
memory used  (hard to do with the test suite though since you can't
expect any memory at first)..
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validation is consuming all memory resources

2008-11-23 Thread francky06l

Well after digging, I found the problem .. it comes from the _check
function in validation.php.

The check stores true/false in $_this-error array, but actually never
reset this array (neither use it anyway) .. There is also the var
$errors that is never reset ...

Cheers

On Nov 23, 11:42 pm, francky06l [EMAIL PROTECTED] wrote:
 Hi All,

 I am working on an application that updates really a lot of data in a
 shell process.
 Customer are sending very big files of data that I need to match and
 update .. so far so good 

 I realized that after a while (about 40 000 records) my application
 runs out of memory (32 Mb) ... I have 3 millions records to update ..
 Digging around, I discover that the validation are consuming the
 memory.
 I did simple test such as commented this line (nb: 2346 on rev: 7847)
 in core model.php:

 $valid = $Validation-dispatchMethod($rule, $ruleParams);

 I use memory_get_usage(true) every 1000 records, when the above is NOT
 commented (actually if the validation is true or false does not
 matter) the memory grows slowly .. but double after 10 000 records.
 When the above line is commented in model.php the memory is stable
 (same amount after 3 millions records).
 Again I use this in a shell, so memory should be quite stable since
 all objects are instantiated after few records, but it always failed
 when trying to allocate memory for validation.php). I guess RC2 did
 not have this problem, I did validate 3 millions records before ...
 but now a bit stuck around 40 000 (about 8 models are involved in
 transactional mode).

 Maybe someone of the core team has an idea about this ? Easy to
 reproduce, just validate 1000 times the same data .. and watch the
 memory used  (hard to do with the test suite though since you can't
 expect any memory at first)..
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: several database settings

2008-11-22 Thread francky06l

That will not work for shell ... but maybe you do not need
Cheers

On Nov 22, 12:06 am, Ricardo Valfreixo [EMAIL PROTECTED] wrote:
 Ok, I ask and also reply..

 directly on the app/config/database.php

 something like:

 classe DATABASE_CONFIG
 {
 var $default = NULL;

 var $dev = array(
 //your dev settings
 );
 var $prod = array(
 //your prod settings
 );

 function __construct()
 {
 if(isset($_SERVER['SERVER_NAME'])
 {
 if($_SERVER['SERVER_NAME'] == your server url)
 {
 $this-default = $this-prod;
 }
 else
 {
 $this-default = $this-dev;
 }
 }
 }

 }

 et voilá

 @teknoid

 This way I don't need to worry about overwriting all the files. I can simply
 delete all and reupload the entire source.

 Zen

 On Fri, Nov 21, 2008 at 10:45 PM, Ricardo Valfreixo [EMAIL PROTECTED]wrote:

  Hello once more. I'm a real pain, I know..

  I have two database settings. one $default and one $production. How can I
  make the code sensitive to the url? I have the php magic system variables
  which I can use, But were, in the code, should I put the selector?

  Thank you

  Zen
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple Has Many, not returning with find('all')

2008-11-10 Thread francky06l

try recursive = 2  =  find('all', array('recursive' = 2));

On Nov 10, 11:43 pm, thatsgreat2345 [EMAIL PROTECTED] wrote:
 I have my admin controller include ListAffiliate , which has a hasMany
 like this

 ?php
 class ListAffiliate extends AppModel {
   var $name = 'ListAffiliate';
   var $hasMany =
 array('Postback'=array('className'='Postback','foreignKey'='list_affiliate_id'),

 'ListAffiliateIp'=array('className'='ListAffiliateIp','foreignKey'='list_affiliate_id'));
  }

 ?
 Postback Model
 ?php
 class Postback extends AppModel {
   var $name = 'Postback';
   var $belongsTo = 'ListAffiliate';
  }

 ?

 ListaffiliateIP model

 ?php
 class ListAffiliateIp extends AppModel {
   var $name = 'ListAffiliateIp';
   var $belongsTo = 'ListAffiliate';
  }

 ?
 However, when I do a and pr or debug it , it only returns the data in
 the ListAffiliate table, not any of the data that is associated with
 the hasMany.
 $this-ListAffiliate-recursive = 1;
 $this-set('postback',$this-ListAffiliate-find('all'));
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: session data in Model::afterSave

2008-11-10 Thread francky06l

you could set a static variable and method in app_model to hold/set
the session data.  You can call the method from app_controller
beforeFilter using $this-{$modelClass}-setSessionData($this-Session-
read('User')) for example... Then, in any model you could refer to
self::$sessionData ...

just a hint

On Nov 10, 3:20 am, validkeys [EMAIL PROTECTED] wrote:
 Hey Guys,

 So I have created an activity log model Acitivity that tracks
 certain events that happen in my app (Client Created, Message Posted
 etc..)

 Because there is no uniformity to the times when these activities are
 logged I have decided not to create a behaviour (also because I haven
 ever progged a behavour before), but instead I am placing the function
 to create the activity log in the afterSave method for the models that
 will be logged.

 Whenever an activity is logged, I associate that record with the user
 who performed the action. The only problem is that the user id is in
 the session and I am using an afterSave method in the model to create
 the activity log. How can I access the user id from the session in a
 Model::afterSave method?

 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: A way to lost your session in Cake 1.2RC3 :-)

2008-11-10 Thread francky06l

Are the link ajax one ?
This, is I believe due to the security level., set it to medium. I
guess when during long queries/slow connection your second query is
there before the first one is gone ..making an hijacking session ..

On Nov 10, 10:18 pm, validkeys [EMAIL PROTECTED]
wrote:
 Im not sure. I have had similar problems when using a database. Anyone
 else have the same problem / advice?

 On Nov 10, 12:36 pm, Serge Rodovnichenko [EMAIL PROTECTED] wrote:

  No, I store sessions in files, in /tmp directory. Database useage may
  help to resolve this problem?

  On 10 нояб, 22:15, validkeys [EMAIL PROTECTED] wrote:

   I have had this problem before, where I click links quickly and it
   blows up my session data. Are you using the database to manage your
   sessions?

   On Nov 10, 10:45 am, Serge Rodovnichenko [EMAIL PROTECTED] wrote:

It's simple:

In your application, click on a link to one action, then click on a
link to the second action without waiting of results of first action.
Session data lost.

A heavy-loaded server and complex database query, generated by first
action/Model or slow network connection may help you to do this :-)

I think it's not a bug, but is there a hope for correcting the
situation?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: missing controller, can't get http://localhost/xampp

2008-11-05 Thread francky06l

you should install cake in xampp/htdocs/cake for example, not in
htdocs directly.
Also, I guess xampp does not have the mod-rewrite enabled by
default .. Check your php.ini in the xampp/apache/bin and uncomment
the line relative to mod-rewrite.

hth

On Nov 5, 9:26 pm, Janis Rough [EMAIL PROTECTED] wrote:
 Sorry I sent an earlier message but I didn't explain very well.

 I installed phpCake.  I have Xampp version of apache and mysql server for 
 localhost testing which earlier worked.  If I typedhttp://localhost/xamppI 
 would get a list of tools and status and so forth.  Now if I 
 typehttp://localhost/xampp/phpinfo.php
 orhttp://localhost/xampp.  I get missing controller errors.  I need to 
 accesshttp://localhost/xampppage to use the phpadmin tool to create a table 
 for the tutorial.
 How can I reroute the xampp page index so that it works so that I can use the 
 admin tool?

 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: change base url for $javascript-link calls

2008-11-05 Thread francky06l

I guess that if you include http://; in the name it should generate
the righrt url ..


On Nov 5, 7:15 pm, Andres Monroy-Hernandez [EMAIL PROTECTED]
wrote:
 I'm using $javascript-link to generate calls like:

 script type=text/javascript src=/js/scriptaculous.js/script

 Now I want to change it to something like:
 script type=text/javascript src=http://foobar.com/js/
 scriptaculous.js/script

 I was looking for some kind of parameter in core.php to automatically
 append something to every $javascript-link call but I couldn't find
 it.

 Any suggestions on how I can do 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Changing the Auth-loginRedirect based on value in user model

2008-11-05 Thread francky06l

Well quite normal since as long as you are not logged in beforeFilter
has no much effect on redirection ..
Better, use $this-Auth-autoRedirect = false; in beforeFilter ..

In login,

if($this-Auth-user('id'))
{
if($this-Auth-user('admin') == 'n')
blah;
else
otherblah ...
}

hth

On Nov 5, 4:03 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 Hi all,

 I have a simple app that needs to have 2 types of users, normal users
 and admins. I have got the Auth component working great and has the
 entire site requiring log in etc, but I want to redirect users that
 are admins to the admin route sections upon login.

 I have this in my app_controller:

 function beforeFilter() {
 $this-Auth-allow('display');
 $this-Auth-logoutRedirect =
 array(Configure::read('Routing.admin') = false, 'controller' =
 'users', 'action' = 'logout');
 $user = $this-Auth-user();
 //debug($user);
 if($user['User']['admin'] == 'n') {
 $this-Auth-loginRedirect = array('controller'='orders',
 'action'='index');
 } else {
 $this-Auth-loginRedirect = array('controller'='orders',
 'action'='index', 'admin' = true);
 }

 }

 And while it doesnt throw errors it seems to behave wierdly - it
 redirects to the /admin route regardless, but if I go back in my
 browser and login again it redirects to the correct page!

 Has anyone tried to do this before? Any suggestions what I may be
 missing?
 TIA,
 d.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Set::extract issue - array must start with [0] index

2008-10-26 Thread francky06l

I have noticed this to. Forget to post a ticket for enhancements, my
solution for now was to re-index the array.

On Oct 25, 7:33 pm, senser [EMAIL PROTECTED] wrote:
 Hello,

 I have problem using Set::extract class. Here is an example array
 $test:

 Array
 (
 [3181] = Array
 (
 [Sync] = Array
 (
 [id] = 3181
 [synced] = 0
 )
 )

 On this array Set::extract('/Sync[id=3181]', $test) returns an empty
 result but if I change the array like this

 Array
 (
 [0] = Array
  (
   )
 [3181] = Array
 (
 [Sync] = Array
 (
 [id] = 3181
 [synced] = 0
 )
 )

 and Set::extract('/Sync[id=3181]', $test) gives the right result.  My
 conclusion is that Set:extract needs the first element of an array to
 be with zero index - am I wrong or missing something.

 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ajax-observeField trouble

2008-10-19 Thread francky06l

Probably, the product group field is removed when you update the list.
Place the observeField call when you update the product group (ie:
in the same update as the updating the groups from categories).

On Oct 19, 5:06 pm, cds [EMAIL PROTECTED]
wrote:
 http://bin.cakephp.org/saved/38610

 I'm having real trouble with $ajax-observeField. I have a form that
 has a product category, product group, and then product size. Product
 group is dependent on product category so I have an observeField on
 Product Category. This triggers an action, which works. Next, Product
 Size is dependent on product group, so a change in product group
 SHOULD trigger another action, but it never gets that far.

 I have two $ajax-observeField elements and think the problem lies
 there, but I was hoping someone could guide me through this a bit. The
 paste is located at the top of this message.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Association not available when expected

2008-10-19 Thread francky06l

Do you set reset to false in your bindModel ?, check also the
'recursive; option in find.

hth

On Oct 19, 11:56 am, lazyeye [EMAIL PROTECTED] wrote:
 I have a behavior that creates two associations using bindModel.  Now
 if I can find('first') in the model the associations are available.
 Great everything is working and I'm happy, well not quite,
 unfortunately these associations seem to disappear when I call
 find('all') on the same model.

 The odd thing is if a put another completely unrelated bindModel call
 in the constructor of the model (after I've called the parent
 constructor) the associations appear when I call find('all'), however
 if I take that same completely unrelated bindModel call and place in
 the setup method of the behavior and call find('all') the associations
 are gone again.

 Ok, so now I'm thinking this has something to do with the difference
 between when the setup method is called for behaviors and when the
 constructor is called for models.  However I stop coding here and go
 to ask the community for help because I'm a newbie to cake (heard
 about it a while ago and starting using it a week ago) and I over my
 head here.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-15 Thread francky06l

Set recursive to 2  just a hint

On Oct 14, 5:46 am, squidliberty [EMAIL PROTECTED] wrote:
 That worked! The only problem is that it creates a ton of queries...
 instead of just LEFT JOIN ing the Shift table into the select query,
 CakePHP is issuing a separate query for each related Shift record. In
 addition to being inefficient, this means that I can't use Shift
 fields in my condition, fields, or order values :(

 I guess I should just write a custom query and skip bypass Cake's
 database abstraction.

 Thanks for all your help!

 - Scott

 On Oct 13, 6:11 am, francky06l [EMAIL PROTECTED] wrote:

  I faced the same problem. It seems there is a (recent bug) bug in
  containable (I use the SVN branch). It does not adjust the recursive
  properly.
  Try you query adding 'recursive' =  3 and that should do it..

  hth

  On Oct 13, 7:58 am, francky06l [EMAIL PROTECTED] wrote:

   Did you check the generated query ? Does it contain the shifts table?

   On Oct 13, 4:43 am, squidliberty [EMAIL PROTECTED] wrote:

As an experiment, I downloaded a fresh copy of Cake 1.2 and added only
the scripts above. I wanted to confirm that this was not a problem
caused by my existing site's configuration. The new installation
produced identical results, so there must be something wrong with the
approach. Maybe I'm just overlooking something obvious...
- Scott

On Oct 12, 5:44 pm, francky06l [EMAIL PROTECTED] wrote:

 After reading again the post

 $this-find('all', array(
 'contain' = array(
 'Department', 'Sale' = 'Shift(closed)'),
 'fields' = array('Log.cost')
 ),
 );

 Hope this works, I did not catch all relations at first glance, you
 might also use the containable behaviors in the Sale / Departement
 model ..
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: xmlwriter

2008-10-15 Thread francky06l

Well check the xml helper and serialize method, if DB is big you might
have to paginate it ..
I also believe that mysqldump can dump xml (not sure thought)...

On Oct 14, 5:46 pm, Liebermann, Anja Carolin
[EMAIL PROTECTED] wrote:
 I would be interested as well in any help on this topic.

 The cookbook isn't very verbose on this:http://manual.cakephp.org/view/623/Xml

 In the end I would like to make an XML export out of my database, but at
 the moment I  don't know how to get expat on my development server
 (WinXP) or on my production environment (Linux). And I have no clue how
 to talk to expat or if cake does it for me.

 Thanks for any help, hints and links in advance!

 Anja

 

 Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im
 Auftrag von .
 Gesendet: Sonntag, 12. Oktober 2008 05:53
 An: Cake PHP
 Betreff: xmlwriter

 has anybody worked with xmlwriter (or similar) with cakephp? 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: mod_rewrite problem?

2008-10-15 Thread francky06l

Usually mod-rewrite is in the htaccess, be sure you have
proper .htaccess in your webroot virtual site
(you can also turn on the rewrite log on apache, and check if
something is wrong)..

hth

On Oct 15, 10:13 pm, Arndtinho [EMAIL PROTECTED] wrote:
 Hello,

 I reconfigured my new workstation with Cake.
 Following transfering my projects I tested one.
 But the site is displayed without the CSS definitions and the
 includes.
 I was first exposed mod_rewrite is disabled but it's enabled. And if
 I
 callhttp://myproject/css/main.css, the content of the css file is
 displayed
 at the browser.
 What could be the reason for this behavior?
 Here my virtual host configuration:

 VirtualHost *:80
 ServerAdmin [EMAIL PROTECTED]
 DocumentRoot E:/Pfad/zum/Projekt
 ServerName myproject
 ServerAlias 127.0.0.1
 ErrorLog E:/Pfad/zum/Projekt/logfiles/profil_error.log
 CustomLog E:/Pfad/zum/Projekt/logfiles/profil_access.log common

 Directory E:/Pfad/zum/Projekt/
AllowOverride All
Options +FollowSymLinks
Order deny,allow
Allow from all
Satisfy all
 /Directory
 /VirtualHost

 System: WinXP, Apache2 (mod_rewrite enabled), CakePHP 1.1

 Regards
 Arndtinho
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Changing views depending on ARO

2008-10-15 Thread francky06l

Well id the group_id is in session (if your use belongsTo a group, you
can store it in session), easy to have in app_controller beforeRender,
(if($this-Auth-user('group_id') == x) $this- layout = admin; ..
just a hint..
hth

On Oct 15, 7:37 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I have this at the login action... it works, but its not pretty

 $this-User-id = $this-Auth-user('id');
 $node = $this-User-node();
 $type = $node['1']['Aro']['alias'];

 if($type=='Admin'){

 $this-redirect(array('controller'='dashboard','action'='index'));

 }else{
$this-redirect($this-Auth-redirect());
}
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practices for multiple cake apps sharing tables?

2008-10-15 Thread francky06l

make a plugin maybe ?

On Oct 15, 7:15 pm, comb [EMAIL PROTECTED] wrote:
 For example, I would like to build one app to manage the users and
 groups for all my other apps. Single sign on if you will.

 ---
 How do I name tables?
 I've noticed I run into trouble attempting to use tablePrefixes in
 either project, particularly with HABTM joinTables:
 master_groups
 master_groups_users
 master_users
 project1_stuff
 project1_thingers
 Accessing the groups+users relationship and join table is problematic.
 But maybe that's because I'm trying to create models in the project
 app too.

 ---
 What's the best strategy for not repeating work?
 So far, I've tried re-creating the User and Group model in the
 project, but that has problems mentioned above. Aside from the table
 naming, do I need to also redefine all the methods I already wrote in
 the Master User/Group app? Is this something that I need to wrap into
 a behavior of some sort?

 ---
 I've tried explicitly defining my join tables, but from within
 Project1, cake tries to attach the Project1_ prefix to the
 groups_users join table. Even when I specify the table name in the
 habtm relationship, it still appends the prefix.

 The hack as I see it is to just explicitly define each table, but that
 feels very un-cake-like and hackish.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-13 Thread francky06l

I faced the same problem. It seems there is a (recent bug) bug in
containable (I use the SVN branch). It does not adjust the recursive
properly.
Try you query adding 'recursive' =  3 and that should do it..

hth

On Oct 13, 7:58 am, francky06l [EMAIL PROTECTED] wrote:
 Did you check the generated query ? Does it contain the shifts table?

 On Oct 13, 4:43 am, squidliberty [EMAIL PROTECTED] wrote:

  As an experiment, I downloaded a fresh copy of Cake 1.2 and added only
  the scripts above. I wanted to confirm that this was not a problem
  caused by my existing site's configuration. The new installation
  produced identical results, so there must be something wrong with the
  approach. Maybe I'm just overlooking something obvious...
  - Scott

  On Oct 12, 5:44 pm, francky06l [EMAIL PROTECTED] wrote:

   After reading again the post

   $this-find('all', array(
   'contain' = array(
   'Department', 'Sale' = 'Shift(closed)'),
   'fields' = array('Log.cost')
   ),
   );

   Hope this works, I did not catch all relations at first glance, you
   might also use the containable behaviors in the Sale / Departement
   model ..
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Uploading files to private folder

2008-10-12 Thread francky06l

When you upload files, usually it goes to the temp folder of Apache.
The you can use move_uploaded_file (php function) to move the file
to APP.somewhere ... Of course you would create the somewhere
folder before.

hth

On Oct 12, 8:52 pm, Orhan Toy [EMAIL PROTECTED] wrote:
 Hi

 There a plenty of guides about uploading files to a database or to the
 public folder with Cake. But what if I just want to upload files to
 private folder? One solution could be to make my own folder somewhere
 in the root but is there a predefined directory for this purpose?

 What I mean about private is that you can't access the file directly
 via an url but instead it is the controller's job to get the file from
 the private folder and serve it to the user.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: RC3 auth and can't login

2008-10-12 Thread francky06l

What is the problem ? I mean, what kind of problem do you have ? Can
you log in ? if not, did you check the Sql traces with debug = 2 ?

On Oct 12, 9:15 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 please tell me, only i've problem witch login to my app after update
 on RC3 ??
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: using methods in a model

2008-10-12 Thread francky06l

You can't use a function in a member variable. However you can
probably do it in a beforeFind (even just adding the condition in the
query array)..

On Oct 12, 7:43 pm, Ryan [EMAIL PROTECTED] wrote:
 Cake is not liking:

   var $hasAndBelongsToMany = array(
 'Item' = array(
   'conditions' = array('`Item`.`site_id`' =
 Configure::read('site_id'))
 )
   );

 But it's ok with:

   var $hasAndBelongsToMany = array(
 'Item' = array(
   'conditions' = array('`Item`.`site_id`' = 1)
 )
   );

 How can I use the value of Configure::read('site_id') in my models?

 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can I Cache::write() forever

2008-10-12 Thread francky06l

Well forever maybe means parameter duration = '+10 years'  or
so ...
hth

On Oct 12, 7:38 pm, angel333 [EMAIL PROTECTED] wrote:
 Hello,

 I would like to cache something forever, can I use Cache::write() for
 this?

 Thanks, Ondrej
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Warning (2): array_merge() [function.array-merge]: Argument #1 is not an array [CORE/cake/dispatcher.php, line 337]

2008-10-12 Thread francky06l

I do not think ':url' is recognized, if :url is an id use  :id, if
it's an action use :action ..
hth

On Oct 12, 5:31 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 I get that error when I load the pagehttp://example.com/news/first-post

 I have this in my routes.php:
 Router::connect('/news/:url', array('controller' = 'news','action' =
 'view'), array('pass' = array('url')));

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



Re: xmlwriter

2008-10-12 Thread francky06l

Do you mean the xml helper for cake ?


On Oct 12, 5:52 am, . [EMAIL PROTECTED] wrote:
 has anybody worked with xmlwriter (or similar) with cakephp? 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Issue with complex contain in a find

2008-10-12 Thread francky06l

Well, when you run this query using cake, what is the value of the
main condition = 'MixtureCategory.slug'=$slug ?
If you set debug = 2, what do you get in the sql log ?

On Oct 12, 10:07 pm, Jon Bennett [EMAIL PROTECTED] wrote:
 Hi

 I'm experiencing something unexpected with a containable within a
 find('first') - here's my code:

 $this-data = $this-Mixture-MixtureCategory-find('first', array(
 'conditions'=array('MixtureCategory.slug'=$slug,
 'MixtureCategory.status'=1),
 'recursive'=2,
 'contain'=array(
 'BannerImage',
 'Mixture'=array('BannerImage', 
 'conditions'=array('Mixture.status'=1)),
 'ParentMixtureCategory'=array('BannerImage'),
 'ChildMixtureCategory'=array('BannerImage',
 'Mixture'=array('conditions'=array('Mixture.status'=1)))
 )
 ));

 This outputs a few queries, one of which is:

 SELECT `BannerImage`.`id`, `BannerImage`.`document_category_id`,
 `BannerImage`.`model`, `BannerImage`.`foreign_key`,
 `BannerImage`.`name`, `BannerImage`.`description`,
 `BannerImage`.`meta_title`, `BannerImage`.`meta_keywords`,
 `BannerImage`.`meta_description`, `BannerImage`.`extension`,
 `BannerImage`.`mime_type`, `BannerImage`.`filesize`,
 `BannerImage`.`md5`, `BannerImage`.`allow_delete`,
 `BannerImage`.`status`, `BannerImage`.`created`,
 `BannerImage`.`modified`, `BannerImagesMixtureCategory`.`id`,
 `BannerImagesMixtureCategory`.`mixture_category_id`,
 `BannerImagesMixtureCategory`.`document_id` FROM `documents` AS
 `BannerImage` JOIN `banner_images_mixture_categories` AS
 `BannerImagesMixtureCategory` ON
 (`BannerImagesMixtureCategory`.`mixture_category_id` = 5 AND
 `BannerImagesMixtureCategory`.`document_id` = `BannerImage`.`id`)
 WHERE 1 = 1

 This shows no records found in the SQL log - but when i run the exact
 query above in phpmyadmin the record i expect is found.

 Any ideas?

 Thanks,

 Jon
 --

 jon bennett
 w:http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-12 Thread francky06l

Probably:

$this-find('all', array(
'contain' = array(
'Department',
'Sale',
'Sale' = array('Shift(closed)')
),
'fields' = array('Log.cost'),
));

hth

On Oct 12, 9:50 pm, squidliberty [EMAIL PROTECTED] wrote:
 I have three models: Shift, Sale and Log that are related using
 CakePHP associations (see model definitions below). I want to find
 logs and return their associated sale and the sale's associated shift.
 But I'm having a hard time with this...

 $this-find('all', array(
 'contain' = array(
 'Department',
 'Sale',
 'Sale' = array('Shift')
 ),
 'fields' = array('Shift.closed', 'Log.cost'),
 ));

 Any idea why this produces SQL Error: 1054: Unknown column
 'Shift.closed' in 'field list'? Where am I going wring? Any advice
 would be appreciated! I've also tried using recursive instead of
 contain, but had similar results.

 Models:
 class Log extends AppModel {
 var $name = 'Log';
 var $belongsTo = array('Department', 'Sale');
 var $actsAs = array('Containable');}

 ...
 class Sale extends AppModel {
 var $name = 'Sale';
 var $belongsTo = array('Shift');
 var $hasMany = array('Log');}

 ...
 class Shift extends AppModel {
 var $name = 'Shift';
 var $hasMany = array('Sale');

 }
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-12 Thread francky06l

After reading again the post

$this-find('all', array(
'contain' = array(
'Department', 'Sale' = 'Shift(closed)'),
'fields' = array('Log.cost')
),
);

Hope this works, I did not catch all relations at first glance, you
might also use the containable behaviors in the Sale / Departement
model ..

On Oct 12, 11:02 pm, squidliberty [EMAIL PROTECTED] wrote:
 Thanks for the speedy response! Unfortunately, that doesn't return any
 data from the Shift model. I guess 'fields' overrides 'contain'?
 - Scott

 On Oct 12, 4:20 pm, francky06l [EMAIL PROTECTED] wrote:

  Probably:

  $this-find('all', array(
  'contain' = array(
  'Department',
  'Sale',
  'Sale' = array('Shift(closed)')
  ),
  'fields' = array('Log.cost'),
  ));

  hth

  On Oct 12, 9:50 pm, squidliberty [EMAIL PROTECTED] wrote:

   I have three models: Shift, Sale and Log that are related using
   CakePHP associations (see model definitions below). I want to find
   logs and return their associated sale and the sale's associated shift.
   But I'm having a hard time with this...

   $this-find('all', array(
   'contain' = array(
   'Department',
   'Sale',
   'Sale' = array('Shift')
   ),
   'fields' = array('Shift.closed', 'Log.cost'),
   ));

   Any idea why this produces SQL Error: 1054: Unknown column
   'Shift.closed' in 'field list'? Where am I going wring? Any advice
   would be appreciated! I've also tried using recursive instead of
   contain, but had similar results.

   Models:
   class Log extends AppModel {
   var $name = 'Log';
   var $belongsTo = array('Department', 'Sale');
   var $actsAs = array('Containable');}

   ...
   class Sale extends AppModel {
   var $name = 'Sale';
   var $belongsTo = array('Shift');
   var $hasMany = array('Log');}

   ...
   class Shift extends AppModel {
   var $name = 'Shift';
   var $hasMany = array('Sale');

   }
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive find()

2008-10-12 Thread francky06l

Did you check the generated query ? Does it contain the shifts table?

On Oct 13, 4:43 am, squidliberty [EMAIL PROTECTED] wrote:
 As an experiment, I downloaded a fresh copy of Cake 1.2 and added only
 the scripts above. I wanted to confirm that this was not a problem
 caused by my existing site's configuration. The new installation
 produced identical results, so there must be something wrong with the
 approach. Maybe I'm just overlooking something obvious...
 - Scott

 On Oct 12, 5:44 pm, francky06l [EMAIL PROTECTED] wrote:

  After reading again the post

  $this-find('all', array(
  'contain' = array(
  'Department', 'Sale' = 'Shift(closed)'),
  'fields' = array('Log.cost')
  ),
  );

  Hope this works, I did not catch all relations at first glance, you
  might also use the containable behaviors in the Sale / Departement
  model ..
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Nusoap cakephp question

2008-09-12 Thread francky06l

I use cake with nusoap, I did a small tutorial and sample apps here:
http://www.cakephpforum.net/index.php?showtopic=559

hth

On Sep 12, 9:07 pm, . [EMAIL PROTECTED] wrote:
  Hi

 I am trying to convert the Remote Service (helloworld-server.php) in the
 following tutorial (in the URL below) to cakephp Component-compatible. I am
 struggling with the correct syntax, however. In the server-register(..)
 method, the first parameter should be the name of the service function. In
 this case, the function is hello. How would I call this hello function?
 Right now, i am getting a client method is not defined error message.

 Thanks for any help!

 *This is the tutorial:
 **http://www.oclipa.com/university/nusoap/3.php*http://www.oclipa.com/university/nusoap/3.php

 *This is what I have in my Cake NusoapComponent:*

 function serverMain()
  {
   $this-server= new nusoap_server();
   *$this-server-register('hello',*// method name
array('name' = 'xsd:string'),// input parameters
array('return' = 'xsd:string'),  // output parameters
'urn:hellowsdl',  // namespace
'urn:hellowsdl#hello',// soapaction
'rpc',// style
'encoded',// use
'Says hello to the caller'// documentation
   );
   $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA :
 '';
   $this-server-service($HTTP_RAW_POST_DATA);

  }

  // This is the method
  *function hello*($input) {
   $output_string = 'Hello ' . $input['firstname'] .
  '. You are ' . $input['age'] . ' years old.';

   if ( $input['age'] = 18 ) { $allow = 1; }

   $output = array(
  'output_string' = $output_string,
  'allow' = $allow
  );

   return new soapval('return', 'HelloInfo', $output, false, 'urn:AnyURN');
  }
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Acl and Auth slow page load

2008-08-20 Thread francky06l

Index your aco table on alias ...

On Aug 19, 1:15 am, Marcus J. Ertl [EMAIL PROTECTED] wrote:
 Marcus J. Ertl schrieb:

 Hi again! I'm afraid, this is poor application design on my side too. :-(

 OK, I took a look into this! It was bad design on my side! :-(

 I've startet with more then 60 queries, taking about 30 seconds! :-(

 After taking the check outside the loop, I'm down to 24 queries, taking
 about 10 seconds.

 Adding indexes to the acos- and aros-tables brought down the time for
 this queries to about 2 seconds!

 A closer look shows, it's allways the same query taking to long:

 *23. Affected: 36 Num. rows: 36 Took: 502ms*
 SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`,
 `Aco`.`foreign_key`, `Aco`.`alias` FROM `acos` AS `Aco` LEFT JOIN
 `acos` AS `Aco0` ON (`Aco0`.`alias` = 'links') LEFT JOIN `acos` AS
 `Aco1` ON (`Aco1`.`lft`  `Aco0`.`lft` AND `Aco1`.`rght` 
 `Aco0`.`rght` AND `Aco1`.`alias` = 'mod_edit') WHERE ((`Aco`.`lft`
 = `Aco0`.`lft` AND `Aco`.`rght` = `Aco0`.`rght`) OR (`Aco`.`lft`
 = `Aco1`.`lft` AND `Aco`.`rght` = `Aco1`.`rght`)) ORDER BY
 `Aco`.`lft` DESC

 This is not perfekt, but I can life with this values. But it would be
 nice, if I could get this querys down in time too!

 Will be there some acl-caching as core feature in cakephp 1.2? Or have I
 to do it by myself?

 Thank you very much!

 Bye
 Marcus

  smime.p7s
 4KViewDownload
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: strange html code behavior (ajax, firefox)

2008-08-19 Thread francky06l

A bit too long code, you should use the bin ..
However, when ajax is involved and you modify an id ( =?php echo
$controller.'_'.$action.'_'.$key; ?),
be aware that it might on this form for good reason. Usually it's
because the ajax request will use this DOM id to update the view.

I guess the answer of the ajax call, is not finding the Dom id
anymore ... You should look to the file adjustperm.ctp, it must
contain the code to update the initial DOM id, and probably contains
the same syntax for the id.

hth

On Aug 19, 9:02 am, byku [EMAIL PROTECTED] wrote:
 Hi.

 first post (...english isnt my first language ;) )

 lately i started to build users management part for my new project
 using acl/roles using example 
 fromhttp://www.cakephpforum.net/index.php?showtopic=27st=0

 there is some acl managment action that output controller actions /
 roles in grid to easier menagament of above (i uses ajax) i have
 modified it a bit (view) - but i have some strange isues with this
 under Firefox...

 Firefox:http://img80.imageshack.us/img80/2607/ffcakehr1.jpg
 at this screenshot actions add (both controllers) and adjustperm
 are not visible - they are in html code but i cant see them - even
 when i remove css file, i tested this a bit and i found that

 td id=?php echo $controller.'_'.$action.'_'.$key; ?

 id generated in this way generates this error, if i modify this to
 look like

 td id=?php echo $controller.$action.'_'.$key; ?   - one _
 less

 i can see every actions but ajax wont update this cells

 Firefox/IE generates this in my error.log (every time i hit ajax
 link):

 2008-08-19 08:07:49 Error: script type=text/javascript
 //![CDATA[
 _elem = $('Roles_cleanupAcl_1'); Element.replace(_elem,
 unescape(%3Ctd id=\Roles_cleanupAcl_1\ class=\actdanied\denied
 %3Ca href=\\/test07\/index.php\/roles\/adjustperm\/1\/Roles\/
 cleanupAcl\/allow\ id=\link9470\ onclick=\ event.returnValue =
 false; return false;\allow?%3C\/a%3Cscript type=\text\/javascript
 \\r\n\/\/%3C![CDATA[\r\nEvent.observe('link9470', 'click',
 function(event) { new Ajax.Updater('updacl','\/test07\/index.php\/
 roles
 \/adjustperm\/1\/Roles\/cleanupAcl\/allow', {asynchronous:true,
 evalScripts:true, requestHeaders:['X-Update', 'updacl']}) }, false);\r
 \n\/\/]]\r\n%3C\/script%3C\/td));
 //]]
 /script

 he is the complete view/action code:

 ACTION:

 function acl() {

 $avoidControllers   = array('Pages');
 $data   = $this-Role-findAll();
 $controllerList = $this-ControllerList-get();

 // we loop on all action for all roles
 $inidbg =  Configure::read( 'debug');

 Configure::write( 'debug', '0' );

 foreach($controllerList as $controller = $actions) {

 if(in_array($controller, $avoidControllers)) {

 unset($controllerList[$controller]);
 continue;

 }
 foreach($actions as $key = $action) {

 $controllerList[$controller][$action] = array();
 unset($controllerList[$controller][$key]);
 foreach($data as $p)
 $controllerList[$controller][$action][$p['Role']
 ['id']] = $this-Acl-check($p, $controller . '/'. $action, '*');

 }

 }

 Configure::write( 'debug', $inidbg);
 $this-set('actlist', $controllerList);
 $this-set('data', $data);

 }

 VIEW:

 div class=x

 table cellpadding=0 cellspacing=0
 tr
 thController Action/th
 ?php foreach($data as $p): ?
 th width=15%? echo $p['Role']['name']; ?/th
 ?php endforeach; ?
 /tr

 ?php $i = 0; foreach($actlist as $controller = $actions): ?

 tr class=?php echo ($i++ % 2 == 0) ? 'oddrow' : 'evenrow'; ?
 td class=controller style=font-weight: bold;?php echo
 $controller; ?/td

 ?php foreach($data as $val): ?

 td
 ?php echo $ajax-link('Allow all', '/roles/adjustperm/'.
 $val['Role']['id'].'/'.$controller.'/all/allow', array('update' =
 'updacl')); ?
 ?php echo $ajax-link( 'Deny all', '/roles/adjustperm/'.
 $val['Role']['id'].'/'.$controller.'/all/deny', array('update' =
 'updacl')); ?
 /td

 ?php endforeach; ?

 /tr

 ?php foreach($actions as $action = $perm): ?
 tr class=?php echo ($i++ % 2 == 0) ? 'oddrow' : 'evenrow'; ?
 td?php echo $action; ?/td

 ?php foreach($perm as $key = $val): ?
 td id=?php echo $controller.'_'.$action.'_'.$key; ? class=?
 php echo ($val == 1) ? 'actallowed' : 'actdanied'; ?
 ?php echo ($val == 1) ? 'allowed '.$ajax-link('deny?', '/roles/
 adjustperm/'.$key.'/'.$controller.'/'.$action.'/deny', array('update'
 = 'updacl')) :
   'denied '.$ajax-link('allow?', '/roles/adjustperm/'.$key.'/'.
 $controller.'/'.$action.'/allow', array('update' = 'updacl')); ?
 /td
 ?php endforeach; ?

 /tr
 ?php endforeach; ?

 ?php endforeach; ?

 /table

 /div
 div id=updacl/div

 ps. it may double post - i send this post earlier but it didnt show up
--~--~-~--~~~---~--~~
You received this 

Re: Ajax link creation

2008-08-19 Thread francky06l

Maybe you could use the with option.

On Aug 19, 3:10 pm, f1codz [EMAIL PROTECTED] wrote:
 dear all,

 i have a problem with $ajax-link() function.

 My doubt is - how do we pass post parameters to the action using 
 $ajax-link().

 Though the ajaxOptions array contains the options 'parameters' ..
 setting it to some value while calling $ajax-link()  is providing no
 functionality:

 $ajax-link('save', 'javascript://' , array(
 'url' = '/controller/action',
 'update = 'my_division',
 'method' = 'post',
 'parameters =
 'name=f1codzvalue=help'
 ));

 i checked the script generated in the source code .. it holds no
 reference to the parameters keyword.
 i hope its not a problem with cakePHP or is it???

 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Last resort: persistent auth error

2008-08-19 Thread francky06l

Do you have any requestAction called somewhere prior to render the
view (that is not allowed? ) ?

On Aug 20, 3:59 am, Baxter [EMAIL PROTECTED] wrote:
 Hi all,

 I can't figure out my app's strange auth behavior.  I have a simple
 application that allows users to register, log in, view some
 information, and edit their settings.  Using Auth and ACL components,
 everything is working fine, except one thing.  When I try to go to /
 users/edit, the edit form is displayed, but so is the auth error You
 are not authorized to access that location.  Doubly strange is that
 the auth error doesn't appear right away; only when I refresh the
 page /users/edit, and then it persists with each refresh.  I have
 tried so many things and looked so many places and can't figure it
 out.

 Any ideas?  A thousand 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Acl and Auth slow page load

2008-08-18 Thread francky06l

You might also index your aros/acos tables, according to the mode used
in Auth ...

On Aug 18, 10:51 pm, mark_story [EMAIL PROTECTED] wrote:
 Tiggr:  How many queries is ACL component doing. Normally for a single
 check it is ~6 db calls.  If you are doing more than one acl check per-
 page you should be caching the results, so you can use them over
 again.  But caching is not part of the core ACL component.

 -Mark

 On Aug 18, 3:12 am, Tiggr [EMAIL PROTECTED] wrote:

  Hi!

   var $components = array('Acl', 'Auth', 'Email');

   The page load goes through the roof.

  Just the same for me, but only with Acl! And it isn't slow all the
  time, pages load fast when user isn't logged in, but after logging in,
  all is getting worse! Loadtime goes up through the roof because of the
  many sql-queries acl does! :-(

  I'm going to implement some sort of caching, but that's no real
  solution, only a work around!

  Is there a way to reduce the amount of queries in acl?

  Bye
  Marcus

  PS: It's my first page with cake...! You may have a look at the page
  athttp://www.larp-welt.de, and at the code 
  athttp://code.google.com/p/cakelinks/source/browse/.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Selective field model validation

2008-08-18 Thread francky06l

Check carefully the meaning of required versus notEmpty (or '/\S
+/') in validation  (required makes the field mandatory -- but can
be empty -- every time single time you call validation, whether the
field is in a form or not).
Some usage of on = create might also help.

hth

On Aug 18, 9:55 pm, AD7six [EMAIL PROTECTED] wrote:
 On Aug 18, 9:47 pm, David Yell [EMAIL PROTECTED] wrote:

  This was solved in #cakephp
  By using $this-Model-validates($this-data['Model']['field']

  So big thanks to penfold_99 for sorting this for me, thanks!

 That reminds me of the time someone optimized my code by commenting
 out all the code that did anything...
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice: DB table data needed in a view helper?

2008-08-18 Thread francky06l

@Mark,

Kalt suggestion is goof for an element. You could also user an helper
and caching. The helper would check the cached file, if not there or
expired your helper can do a requestAction and cache the results for
future calls.
I use this quite a lot for fetching data for select for example (like
for a category list, not changing every 10 seconds, and avoiding
queries), and manually delete the cache when I update the tables..

hth

On Aug 19, 12:38 am, Kalt [EMAIL PROTECTED] wrote:
 Take a look at the requestAction method.

 And instead of a helper, I think you'd better use an element.

 On 19 août, 00:06, Mark (Germany) [EMAIL PROTECTED]
 wrote:

  I have a helper which needs the codecats table data (20-40 rows)
  everywhere where it is used.
  i sure could ask for it in the controller:
  -list('all')..
  and pass it the view
  there i can again pass it to the helper

  but is there
  a) a way to automatically pass it from the controller to the helper
  b) directly get the information into the helper (without having to
  manually query the DB)

  i have thought about using some caching or file-exporting (xml)
  the helper could read out this file again.
  but - what kind of backup would there be if the file gets lost somehow
  (as it is in temp folder the max lifetime may be over some time)?
  or is this a good practive anyway?

  thats what is bothering me right now
  as i do not know how to stick to the MVC pattern

  especially because this helper is not bound to specific controllers
  and may be used quite a lot.
  so it would be really a huge load of code if i have to do it as
  described above: controller - view - helper

  thx
  mark
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL with multi-group membership?

2008-07-22 Thread francky06l

I am not sure the syntax will work .. (the DOT in post.1 might be a
problem)..
The best is to try ...


On Jul 22, 5:44 pm, Stinkbug [EMAIL PROTECTED] wrote:
  - you can call ACL's check method by $this-Acl-check(array('Group'
  = array('id' = array(1, 2, 3 ..)), 'Users/index');

 Interesting...  So using my ACL description above, could I do
 something like this too?

 $this-Acl-check('Department.1', array('alias' = array('Post.1',
 'Post.2', 'Post.3')));

 And if so, is this fewer queries to the database than doing a check on
 each individual one?

 On Jul 19, 12:04 pm, francky06l [EMAIL PROTECTED] wrote:

  Making a User in multiple group using ACL and Auth (need to extend it
  a bit), it's not so complex. In fact everything is almost there, just
  2 important points :

  - use inherit instead of deny when setting the authorization on action
  - you can call ACL's check method by $this-Acl-check(array('Group'
  = array('id' = array(1, 2, 3 ..)), 'Users/index');

  Using the 2 steps above it''s quite easy to check authorization on
  different groups..

  Have a look here (new one), maybe that will help 
  you:http://www.cakephpforum.net/index.php?showtopic=745
  hth
  cheers

  On Jul 18, 2:41 pm, CrazyDave [EMAIL PROTECTED] wrote:

   Believe my Aran I've spent a lot of time trying to work out how to do
   the things I wanted without resorting to a single user inmultiple
   groups but kept running into dead ends.

   I was tempted to have a look at a phpgacl plugin for CakePHP but it
   doesn't appear to be activity maintained.  Plus I don't think I'm
   quite up to scratch for creating my ownACLcomponent just yet... ;)

   On Jul 17, 7:57 pm, aranworld [EMAIL PROTECTED] wrote:

I really don't think you should be holding your breath for the Cake
component to supportmultiplegroups per user.  So, Mark's solution of
writing his own version is probably the only short-term solution.

But I agree with Stinkbug that there are often times when it seems
likemultiplegroups are the ONLY option that will work even though
there may be a way to do it well without resorting to that.  Not to
say it isn't an important feature for some situations, but I think too
many people jump too quickly to the conclusion that they absolutely
MUST havemultiplegroups, when they don't really need it.

-Aran

On Jul 17, 11:39 am, Mark (Germany) [EMAIL PROTECTED]
wrote:

 i had the similar problem and ended up writing my own component/
 function for it
 and it is now hard-coded in each view

 but this makes it possible to have users in several different groups.
 although i lost the initial way ofACLHandling.. but coundn't find a
 better solution

 On 17 Jul., 17:33, CrazyDave [EMAIL PROTECTED] wrote:

  Thanks Stinkbug,

  I think I understand the approach you've taken.  It does make sense
  and might probably be the way to go if CakePHP is probably not going
  to go down a similar route. ;)

  Thanks again,
  Dave

  On Jul 15, 9:01 pm, Stinkbug [EMAIL PROTECTED] wrote:

   Not sure if this will help you out or not, but I can explain what 
   I've
   done in our application.  I thought about a way to have the same 
   user
   under two different departments.  What I really starting thinking
   about it though, I found it wasn't necessary (at least in my 
   case).

   I have something like this.

   Aros
   
   Department.1
   -User.1
   -User.2
   Department.2
   -User.3
   -User.4

   Acos
   
   Department.1
   -blog
   -page
   Department.2
   -blog
   -page

   Now I can give Department.1 (Aro) access to Department.1 (Aco).  
   Now,
   let's say User.1 (Aro) needs access to the same things that 
   Department.
   2 (Aro) has access to.  Because all my Aros are grouped by 
   Departments
   too...  Even though User.1 isn't a part of the Department.2group, 
   I
   can still give User.1 access to the Aco Deparment.2.  Now User.1 
   has
   access to everything that Department.2 has access to.

   The only time I can think of where this might be a problem is if 
   you
   wanted to give Department.2 (Aro) access to Department.3 (Aco).  
   User.
   1 (Aro) won't have access to it unless you say it can. It will 
   still
   only have access to Department.2.

   In your case you could set up a structure like this:

   Aros
   
   Millennium Falcon
   -Crew
   --Han
   --Chewie
   -Passangers
   --Luke
   --R2D2

   Acos
   
   Guns
   Engines
   Lounge
   Cockpit

   Now Crew (Aro) could have access to everything.  Passangers could 
   have
   access to Lounge.  And R2D2 could have access to Guns and Engines.

   Another good way to think about...  There can't be more than

Re: model::del() doesn't delete??

2008-07-22 Thread francky06l

Is the record wiped out having the same id as the deleted one ?


On Jul 22, 1:58 pm, leo [EMAIL PROTECTED] wrote:
 Oh, and the delete method returns success (!)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Securing a URL

2008-07-21 Thread francky06l

I have done something about this (a while ago) and maybe not up to
date with 1.2 RC2.
Check about SecureGet on bakery.
hth

On Jul 21, 6:24 am, Jonathan Snook [EMAIL PROTECTED] wrote:
 Normally you have a user object stored in the session that's used to
 authenticate. Just include that in any query that needs to be locked
 down to a specific user.

 On Sun, Jul 20, 2008 at 3:22 PM,  [EMAIL PROTECTED] wrote:

  I searched the archives of this group and never found an answer to
  this question.

  Suppose I have a page that is access via the URL
 http://www.mydomain.com/mycontroller/5

  There is nothing to stop a user from changing the URL to
 http://www.mydomain.com/mycontroller/6
  and viewing a different record.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL with multi-group membership?

2008-07-19 Thread francky06l

Making a User in multiple group using ACL and Auth (need to extend it
a bit), it's not so complex. In fact everything is almost there, just
2 important points :

- use inherit instead of deny when setting the authorization on action
- you can call ACL's check method by $this-Acl-check(array('Group'
= array('id' = array(1, 2, 3 ..)), 'Users/index');

Using the 2 steps above it''s quite easy to check authorization on
different groups..

Have a look here (new one), maybe that will help you:
http://www.cakephpforum.net/index.php?showtopic=745
hth
cheers

On Jul 18, 2:41 pm, CrazyDave [EMAIL PROTECTED] wrote:
 Believe my Aran I've spent a lot of time trying to work out how to do
 the things I wanted without resorting to a single user inmultiple
 groups but kept running into dead ends.

 I was tempted to have a look at a phpgacl plugin for CakePHP but it
 doesn't appear to be activity maintained.  Plus I don't think I'm
 quite up to scratch for creating my ownACLcomponent just yet... ;)

 On Jul 17, 7:57 pm, aranworld [EMAIL PROTECTED] wrote:

  I really don't think you should be holding your breath for the Cake
  component to supportmultiplegroups per user.  So, Mark's solution of
  writing his own version is probably the only short-term solution.

  But I agree with Stinkbug that there are often times when it seems
  likemultiplegroups are the ONLY option that will work even though
  there may be a way to do it well without resorting to that.  Not to
  say it isn't an important feature for some situations, but I think too
  many people jump too quickly to the conclusion that they absolutely
  MUST havemultiplegroups, when they don't really need it.

  -Aran

  On Jul 17, 11:39 am, Mark (Germany) [EMAIL PROTECTED]
  wrote:

   i had the similar problem and ended up writing my own component/
   function for it
   and it is now hard-coded in each view

   but this makes it possible to have users in several different groups.
   although i lost the initial way ofACLHandling.. but coundn't find a
   better solution

   On 17 Jul., 17:33, CrazyDave [EMAIL PROTECTED] wrote:

Thanks Stinkbug,

I think I understand the approach you've taken.  It does make sense
and might probably be the way to go if CakePHP is probably not going
to go down a similar route. ;)

Thanks again,
Dave

On Jul 15, 9:01 pm, Stinkbug [EMAIL PROTECTED] wrote:

 Not sure if this will help you out or not, but I can explain what I've
 done in our application.  I thought about a way to have the same user
 under two different departments.  What I really starting thinking
 about it though, I found it wasn't necessary (at least in my case).

 I have something like this.

 Aros
 
 Department.1
 -User.1
 -User.2
 Department.2
 -User.3
 -User.4

 Acos
 
 Department.1
 -blog
 -page
 Department.2
 -blog
 -page

 Now I can give Department.1 (Aro) access to Department.1 (Aco).  Now,
 let's say User.1 (Aro) needs access to the same things that 
 Department.
 2 (Aro) has access to.  Because all my Aros are grouped by Departments
 too...  Even though User.1 isn't a part of the Department.2group, I
 can still give User.1 access to the Aco Deparment.2.  Now User.1 has
 access to everything that Department.2 has access to.

 The only time I can think of where this might be a problem is if you
 wanted to give Department.2 (Aro) access to Department.3 (Aco).  User.
 1 (Aro) won't have access to it unless you say it can. It will still
 only have access to Department.2.

 In your case you could set up a structure like this:

 Aros
 
 Millennium Falcon
 -Crew
 --Han
 --Chewie
 -Passangers
 --Luke
 --R2D2

 Acos
 
 Guns
 Engines
 Lounge
 Cockpit

 Now Crew (Aro) could have access to everything.  Passangers could have
 access to Lounge.  And R2D2 could have access to Guns and Engines.

 Another good way to think about...  There can't be more than one of me
 in this world.  Having more than one of me would be trouble.  I have
 access to my job and my office.  If I get fired I shouldn't have
 access to it anymore, but if there were two of me, even though I got
 fired, I might still have access to my job and office.  It's bad
 news.  The same goes for theACL.  There should never be two Hans...
 there's only one, that can have access to many different things.

 Hope that's not to confusing.  Hope it helps.

 On Jul 14, 3:34 am, CrazyDave [EMAIL PROTECTED] wrote:

  Hi,

  I want to use theACLcomponent in CakePHP and have got things up and
  running thanks to some blog posts by Mark Story and LemonCake.  I do
  have a query about theACLand if it's capable of users belong to
 multiplegroups?

  I found two previous posts on the subject:

 

Re: Webservices --- StrikeIron.com

2008-07-18 Thread francky06l

If you call the method behavior from the model, just do $this-
request, from controller $this-model-request ..
simple isn'it ?
cheers

On Jul 18, 1:08 pm, Dave [EMAIL PROTECTED] wrote:
 OKay  thanks. Keep helping me - almost there.

 I now have /app/models/behaviours/webservice.php
 Can I put the following code (to follow the example) in any view?

 $actsAs = array('webservice');
 $this-Model-request('get', array('data' = array('q' = 'mark
 story'), 'url' = 'www.google.ca/search'));

 Do I have to change the word Model? or anything else.
 This gives me the error: Fatal error: Call to undefined method
 View::request()

 Thanks - sorry I'm slow at this one...

 Dave

 On Jul 18, 12:35 am, Dr. Tarique Sani [EMAIL PROTECTED] wrote:

  On Fri, Jul 18, 2008 at 9:37 AM, Dave [EMAIL PROTECTED] wrote:

   Where do I put the webservice behavior php file?

  /app/models/behaviours

  HTH

  Tarique

  --
  =
  Cheesecake-Photoblog:http://cheesecake-photoblog.org
  PHP for E-Biz:http://sanisoft.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP User Management/Auth Plugin - Define functions for AppController with code OUTSIDE the file.

2008-07-18 Thread francky06l

Baz, I was thinking of your problem .. I have an idea, but maybe
completly wrong ..

In your plugin you could write a cached::file, or a config file where
you would store the code needed to make a proper create_function ..
Thus you could make this function using create_function in your
app_controller...

Just an idea, sorry if does not fit..

On Jul 18, 4:19 pm, kiang [EMAIL PROTECTED] wrote:
 Try this:http://www.cakephpforum.net/index.php?showtopic=27

 ---
 kiang

 On Jul 17, 11:58 am, Baz L [EMAIL PROTECTED] wrote:

  I'll cut to the chase:http://code.google.com/p/cakeusermanagement/

  I couldn't get CakePHP's built in ACL to work in a simple to
  understand manner. Actually, I couldn't get it to work at all. So I
  built upon 
  this:http://www.studiocanaria.com/articles/cakephp_auth_component_users_gr...
  And tried to stick it in a plugin so that anyone can drop in and use
  (and also importantly, update to a later revision).

  Features: User Management, User Profile Editing, Changing Passwords
  (confirms duplicate passwords), User Registration, Forget/Reset
  Password, User Groups (HABTM), User Permissions (handled through
  Groups), and some other stuff.

  Here's where I'm stuck:
  I need to define some functions in the main AppController class. Since
  this is a plug in I'm trying to maintain as much of the code in the
  actual plugin folder that I can.

  So my question is, how do I define functions in /app/
  app_controller.php with code from /app/plugins/user/somefile.php.

  Currently, I've been reduced to something like this:

  function beforeRender() {

  require(APP.'plugins'.DS.'user'.DS.'app_controller'.DS.'before_render.php');
  }

  function isAuthorized(){
  return
  require(APP.'plugins'.DS.'user'.DS.'app_controller'.DS.'is_authorized.php');;
  }

  function __permitted($controllerName,$actionName){
  return
  require(APP.'plugins'.DS.'user'.DS.'app_controller'.DS.'__permitted.php');;
  }

  Any brighter 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Webservices --- StrikeIron.com

2008-07-17 Thread francky06l

I have done some work with cake and Soap, more informations here :

http://www.cakephpforum.net/index.php?showtopic=559
hth

On Jul 18, 6:47 am, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
 On Fri, Jul 18, 2008 at 10:08 AM, Anuj Chauhan [EMAIL PROTECTED]
 wrote:

  you can also put this in vendors folder in apps. in your app file you may
  call this by

 No!



  vendor(filename);

 And again No!!

 Tarique

 --
 =
 Cheesecake-Photoblog:http://cheesecake-photoblog.org
 PHP for E-Biz:http://sanisoft.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: redirect and header error but no white space

2008-07-17 Thread francky06l

CHeck the syntax of  find, if you use 1.2, you should do something
like this:

$this-Post-Department-find(all, array(conditions =
Department.id =  . $this-data['Post']
['department_id'], recursive = 1));

I guess you problem comes from the find throwing some errors before
you render/redirect.

hth

On Jul 17, 6:01 pm, Stinkbug [EMAIL PROTECTED] wrote:
 I tried removing the ? from my files, but that didn't seem to help.
 I don't have a space at the end of ? on any of my files anyway.  This
 same exact code worked under cake 1.1, but it isn't in 1.2.

 I also did some searching online and found an application called
 BabelPad that would save utf-8 files without BOM.  I tried that.  All
 of my files appeared to be saved without BOM, but I resaved them
 anyway, just in case.

 Still didn't work.  I've narrowed the problem down to one line of
 code.

 $this-Post-Department-find(Department.id =  . $this-data['Post']
 ['department_id'], array(), null, 1);

 Then further down I have a redirect.  The line above is a simple query
 to the database.  I can comment this line out and the application
 redirects like it should.  If I try to use this line, I get the header
 could not be sent error.

 This model is associated with two other models.  The User model and
 Post model.  I'm unbinding the Post model so the only data being
 fetched is Department and user.  In the find method above, if I set
 recursive to 0 the application redirects like it should (just grabbing
 the department data).  Set to 1 it grabs the User data as well, but
 then I get the header can't be sent error.

 I'm still trying to narrow the problem down.  If anyone has any
 suggestions, I'd appreciate it though.

 On Jul 17, 9:06 am, RichardAtHome [EMAIL PROTECTED] wrote:

  You can save yourself a *lot* of heartache with this issue by leaving
  off the closing ? in your php files :-)

  --- snip ---
  ?php
  class TestController extends AppController {

  function index() {

  }
  }

  ---end snip---

  is enough, the closing ? is optional

  On Jul 17, 2:20 pm, haj [EMAIL PROTECTED] wrote:

   I'm using this editor on windows:

  http://www.emeditor.com/

   There is a checkbox in config menu if to add BOM or not for UTF-8.
   Some editor may not have this feature.

   On Jul 16, 1:07 pm, Stinkbug [EMAIL PROTECTED] wrote:

Excuse my stupidity on this topic, but I don't really understand
encoding at all.  So how exactly do I save a a file without the BOM?

Does it require special software, or what?  I'm on windows.

On Jul 14, 11:39 pm, haj [EMAIL PROTECTED] wrote:

 So, I basically saved all UTF-8 files without BOM and now things works
 beautifully.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: the questions rarely answered. why?

2008-07-11 Thread francky06l

Yes guys you right ..  after a while you think sometimes if I answer
this, it will take ages and probably more following questions will
raise and I have also a full job, a girlfriend etc ...

At the very beginning, I was reading a lot the list mainly before
questionning, then I began to answer ..and there is a lot to learn in
answering..
That's the point, I was searching the answer for some peolple, a very
good learning way ..
Now, it's very rare that I am interested in a question, I still answer
though ... but a bit by sequence..

Polutan, you should try to answer to people, you will realize that you
learn so much that you do not have many questions...

cheers


On Jul 11, 7:50 pm, mbavio [EMAIL PROTECTED] wrote:
 There is a reason why Google exists, and I really hate when users post
 something that can be founded in 20 seconds of Google. Feels like you
 are wasting my time and yours too.

 Cheers,
 mbavio

 On Jul 11, 9:13 am, Siebren Bakker [EMAIL PROTECTED] wrote:

  I think that at one point or another, we've all started answering a question
  before realizing that it wasn't actually a question, but actually a demand.
  For the most part, if anyone takes the time to first do some research, and
  still can't find an answer, if they phrase it as a polite question, with as
  much supporting information as they can think of, and are willing to give
  even more information if asked about it, their answers will tend to be
  answered, as generally, all of the people who read the google group and have
  the information sought after, are willing to help out, if nothing than to
  point people in the right direction. I know I've been helped a lot through
  the group, and I've helped others with things they didn't know. It's a kind
  of mutual give-and-take here.

  In the name of Life, Liberty, and the pursuit of my sanity.
  Siebren Bakker(Aevum Decessus)

  On Fri, Jul 11, 2008 at 04:53, grigri [EMAIL PROTECTED] wrote:

Hello :) i'am so sorry before if this post sounds insulting :)
i just want to know, why most of questions here is rarely answered?

People (including me) get sick of answering the same questions over
and over again, often from people with little self-initiative. I think
some people (especially php noobs) find it easier to post a question
on google groups rather than spend the time poring over the manual,
api, blogs, google groups, or cake source code.

   ...and then don't even ask a decent question. A lot of the unanswered
   questions are like i tried to do {x} and it didn't work - fix it for
   me [as you can see, not even a question!]. People who don't put the
   time in to phrasing a question properly haven't put the time into
   researching the problem by themselves.

Sometimes I begin writing a reply to a post, but halfway through I
decide not to post it because it's obvious the person hasn't done any
preliminary research or hasn't made the effort of asking their
question in a way that is easy to answer.

   Yeah, I do this too. I start off with all the best intentions, then
   think halfway through I've answered this before... and stop.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Good practice - Ajax action views?

2008-07-11 Thread francky06l

In case of ajax, a view can be considered as an element since there is
no layout in it..

Now, if you observe every single field on the form and make a server
call everytine, it might get slow. Why not submit the complete form,
validate all and render the form again (if error), you could also use
javascript validation .. ?

The basic of ajax is to update the Dom document using javascript. I
have tried once to make an application 100% ajax, and it's a mistake..
The dom somehow becomes heavier and slower .. So, a good complete HTML
refreshes and cleans everything.
If the ajax call updates the complete view except the layout, then
better using classic html.



On Jul 11, 1:59 am, Sir Tabs [EMAIL PROTECTED] wrote:
 I'm still getting used to cakePHP and the MVC, and I had a question
 about good practices when updating an element on a page with an Ajax
 action.

 Currently I have $ajax-observeField() watching the fields of my form,
 checking to see that the information the user types in is valid. The
 data is checked by a custom action in my controller: validateField().
 Since this is an action, it necessarily needs a view whenever the
 action is called. As it is, the view file, valid_field.ctp, contains
 code that will display the appropriate validation message after the
 action has run. This information in valid_field.ctp is then inserted
 (via the 'update' option) back into the original form that contains
 the form.

 This doesn't strike me as good practice, because it seems like I'm
 inserting one view inside of another.

 Should I use an element instead? Or, even more different, is it better
 to have the actual 'add' action somehow provide the Ajax validation
 and update the appropriate div? (Which would complicate things because
 then my add view, add.ctp would have to intelligently distinguish
 which error message to display inside of each error_message div).

 So, when you have an Ajax specific request, what's best practice? Do
 you make a call to an ajax specific function? And then that Ajax
 function has it's own view file?

 I think I'm missing something simple. I've browsed around the forums
 and documentation quite a bit, but there isn't really an example of
 best practices for Ajax and keeping consistent with MVC.

 Thanks for the 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: calling helper functions from within the controller

2008-07-11 Thread francky06l

Maybe parameters that do not change often can be in a config
file  .. ? Then use Configure::read where ever you are ...
just a hint

On Jul 11, 9:56 pm, Siegfried Hirsch [EMAIL PROTECTED]
wrote:
 Hello Chris,

 yes I know. Maybe I need a hint for my problem.

 I have written a new Helper. Now I want to set some variables, that
 I can use from within the helper (yes I know I could handle this with
 parameters), but I am trying to save some parameters, cause the
 values are always the same.

 Siegfried

 On Fri, Jul 11, 2008 at 9:41 PM, Chris Hartjes [EMAIL PROTECTED] wrote:

  Helpers are called within views, not controllers.

  Perhaps you can place that function somewhere else?  Like in a model?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Use localization in model validation

2008-07-10 Thread francky06l

@Allessandro, that would not work, you can't initialize model variable
with a function call.

@Emilio, I did post a ticket on this a while ago with a solution (as
you described), it has been introduced and removed after (probably
because it does not cover all needs etc..). I end up writing the
invalidFields method in app_model, taking over the core method.

http://groups.google.com/group/cake-php/browse_thread/thread/fa32c81acc043eef/6a49c6d9fdc6f158?lnk=stq=#6a49c6d9fdc6f158

hth

On Jul 10, 4:43 pm, Alessandro Daducci [EMAIL PROTECTED]
wrote:
 Hi Emilio!



  I'll ilustrate the problem with an example, I want to make something
  like this:

  code
 var $validate = array
 (
 status = array
 (
 rule = numeric,
 rule = array (range, -1, 101),
 message = error_task_status,
 ),
 );
  /code

  If you see the message for the error on validation, you see
  error_task_status, the idea is that the model calls
  __(error_task_status) for the message instead of printing
  error_task_status directly.

 I don't know if I understood properly, but I usually do this way:

 var $validate = array
 (
 status = array
 (
 rule = numeric,
 rule = array (range, -1, 101),
 message = __(error_task_status,true),
 ),
 );

 This way, you can perform translation automatically!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ajaxhelper::form() submit to different controller?

2008-07-10 Thread francky06l

Maybe you could use the router:: url with the true parameter,
ie:
new Ajax.Updater('usersprojects', router::url('/users/projects/add'
true), 

Did not try, but seems it could be clean ..
hth

On Jul 10, 6:36 pm, Kyle Decot [EMAIL PROTECTED] wrote:
 I'm not sure if this is the correct solution but it worked for me.
 just put ../projects/add/ instead of /projects/add
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Redirect based on Active

2008-07-08 Thread francky06l

A solution, maybe not best, would be to remove the userScope and set
autoRedirect to false.
Once the user is logged, you can then check the active flag, if it's
not activated, you can logout the user and set a different message
before redirect.

On Jul 8, 4:12 am, DanielMedia [EMAIL PROTECTED] wrote:
 I was wondering this also. And how do you test if the active part is
 what went wrong with a login to supply a different error message to
 the user?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Image Helper memory usage fatal error

2008-07-08 Thread francky06l

Well try with smaller images. Also what is your memory_limit set in
php.ini ?
Maybe try an ini_set('memory_limit', xxMb), before calling the
resizing ..

On Jul 8, 3:29 pm, clrockwell [EMAIL PROTECTED] wrote:
 Thanks francky06l - I am actually using rc2, sorry for the typo.

 The images were originally as large as 3M, but I have resized them all
 down to less than 2MB and the issue still occurs.  I also re-exported
 them as jpg as they were originally exported with cmyk color.  The
 issue is less prevalent, but still occuring.  I am starting to think
 the root of the problem is a virtual memory issue on the vps side of
 things.

 I appreciate any direction or shared experience anyone has with this.

 Thanks for any direction

 On Jul 7, 5:38 pm, francky06l [EMAIL PROTECTED] wrote:

  You should use rc2 ;-)
  By the way, what is theimagesize you try to resize ?

  On Jul 7, 3:34 pm, clrockwell [EMAIL PROTECTED] wrote:

   Hello All, hoping someone can point out the why I keep getting a
   memory error at line 59 ofimagehelper, it is using a ridiculous
   amount of memory.

   Thehelperis posted here:http://bin.cakephp.org/view/859527090

   Using nightly build 6296 (just grabbed it yesterday), cakephp 1.2 rc1

   Thanks much for any insight you can provide.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with setFlash

2008-07-07 Thread francky06l

Seems you are always setting the flash message somehow .. Try to trace
in log before you use $this-Session-setFlash, maybe it's done when
you think it's not...

On Jul 7, 1:44 pm, angel333 [EMAIL PROTECTED] wrote:
 Thank you for your reply.

 No, I don't use view caching.
 I am on debug 1, but I've tried debug 0 with the same result.
 I'm using both Opera and Firefox.

 Ondrej

 On Jul 7, 1:10 am, the_woodsman [EMAIL PROTECTED] wrote:

  This sounds like caching to me.
  What debug level are you on?
  Do you use view caching?
  What browser do you use?
  etc!

  On Jul 6, 7:35 am, angel333 [EMAIL PROTECTED] wrote:

   Hello,

   I have a problem with SessionComponent::setFlash(). When I save
   something in flash, it should be shown on next page and it should
   expire when user go to another page. But it doesn't expire
   immediatelly, but after a long while (probably session expiration).
   When I turn cookies off, it seems to work.

   I have tried writing $session-flash() in view (layout) twice. As I
   expected, the first flash() deleted Message.flash, so the second
   didn't flash. But on next request it flashes the same message again.

   Finally, I'm sorry for my English :).

   Thanks, Ondrej
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using Auth Component from behavior

2008-07-07 Thread francky06l

Session in not available in models. The best in your case would be to
pass the parameters to the behavior from controller.
hth

On Jul 7, 2:05 pm, Siegfried Hirsch [EMAIL PROTECTED]
wrote:
 Hello,

 just a simple question, I guess:

 How could I load the AuthComponent from a behavior, that I am writing ?

 I think it should work with something like:

App::import('Component', 'AuthComponent');
$this-Auth = new AuthComponent();
 from within the behavior.

 But if I want to call it like this:
   $user = $this-Auth-user();
 I get a Undefined property:  AuthComponent::$Session

 Any hints ?

 Thanks and sorry for the other incomplete posting in the list.

 Siegfried
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL in Cake 1.2

2008-07-07 Thread francky06l

Of course, the Department.1 can be used with the console. But if you
have a User than belongsTo Departement, you could implement the
parentNode() in the User model that will  send back the Department
along with it's id.

On Jul 7, 4:02 pm, Stinkbug [EMAIL PROTECTED] wrote:
 I tried the model.id and it didn't work.

 $user_array['foreign_key'] = $user['User']['id'];
 $user_array['parent_id'] = 'Department.1';
 $user_array['model'] = 'User';
 $user_array['alias'] = 'User.' . $user['User']['id'];

 but when I use just an id (integer) it does work.

 $user_array['parent_id'] = 2;

 I'm not familiar with the parentNode() method.  I couldn't find it in
 the API.  Is this something that someone else has developed?  If so,
 where can it be found?

 If you have to use an integer id, surely there has to be an easy way
 to retrieve it.  I guess it's all fine if you're doing everything
 manually, but I want it automated.

 On Jul 3, 5:05 pm, francky06l [EMAIL PROTECTED] wrote:

  @Stinkbug
  parent, as far as I know should be passed with model.id. However did
  you check the ACL behavior that can do this automatically if you
  implement the parentNode() method in the model (be aware of updating
  the parent though..) ?

  On Jul 3, 5:01 pm, Stinkbug [EMAIL PROTECTED] wrote:

   To expand on this...

   I almost figured out everything that I need to do to get my stuff
   working.  The major problem I'm having now is with the parent_id.  Is
   there anyway to retrieve the id by passing something like Department.1
   (this would be the model and foreign_key, or alias)?

   In the 1.1 version I could use an alias to set the parent, but that
   doesn't seem to work in 1.2.  I didn't see anything in the API.  I
   could write my own query to retrieve the data I want, but I was just
   wondering if cake requires the unique id be used to set the parent, is
   there not a way to retrieve that id?

   I did notice a getAro method in the API, but I couldn't figure out how
   to use it, so I don't know that it would do what I need.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Mod_Rewrite problem...

2008-07-07 Thread francky06l

What append if you do localhost/app/index.php ?


On Jul 7, 10:28 pm, Jonathan Snook [EMAIL PROTECTED] wrote:
 Are you sure you're hitting the local PHP install and not the local
 IIS install? with the index.php file in webroot, it'd be unlikely to
 get a directory listing.

 On Mon, Jul 7, 2008 at 4:07 PM, Hitsugaya [EMAIL PROTECTED] wrote:

  Hello all, im a new CakePHP user. Im setting up for my first project,
  but im running into some trouble with mod_rewrite.

  Now for the problemwhen i use:http://localhost/i get a list of
  the files from:
  C:/Program Files/Apache Group/Apache2/htdocs/cakePHP/app/webroot/
  If mod_rewrite was configured the right way i should be directed
  stright to index.php...right?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL: allowing modifications to row to owner only

2008-07-07 Thread francky06l

This is really ACL.
Your user/creator will be an ARO and your row will be an ACO. After
it's a story of CRUD type actions.

On Jul 7, 6:10 pm, Paolo [EMAIL PROTECTED] wrote:
 Hi,

 I need to know if it is possible by using cake ACL to allow
 modifications to a single row only to the original creator of that
 row. I'm not sure if also visibility is limited to the creator, but
 modification would be fine for the moment. Should I create something
 on my own or is it already possible with cake ACL?

 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Redirect based on Active

2008-07-07 Thread francky06l

This is indeed ACL.
Your use/creator will be an ARO and the row an ACO, after story of
permissions on CRUD.

Now if it's only to limit to edit and you have the creator_id/
user_id in the row, you can make it simple by checking if the
creator_id of the row is the logged in user (from session)...

hth

On Jul 7, 6:55 pm, Kyle Decot [EMAIL PROTECTED] wrote:
 I want to be able to redirect my users to a Your Account is not yet
 active page if active is set to 0. I know there is userScope which
 will not allow them to login, but how to I redirect them afterwards?
 Thank you as always for the 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth logout redirect no functioning properly

2008-07-07 Thread francky06l

Humm quite normal if your news/index requires to be logged in ..If
this is the case, you redirect to an action that needs login, and you
are not (after logout) ..then login action is invoked.

On Jul 7, 7:15 pm, Arak Tai'Roth [EMAIL PROTECTED] wrote:
 I am using Auth and ACL for my website and am having a problem with
 the logout redirect of Auth. It is not taking the user to the page I
 want it to, and is instead taking them to the login screen again. Just
 wondering if anyone can spot the problem.

 Here is some of the code I think is important, if you need more,
 please just let me know.

 Users Controller:

 function logout()
 {
 $this-redirect($this-Auth-logout());
 }

 app_controller

 function beforeFilter()
 {
 $this-Auth-authorize='crud';
 $this-Auth-loginAction = array('controller' = 
 'users', 'action'
 = 'login');
 $this-Auth-loginError = 'Invalid username / 
 password combination.
 Please try again.';
 $this-Auth-loginRedirect = array('controller' = 
 'news', 'action'
 = 'index');
 $this-Auth-logoutRedirect = array('controller' = 
 'news',
 'action' = 'index');
 }

 And yes, I know the login and logout are both pointing to the same
 place, just ignore that unless that is what could be causing the
 problem.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Image Helper memory usage fatal error

2008-07-07 Thread francky06l

You should use rc2 ;-)
By the way, what is the image size you try to resize ?

On Jul 7, 3:34 pm, clrockwell [EMAIL PROTECTED] wrote:
 Hello All, hoping someone can point out the why I keep getting a
 memory error at line 59 of image helper, it is using a ridiculous
 amount of memory.

 The helper is posted here:http://bin.cakephp.org/view/859527090

 Using nightly build 6296 (just grabbed it yesterday), cakephp 1.2 rc1

 Thanks much for any insight you can provide.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL: allowing modifications to row to owner only

2008-07-07 Thread francky06l

This is exactly ACL. User/creator will be an ARO and the row will be
an ACO, the rest is permissions on CRUD operations.

Now if it's just to limit the user/creator to edit the record AND if
the creator/user_id is in the row, checking the user/creator_id of the
row against the logged in user (in Session) can be done in edit
action ..(without ACL).

On Jul 7, 6:10 pm, Paolo [EMAIL PROTECTED] wrote:
 Hi,

 I need to know if it is possible by using cake ACL to allow
 modifications to a single row only to the original creator of that
 row. I'm not sure if also visibility is limited to the creator, but
 modification would be fine for the moment. Should I create something
 on my own or is it already possible with cake ACL?

 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Detect cookies

2008-07-04 Thread francky06l

You can use javascript for this. A quick google search gave me this:

http://www.tec-i.com/gEwCart/HowToEnableJavascriptAndCookies.htm

Of course, if you have also to check if javascript is enabled .. :-)

On Jul 4, 2:24 am, dandreta [EMAIL PROTECTED] wrote:
 any solution, please?

 On 26 jun, 09:42, dandreta [EMAIL PROTECTED] wrote:

  Hi!

  I have used the OthAuth component for the access to my application,
  defining the groups and permissions. If in the browser thecookiesare
  not activated, on login the user cannot enter to the restricted
  functions because the permissions are not loaded in the session. What
  I want is if a user does not have the activatedcookiesa message
  appears indicating that he must activate thecookiesin his browser.
  An example of this would be this google group, where if you do not
  activate thecookiesa message appears saying to you that you should
  activate them. I suppose that I have to add something in the
  beforefilter function of app_controller.
  How can I obtain this?

  Thanks and regards
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model validation

2008-07-04 Thread francky06l

What is your model file name ? Should be application_tool.php, table
name should be plural : application_tools ..
hth

On Jul 4, 2:52 pm, Sai Krishna [EMAIL PROTECTED] wrote:
 Hey Just an update on this. One of my fellow coder has said that I'm
 doing a mistake by using plurals
 My App controller name is plural to Model

 If the controller name is

 ApplicationToolsController and Model name is ApplicationTool and
 database table is application_tool and view  directory name
 application_tools.. I tried making everything singular with exception
 of database table. but no luck.. Can somebody tell me where am I doing
 wrong?

 On Jul 4, 11:23 am, Sai Krishna [EMAIL PROTECTED] wrote:

  Hi,

  I'm a newbie  to cakePHP 1.2. I had been working module in which I had
  been doing the following model validation. The validation never fails,
  what am I doing wrong

  Model contains this
  -
   var $name='MyModule';
   var $validate = array(
  'module'=array(
  'rule'='numeric',
  'message'='Not a valid module
  selected'
  ),
  'description'=array(
  'rule'=array('custom','/[A-Z0-9_-\\\/
  [EMAIL PROTECTED]\*\(\)]+/si')
  'message'='Not a valid character in
  the description'
  )

  );
  
  And in Controller I do this, $this-data comes from a an ajax form
  
  $this-Model-set($this-data);
  echo $this-Model-validates();
  
  this validation ever returns 1. what am I 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How can you render() into a variable without outputting to screen in RC2?

2008-07-04 Thread francky06l

After $this-controller-render(...)
$this-controller-output = '';

hth

On Jul 4, 3:55 pm, keymaster [EMAIL PROTECTED] wrote:
 Just upgraded from 1.2 Beta to 1.2 RC2.

 In a component, I assign a string represention of a fully rendered
 view/layout to a variable, like this:

 $myVar = $this-controller-render('myLayout', 'myView');

 That works.

 Unfortunately, it also outputs it to the screen, something which did
 not happen in 1.2 Beta.

 Anyone know how to get it to NOT output to the screen ?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL - Magic - Deleting a user

2008-07-04 Thread francky06l

Adding a user should be automagic (using the ACL behavior, and
parentNode in model), changing the role requires a bit of coding, but
very simple ..


On Jul 4, 9:28 pm, Josoroma [EMAIL PROTECTED] wrote:
 Thanks to the kitchen example 
 from:http://aranworld.com/article/170/cakephp-acl-and-auth-sample-website

 Now im having Roles instead of Groups working. Now we can add user to
 ARO groups without problems. Few minutes ago i noticed when i delete a
 user, it is automatically removed from aros table, nice magic.

 But when i add or edit a user i have to manually create or update de
 aros table in the model, no magic. My question is: There exist some
 magic to add user to aros table? im missing something from acl
 behavior? or a better way to improve this code in terms of adding or
 editing a new user:http://bin.cakephp.org/view/313440863

 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL - Magic - Deleting a user

2008-07-04 Thread francky06l

Just 1 line : 113

if (!$data['User']['parent_id']){

should be
 if (!$data['User']['role_id']){

Then I guess your problem adding a new user should be solved,
Now when you change the current role of a user, you should check the
new parent_id (if it changes) and set the proper parent Aro ..

hth

On Jul 4, 9:50 pm, José Pablo Orozco Marín [EMAIL PROTECTED] wrote:
 Thanks francky06l,

 In my code:http://bin.cakephp.org/view/313440863

 What do you think i need to change?

 francky06l escribió:



  Adding a user should be automagic (using the ACL behavior, and
  parentNode in model), changing the role requires a bit of coding, but
  very simple ..

  On Jul 4, 9:28 pm, Josoroma [EMAIL PROTECTED] wrote:

  Thanks to the kitchen example 
  from:http://aranworld.com/article/170/cakephp-acl-and-auth-sample-website

  Now im having Roles instead of Groups working. Now we can add user to
  ARO groups without problems. Few minutes ago i noticed when i delete a
  user, it is automatically removed from aros table, nice magic.

  But when i add or edit a user i have to manually create or update de
  aros table in the model, no magic. My question is: There exist some
  magic to add user to aros table? im missing something from acl
  behavior? or a better way to improve this code in terms of adding or
  editing a new user:http://bin.cakephp.org/view/313440863

  Thanks in advance.

 --

 

 Con toda libertad consulte:

 http://www.SukiaLogic.com/blog
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: ACL - Magic - Deleting a user

2008-07-04 Thread francky06l

If you need some help on User changing role check it here :
http://www.cakephpforum.net/index.php?showtopic=27st=0

At bottom of page the inheritAcl component takes care of this ...

On Jul 4, 11:30 pm, francky06l [EMAIL PROTECTED] wrote:
 Just 1 line : 113

 if (!$data['User']['parent_id']){

 should be
  if (!$data['User']['role_id']){

 Then I guess your problem adding a new user should be solved,
 Now when you change the current role of a user, you should check the
 new parent_id (if it changes) and set the proper parent Aro ..

 hth

 On Jul 4, 9:50 pm, José Pablo Orozco Marín [EMAIL PROTECTED] wrote:

  Thanks francky06l,

  In my code:http://bin.cakephp.org/view/313440863

  What do you think i need to change?

  francky06l escribió:

   Adding a user should be automagic (using the ACL behavior, and
   parentNode in model), changing the role requires a bit of coding, but
   very simple ..

   On Jul 4, 9:28 pm, Josoroma [EMAIL PROTECTED] wrote:

   Thanks to the kitchen example 
   from:http://aranworld.com/article/170/cakephp-acl-and-auth-sample-website

   Now im having Roles instead of Groups working. Now we can add user to
   ARO groups without problems. Few minutes ago i noticed when i delete a
   user, it is automatically removed from aros table, nice magic.

   But when i add or edit a user i have to manually create or update de
   aros table in the model, no magic. My question is: There exist some
   magic to add user to aros table? im missing something from acl
   behavior? or a better way to improve this code in terms of adding or
   editing a new user:http://bin.cakephp.org/view/313440863

   Thanks in advance.

  --

  

  Con toda libertad consulte:

 http://www.SukiaLogic.com/blog
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model association question

2008-07-03 Thread francky06l

@Jonathan, yes it always a bit confusing the hasOne (in Cake)..
because a Task hasOne priority, no matter if this priority is
shared .. but for cake it'a a belongsTo .. :-) Even after using for
few months  (years)... hasOne always make me think twice (actually I
use it very rarely)..

On Jul 3, 9:56 pm, John David Anderson [EMAIL PROTECTED]
wrote:
 I always remember it like this:

 If a table contains a foreign key, it's like a little label that
 another object has put on it... i.e. it belongsTo something else.

 hth/fwiw,

 John

 On Jul 3, 2008, at 1:38 PM, Jonathan Snook wrote:



  A priority hasMany tasks.
  A task belongsTo a priority.

  It's a little weird, I know because in English you'd normally say:

  A task has a priority.
  A priority belongs to many tasks.

  And belongsTo is used if:
  A priority has one task.
  A task has one priority.

  At least, that's how I've considered it. (Although I'll gladly be
  corrected).

  On Jul 3, 1:53 pm, jhicks [EMAIL PROTECTED] wrote:
  OK, so I've got two tables: tasks and priorities. Many tasks can
  share
  the same priority. So is this a HABTM relationship?

  With HABTM, you usually have a join table but in my situation I don't
  need one. I just have a foreign key in my tasks table (priority_id)
  which points to the index of the priorities table. What do I do in
  this situation? CakePHP is expecting a join table.

  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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: trouble with isAuthorized()

2008-07-03 Thread francky06l

@b logica
change the $this-Auth-loginAction in before filter when ($this-
action == 'login'  empty($this-data)) .. set it to any action you
want (except null)..
hth

On Jul 3, 8:32 pm, b logica [EMAIL PROTECTED] wrote:
 On Thu, Jul 3, 2008 at 2:24 PM, mbavio [EMAIL PROTECTED] wrote:

  The login method is called automatically by Auth Component, if you
  redirect to there and you have $this-data filled with the right info,
  it will login. A way to solve this? I really dont know, I´ve never
  tried to not use this function

 Right. I guess that what I should have asked is, How do I intercept
 login()? Everything I've seen about Auth says that one only needs an
 empty login() method. However, it seems that that isn't even
 necessary. But, how to perform other stuff upon login?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Retrieving User Information with Auth/Acl

2008-07-03 Thread francky06l

I do not understand the on the fly there .. You are wanted to check
a permission on an action regarding a user, but is this User logged-
in ? I mean a member of a User model or something similar ??

On Jul 3, 5:07 pm, Tony Thomas [EMAIL PROTECTED] wrote:
 I've been trying to get Acl working for a long time now. I think I'm
 very close, but I'm tired of doing endless Google searches for an
 answer, so I'm just going to ask.

 My Acl is all set up in the database, and Auth is working. It's the
 Acl check that I'm not getting. This article got me close:

 http://bakery.cakephp.org/articles/view/real-world-access-control

 But what is lacking is a way to generalize this. Like most articles 
 blog posts I've read about Acl, it focuses on setting up super-
 granular permissions, i.e., checking for one specific user. What I
 want to do (and what I imagine a lot of folks would find useful) is
 check the user on the fly in and see what permissions they have.

 So I apologize if I missed this somewhere, but it really has eluded me
 after about a month of trying. So without further complaining, here is
 my AppController class as it exists right now:

 class AppController extends Controller {

 var $components = array('Acl','Auth', 'Session');
 var $helpers = array('Html', 'Javascript', 'Form');

 function beforeFilter(){

 $user = $this-Auth-identify();
 $user_id = $user[0];

 $page = $this-name.DS.$this-action;
 $access = $this-Acl-check($user_id, $page, '*');

 if ($access === false) {
 $this-Session-setFlash($page, $user_id);
 }

  else {
 $this-Session-setFlash($page, $user_id);
 }

 }

 Right now, I'm just setting a flash message so I can debug this thing
 and see if the variables have the expected variables. Those who know
 more about this than I do will see that I'm clearly not using
 identify() correctly. But I think you can see what I'm trying to do. I
 want to retrieve the user info from the session and check it against
 the Acl permissions. How can I use AuthComponent::identify to get the
 user's id and then run the Acl check?

 I am at your mercy. 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Retrieving User Information with Auth/Acl

2008-07-03 Thread francky06l

The native Auth has got this functionnality. If you use the Auth in
mode actions, you would create

- Aro for each user
- Aco for controller/actions  pairs in this way :
an Aco for the controller name with no parent, and an Aco per action
of the controller having the Aco controller as parent. You use the
controllers/action as alias.

You will allow or deny users for each aco, and Auth will take care of
this in beforeFilter.

When you want to change the authorization for a User, you just have to
use ACL allow/deny (using the console or maybe a view for this). The
authotization becomes driven by the DB and not in the code.
There is a tutorial there, that uses a role level with user but easy
to simplify with only user: http://www.cakephpforum.net/index.php?showtopic=27

On Jul 4, 2:12 am, Tony Thomas [EMAIL PROTECTED] wrote:
 On Jul 3, 6:23 pm, francky06l [EMAIL PROTECTED] wrote:

  I do not understand the on the fly there ..

 Meaning I don't want to have to statically define who can do what.
 Instead of something like:

 if ($this-Auth-user('username') == 'User1') {

 // allow them to do stuff

 } else {

 // kick them out

 }

 I want to get user information after they've gone through the login
 process in Auth, look at the Acl and determine whether or not they
 have permission to do what they want to do. In other words, I don't
 want static rules in the controller. I want to load up some variables
 from the session and check it against Acl.

 You are wanted to check
  a permission on an action regarding a user, but is this User logged-
  in ? I mean a member of a User model or something similar ??

 In this case I'm certain the user (me) is logged in. Auth is working
 as expected. I just can't get my head around checking Acl.

 For now I've abandoned the built in Acl in lieu of a simple system
 using roles in the user table. The Acl component is more flexible,
 so I'd still like to use it if anyone has advice.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM Relationship and Multiple Models

2008-07-02 Thread francky06l

If you use a join model (ie: HABTM) using 'with' option, the saveAll
will work if you also save the Associate (saving User, Associate and
the with Model).
If you do not have the Associate to save, just unbind and bind as
hasMany your liked model (the with), and call saveAll...

hth

On Jul 2, 6:28 pm, James K [EMAIL PROTECTED] wrote:
 It's best to just make a model for your join table, populate it
 manually and save it separately. There is an automagic way to do it
 - which is described in the manual - but it's just as much work and
 not very intuitive. The way the automagic works is you have to add an
 array of Associate keys you want to save into the join table in the
 User data collection (or vice-versa depending on which is the parent
 model). Then when you do user-save, it'll see that collection of keys
 and populate the join table.

 On Jul 1, 1:44 pm, lirc201 [EMAIL PROTECTED] wrote:

  Hello All,

  I'm stuck and need a jump start here.  I have a form that collections
  User model and Associate model data.  User like email, password and
  Associate like street, city, state, etc... data.   I have a HABTM
  relationship between User and Associate.  My question is how to make
  the linkage work?  In this case I'm assuming that both the User and
  Associate data enter is new.

  $this-User-save($this-data);
  $user_id = $this-User-getLastInsertId();

  at this point do I just this:
  $this-data['User']['id'] = $user_id;
  $this-Associate-save($this-data);

  Will the join table get popualted?

  Thanks,
  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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



  1   2   3   4   5   6   7   8   9   >