ACL page restriction
I want to use ACL such that the actions of a controller are limited to some users. I have 3 AROs group Administrator Addonly Readonly I want to create ACO so that Readonly users can visit only /index page of any controller, Addonly users cannot visit /edit and /delete, and Administrator can visit all of them That is Administrator - can access all pages Addonly - can access only /*/add and /*/index but not /*/edit/ * and /*/delete/* Readonly - can access only /*/index I have seen the cake's manual but it doesn't give the real example. So, please send me the sample code how I can do it... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Need some help with pagination in 1.2
Hi all, I need some help and advice with implementing pagination in 1.2 . I got the basic functionality working which means I have paginate() return the correct count of items of the first page and if change the URL to pass different page # and limit #, the page behaves as expected. What I am not sure about is how to get more control over the pagination behavior and make it do exactly what I want. Looking at the source code it seems like paginate() is taking its parameters from the URL in is various forms (params, URL and passedArgs) and it overrides anything else I can set (well, there is whitelist but I am not sure how to use it exactly and couldn't make it to work). I am looking for the proper way to do the following: 1. Validate the parameters passed to paginate(). For example having a max and min values that the limit parameter can have (to prevent just calling my page with huge limit numbers) or to prevent some field names as entries for being sorted by (currently, everything passed in the URL goes). 2. Gracefully ignore any fields that are passed as sort parameter and don't actually exists. So if a user enters some non existing field name in the URL, the page just ignores it and sorts the data by the default field instead of displaying an ugly error. 3. Have aliases for some fields to be used with the sort parameters. So if I need to sort by a field that is nested a level or two deep inside the model, I can just use something like sort:alias_name instead of writing the entire hierarchy for the required field. Where is the proper place to hook the above? What is the best way to achieve it and keep everything clean? On a related note, what could be the reason for $paginator-next('', null, null, null) not returning the correct URL for the next page? It just returns the same URL the page is on, without any parameters. Do I need to pass anything special to it? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Newbie to Cake - IIS5 problem
I seen loads of posts about the problems with IIS, but I didn't spot anything that relates exactly to my problem (so maybe it's not a cake problem - but IIS) - maybe there is an existing post - and I just don't know what to search for! (in which case I do apologise in advance) Basically, I can't run any rewrite dll's, so wanted to try the options without it I'm using php as ISAPI The only php settings I've changed are the extensionpath, and uncommented the extensions for mysql I've gone through the basic tutorial I'm using PHP 5 Cake 1.1.13.4450 So, to the problem By adding define ('SERVER_IIS', true); and define ('BASE_URL', env('SCRIPT_NAME').'?'); I can get http://localhost/cake/app/index.php?/posts/index working (and links from that page work also) but if i omit the '?', I just get page cannot be found I did try define ('BASE_URL', env('SCRIPT_NAME')); But if i omit the '?' in the url, I still get page cannot be found - it still shows the initial page if I put the '?' back in the url as before, but now links from that page don't work (the links miss the '?' out) Have I missed a setting from IIS or PHP that cake needs? Also, why do I have to put the 'app' part in also? - if I just use http://localhost/cake/index.php?/posts/index It stays on the home page --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Thank You for CakePHP
There's so much love put into the development of Cake, that anyone who uses it, cannot but love it! Thanks so much, Cake has been an eye- opener and is such a pleasure to work with! Gerben. On 18 mrt, 04:45, phirschybar [EMAIL PROTECTED] wrote: true that. On Mar 17, 2:38 pm, yolabingo [EMAIL PROTECTED] wrote: Ditto all above. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
cakephp and developer rates
might sounds like a stupid questions but... if cakephp is a rapid development framework (and it looks like), does it mean that developing a simple web app will cost less money? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: R: Format ID field throughout
Thanks for the tip, I have tried that and it worked. However I have now run into a new problem which is that the code now breaks the links. For example: The URL to edit a project is now: /projects/edit/FWL0001 which doesn''t work. I guess I need to reverse the transformation on any database queries, the logical place for this seems to be in beforeFind, but I can't seem to work out how to change the ID field back tot it's original number. Anyone got any ideas, or should I just give up on this method? Cheers Mike On Mar 17, 11:36 pm, Marco \(GMail\) [EMAIL PROTECTED] wrote: All ok but you must return $results ;-) function afterFind($results) { foreach ($results as $result_id = $result) { $results[$result_id]['Model']['id'] = 'FLW' . $result['Model'] ['id']; } return $results; // } -Messaggio originale- Da: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Per conto di djiize Inviato: sabato 17 marzo 2007 19.35 A: Cake PHP Oggetto: Re: Format ID field throughout try to play with the Model's function afterFind A quick try, in your model: function afterFind($results) { foreach ($results as $result_id = $result) { $results[$result_id]['Model']['id'] = 'FLW' . $result['Model'] ['id']; } } On 17 mar, 13:30, Mike Digital Egg [EMAIL PROTECTED] wrote: Hi, I am looking for the best way to format an ID field every time it appears, without having to specifcally tell it to. Let me explain a bit further: I have a table called Projects, each project has an ID (numeric auto increment) so a typical output from a db call would be: ID, Project Name, Owner, Created 1,My Project,Mike,14/03/2007 2,My Second Project,Nigel,16/03/2007 Idealy I would like to transform the ID field output to something like: FWL0001 FWL0002 I know this can be done easily in the view, but what if I could make the model output the ID in this format every time. I think this is possible in RoR but I'm not sure how to do it in Cake, is this what the 'behaviors' folder is for in the model folder? Any help would be appreciated. Cheers Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 and developer rates
I have always looked at it like this: You will pay more per hour for a good programmer (no matter the tools they are using). You will end up paying the same amount for a not-so-good programmer because they will take much longer to produce the same thing that the expensive (and hopefully, good) programmer just made. On Mar 18, 8:09 am, sixlaneve [EMAIL PROTECTED] wrote: might sounds like a stupid questions but... if cakephp is a rapid development framework (and it looks like), does it mean that developing a simple web app will cost less money? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 editor() and wysiwyg editor
I don't thnk either of those support ajax editor at the time. You might want to write a plugin for them. However, TinyMCE is quite heavy since it does a lot of checking and processing (its capabilities is really broad too). You might want to go for a the lite version of TinyMCE and put it in your AjaxEditor Helper. On Mar 16, 10:07 am, Cavallo [EMAIL PROTECTED] wrote: Hi Is possible to use in $ajax-editor() a wysiwyg (tinymce, FCK,...) ? And if it is then how ? It would be realy nice if this would be possible. Thanks Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 and developer rates
Walker's analysis makes sense. In economic terms: If by using a framework you are able to produce the same simple web app in less time, you may say that you have increased your productivity and as a consequence you are able to reduce your costs and increase your profit. It has nothing to do with the final price of the product you are selling. On Mar 18, 10:09 am, sixlaneve [EMAIL PROTECTED] wrote: might sounds like a stupid questions but... if cakephp is a rapid development framework (and it looks like), does it mean that developing a simple web app will cost less money? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: R: Format ID field throughout
you could have the after find create a format_id field on the fly and then you would still have the id field for linking and other work. Then you can use the format_id for display and the id for the 'work' Sam D On 3/18/07, Mike Digital Egg [EMAIL PROTECTED] wrote: Thanks for the tip, I have tried that and it worked. However I have now run into a new problem which is that the code now breaks the links. For example: The URL to edit a project is now: /projects/edit/FWL0001 which doesn''t work. I guess I need to reverse the transformation on any database queries, the logical place for this seems to be in beforeFind, but I can't seem to work out how to change the ID field back tot it's original number. Anyone got any ideas, or should I just give up on this method? Cheers Mike On Mar 17, 11:36 pm, Marco \(GMail\) [EMAIL PROTECTED] wrote: All ok but you must return $results ;-) function afterFind($results) { foreach ($results as $result_id = $result) { $results[$result_id]['Model']['id'] = 'FLW' . $result['Model'] ['id']; } return $results; // } -Messaggio originale- Da: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Per conto di djiize Inviato: sabato 17 marzo 2007 19.35 A: Cake PHP Oggetto: Re: Format ID field throughout try to play with the Model's function afterFind A quick try, in your model: function afterFind($results) { foreach ($results as $result_id = $result) { $results[$result_id]['Model']['id'] = 'FLW' . $result['Model'] ['id']; } } On 17 mar, 13:30, Mike Digital Egg [EMAIL PROTECTED] wrote: Hi, I am looking for the best way to format an ID field every time it appears, without having to specifcally tell it to. Let me explain a bit further: I have a table called Projects, each project has an ID (numeric auto increment) so a typical output from a db call would be: ID, Project Name, Owner, Created 1,My Project,Mike,14/03/2007 2,My Second Project,Nigel,16/03/2007 Idealy I would like to transform the ID field output to something like: FWL0001 FWL0002 I know this can be done easily in the view, but what if I could make the model output the ID in this format every time. I think this is possible in RoR but I'm not sure how to do it in Cake, is this what the 'behaviors' folder is for in the model folder? Any help would be appreciated. Cheers Mike -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 to dynamically display form fields client side
ajusx-observeField might be what you want. I use this to load form elements based on choices On 3/18/07, keymaster [EMAIL PROTECTED] wrote: In a view file I have a 'select' dropdown. Depending on the user selection, I want to display a different set of additional fields ... without refreshing the page. How is this done ? (being a js/Ajax newbie, I don't know where to start) ? Not looking for a solution, just a quick pointer to get going. Advice appreciated. -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Overriding foreign key conventions
Hi Bakers, i have a database table (table name: 'relations') which related to other tables via a foreign key (field name: related_table_id). I want, that whenever i fetch an entry from the table 'relation', the associated table entry will be fetched as well (like the posts and comments in the manual). The problem is, that I should name this field like related table name_id, but i have 7 different tables related to the table 'relation'. Do you have any idea, how could i solve this problem? Regards, Korcs --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Model::query() + Sanitize::sql() vs.DboMysql API
Hello, everybody! So I have what advantages of using of Model::query() + Sanitize::sql() instead of using DboMysql API? When I must use the first and when the second? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
saving sensitive data with md5
Hi - I'm using cake's MVC approach which works really great. I like the ability to use the MVC and save from the controller; it makes things nice and is very easy. I did run into a problem which I can't figure out, however. Let's say I want to save sensitive information like a password in the database. Currently, it appears cake will only let you save in clear text (won't let you hash) in the default MVC approach. Does anyone have a solution to the problem above - while still taking advantage of the elegant, automated MVC approach? It almost seems like I'm stuck with one or the other - kind of annoying. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
how to dynamically display form fields client side
In a view file I have a 'select' dropdown. Depending on the user selection, I want to display a different set of additional fields ... without refreshing the page. How is this done ? (being a js/Ajax newbie, I don't know where to start) ? Not looking for a solution, just a quick pointer to get going. Advice appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Unit Testing in 1.2
Hi guys, Does anyone know how to go about running a unit test case / suite in 1.2 . I can't seem to find the documentation anywhere about this. I have version 1.2 of cake now and have put some test code under /app/ tests/cases/controllers/my_controller.test.php How do I run it? Do I need to put SimpleTest lib somewhere? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Menu from database
There is no solution? Please, CakePHP seems very cool but this is a problem... L. LSL wrote: Thanks, I have tried this but without success. The excerption from app_controller.php: var $uses=array('MenuCategory'); function beforeFilter() { parent::beforeFilter(); $this-setMenuElement(); } function setLeftMenuElement() { $this-set('element_menu', $this-MenuCategory-genMenu()); } This gives PHP notice and error: Notice: Undefined property: IndexController::$MenuCategory in /var/www/ app/app_controller.php on line 48 Fatal error: Call to a member function genMenu() on a non-object in / var/www/app/app_controller.php on line 48 It seems like tne AppController don't know about MenuCategory... L. djiize wrote: you can do it in app_controller.php (copy it from cake folder to your app folder) in a beforeFilter function, add you $this-set(...) calls Caution: it'll be called for ALL controllers On 15 mar, 20:19, LSL [EMAIL PROTECTED] wrote: Maybe I was not really clear. The question is a bit different - how to make some $this-set('variable', ...) for every page? Should I call some method from every control? Or is there better way? L. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Menu from database
On Mar 18, 12:59 pm, LSL [EMAIL PROTECTED] wrote: There is no solution? Please, CakePHP seems very cool but this is a problem... There is a solution, but you are not providing enough information for us to help you solve it. Dijize was correct in his instructions provided to you, but something is going wrong with your code. I believe you have a misspelling or misstyped something, orI dunnobut from the code you gave us: This gives PHP notice and error: Notice: Undefined property: IndexController::$MenuCategory in /var/ www/ app/app_controller.php on line 48 Fatal error: Call to a member function genMenu() on a non-object in / var/www/app/app_controller.php on line 48 I would say that: 1. You're misusing the model because of the first error, remember it would be $this-MenuCategory-findAll(); 2. Also, you're calling genMenu incorrectly, possibly because of the first error. Do not start blaming the tool, until you have no proof it's not yourself to blame.you were complimenting cakePHP in your first post, don't turn back on that compliment just because you are frustrated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: saving sensitive data with md5
This is not a cakePHP problem so much as a programming issue. If you learn how to hash md5's using php, you'll be able to do them in cake. On Mar 18, 12:12 pm, billybob [EMAIL PROTECTED] wrote: Hi - I'm using cake's MVC approach which works really great. I like the ability to use the MVC and save from the controller; it makes things nice and is very easy. I did run into a problem which I can't figure out, however. Let's say I want to save sensitive information like a password in the database. Currently, it appears cake will only let you save in clear text (won't let you hash) in the default MVC approach. Does anyone have a solution to the problem above - while still taking advantage of the elegant, automated MVC approach? It almost seems like I'm stuck with one or the other - kind of annoying. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Unit Testing in 1.2
Maybe try DH's testing suite for Cake 1.2 ? http://cakebaker.42dh.com/2006/12/18/testing-with-cakephp-12-a-preview/ he's got instructions. On Mar 18, 12:58 pm, Dat Chu [EMAIL PROTECTED] wrote: Hi guys, Does anyone know how to go about running a unit test case / suite in 1.2 . I can't seem to find the documentation anywhere about this. I have version 1.2 of cake now and have put some test code under /app/ tests/cases/controllers/my_controller.test.php How do I run it? Do I need to put SimpleTest lib somewhere? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
ajax auto save?
Can anyone point me to some sample code that will use ajax to autosave a form periodically? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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::query() + Sanitize::sql() vs.DboMysql API
You should only run the first when the second will not do what you want. That said probably 90% of whatever you have to do should use the second. Sanitize is not needed as data and fields are escaped properly at the dbo level. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 auto save?
There is a nice JQuery plugin that does this: http://daemach.blogspot.com/2007/03/autosave-jquery-plugin.html You can probably convert the code to prototype if that is your library of choice. HTH, Ryan Rose http://www.digiwize.com On Mar 18, 3:11 pm, Uncle Bill [EMAIL PROTECTED] wrote: Can anyone point me to some sample code that will use ajax to autosave a form periodically? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: saving sensitive data with md5
Sure, use the beforeSave and beforeFind on the model side. class User extends AppModel { // ... function beforeSave() { if (isset($this-data[$this-name]['password'])) { $this-data[$this-name]['password'] = md5($this-data[$this-name]['password']); } return parent::beforeSave(); } function beforeFind($queryData) { if (isset($queryData[$this-name]['password'])) { $queryData[$this-name]['password'] = md5($this-data[$this-name]['password']); } return $queryData; } } This way when from your controller you are saving the model having the password field set, it will automatically hash it: $data = array( 'User' = array('user' = 'mariano', 'password' = 'password') ); $this-User-save($data); The same way when you are looking for a record if you set the password field as part of the data to be searched for, it will hash it: $conditions = array( 'User' = array('user' = 'mariano', 'password' = 'password') ); $result = $this-User-find($conditions); -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de billybob Enviado el: Domingo, 18 de Marzo de 2007 02:12 p.m. Para: Cake PHP Asunto: saving sensitive data with md5 I'm using cake's MVC approach which works really great. I like the ability to use the MVC and save from the controller; it makes things nice and is very easy. I did run into a problem which I can't figure out, however. Let's say I want to save sensitive information like a password in the database. Currently, it appears cake will only let you save in clear text (won't let you hash) in the default MVC approach. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Unit Testing in 1.2
1. Unzip simpletest at cake/vendors/simpletest (inside after installing you should see simple test files like unit_tester.php) 2. Set up your tests on app/tests inside the appropriate directory. As a guidance, you can set up your controller tests under app/tests/cases/controllers/. For example, let's assume you have a controller called Users like so: class UsersController extends AppController { var $name = 'Users'; var $uses = null; function index() { $this-set('title', $this-_getTitle()); } function _getTitle() { return 'Page Title'; } } And you want to test the method _getTitle() (I know, how lame is that) then set up a users_controller.test.php on app/tests/cases/controllers/ with the following: uses('controller' . DS . 'controller'); if (file_exists(APP . 'app_controller.php')) { require_once (APP . 'app_controller.php'); } else { class AppController extends Controller { } } require_once(APP . 'controllers' . DS . 'users_controller.php'); class UsersControllerTest extends UnitTestCase { function testGetTitle() { $controller = new UsersController(); $result = $controller-_getTitle(); $expected = 'Page Title'; $this-assertEqual($result, $expected); } } 3. Assuming your Cake application is hosted at http://localhost/cake, go to: http://localhost/cake/test.php And click on App Test Cases. You'll see a test listed there called controllers/users_controller.test.php. Click on it and you'll see your test succeed :) That's it in a nutshell, basically. If you checkout Cake 1.2 SVN you can see we've started building some tests in Cake's core and you can certainly learn from them. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Dat Chu Enviado el: Domingo, 18 de Marzo de 2007 02:59 p.m. Para: Cake PHP Asunto: Unit Testing in 1.2 Does anyone know how to go about running a unit test case / suite in 1.2 . I can't seem to find the documentation anywhere about this. I have version 1.2 of cake now and have put some test code under /app/ tests/cases/controllers/my_controller.test.php --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
newbie. add inside a view
sorry for this very newbie questions, but between bakery, here and google, still I haven't got an answer. let's take the blog tutorial in cakephp manual as example... when I look at one of the post, how can I add a field for adding comments, and how to display existing comments? Any examples? Tutorials? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Unit Testing in 1.2
You can simplify the test a lot, just put it like (see the use of loadController() instead of all the junk I've just given you): uses('controller' . DS . 'controller'); loadController('Users'); class UsersControllerTest extends UnitTestCase { function testGetTitle() { $controller = new UsersController(); $result = $controller-_getTitle(); $expected = 'Page Title'; $this-assertEqual($result, $expected); } } -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog: http://www.MarianoIglesias.com.ar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: Menu from database
I'm really sorry that it seems I think CakePHP is wrong. I know that it is probably my fault that I can't use it the right way. As I have written in my first post - It's a great piece of SW. Now I'm a bit closer to the problem. It seems that the error is present only when I use controller without model ($uses=array() or $uses=null). Other controllers seems OK and rendering my menus the right way. I have written miniapp to demonstrate that: config/routes.php: ... $Route-connect('/', array('controller' = 'index', 'action' = 'index')); ... controllers/index_controller.php class IndexController extends AppController { var $name='Index'; var $uses=null; function index() { } } controllers/menu_items_controller.php: class MenuItemsController extends AppController { var $scaffold; } models/menu_item.php: class MenuItem extends AppModel { var $name='MenuItem'; } views/elements/menu.thtml: preMenu element: ?php print_r($menuElement);?/pre views/layouts/default.thtml: html body p?=$this-renderElement('menu')?/p ?=$content_for_layout? /body /html app_controller.php: class AppController extends Controller { var $uses=array('MenuItem'); function beforeFilter() { parent::beforeFilter(); $this-set('menuElement', $this-MenuItem-findAll()); } } I don't know how to deal with this. Is CakPHP misused or is it some error? Thanks (and once again sorry). Lukas Walker Hamilton wrote: Do not start blaming the tool, until you have no proof it's not yourself to blame.you were complimenting cakePHP in your first post, don't turn back on that compliment just because you are frustrated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Conditional Ajax div update?
Hello, i'm trying to implement a login system using ajax, but i've come across a problem. I want to do it so that when a login is incorrect, then only a small div below the form is shown with invalid login but when the login is correct i want to update a different div with the user's account options. Any ideas or examples on how can i do this? I'm kind of new to ajax but looked for examples and it seems all just update one or multiple divs simultaneously. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: ODBC support
I succeeded connecting cakephp with adodb: ?php class DATABASE_CONFIG { var $default = array('driver' = 'adodb', //use adodb 'connect' = 'odbc', //adodb support not only odbc, but also mysql, ldap, etc) 'host' = 'mysql', //mysql is my dns name that i defined in ODBC Control Panel 'login' = 'root', 'password' = '', 'database' = 'cool', // you don't need this, because if you define dns in ODBC Control Panel you define also the database name 'prefix' = ''); } ? Ok, odbc connection is defined. CakePHP is connected to ODBC. But now I get the error Warning: Invalid argument supplied for foreach() in E:\xampp\htdocs \cake\cake\libs\model\dbo\dbo_adodb.php on line 222 This line should actually return the column name. I'm looking now into the code of ADODB. If it takes too long, to get ODBC works on CakePHP, I'm thinking to use another Framework, or may be Rails or Java. Can somebody help me NOT MOVING to another language or framework? Jon On 17 Mrz., 23:37, jon [EMAIL PROTECTED] wrote: Ok, I've recognize thatODBCin CakePHP is experimental. I tried to use adodb. Should I set something before, so adodb refers to myodbcsettings? I don't find adodb when I run bake.php and set the database. Should I set it manually in Code? Jon On 16 Mrz., 18:10, nate [EMAIL PROTECTED] wrote: Hey Jon, the nativeODBCdriver is still experimental... at best. It is recommended that you use the ADOdb driver forODBC. On Mar 16, 12:28 pm, jon [EMAIL PROTECTED] wrote: Hi, I'm trying now to useODBCin CakePHP. When I generated the Model, I got always some warnings formodbcfunction. Does CakePHP support alreadyODBC? FYI: I'm using Adabas D. Jon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
newbie question, populate drop down box from other parent table
I have 2 simple tables Groups [id, name] Users [id, name, group_id] when admin create a new user , he has to fill in the group I try to use selectTag() to build the Group drop down in User page, but I have no idea how could cake do that for me ? any snipper code / direction will help Thanks Calvin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: saving sensitive data with md5
No need to jump up and down proclaiming the original message poster to be incompetant while trumpeting CakePHP's virtues. Why don't you learn from Mariano and provide a solution. You've done it in a few message threads today, and it's not productive at all. On Mar 19, 5:30 am, Walker Hamilton [EMAIL PROTECTED] wrote: This is not a cakePHP problem so much as a programming issue. If you learn how to hash md5's using php, you'll be able to do them in cake. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: is acl.php not working?
Having the same problem. Looked everything over don't know what the problem could be. - Jon On Mar 15, 3:24 pm, rtconner [EMAIL PROTECTED] wrote: I cannot getacl.php to work in 1.2. I've tried the latest stable build and the latest nightly build. Both give me the same error --phpacl.php PHP Fatal error: Class 'Dispatcher' not found in [path]\cake\libs \error.php on line 58 Fatal error: Class 'Dispatcher' not found in [path]\cake\libs \error.php on line 58 - I don't even care if I can use this script or not, but I need to create theACLtables so I can start to use them. If this is not working, does anyone know of another way to create the tables in my database, and then set cake up so it knows to use my db for Access control. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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: saving sensitive data with md5
Will that re-hash the MD5'ed password field when editing and then saving again? I do this at the moment: In model: function beforeSave() { $password = isset($this-data['User']['password'])?$this-data['User'] ['password']:; if (!preg_match(VALID_MD5,$password) { $this-data['User']['password'] = md5($this-data['User'] ['password']); } return true; } In bootstrap: define('VALID_MD5','/^[a-fA-F0-9]{32}$/i'); On Mar 19, 6:40 am, Mariano Iglesias [EMAIL PROTECTED] wrote: Sure, use the beforeSave and beforeFind on the model side. class User extends AppModel { // ... function beforeSave() { if (isset($this-data[$this-name]['password'])) { $this-data[$this-name]['password'] = md5($this-data[$this-name]['password']); } return parent::beforeSave(); } function beforeFind($queryData) { if (isset($queryData[$this-name]['password'])) { $queryData[$this-name]['password'] = md5($this-data[$this-name]['password']); } return $queryData; } } This way when from your controller you are saving the model having the password field set, it will automatically hash it: $data = array( 'User' = array('user' = 'mariano', 'password' = 'password') ); $this-User-save($data); The same way when you are looking for a record if you set the password field as part of the data to be searched for, it will hash it: $conditions = array( 'User' = array('user' = 'mariano', 'password' = 'password') ); $result = $this-User-find($conditions); -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! blog:http://www.MarianoIglesias.com.ar -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de billybob Enviado el: Domingo, 18 de Marzo de 2007 02:12 p.m. Para: Cake PHP Asunto: saving sensitive data with md5 I'm using cake's MVC approach which works really great. I like the ability to use the MVC and save from the controller; it makes things nice and is very easy. I did run into a problem which I can't figure out, however. Let's say I want to save sensitive information like a password in the database. Currently, it appears cake will only let you save in clear text (won't let you hash) in the default MVC approach. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Introducing myself
I am new to this group and would like to introduce myself. I am the President of US AngelInvestors,an angel investor group in Silicon Valley,and also founder of Bay Area Startup Network a networking group in the Bay Area. I invite you to join my network on LinkedIn, which I use much principally. I am always looking at increasing my contacts, and welcome new deals. You can connect with me on Linked In (linkedindot com) where I have about 3000 contacts by sending an invitation to John Ricci using the following e-mail johnr at basn dot org. I am also a member of XING/OpenBC and Viadeo where I can be invited using the same name and e-mail Regards - John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---