Re: JSON response!

2012-04-17 Thread Serkan Sipahi
Thanks :) 

Von meinem iPhone gesendet

Am 16.04.2012 um 20:51 schrieb Rob rcole...@mailforce.net:

 It is not possible to send both a HTML and a JSON response for the same 
 request.  However, you can detect the type of request and respond with HTML 
 or JSON accordingly.  For example:
 
 public function index()
 {
 $this-set('test', array(
 'Hallo World!',
 ));
 
 if($this-RequestHandler-accepts('json'))
 $this-set('_serialize', array('test'));
 }
 
 On Saturday, April 14, 2012 10:38:51 AM UTC-4, Sipatshi wrote:
 hi,
 
 i remove Router::parseExtensions('json');
 
 My wish is to do something like this:
 
 ?php
 class SomeController extends AppController {
 
 public $components = array(
 'RequestHandler'
 );
 
 public function index(){
 
 /
 json response
 /
 $this-RequestHandler-setContent('json', 'application/json' );
 $this-set('test', array(
 'Hallo World!',
 ));
 $this-set('_serialize', array('test'));
 
 /
 html response
 /
 $this-RequestHandler-setContent('html', 'text/html, */*' );
 $this-set('test_2', array(
 'Hallo World 2',
 ));
 }
 } 
 
 is that possible?
 
 Von: stork lubomir.st...@gmail.com
 An: cake-php@googlegroups.com 
 CC: Serkan Sipahi serkan.sip...@yahoo.de 
 Gesendet: 15:56 Samstag, 14.April 2012
 Betreff: Re: JSON response!
 
 If you called Router::parseExtensions() in routes.php, you don't need to call 
 $this-RequestHandler-
 setContent() manually - as long as requested URI does have .json extension at 
 the end or ajax request was called with proper dataType/accept request header.
 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
  
  
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php
 
 
 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
  
  
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

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


Images in RSS Feed

2012-04-17 Thread Reza Talamkhani
Hi, how can I insert images in my rss feed? I want one image to go
with each post.

index.ctp

?php
$this-set('documentData', array(
'xmlns:dc' = 'http://purl.org/dc/elements/1.1/'));

$this-set('channelData', array(
'title' = __(پست های اخیر رضا تلم خانی),
'link' = $this-Html-url('/', true),
'description' = __(وب سایت رسمی رضا تلم خانی),
'language' = 'fa'));

App::uses('Sanitize', 'Utility');
foreach ($posts as $post) {
//$postTime = strtotime($post['Post']['created']);

$postLink = array(
'controller' = 'posts',
'action' = 'view',
$post['Post']['id'],
//'year' = date('Y', $postTime),
//'month' = date('m', $postTime),
//'day' = date('d', $postTime),
//$post['Post']['slug']
);

// This is the part where we clean the body text for output as the
description
// of the rss item, this needs to have only text to make sure the feed
validates
$bodyText = preg_replace('=\(.*?\)=is', '', $post['Post']['body']);
$bodyText = strip_tags($bodyText);
$bodyText = $this-Text-stripLinks($bodyText);
$bodyText = Sanitize::stripAll($bodyText);
$bodyText = $this-Text-truncate($bodyText, 400, array(
'ending' = '...',
'exact'  = true,
'html'   = true,
));

echo  $this-Rss-item(array(), array(
'title' = $post['Post']['title'],
'link' = $postLink,
'guid' = array('url' = $postLink, 'isPermaLink' = 'true'),
'description' = $bodyText,
'creator' = $post['User']['full_name'],
'pubDate' = $post['Post']['created'],
));
}

?

-- 
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: Issue with multiple select form input.

2012-04-17 Thread Owlio
That is the proper name, because PHP sees that and creates an array with 
the values within that array. How else would you get multiple values for 
the same group?

Ahh! This makes perfect sense, to be honest, I'm not sure why I didn't 
realise this was the case.

It sounds like the problem is that your search plugin is not expecting an 
array.

You were correct that the search plugin wasn't expecting an array (it was 
expecting a simple value) I've altered this now to unpack the values when 
they're passed through to my action and it works. I still have an issue 
when selecting multiple values as the URL is formed badly - but I should be 
able to resolve this.

Just curious, how would you expect the URL to look to search for multiple 
brands?

Now I understand this, I'd expect them to be displayed like 
.../brand[0]:Dell/brand[1]:Apple/. Currently (now I've tweaked the plugin) 
the values are separated with a pipe, for example /brand:Dell%7CApple but 
as I mentioned above, this causes problems as the search plugin is taking 
the value literally which obviously returns no results.

Thanks for your help!



On Monday, April 16, 2012 11:38:45 PM UTC+1, jeremyharris wrote:

 That is the proper name, because PHP sees that and creates an array with 
 the values within that array. How else would you get multiple values for 
 the same group?

 When you submit the form, for example, the data is populated like this:

 // $this-data
 array(
   'Server' = array(
 'brand' = array('Dell', 'Apple')
   )
 );

 It sounds like the problem is that your search plugin is not expecting an 
 array. Perhaps you can a) modify the plugin to accept an array, or b) 
 modify how you pass the values in the URL to choose just the first one.

 Just curious, how would you expect the URL to look to search for multiple 
 brands?

 On Monday, April 16, 2012 4:48:04 AM UTC-7, Owlio wrote:

 Hi,

 I hope someone can shed some light on this, it's driving me crazy. I have 
 a multiple select list with options generated from a database. The problem 
 is that the select name is being set, incorrectly, as follows:

 name=data[Server][brand][] 

 When it should be:

 name=data[Server][brand]

 This is causing problems as when an option is selected it displays in the 
 URL as '.../brand[0]:Dell' which in turn throws of my search plugin as it's 
 expecting '.../brand:Dell'. In my view the select box code is as follows:

 echo $this-Form-create('Server', array('url' = array('action' = 
 'find'), $this-params['pass'])); 
echo $this-Form-input('brand', array(
   'type' = 'select',
   'options' = $serverBrand,
   'multiple' = 'multiple',
 ));

 With the options being generated in the controller, like so:

 $serverBrand = Set::extract('/Server/brand', $this-Server-find('all', 
 array(
'fields' = array('DISTINCT Server.brand', 'Server.brand'),
'recursive' = -1
 )));
 $serverBrand = array_combine($serverBrand, $serverBrand);
 $this-set('serverBrand', $serverBrand);

 The array_combine is necessary in order for the select box to insert the 
 correct value in the URL, I've tried commenting this out but the above 
 problem still persists. I need a way to either customize the select name, 
 or preferably fix it. 

 Any help would be greatly appreciated!



-- 
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: ACL very slow

2012-04-17 Thread stork


 Any one can help me with this ?

Not me, sorry. This is example, how should NOT look code of CakePHP 
application, controller should be as slim as possible.

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


Some Issues: multiple views on one page and help with javascript

2012-04-17 Thread Timo
Hello everybody,

since I am fairly new to CakePhp and since my research has not yielded any 
definitive results concerning my specific problem so far, I figured the 
best thing to do would be to ask here. :) 
Bear with me, this is going to be rather elaborate, I fear... 

I'm creating an application with CakePhp (2.1) and Javascript / JQuery, one 
basic functionality is that table entries can be viewed in different ways, 
to which I will come in a moment. My main content area consists of 2 sub 
divisions, one is the actual main content, the other is a horizontally 
sliding area which can be toggled on and off (in the following text 
referred to as accordion). I will attach an image at the end of the post 
to exemplify what I mean.

The afore mentioned different views ( / edits / adds)  are: 

*1. Standard view* would be in accordion which is hidden until a table 
entry is chosen, once the view is triggered, the area is supposed to slide 
from the right side into the screen and overlap the underlying table, the 
area can be toggled on and off. Basically it acts as a horizontal accordion 
window, the user is able  to quickly manipulate table entries, hide the 
entry to look something up in the table, and show the entry again to 
continue whatever he was doing before.
*2. Fullscreen view *is supposed to be rendered in the actual main content 
area, in this view the table is transferred to the accordion, basically 
table and table entry swap positions.

Another aspect of the application is that table entries can be stored in 
favourites or clipboard, those two are small windows which can be shown 
on any page of the application and which are also part of the start page. 

Now that I have started to try to implement this layout, I have encountered 
some problems, which might result from me being a beginner in CakePhp. 
After baking controllers and models via the console, I created the index 
view for one controller (companies) and went on to the add view for 
this controller. Naive as I was I simply put the generated add view code 
in the accordion div and left the table (index view) code in the main area 
div which led to errors. So if I understand this correctly, I cannot simply 
fill 2 divs with different view contents from only one query, which makes 
sense. My research led me to the elements functionality of cake, though I 
could only find the cookbook entry for 1.3 ( 
http://book.cakephp.org/1.3/view/1081/Elements ). 
Please tell me whether this will help me with my problem, or if there is a 
better, simple solution for what I am trying to do. (I might have to fill 
not only the accordion and the main content area with data entries, but 
also the favourites and clipboard area once the user clicks the button 
to show those). I also searched for a way to fetch multiple content in my 
default layout like

echo $this-fetch('content'); 
echo $this-fetch('accordion');  

but I did not find anything. So this is my first issue. A second one: 
When the user clicks on a table entry in the table, an option menu is shown 
at the mouse position from which the user can choose to edit, delete or 
view the clicked entry. This option menu is also shown when the user clicks 
on an entry in the favourites or clipboard area. Is there a way to combine 
PHP and Javascript to determine, which kind of data is clicked (e.g. which 
controller must be used)?
And furthermore, is  there a way to integrate (cake)php in code in 
javascript? 

Example: 
$('#listEditButton').click(function(){
   window.location.href=companyEdit.html; 
});

Instead of window.location.href=companyEdit.html; the cakephp edit view 
for the correct controller should be triggered.

*Breathes deeply* Excuse my excessive question, but I just started with 
CakePhp (did research, went through the blog tutorial - which as far as I 
can tell does not cover what I need for my application), maybe I even 
missed some CakePhp functionalities which provide exactly what I am looking 
for.


To sum it up:
*1. Multiple Views on one page: *How does one for example show the index 
view AND the view of one entry of a controller on a single page with 
CakePhp.
*2. Javascript and CakePhp: *How do you use CakePhp view calls in 
javascript, is this even possible, how would one approach the above problem 
with the option menu (if there is any way apart from separate option menus 
for all pages AND for favourites and clipboard).


If you have read all the above - Thank you very much! I would have put this 
in caps but that is just hurting for the eyes. I hope someone can help me 
and put me on the right way to what I am trying to do :)


Kindest regards

Timo






Attachment: 

https://lh6.googleusercontent.com/--4enSImYE8U/T40rbqL-DFI/AAk/SNHq3HD_29Q/s1600/example.png

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

Re: ACL very slow

2012-04-17 Thread Farah
Ok, I'm sorry stork, but I if I just try put in the session all permissions 
of the controller:

$acoes = $this-Acao-find(all, array(conditions = 
array(Controller.alias = $controller)));
foreach ($acoes as $key = $acao) {
if (!$this-Session-check(Auth.Permissions. . 
$controller . . . $acao[Acao][alias])) {
if ($this-SessionAcl-check(array('model' = 
'Usuario', 'foreign_key' = $this-Auth-user('id')), $controller . / . 
$acao[Acao][alias])) {
$this-Session-write(Auth.Permissions. . 
$controller . . . $acao[Acao][alias], true);
}
}
}

It takes (default) 561 queries took 1072 ms, the count of $acoes is 7, I 
don't understand why 561 queries, is too slow?

Thanks =)


On Tuesday, April 17, 2012 8:09:00 AM UTC-3, stork wrote:

  Any one can help me with this ?

 Not me, sorry. This is example, how should NOT look code of CakePHP 
 application, controller should be as slim as possible.


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


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


How to show message from default.po into javascript

2012-04-17 Thread Marcus James
Hi,

Can any one tell me how to read messages from default.po inside JavaScript.








Thanks,

Marcus

-- 
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: ACL very slow

2012-04-17 Thread stork
1. Do you store sessions in database? If yes, is it the same database as 
the one with application data? If yes, why? And why not use other 
(memcache) storage for sessions?

2. Stop blaming core code for slowness, until you'll be able to write short 
example NOT using your own classes like SessionAcl etc in it, especially 
not after your example code snippet above. I do have advanced imagination 
and I'm more then just a bit scared of what and how does your other custom 
code, used in your last loop over $acoes, where I even don't know what 
$recursive you used and how many associations are queried along.

Set up clean CakePHP installation, connect it to the very same database 
like your ACL uses, and run some test code related to your doubts WITHOUT 
your own code.

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


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


Re: How to show message from default.po into javascript

2012-04-17 Thread Fábio
Its just a basic example, you could add scriptalert('?php echo __('text 
to translate'); ?');/script to your layout. I think there are many 
better options, but i dont know the best one.

Em terça-feira, 17 de abril de 2012 08h52min13s UTC-3, marco metal escreveu:

 Hi,

 Can any one tell me how to read messages from default.po 
 inside JavaScript. 








 Thanks,

 Marcus


-- 
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: ACL very slow

2012-04-17 Thread Farah
I'm not expert in CakePHP, but its very clear that the ACL is slow if my 
tables database acos, aros and aros_acos over thousand rows.

Just a simple $this-Acl-check() runs over 500 queries and its clear that 
its not the acl generate that, it uses the Tree behavior to find the 
specific permission.

1. I'm not using database session.
2. There are many articles on the internet talking about that, and I'm not 
blaming, I'm just trying to figure out how fast my app can be.

The articles

1. http://www.visuallizard.com/blog/2009/10/19/241 
2. http://www.mainelydesign.com/blog/view/speeding-up-cakephp-acl-component
3. 
http://phpknight.com/cakephp-acl-controlled-application-slow-performance-problem/


I'll create a component and helper to make this faster as soon as possible 
and I'll post it here.

Thanks for your attention =)


On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


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


Auth component WITHOUT ACL blocks every controller action

2012-04-17 Thread DigitalDude
Hey,


I have a little problem with the Auth component. Normally I use it
together with ACL, everything works finde. Now I have a really small
Project and I just want to have some authentication without ACL tables
or different roles.

The basic setup is like the following:

AppController

$components = array('Auth', 'Session', ...);

$this-currentUser = $this-Auth-user();
$this-isAuthed = !empty($this-currentUser);

$this-Auth-authorize = 'controllers';
$this-Auth-loginAction = array('controller' = 'users', 'action' =
'login');
$this-Auth-loginRedirect = '/';
$this-Auth-logoutRedirect = '/';
$this-Auth-loginError = 'Login failed!';
$this-Auth-authError = 'Please login to see the contents of the
site!';
$this-Auth-userScope = array(
'deleted' = 0,
'status' = 2
);


Login and Logout are working fine. I have all data for the user within
the session after a login.

BUT when I try to open any other action besides login/logout or
actions like index within a controller forms, (forms/index) I am
redirected to the page before without any messae. I have no access to
the actions anymore, no matter if I'm logged in or not.

What am I missing here? I do NOT want to use $this-Auth-allow()
because it makes the actions accessible for EVERYONE and that is what
I am trying to cover...

-- 
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 component WITHOUT ACL blocks every controller action

2012-04-17 Thread luca capra


Il 17/04/2012 15:13, DigitalDude ha scritto:

Hey,


I have a little problem with the Auth component. Normally I use it
together with ACL, everything works finde. Now I have a really small
Project and I just want to have some authentication without ACL tables
or different roles.
...
What am I missing here? I do NOT want to use $this-Auth-allow()
because it makes the actions accessible for EVERYONE and that is what
I am trying to cover...



I think this should works:

// AppController::beforeFilter()

if($this-Auth-user())

  $this-Auth-allow();

else

  $this-Auth-deny();


--
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 component WITHOUT ACL blocks every controller action

2012-04-17 Thread stork


 $this-Auth-authorize = 'controllers'; 


 $this-Auth-authorize = array('Controller'); 

-- 
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: Issue with multiple select form input.

2012-04-17 Thread jeremyharris
If your app is in Cake 2, it should handle array named parameters (what 
you're trying to do with  /brand[0]:Dell/brand[1]:Apple) by itself. Just 
pass them as an actual array rather than building the url yourself, like

$this-Html-link('search', array(
'controller' = 'products',
'action' = 'search',
'brand' = array('Dell', 'Apple')
));

This will allow cake to generate the url for you. Otherwise, it will be 
escaped which is where you get the url encoded characters (%7C, etc).

If you *need* to generate it yourself for some reason, you can prevent the 
escaping by creating it with the Router and telling it not to escape:

Router::url('/products/search/brand[0]:Dell/brand[1]:Apple', array('escape' 
= false)); 

On Tuesday, April 17, 2012 2:42:28 AM UTC-7, Owlio wrote:

 That is the proper name, because PHP sees that and creates an array with 
 the values within that array. How else would you get multiple values for 
 the same group?

 Ahh! This makes perfect sense, to be honest, I'm not sure why I didn't 
 realise this was the case.

 It sounds like the problem is that your search plugin is not expecting an 
 array.

 You were correct that the search plugin wasn't expecting an array (it was 
 expecting a simple value) I've altered this now to unpack the values when 
 they're passed through to my action and it works. I still have an issue 
 when selecting multiple values as the URL is formed badly - but I should be 
 able to resolve this.

 Just curious, how would you expect the URL to look to search for multiple 
 brands?

 Now I understand this, I'd expect them to be displayed like 
 .../brand[0]:Dell/brand[1]:Apple/. Currently (now I've tweaked the plugin) 
 the values are separated with a pipe, for example /brand:Dell%7CApple but 
 as I mentioned above, this causes problems as the search plugin is taking 
 the value literally which obviously returns no results.

 Thanks for your help!



 On Monday, April 16, 2012 11:38:45 PM UTC+1, jeremyharris wrote:

 That is the proper name, because PHP sees that and creates an array with 
 the values within that array. How else would you get multiple values for 
 the same group?

 When you submit the form, for example, the data is populated like this:

 // $this-data
 array(
   'Server' = array(
 'brand' = array('Dell', 'Apple')
   )
 );

 It sounds like the problem is that your search plugin is not expecting an 
 array. Perhaps you can a) modify the plugin to accept an array, or b) 
 modify how you pass the values in the URL to choose just the first one.

 Just curious, how would you expect the URL to look to search for multiple 
 brands?

 On Monday, April 16, 2012 4:48:04 AM UTC-7, Owlio wrote:

 Hi,

 I hope someone can shed some light on this, it's driving me crazy. I 
 have a multiple select list with options generated from a database. The 
 problem is that the select name is being set, incorrectly, as follows:

 name=data[Server][brand][] 

 When it should be:

 name=data[Server][brand]

 This is causing problems as when an option is selected it displays in 
 the URL as '.../brand[0]:Dell' which in turn throws of my search plugin as 
 it's expecting '.../brand:Dell'. In my view the select box code is as 
 follows:

 echo $this-Form-create('Server', array('url' = array('action' = 
 'find'), $this-params['pass'])); 
echo $this-Form-input('brand', array(
   'type' = 'select',
   'options' = $serverBrand,
   'multiple' = 'multiple',
 ));

 With the options being generated in the controller, like so:

 $serverBrand = Set::extract('/Server/brand', $this-Server-find('all', 
 array(
'fields' = array('DISTINCT Server.brand', 'Server.brand'),
'recursive' = -1
 )));
 $serverBrand = array_combine($serverBrand, $serverBrand);
 $this-set('serverBrand', $serverBrand);

 The array_combine is necessary in order for the select box to insert the 
 correct value in the URL, I've tried commenting this out but the above 
 problem still persists. I need a way to either customize the select name, 
 or preferably fix it. 

 Any help would be greatly appreciated!



-- 
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: Where am I supposed to save additional PHP source files while I'm writing a new behavior

2012-04-17 Thread jeremyharris
If it's more than two files (behavior + test case) it's worthwhile to point 
out that plugins are not only good for redistributing your code, but it's 
also good for packaging your tests and everything in a different repo that 
has its own history and that you can submodule via git. This assumes the 
libs are only specific to the behavior and their methods aren't used in 
other areas.

Just a thought!

On Monday, April 16, 2012 5:05:09 PM UTC-7, Daniel Baird wrote:


 Hi Cake dudes,

 I'm new to Cake, and I'm adding a behavior to a model.  I've done that by 
 writing a PHP file that I save in the Behavior directory.

 Now I'm making that Behavior a bit more complicated, and I'd like to split 
 some sections of code out into separate files.  This Behavior is pretty 
 specific to my application, I can't imagine wanting to make it a 
 redistributable plugin or anything.

 So here's my question: where's the recommended place to save those 
 supporting files?  Can I just make a subdir or Behavior and save them all 
 in there?  Or am I supposed to save my additional files into the Vendor dir 
 or something like that.

 Thanks in advance

 Daniel


-- 
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: ACL very slow

2012-04-17 Thread stork


 1. http://www.visuallizard.com/blog/2009/10/19/241 
 2. 
 http://www.mainelydesign.com/blog/view/speeding-up-cakephp-acl-component
 3. 
 http://phpknight.com/cakephp-acl-controlled-application-slow-performance-problem/


1. 2009/10
2. 2010/05
3. 2010/06

Better use current stable CakePHP release then ~2 years old one.


-- 
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: ACL very slow

2012-04-17 Thread stork
Also, check out these projects
http://plugins.cakephp.org/packages?query=acl
if you do not need wheel with some special shape.

-- 
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: Some Issues: multiple views on one page and help with javascript

2012-04-17 Thread bs28723
I will try to help with the view issue.
First look at the 2.x View Template section 
http://book.cakephp.org/2.0/en/views.html
And look into Extending Views.   This will allow you to break up the 
view.  You create a frame work for a controller, then the view can have 
different content in the main section depending on the function.

I would then look at each of these areas that slide in and out might be 
a good fit for an Element. (see same doc page).
You can pass parameters to them to customize them.  I use elements for 
addresses.  I have shipping, billing  other address. It formats the 
address. I pass a title to element to be displayed by element.

you can use the requestAction function in the Elements to get data from 
another controller function. See sample code in same documentation page 
under elements.

This way you have a few main functions and views to go with them. Then 
you have the elements, that may use other functions in the controller or 
possibly other controllers, to get data.  You could do this for a 
dashboard, or to fill these  slide outs that you describe.

You may want to consider adding a Helper to get some of this data for 
the view, if you think you may want the data on multiple views.  The 
helper can make calls via requestAction to this controller, or possibly 
other controllers to get some data, that can be formatted by the 
elements for the view.

Bill

On 4/17/2012 7:30 AM, Timo [via CakePHP] wrote:
 Hello everybody,

 since I am fairly new to CakePhp and since my research has not yielded 
 any definitive results concerning my specific problem so far, I 
 figured the best thing to do would be to ask here. :)
 Bear with me, this is going to be rather elaborate, I fear...

 I'm creating an application with CakePhp (2.1) and Javascript / 
 JQuery, one basic functionality is that table entries can be viewed in 
 different ways, to which I will come in a moment. My main content area 
 consists of 2 sub divisions, one is the actual main content, the other 
 is a horizontally sliding area which can be toggled on and off (in the 
 following text referred to as accordion). I will attach an image at 
 the end of the post to exemplify what I mean.

 The afore mentioned different views ( / edits / adds)  are:

 *1. Standard view* would be in accordion which is hidden until a table 
 entry is chosen, once the view is triggered, the area is supposed to 
 slide from the right side into the screen and overlap the underlying 
 table, the area can be toggled on and off. Basically it acts as a 
 horizontal accordion window, the user is able  to quickly manipulate 
 table entries, hide the entry to look something up in the table, and 
 show the entry again to continue whatever he was doing before.
 *2. Fullscreen view *is supposed to be rendered in the actual main 
 content area, in this view the table is transferred to the accordion, 
 basically table and table entry swap positions.

 Another aspect of the application is that table entries can be stored 
 in favourites or clipboard, those two are small windows which can 
 be shown on any page of the application and which are also part of the 
 start page.

 Now that I have started to try to implement this layout, I have 
 encountered some problems, which might result from me being a beginner 
 in CakePhp. After baking controllers and models via the console, I 
 created the index view for one controller (companies) and went on to 
 the add view for this controller. Naive as I was I simply put the 
 generated add view code in the accordion div and left the table 
 (index view) code in the main area div which led to errors. So if I 
 understand this correctly, I cannot simply fill 2 divs with different 
 view contents from only one query, which makes sense. My research led 
 me to the elements functionality of cake, though I could only find 
 the cookbook entry for 1.3 ( 
 http://book.cakephp.org/1.3/view/1081/Elements ).
 Please tell me whether this will help me with my problem, or if there 
 is a better, simple solution for what I am trying to do. (I might have 
 to fill not only the accordion and the main content area with data 
 entries, but also the favourites and clipboard area once the user 
 clicks the button to show those). I also searched for a way to fetch 
 multiple content in my default layout like

 echo $this-fetch('content');
 echo $this-fetch('accordion');

 but I did not find anything. So this is my first issue. A second one:
 When the user clicks on a table entry in the table, an option menu is 
 shown at the mouse position from which the user can choose to edit, 
 delete or view the clicked entry. This option menu is also shown when 
 the user clicks on an entry in the favourites or clipboard area. Is 
 there a way to combine PHP and Javascript to determine, which kind of 
 data is clicked (e.g. which controller must be used)?
 And furthermore, is  there a way to integrate (cake)php in code in 
 javascript?

 Example:
 

Re: ACL very slow

2012-04-17 Thread jeremyharris
It's quite possible you're just missing indexes[1], which would be a huge 
performance problem. Also, make sure the engine is innodb.

1:  http://blog.loadsys.com/2008/03/19/cakephp-12-tuning-the-acl-via-mysql/ 

On Tuesday, April 17, 2012 6:00:05 AM UTC-7, Farah wrote:

 I'm not expert in CakePHP, but its very clear that the ACL is slow if my 
 tables database acos, aros and aros_acos over thousand rows.

 Just a simple $this-Acl-check() runs over 500 queries and its clear that 
 its not the acl generate that, it uses the Tree behavior to find the 
 specific permission.

 1. I'm not using database session.
 2. There are many articles on the internet talking about that, and I'm not 
 blaming, I'm just trying to figure out how fast my app can be.

 The articles

 1. http://www.visuallizard.com/blog/2009/10/19/241 
 2. 
 http://www.mainelydesign.com/blog/view/speeding-up-cakephp-acl-component
 3. 
 http://phpknight.com/cakephp-acl-controlled-application-slow-performance-problem/


 I'll create a component and helper to make this faster as soon as possible 
 and I'll post it here.

 Thanks for your attention =)


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.



-- 
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: ACL very slow

2012-04-17 Thread jeremyharris
I realized after posting that the post I referenced assumes MySQL, but the 
idea of indexing is relative nonetheless.

On Tuesday, April 17, 2012 8:20:05 AM UTC-7, jeremyharris wrote:

 It's quite possible you're just missing indexes[1], which would be a huge 
 performance problem. Also, make sure the engine is innodb.

 1:  
 http://blog.loadsys.com/2008/03/19/cakephp-12-tuning-the-acl-via-mysql/ 

 On Tuesday, April 17, 2012 6:00:05 AM UTC-7, Farah wrote:

 I'm not expert in CakePHP, but its very clear that the ACL is slow if my 
 tables database acos, aros and aros_acos over thousand rows.

 Just a simple $this-Acl-check() runs over 500 queries and its clear 
 that its not the acl generate that, it uses the Tree behavior to find the 
 specific permission.

 1. I'm not using database session.
 2. There are many articles on the internet talking about that, and I'm 
 not blaming, I'm just trying to figure out how fast my app can be.

 The articles

 1. http://www.visuallizard.com/blog/2009/10/19/241 
 2. 
 http://www.mainelydesign.com/blog/view/speeding-up-cakephp-acl-component
 3. 
 http://phpknight.com/cakephp-acl-controlled-application-slow-performance-problem/


 I'll create a component and helper to make this faster as soon as 
 possible and I'll post it here.

 Thanks for your attention =)


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.



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

Re: ACL very slow

2012-04-17 Thread Farah
Thanks for the reply!

On Tuesday, April 17, 2012 11:16:49 AM UTC-3, stork wrote:

 Also, check out these projects
 http://plugins.cakephp.org/packages?query=acl
 if you do not need wheel with some special shape.


On Tuesday, April 17, 2012 11:16:49 AM UTC-3, stork wrote:

 Also, check out these projects
 http://plugins.cakephp.org/packages?query=acl
 if you do not need wheel with some special shape.


-- 
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: ACL very slow

2012-04-17 Thread Farah
Yes, all fields has index

On Tuesday, April 17, 2012 12:21:36 PM UTC-3, jeremyharris wrote:

 I realized after posting that the post I referenced assumes MySQL, but the 
 idea of indexing is relative nonetheless.

 On Tuesday, April 17, 2012 8:20:05 AM UTC-7, jeremyharris wrote:

 It's quite possible you're just missing indexes[1], which would be a huge 
 performance problem. Also, make sure the engine is innodb.

 1:  
 http://blog.loadsys.com/2008/03/19/cakephp-12-tuning-the-acl-via-mysql/ 

 On Tuesday, April 17, 2012 6:00:05 AM UTC-7, Farah wrote:

 I'm not expert in CakePHP, but its very clear that the ACL is slow if my 
 tables database acos, aros and aros_acos over thousand rows.

 Just a simple $this-Acl-check() runs over 500 queries and its clear 
 that its not the acl generate that, it uses the Tree behavior to find the 
 specific permission.

 1. I'm not using database session.
 2. There are many articles on the internet talking about that, and I'm 
 not blaming, I'm just trying to figure out how fast my app can be.

 The articles

 1. http://www.visuallizard.com/blog/2009/10/19/241 
 2. 
 http://www.mainelydesign.com/blog/view/speeding-up-cakephp-acl-component
 3. 
 http://phpknight.com/cakephp-acl-controlled-application-slow-performance-problem/


 I'll create a component and helper to make this faster as soon as 
 possible and I'll post it here.

 Thanks for your attention =)


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database 
 as the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database 
 as the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database 
 as the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database 
 as the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.



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

Re: Best IDE for CakePHP 2.1

2012-04-17 Thread Dunhamzzz
Slower than Eclipse?! Mother of god...

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


Copy Paste from Excel to Textarea

2012-04-17 Thread jcrens8392
I have a form that allows people to copy  paste from Excel into a 
textarea. The textarea is then parsed and the data is saved one line at a 
time.

I've noticed a weird issue that I can't seem to resolve to the point I'm 
confident in it's reliability.

When pasting data from excel, where there is an empty cell with a space in 
it, cake appears to be converting that empty cell to the ASCII character 
182 ('A' with circumflex accent) followed by one character of whitespace.

The problem is, I don't believe the conversion is happening exactly as I've 
described. That's what I see when I print the data, however, any attempts 
to use preg_replace or str_replace to strip that character(s) have failed.

The only solution I've been able to find so far is to convert the import 
data to html entities, which converts the offending characters to 
Acirc;nbsp; and then strip out those using str_replace. However, I'm 
not too confident this won't corrupt other, valid import data that I 
haven't yet considered.

I have not been able to reproduce this problem outside of Cake on the same 
machine. Even with character encoding on the page and accept-encoding attr 
on the form matching Cake's.

Here's how to reproduce the problem:

* Create textarea using cake form helper (nothing non-standard).
* Create excel spreadsheet with 1 empty cell
* In that empty cell, add a space
* Copy that empty cell and paste into the textarea
* Use debug($this-request-data['ModelName']['fieldName']) to print out 
the submitted data.
* You should see a ASCII character 182 followed by a space
* Try and strip that character -- I haven't been able to do this at all 
without converting using htmlentities

-John

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


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


Re: Best IDE for CakePHP 2.1

2012-04-17 Thread Alejandro Gómez Fernández
Did you try phpdesigner 8? You can import libraries and then the editor use 
this definitions for autocomplete (i don't use this feature) but sometimes i 
use the parameters list for some functions...
It has a privative licence but I think it's good enought.

Regards,


Ale.
 

Enviado desde mi iPad

El 17/04/2012, a las 13:25, Dunhamzzz dunham...@gmail.com escribió:

 Slower than Eclipse?! Mother of god...
 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
  
  
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

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


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


Open file with character special cakephp

2012-04-17 Thread Adrian Ac
I have a problem in the moment to open an file than it have character 
special in the name.. example :   
Francais_V_defle_exo_04_04_(découpage_ok).srt .

the error: file(Francais_V_defle_exo_04_04_(découpage_ok).srt) [
function.file http://php.net/function.file]: failed to open stream: No 
such file or directory

i have anothers files without this characters and they works ok. 

i tryed with this functions, but anything : 

htmlentities();
and i have the configuration charset UTF-8.

any suggestion please!

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


Plantilla Artisteer para CakePhp

2012-04-17 Thread Jose Molina
Sería bueno que alguien con experiencia en CakePhp pudiera explicar
cómo convertir una plantilla generada con Artisteer, utilizando
Elements de Cake, etc., de esa manería se contaría con una interfaz de
más calidad. Sería ideal desarrollar un convertidor.

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


Authentication like the one implemented in Yii Framework

2012-04-17 Thread Jose Molina
Is it dificult to implement such Auth like the one Yii uses???. I
think Cake's continues to be hard to understand.

-- 
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: Authentication like the one implemented in Yii Framework

2012-04-17 Thread Thiago Belem
I do not want to be rude but...

You want us to search and study about YiI's auth implementation or you
could just provide us with some code and show us how it does?

I don't like the way you do something... i think i know a better way
means nothing to me.

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

*Assando Sites* - Curso online de *CakePHP*
assando-sites.com.br http://goo.gl/b1EEd

thiagobelem.net
cont...@thiagobelem.net

*Skype / gTalk **»* thiago.belem.web
*LinkedIn* *»* br.linkedin.com/in/thiagobelem/pt



On Tue, Apr 17, 2012 at 15:41, Jose Molina ja200...@gmail.com wrote:

 Is it dificult to implement such Auth like the one Yii uses???. I
 think Cake's continues to be hard to understand.

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


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


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


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


Re: Copy Paste from Excel to Textarea

2012-04-17 Thread lowpass
This doesn't appear to be a Cake issue. I suspect what you're seeing
is the dreaded paste from Word conundrum. Yes, you're talking about
Excel here but it's all the same problem: bizarre and convoluted
formatting and other metadata coming along for the ride.

Also, you should first ensure that you don't have a character set
mismatch somewhere. This page has some good information, including a
couple of ways you can test things (and some Java stuff that's
irrelevant): https://blogs.oracle.com/shankar/entry/how_to_handle_utf_8

You should also test in various browsers to see if the same character
shows up. In Firefox, if you have Firebug installed (if you don't
you're missing out on a lot) paste into the textarea, then right-click
on it and choose Inspect with Firebug to see what content is there.

On Tue, Apr 17, 2012 at 12:45 PM, jcrens8392 runner1...@gmail.com wrote:
 I have a form that allows people to copy  paste from Excel into a textarea.
 The textarea is then parsed and the data is saved one line at a time.

 I've noticed a weird issue that I can't seem to resolve to the point I'm
 confident in it's reliability.

 When pasting data from excel, where there is an empty cell with a space in
 it, cake appears to be converting that empty cell to the ASCII character 182
 ('A' with circumflex accent) followed by one character of whitespace.

 The problem is, I don't believe the conversion is happening exactly as I've
 described. That's what I see when I print the data, however, any attempts to
 use preg_replace or str_replace to strip that character(s) have failed.

 The only solution I've been able to find so far is to convert the import
 data to html entities, which converts the offending characters to
 Acirc;nbsp; and then strip out those using str_replace. However, I'm not
 too confident this won't corrupt other, valid import data that I haven't yet
 considered.

 I have not been able to reproduce this problem outside of Cake on the same
 machine. Even with character encoding on the page and accept-encoding attr
 on the form matching Cake's.

 Here's how to reproduce the problem:

 * Create textarea using cake form helper (nothing non-standard).
 * Create excel spreadsheet with 1 empty cell
 * In that empty cell, add a space
 * Copy that empty cell and paste into the textarea
 * Use debug($this-request-data['ModelName']['fieldName']) to print out the
 submitted data.
 * You should see a ASCII character 182 followed by a space
 * Try and strip that character -- I haven't been able to do this at all
 without converting using htmlentities

 -John

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


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

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


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


Re: How to show message from default.po into javascript

2012-04-17 Thread lowpass
This would create a global variable. A really basic example.

$code = 'var messages = {'
. 'msg1: '. __('some text here') .','
. 'msg2: '. __('some text here') .','
. 'msg3: '. __('some text here')
. '};'; 

$this-Html-scriptBlock($code, array('inline' = false));

alert(messages.msg1);

On Tue, Apr 17, 2012 at 7:52 AM, Marcus James marco...@gmail.com wrote:
 Hi,

 Can any one tell me how to read messages from default.po inside JavaScript.








 Thanks,

 Marcus

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


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

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


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


Translations Behaviour and Associated Models bug

2012-04-17 Thread Fábio
Its hard to understand why this conflit is still present in cake 2.1, as it 
has been noticed by many people since version 1.2. I made tons of searches 
in google and coudnt find any useful awnser.
I was testing it in cake 2.0, but when i figured out that it was a cake 
problem i tryed to update to 2.1, expecting it to be fixed, but it wasnt

When you try to set up the $actas to the translate behaviour, use belongsto 
relationship in your models, and try to paginate recursively the results, 
you get an error. 

What i'm trying to do:

Retrieve a list of packages, and for each package in the list, ill print a 
list of itineraries for that package. To retrieve this content, i'm using 
$this-{$model_name}-recursive = 2.
If i comment the lines of the actas, the page works and displays the list 
of packages and itineraries for each package, but all in the default 
language. If i add the actas, and use recursive = 1, it also works, but do 
not give me the itinerary data that i need to display in each package.

Ill give you my model structure.

Package hasmany ItineraryPackages
Itinerary hasmany ItineraryPackages
ItineraryPackages belongsto Package
ItineraryPackages belongsto Itinerary

Why i'm not using the HABTM relation?
Because the ItineraryPackages has a description and order field. The 
description of ItineraryPackages is also using the translate behaviour for 
the column description.

*Fatal Error* (256): [PDOException] SQLSTATE[42S22]: Column not found: 1054 
Unknown column 'I18n__nameTranslation.content' in 'field list'
 #0 C:\wamp\www\lib\Cake\Model\Datasource\DboSource.php(437): 
 PDOStatement-execute(Array)
 #1 C:\wamp\www\lib\Cake\Model\Datasource\DboSource.php(403): 
 DboSource-_execute('SELECT `Package...', Array)
 #2 C:\wamp\www\lib\Cake\Model\Datasource\DboSource.php(647): 
 DboSource-execute('SELECT `Package...', Array, Array)
 #3 C:\wamp\www\lib\Cake\Model\Datasource\DboSource.php(1300): 
 DboSource-fetchAll('SELECT `Package...', false)
 #4 C:\wamp\www\lib\Cake\Model\Datasource\DboSource.php(1169): 
 DboSource-fetchAssociated(Object(PackageType), 'SELECT `Package...', Array)
 #5 C:\wamp\www\lib\Cake\Model\Datasource\DboSource.php(1087): 
 DboSource-queryAssociation(Object(PackageType), Object(Package), 'hasMany', 
 'Package', Array, Array, true, Array, 0, Array)
 #6 C:\wamp\www\lib\Cake\Model\Model.php(2653): 
 DboSource-read(Object(PackageType), Array)
 #7 C:\wamp\www\app\Controller\AppController.php(36): Model-find('all')
 #8 C:\wamp\www\lib\Cake\Controller\CakeErrorController.php(71): 
 AppController-beforeRender()
 #9 [internal function]: CakeErrorController-beforeRender(Object(CakeEvent))
 #10 C:\wamp\www\lib\Cake\Event\CakeEventManager.php(246): 
 call_user_func(Array, Object(CakeEvent))
 #11 C:\wamp\www\lib\Cake\Controller\Controller.php(924): 
 CakeEventManager-dispatch(Object(CakeEvent))
 #12 C:\wamp\www\lib\Cake\Error\ExceptionRenderer.php(285): 
 Controller-render('error500')
 #13 C:\wamp\www\lib\Cake\Error\ExceptionRenderer.php(267): 
 ExceptionRenderer-_outputMessageSafe('error500')
 #14 C:\wamp\www\lib\Cake\Error\ExceptionRenderer.php(252): 
 ExceptionRenderer-_outputMessage('pdo_error')
 #15 [internal function]: ExceptionRenderer-pdoError(Object(PDOException))
 #16 C:\wamp\www\lib\Cake\Error\ExceptionRenderer.php(165): 
 call_user_func_array(Array, Array)
 #17 C:\wamp\www\lib\Cake\Error\ErrorHandler.php(127): 
 ExceptionRenderer-render()
 #18 [internal function]: ErrorHandler::handleException(Object(PDOException))
 #19 {main} [*CORE\Cake\Error\ErrorHandler.php*, line *136*]



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


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


Re: Best IDE for CakePHP 2.1

2012-04-17 Thread Fábio
I currently use netbeans. You can add the lib path to the netbeans 
configuration, so it will give suggestions of the entire project. It does 
not support cake console, but i saw some plugins that might help you.
Unfortunately i do not remember the urls or names, but you can search for 
that in google and also how to add the cake lib path to your netbeans.

Em quinta-feira, 12 de abril de 2012 02h23min46s UTC-3, Reza Talamkhani 
escreveu:

 Hi,
 I Need an IDE for CakePHP 2.1 that integerated with cake console and 
 suggestion...
 I test eclipse, netbeans  Codelobster but it did not meet any...

 Please help me to choose the best IDE. 

-- 
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: Authentication like the one implemented in Yii Framework

2012-04-17 Thread stork


 I think Cake's continues to be hard to understand.


Good joke, if you want to amaze some teenage girl in candy store.

-- 
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: Authentication like the one implemented in Yii Framework

2012-04-17 Thread Graham Weldon
Lets keep this civil. 

For those without access to google. I've entered yii authentication in, and 
came up with the following helpful guide from the Yii docs: 
http://www.yiiframework.com/doc/guide/1.1/en/topics.auth

I won't be pasting gobs of code or docs here. 

Cheers,
Graham Weldon
http://grahamweldon.com
e. gra...@grahamweldon.com
p. (+61) 0407 017 293
Skype: grahamweldon


On Wednesday, 18 April 2012 at 7:06 AM, stork wrote:

 
  I think Cake's continues to be hard to understand.
 
 Good joke, if you want to amaze some teenage girl in candy store.
 -- 
 Our newest site for the community: CakePHP Video Tutorials 
 http://tv.cakephp.org 
 Check out the new CakePHP Questions site http://ask.cakephp.org and help 
 others with their CakePHP related questions.
  
  
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com 
 (mailto:cake-php+unsubscr...@googlegroups.com) For more options, visit this 
 group at http://groups.google.com/group/cake-php

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


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


Re: Auth component WITHOUT ACL blocks every controller action

2012-04-17 Thread DigitalDude
Hey,

h as I changed the code to the snippet of stork, it gave me a ...
function isAuthorized() on a non-object (auth-component line 52).

When I added the code of luca capra, everything is working as
expected. All actions that are not allowed by $this-Auth-allow()
within beforeFilter-functions of my controllers are blocked when not
logged in. When logged in, I can use those actions.

Thank you very much, both of you. It's still weird about the error
with the auth-component and the isAuthorized() function, but as it now
works I will go deeper into the code of the Auth component later.

If anyone has an explanation for this, it would be great to discuss
it!

Again, thank you very much, that saved me a lot of time!

Regards,

DD



On 17 Apr., 16:03, stork lubomir.st...@gmail.com wrote:
  $this-Auth-authorize = 'controllers';

  $this-Auth-authorize = array('Controller');

-- 
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 component WITHOUT ACL blocks every controller action

2012-04-17 Thread jeremyharris
Setting $this-Auth-authorize = array('Controller'); tells the 
AuthComponent where to run the `isAuthorized()` method, in this case, the 
Controller. You can find more info here:   
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorize
 

On Tuesday, April 17, 2012 2:45:56 PM UTC-7, DigitalDude wrote:

 Hey, 

 h as I changed the code to the snippet of stork, it gave me a ... 
 function isAuthorized() on a non-object (auth-component line 52). 

 When I added the code of luca capra, everything is working as 
 expected. All actions that are not allowed by $this-Auth-allow() 
 within beforeFilter-functions of my controllers are blocked when not 
 logged in. When logged in, I can use those actions. 

 Thank you very much, both of you. It's still weird about the error 
 with the auth-component and the isAuthorized() function, but as it now 
 works I will go deeper into the code of the Auth component later. 

 If anyone has an explanation for this, it would be great to discuss 
 it! 

 Again, thank you very much, that saved me a lot of time! 

 Regards, 

 DD 



 On 17 Apr., 16:03, stork lubomir.st...@gmail.com wrote: 
   $this-Auth-authorize = 'controllers'; 
  
   $this-Auth-authorize = array('Controller');

-- 
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: Where am I supposed to save additional PHP source files while I'm writing a new behavior

2012-04-17 Thread Daniel Baird
Thanks euromark and jeremy!

My behaviour is about handling clustering of map points, and my separate
files are for trialling different techniques.  So I think I'll go with the
lib technique initially, and once my users pick their preferred clustering
technique and I'm ready to clean it up and finish off testing, think about
writing it into a plugin.

Cheers

Daniel

On Wed, Apr 18, 2012 at 12:11 AM, jeremyharris funeralm...@gmail.comwrote:

 If it's more than two files (behavior + test case) it's worthwhile to
 point out that plugins are not only good for redistributing your code, but
 it's also good for packaging your tests and everything in a different repo
 that has its own history and that you can submodule via git. This assumes
 the libs are only specific to the behavior and their methods aren't used in
 other areas.

 Just a thought!


 On Monday, April 16, 2012 5:05:09 PM UTC-7, Daniel Baird wrote:


 Hi Cake dudes,

 I'm new to Cake, and I'm adding a behavior to a model.  I've done that by
 writing a PHP file that I save in the Behavior directory.

 Now I'm making that Behavior a bit more complicated, and I'd like to
 split some sections of code out into separate files.  This Behavior is
 pretty specific to my application, I can't imagine wanting to make it a
 redistributable plugin or anything.

 So here's my question: where's the recommended place to save those
 supporting files?  Can I just make a subdir or Behavior and save them all
 in there?  Or am I supposed to save my additional files into the Vendor dir
 or something like that.

 Thanks in advance

 Daniel

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




-- 
Daniel Baird
I've tried going to the XHTML bar / a few times, but it's always closed.

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


bug in CakeRequest?

2012-04-17 Thread lowpass
Using 2.1.1, but 2.0.6 is the same.

The names of my cached views look pretty strange:

en_archive_2_url_en_2farchive_2f2.php
en_archive_3_url_en_2farchive_2f3.php
en_archive_url_en_2farchive.php
en_contributors_2_url_en_2fcontributors_2f2.php
en_contributors_url_en_2fcontributors.php
en_masthead_url_en_2fmasthead.php
en_subscriptions_url_en_2fsubscriptions.php

I did some digging around in CacheHelper, then View, and finally ended
up at CakeRequest::_processGet()

if (ini_get('magic_quotes_gpc') === '1') {
$query = stripslashes_deep($_GET);
} else {
$query = $_GET;
}
unset($query['/' . str_replace('.', '_', urldecode($this-url))]);

I don't understand what that last line is for. $_GET looks like this:

array(
'url' = 'en/archive/3'
)

If I add a query string to the request, $query will now look like this:

array(
'url' = 'en/archive/3',
'foo' = 'bar'
)

The 'url' key, of course, is because of ModRewrite's magic. So what's
that unset trying to accomplish? The point of the method is to process
query string args and assign them to $this-query. So shouldn't it be
unset($query['url'])?

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