Re: i have three queries

2009-12-27 Thread John Andersen
ad 1) Sorry, it was $form-submit, not $form-input :)

ad 3) I still think you should look at the env() global function, as
they do specify, why it is better to use than to rely on $_SERVER.

Enjoy,
   John

On Dec 27, 3:25 am, engine radicalet...@gmail.com wrote:
 thanks for your replies

 1. John doing $form-input with type = submit dont work...it actually
 creates a textarea instead of submit button whereas it properly renders
 select/password input with proper type setting i dont know in case of
 submit why its not working.

 2. without using helpers those hyperlinks and forms do not point to the
 single location thats what the problem is

 3. thanks kdubya might be $this-webroot this upon concatenation with
 $_SERVER['HTTP_HOST'] can give me right output



 John Andersen-6 wrote:

  1) Use the $form-input with type = submit to create the submit button
  and add your div = false to ensure the div is not created. Then use
  $form-end() without the submit parameter, just to close the form.

  2) If you don't want to use form or html helpers, just write the HTML
  yourself :)

  3) Look at the global function env() at:
 http://book.cakephp.org/view/121/Global-Functions#env-701
  Probably there you can find the answer.

  Enjoy,
     John

  On Dec 26, 7:14 am, engine radicalet...@gmail.com wrote:
  please help me with the following problems i often come across them

  1. $form-end(submit) doesnt have div = false attribute that div is
  making my form look ugly in IE, how to get rid of that div

  2. is there any way to create links and form without using those helpers
  that always points to the right controller and action.

  3. What is cakephp global variable for current web root url for example
  if
  my cake  is running in subfolder called cake inside htdocs of XAMPP and i
  use to access the site withhttp://localhost/cake/

  what variable can return http://localhost/cake/;

  I am grateful to any helping words...
  thanks

  -http://www.libmaker.com/sellbooks online  |
   http://www.milestree.com/
  Web/tech news  |  http://www.hiclicks.com/seoand usability service
  --
  View this message in
  context:http://old.nabble.com/i-have-three-queries-tp26925398p26925398.html
  Sent from the CakePHP mailing list archive at Nabble.com.

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

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

 -http://www.libmaker.com/sell books online  |  http://www.milestree.com/
 Web/tech news  |  http://www.hiclicks.com/seo and usability service
 --
 View this message in 
 context:http://old.nabble.com/i-have-three-queries-tp26925398p26931341.html
 Sent from the CakePHP mailing list archive at Nabble.com.

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

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


Re: testing a controller's add action

2009-12-27 Thread Lorenzo Bettini
Yes, it uses a redirect (inside the method), but the problem comes up 
before reaching a possible redirect: empty($this-data) is true when 
entering the method itself...

As for the redirect I think I already handle that with

class TestPapers extends PapersController {
var $autoRender = false;

 function redirect($url, $status = null, $exit = true) {
 $this-redirectUrl = $url;
 }

but the problem, as I said, it's that no data is passed to the action...

John Andersen wrote:
 Is your add action using a redirect?
John
 
 On Dec 26, 6:48 pm, Lorenzo Bettini bett...@dsi.unifi.it wrote:
 Hi

 I already managed to test some actions of controllers using testAction
 method; these were actions that were expected to return something.

 Now, I'd like to test an add action of the controller, thus, following
 the book I did:

 $data = array(
 'Paper' = array(
 'title' = 'MyTitle',
 'year' = 2009
 ));
 debug($data);
 $results = $this-testAction(
 array(
 'controller' = 'papers',
 'action' = 'admin_add',
 ),
 array('data' = $data, 'method' = 'post')
 );

 but when executing the controller's action (I tried that with the
 debug), the $this-data is always empty and uninitialized...  where am I
 going wrong?

 thanks in advance
 Lorenzo



-- 
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com

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

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


Re: i have three queries

2009-12-27 Thread engine

thanks John $form-submit really worked...i will check list of variables from
env...thanks once again

John Andersen-6 wrote:
 
 ad 1) Sorry, it was $form-submit, not $form-input :)
 
 ad 3) I still think you should look at the env() global function, as
 they do specify, why it is better to use than to rely on $_SERVER.
 
 Enjoy,
John
 
 On Dec 27, 3:25 am, engine radicalet...@gmail.com wrote:
 thanks for your replies

 1. John doing $form-input with type = submit dont work...it actually
 creates a textarea instead of submit button whereas it properly renders
 select/password input with proper type setting i dont know in case of
 submit why its not working.

 2. without using helpers those hyperlinks and forms do not point to the
 single location thats what the problem is

 3. thanks kdubya might be $this-webroot this upon concatenation with
 $_SERVER['HTTP_HOST'] can give me right output



 John Andersen-6 wrote:

  1) Use the $form-input with type = submit to create the submit button
  and add your div = false to ensure the div is not created. Then use
  $form-end() without the submit parameter, just to close the form.

  2) If you don't want to use form or html helpers, just write the HTML
  yourself :)

  3) Look at the global function env() at:
 http://book.cakephp.org/view/121/Global-Functions#env-701
  Probably there you can find the answer.

  Enjoy,
     John

  On Dec 26, 7:14 am, engine radicalet...@gmail.com wrote:
  please help me with the following problems i often come across them

  1. $form-end(submit) doesnt have div = false attribute that div
 is
  making my form look ugly in IE, how to get rid of that div

  2. is there any way to create links and form without using those
 helpers
  that always points to the right controller and action.

  3. What is cakephp global variable for current web root url for
 example
  if
  my cake  is running in subfolder called cake inside htdocs of XAMPP
 and i
  use to access the site withhttp://localhost/cake/

  what variable can return http://localhost/cake/;

  I am grateful to any helping words...
  thanks

  -http://www.libmaker.com/sellbooks online  |
   http://www.milestree.com/
  Web/tech news  |  http://www.hiclicks.com/seoand usability service
  --
  View this message in
 
 context:http://old.nabble.com/i-have-three-queries-tp26925398p26925398.html
  Sent from the CakePHP mailing list archive at Nabble.com.

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

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

 -http://www.libmaker.com/sell books online  |
  http://www.milestree.com/
 Web/tech news  |  http://www.hiclicks.com/seo and usability service
 --
 View this message in
 context:http://old.nabble.com/i-have-three-queries-tp26925398p26931341.html
 Sent from the CakePHP mailing list archive at Nabble.com.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en
 
 


-
http://www.libmaker.com/ sell books online  |  http://www.milestree.com/
Web/tech news  |  http://www.hiclicks.com/ seo and usability service 
-- 
View this message in context: 
http://old.nabble.com/i-have-three-queries-tp26925398p26932856.html
Sent from the CakePHP mailing list archive at Nabble.com.

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

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


Re: i have three queries

2009-12-27 Thread Walther
Hi

1. $form-end(array('label' = 'Submit', 'div' = false)) - It helps
to look at the documentation sometimes.

2. Not really, but you can do Router::url(array('controller' =
'...')) anywhere in your application to get the correct url.

3. Router::url('/', true);

On Dec 26, 7:14 am, engine radicalet...@gmail.com wrote:
 please help me with the following problems i often come across them

 1. $form-end(submit) doesnt have div = false attribute that div is
 making my form look ugly in IE, how to get rid of that div

 2. is there any way to create links and form without using those helpers
 that always points to the right controller and action.

 3. What is cakephp global variable for current web root url for example if
 my cake  is running in subfolder called cake inside htdocs of XAMPP and i
 use to access the site withhttp://localhost/cake/

 what variable can return http://localhost/cake/;

 I am grateful to any helping words...
 thanks

 -http://www.libmaker.com/sell books online  |  http://www.milestree.com/
 Web/tech news  |  http://www.hiclicks.com/seo and usability service
 --
 View this message in 
 context:http://old.nabble.com/i-have-three-queries-tp26925398p26925398.html
 Sent from the CakePHP mailing list archive at Nabble.com.

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

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


Re: Localization for Model validation messages

2009-12-27 Thread Walther
Check here: http://book.cakephp.org/view/133/Multiple-Rules-per-Field
(at the bottom) for the recommended method of doing it.

On Dec 26, 10:55 am, si-mon sijumo...@gmail.com wrote:
 Thanks John. Thanks Euromark. Really helpful...

 On Dec 25, 9:55 pm, John Andersen j.andersen...@gmail.com wrote:

  I can't agree, as I prefer to have the model be concerned with model
  things (data, retrieval, saving, validation, etc.), and the view
  concerned with presenting the data and the related error messages,
  including the localization!

  Usually I only have one form in which data for a specific model is
  entered, so the adding a new rule and forgetting to add the
  localization in the form, does not become an issue! Also, a change is
  always planned - what to add, what to change, etc.

  But each of us use the technique which we are comfortable with :)
     John

  On Dec 25, 4:32 pm, euromark dereurom...@googlemail.com wrote:

   i dont like the form-way
   it is quite redundant - if you add a new rule you might forget
   one or two views which would not be helpful

   having it all together in the model is in my opinion a cleaner
   approach :)

   On 25 Dez., 12:32, John Andersen j.andersen...@gmail.com wrote:

Use the form helpers option for the input fields! Look 
at:http://book.cakephp.org/view/198/options-error

Thus you localize in the view - example:

echo $form-input(
   'email',
   array(
      'label' = __('e-mail address',true),
      'error' = array('users_email_rule' = __
('users_email_rule',true) )
   )
) ;

Observe the 'error' option! Here I use it to convert the validation
message into the language that the user is viewing the form.

Enjoy,
   John

On Dec 24, 7:39 pm, si-mon sijumo...@gmail.com wrote:

 Hi All,

 Is there a way to use localization for validation messages in the
 Model $validate array?

 eg: $validate = array ( 'name' = array('rule'='notEmpty',
 'message'='Name is mandatory' ));

 I need the message 'Name is mandatory' in five different languages.

 In other words: How can we use functions like __('message') like
 functions in model?

 Please help me. Thanks.

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

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


Re: Pagination with 2nd order recursive conditions filter

2009-12-27 Thread thomaus
Hi John,

Thanks for helping but still no luck. I get this (expected) error :

Warning (512): SQL Error: 1054: Unknown column 'User.parent_id' in
'where clause' [/Users/thomas/Sites/Cake/1.2.5/cake/libs/model/
datasources/dbo_source.php, line 525]

Query: SELECT COUNT(*) AS `count` FROM `campaigns` AS `Campaign` LEFT
JOIN `user_campaigns` AS `UserCampaign` ON (`Campaign`.`id` =
`UserCampaign`.`id`) WHERE `User`.`parent_id` = 204

Query: SELECT `Campaign`.`id`, `Campaign`.`name`,
`Campaign`.`description`, `Campaign`.`active` FROM `campaigns` AS
`Campaign` LEFT JOIN `user_campaigns` AS `UserCampaign` ON
(`Campaign`.`id` = `UserCampaign`.`id`) WHERE `User`.`parent_id` = 204
ORDER BY `Campaign`.`id` asc LIMIT 20


The real problem is : is it possible with Cake to filter a model with
a condition under a related model, and how to do that?



On Dec 26, 5:15 pm, John Andersen j.andersen...@gmail.com wrote:
 Try to just specify:

 $this-Campaign-recursive = 3;
 $filter = array('User.parent_id = ' = 204); /* Changed this */
 $campaigns = $this-paginate(null, $filter);

 Enjoy,
    John

 On Dec 19, 3:43 am,thomaustho...@saimiris.com wrote:

  Hi,

  I have to do a 2nd order filter por pagination.

  My pagination var:

  var $paginate = array(
          'limit' = 10,
          'fields' = array('Campaign.id', 'Campaign.name',
  'Campaign.description'),
          'order' = array(
              'Campaign.id' = 'asc'),
  );

  My controller function:

  $this-Campaign-recursive = 2;
  $filter = array('UserCampaign.id = ' = 2);
  $campaigns = $this-paginate(null, $filter);
  pr($campaigns);

  This works great and outputs this:

  Array
  (
      [0] = Array
          (
              [Campaign] = Array
                  (
                      [id] = 2
                      [name] = Newsletter
                      [description] = Newsletter campaign
                  )

              [UserCampaign] = Array
                  (
                      [id] = 2
                      [user_id] = 204
                      [campaign_id] = 2
                      [User] = Array
                          (
                              [id] = 204
                              [parent_id] = 0
                              [username] = barça
                              [fname] = Thomas
                          )

                      [Campaign] = Array
                          (
                              [0] = Array
                                  (
                                      [id] = 2
                                      [name] = Newsletter
                                      [description] = Newsletter
  campaign
                                      [active] =
                                      [created] =
                                      [modified] =
                                  )

                          )

                  )

          )

  )

  Now the problem is that I want and I need to write something like
  this:

  $this-Campaign-recursive = 3;
  $filter = array('UserCampaign.User.parent_id = ' = 204);
  $campaigns = $this-paginate(null, $filter);
  pr($campaigns);

  and this outputs:

  Warning (512): SQL Error: 1054: Unknown column
  'UserCampaign.User.parent_id' in 'where clause'

  which is only logical.

  But then my question is : what do I have to write to get a pagination
  with a condition based on 2nd recursive order???

  Thanks in advance.

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

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


Visualize diff output

2009-12-27 Thread HK
Hello there,

I want to build a cake app for translating text documents. What I want
is to be able to upload the translation if a text file and view
something a diff command output.

Since users don't know/care about diff's output I want to visulize the
output as svn through eclipse does or as source safe does.

Is there a helper or something, or a php class?

thanks

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

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


Re: testing a controller's add action

2009-12-27 Thread nurvzy
testAction will not use your TestPapers class that I assume you've
created in your test.  It will faulter at the redirect.  I'm not sure
why $this-data is not being populated by testAction in your admin_add
action as you seem to be doing it correctly..  How do you know its not
being populated?  What errors are you getting?

while testAction has a lot going for it, its limitations prevent me
from using it, among other things test that use testAction wont run in
the CLI testsuite cake shell.  So I avoid using it and just test my
controllers the hard way As pointed out by Mark Story:

http://www.mark-story.com/posts/view/testing-cakephp-controllers-the-hard-way

In short, you have the right thing going with your TestPapers, simply
instantiate it into a Papers var it within your TestCase and call
functions on it directly.  This way you can just set $this-Papers-
data directly and then call $this-Papers-admin_add();  Since you've
overwritten redirect in your TestPapers class you'll be able to assert
the correct redirects.


Follow Mark's guide (link above), as he walks you through testing the
admin_edit of a posts controller.  You'll almost certainly be able to
copy/paste most of it.  Although I suggest Mocking the Auth Component
instead of writing Auth.user to the Session.   Just my opinion.

Hope that helps,
Nick
http://www.webtechnick.com

On Dec 27, 2:28 am, Lorenzo Bettini bett...@dsi.unifi.it wrote:
 Yes, it uses a redirect (inside the method), but the problem comes up
 before reaching a possible redirect: empty($this-data) is true when
 entering the method itself...

 As for the redirect I think I already handle that with

 class TestPapers extends PapersController {
         var $autoRender = false;

      function redirect($url, $status = null, $exit = true) {
          $this-redirectUrl = $url;
      }

 but the problem, as I said, it's that no data is passed to the action...



 John Andersen wrote:
  Is your add action using a redirect?
     John

  On Dec 26, 6:48 pm, Lorenzo Bettini bett...@dsi.unifi.it wrote:
  Hi

  I already managed to test some actions of controllers using testAction
  method; these were actions that were expected to return something.

  Now, I'd like to test an add action of the controller, thus, following
  the book I did:

  $data = array(
          'Paper' = array(
                  'title' = 'MyTitle',
                  'year' = 2009
          ));
  debug($data);
  $results = $this-testAction(
          array(
          'controller' = 'papers',
          'action' = 'admin_add',
          ),
          array('data' = $data, 'method' = 'post')
          );

  but when executing the controller's action (I tried that with the
  debug), the $this-data is always empty and uninitialized...  where am I
  going wrong?

  thanks in advance
          Lorenzo

 --
 Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
 HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com
 BLOGS:http://tronprog.blogspot.com http://longlivemusic.blogspot.com

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

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


Re: Problem Prototype / jQuery

2009-12-27 Thread Dr. Loboto
Ask on JavaScript forums. It is not Cake-related problem.

On Dec 26, 12:58 pm, thomaus tho...@saimiris.com wrote:
 Hi,

 I tried it this way:

         ?php
         echo $javascript-link('/js/scriptaculous-js-1.8.3/lib/prototype');
        echo $javascript-link('/js/scriptaculous-js-1.8.3/src/
 scriptaculous');

         // jQuery
         echo $javascript-link('/js/jquery-1.3.2.min.js');
         ?

         script
      jQuery.noConflict();

      // Put all your code in your document ready area
      jQuery(document).ready(function($){
        // Do jQuery stuff using $
        $(div).hide();
      });

      // Use Prototype with $(...), etc.
      $('someid').hide();
    /script

         ?php
         // jQuery configuration
         echo $javascript-link('/js/simpla.jquery.configuration.js');
         // Facebox jQuery Plugin
         echo $javascript-link('/js/facebox.js');
         // jQuery WYSIWYG Plugin
         echo $javascript-link('/js/jquery.wysiwyg.js');
         ?

         !-- Internet Explorer .png-fix --
         !--[if IE 6]
                 ?php echo $javascript-link('/js/DD_belatedPNG_0.0.7a.js'); 
 ?
                 script type=text/javascript
                         DD_belatedPNG.fix('.png_bg, img, li');
                 /script
         ![endif]--

 I also tried to put it just after the simpla.jquery.configuration and
 still, it doesn't work.

 Thanks,

 On Dec 25, 12:58 pm, Dr. Loboto drlob...@gmail.com wrote:



  jQuery.noConflict() must be called immediately after initial jQuery
  include.

  On Dec 24, 11:08 pm,thomaustho...@saimiris.com wrote:

   Hi there,

   I have an issue using both Prototype and jQuery in my app.

   Here is my JS includes in my head folder:

           ?php
           echo 
   $javascript-link('/js/scriptaculous-js-1.8.3/lib/prototype');
           echo $javascript-link('/js/scriptaculous-js-1.8.3/src/
   scriptaculous');

           // jQuery
           echo $javascript-link('/js/jquery-1.3.2.min.js');

           // jQuery configuration
           echo $javascript-link('/js/simpla.jquery.configuration.js');
           // Facebox jQuery Plugin
           echo $javascript-link('/js/facebox.js');
           // jQuery WYSIWYG Plugin
           echo $javascript-link('/js/jquery.wysiwyg.js');
           ?

           !-- Internet Explorer .png-fix --
           !--[if IE 6]
                   ?php echo 
   $javascript-link('/js/DD_belatedPNG_0.0.7a.js'); ?
                   script type=text/javascript
                           DD_belatedPNG.fix('.png_bg, img, li');
                   /script
           ![endif]--

   script
        jQuery.noConflict();

        // Put all your code in your document ready area
        jQuery(document).ready(function($){
          // Do jQuery stuff using $
          $(div).hide();
          alert('jquery');
        });

        // Use Prototype with $(...), etc.
        $('someid').hide();
      /script

   and no luck : when I comment jQuery, my Prototype paginator works, and
   when I comment Prototype, my jQuery tabs don't work. Can someone help
   me

   I also tried the other solution commented here 
   :http://docs.jquery.com/Using_jQuery_with_Other_Librariesbyputting
   jQuery include before the Prototype include and... no luck.

   Just a thought : why on Earth Cake Ajax helper is based on the old
   fashioned Prototype and not on the great jQuery???

   Thanks.

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

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


Re: accents in html forms

2009-12-27 Thread Kees de Bruin
On 26 dec 2009, at 11:20, Lorenzo Bettini wrote:

 and, most important, all my tables were sweedish encoding (why that's 
 the default I wonder :) so I altered all the tables with

That is because MySQL was created by a Swedish company.

-- 
Kees de Bruin

A vacation is having nothing to do and all day to do it in

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

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


Re: Test suite deleting tables then complaining that they're missing!

2009-12-27 Thread ygaras



ianmcn wrote:
 
 I'm just trying to get into TDD with Cake. I admit, I'm totally new to
 TDD so am probably doing something totally wrong!
 
 I have setup all the fixtures with default records defined (rather
 than importing data - I don't want to import data because A: there's
 too much of it, and B: there are some enum fields which the test suite
 doesn't support, so by defining the data in the fixtures I can skip
 these fields or treat them as strings). All I'm trying to do at the
 moment is successfully run the testAvailabilityInstance, before
 creating my own tests. This is what happens:
 
 Empty structure created on test database (correctly defined in config/
 database.php)
 Run the test on first model: Success
 Run the test on the second model (dependant on the first one): Error,
 table for first model doesn't exist!
 
 I look in the database, and sure enough the table for the first model
 is gone! This happens whether I run the tests one by one or all at
 once. Can anyone give me any pointers into what I am looking for?
 
 Thanks
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en
 
 
I was facing the same issue you are facing and I am glade I found that
someone else was facing the same problem. I do not know if this will be
helpful or not, but i posted possible solution on my 
http://www.irisoftonline.com/cakephp-testing-errors-database-table-not-found-enum-type-fields-ignored
blog .
-- 
View this message in context: 
http://old.nabble.com/Test-suite-deleting-tables-then-complaining-that-they%27re-missing%21-tp26748096p26933933.html
Sent from the CakePHP mailing list archive at Nabble.com.

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

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


Re: Problem Prototype / jQuery

2009-12-27 Thread robustsolution
the order I use is
1)prototype
2)scriptaculous
3)jquery

then in the first line of the body section I use

script type=text/javascript$j = jQuery.noConflict();/script
and It works...
so for non jQuery plugins I use either the $j keyword or the jQuery
keyword
for jQuery plugins you may use the the $ keyword as it is encasulated
inside a function

happy new year

On Dec 27, 3:34 pm, Dr. Loboto drlob...@gmail.com wrote:
 Ask on JavaScript forums. It is not Cake-related problem.

 On Dec 26, 12:58 pm, thomaus tho...@saimiris.com wrote:

  Hi,

  I tried it this way:

          ?php
          echo $javascript-link('/js/scriptaculous-js-1.8.3/lib/prototype');
         echo $javascript-link('/js/scriptaculous-js-1.8.3/src/
  scriptaculous');

          // jQuery
          echo $javascript-link('/js/jquery-1.3.2.min.js');
          ?

          script
       jQuery.noConflict();

       // Put all your code in your document ready area
       jQuery(document).ready(function($){
         // Do jQuery stuff using $
         $(div).hide();
       });

       // Use Prototype with $(...), etc.
       $('someid').hide();
     /script

          ?php
          // jQuery configuration
          echo $javascript-link('/js/simpla.jquery.configuration.js');
          // Facebox jQuery Plugin
          echo $javascript-link('/js/facebox.js');
          // jQuery WYSIWYG Plugin
          echo $javascript-link('/js/jquery.wysiwyg.js');
          ?

          !-- Internet Explorer .png-fix --
          !--[if IE 6]
                  ?php echo 
  $javascript-link('/js/DD_belatedPNG_0.0.7a.js'); ?
                  script type=text/javascript
                          DD_belatedPNG.fix('.png_bg, img, li');
                  /script
          ![endif]--

  I also tried to put it just after the simpla.jquery.configuration and
  still, it doesn't work.

  Thanks,

  On Dec 25, 12:58 pm, Dr. Loboto drlob...@gmail.com wrote:

   jQuery.noConflict() must be called immediately after initial jQuery
   include.

   On Dec 24, 11:08 pm,thomaustho...@saimiris.com wrote:

Hi there,

I have an issue using both Prototype and jQuery in my app.

Here is my JS includes in my head folder:

        ?php
        echo 
$javascript-link('/js/scriptaculous-js-1.8.3/lib/prototype');
        echo $javascript-link('/js/scriptaculous-js-1.8.3/src/
scriptaculous');

        // jQuery
        echo $javascript-link('/js/jquery-1.3.2.min.js');

        // jQuery configuration
        echo $javascript-link('/js/simpla.jquery.configuration.js');
        // Facebox jQuery Plugin
        echo $javascript-link('/js/facebox.js');
        // jQuery WYSIWYG Plugin
        echo $javascript-link('/js/jquery.wysiwyg.js');
        ?

        !-- Internet Explorer .png-fix --
        !--[if IE 6]
                ?php echo 
$javascript-link('/js/DD_belatedPNG_0.0.7a.js'); ?
                script type=text/javascript
                        DD_belatedPNG.fix('.png_bg, img, li');
                /script
        ![endif]--

script
     jQuery.noConflict();

     // Put all your code in your document ready area
     jQuery(document).ready(function($){
       // Do jQuery stuff using $
       $(div).hide();
       alert('jquery');
     });

     // Use Prototype with $(...), etc.
     $('someid').hide();
   /script

and no luck : when I comment jQuery, my Prototype paginator works, and
when I comment Prototype, my jQuery tabs don't work. Can someone help
me

I also tried the other solution commented here 
:http://docs.jquery.com/Using_jQuery_with_Other_Librariesbyputting
jQuery include before the Prototype include and... no luck.

Just a thought : why on Earth Cake Ajax helper is based on the old
fashioned Prototype and not on the great jQuery???

Thanks.

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

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


Re: accents in html forms

2009-12-27 Thread euromark
the current versions of WAMP for example use utf8 now as default
i just had to install the wampserver for a neighbor today and relized
it


On 27 Dez., 10:52, Kees de Bruin halfje.br...@gmail.com wrote:
 On 26 dec 2009, at 11:20, Lorenzo Bettini wrote:

  and, most important, all my tables were sweedish encoding (why that's
  the default I wonder :) so I altered all the tables with

 That is because MySQL was created by a Swedish company.

 --
 Kees de Bruin

 A vacation is having nothing to do and all day to do it in

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

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


paginating - several on one page

2009-12-27 Thread Melanie Sommer
Hello,

I try to have several tables with paginated data in one view.

###
texttexttexttext

div with paginated data 1

div with paginated data 2

div with paginated data 3
###


When loading the page the first time everything seems correct except
for all counters

In the controller I have these lines:
$data1= $this-paginate('data1');
$data2= $this-paginate('data2');
$data2= $this-paginate('data3');

There seems to be only one counter (for data1)? What do I have to do
to get several counters?

When updating the paginated divs, alls three divs contain now data1.
I have theese lines in my code - no check from which div the call
came. Where can I access this data? Where do I have to put it
$paginator-options()?

if($this-RequestHandler-isAjax()){
$this-viewPath = 'elements';
$this-render('paging1');
}


I am sorry if my text is a bit confusing. English is a foreign
language for me and I do not really know how to describe my problem.
Thank you for any suggestions!

Melanie

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

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


Re: Localization for Model validation messages

2009-12-27 Thread euromark
i wouldnt copy it exactly 1:1

translations should never be just Minimum length of 8 characters
then you'd need the same text for all other 999 different
character lenghts

better to use sprintf(__(text, true), var1, var2, ..) with %s etc


On 27 Dez., 10:47, Walther waltherl...@gmail.com wrote:
 Check here:http://book.cakephp.org/view/133/Multiple-Rules-per-Field
 (at the bottom) for the recommended method of doing it.

 On Dec 26, 10:55 am, si-mon sijumo...@gmail.com wrote:

  Thanks John. Thanks Euromark. Really helpful...

  On Dec 25, 9:55 pm, John Andersen j.andersen...@gmail.com wrote:

   I can't agree, as I prefer to have the model be concerned with model
   things (data, retrieval, saving, validation, etc.), and the view
   concerned with presenting the data and the related error messages,
   including the localization!

   Usually I only have one form in which data for a specific model is
   entered, so the adding a new rule and forgetting to add the
   localization in the form, does not become an issue! Also, a change is
   always planned - what to add, what to change, etc.

   But each of us use the technique which we are comfortable with :)
      John

   On Dec 25, 4:32 pm, euromark dereurom...@googlemail.com wrote:

i dont like the form-way
it is quite redundant - if you add a new rule you might forget
one or two views which would not be helpful

having it all together in the model is in my opinion a cleaner
approach :)

On 25 Dez., 12:32, John Andersen j.andersen...@gmail.com wrote:

 Use the form helpers option for the input fields! Look 
 at:http://book.cakephp.org/view/198/options-error

 Thus you localize in the view - example:

 echo $form-input(
    'email',
    array(
       'label' = __('e-mail address',true),
       'error' = array('users_email_rule' = __
 ('users_email_rule',true) )
    )
 ) ;

 Observe the 'error' option! Here I use it to convert the validation
 message into the language that the user is viewing the form.

 Enjoy,
    John

 On Dec 24, 7:39 pm, si-mon sijumo...@gmail.com wrote:

  Hi All,

  Is there a way to use localization for validation messages in the
  Model $validate array?

  eg: $validate = array ( 'name' = array('rule'='notEmpty',
  'message'='Name is mandatory' ));

  I need the message 'Name is mandatory' in five different languages.

  In other words: How can we use functions like __('message') like
  functions in model?

  Please help me. Thanks.

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

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


Sort 2 arrays into 1

2009-12-27 Thread Dave
I have 2 queries that I merge into 1. so below key [0] was a user entered
entry and [1] and [2] were selected from a list of options, so if there is a
skill the user has that is not in the available list they can add their own
which is where key [0] came from.

How can I now sort this array so its alphabetical based on the
[Skill][name]?
 
Array
(
[0] = Array
(
[id] = 25
[Skill] = Array
(
[name] = User entered value
)

[Year] = Array
(
[range] = 0 - 6 Months
)

)

[1] = Array
(
[id] = 68
[Skill] = Array
(
[id] = 13
[skillset_id] = 1
[name] = English
)

[Year] = Array
(
[id] = 3
[range] = 1 - 3 Years
)

)

[2] = Array
(
[id] = 69
[Skill] = Array
(
[id] = 47
[skillset_id] = 5
[name] = Math)

[Year] = Array
(
[id] = 5
[range] = 5 - 10 Years
)

)


Thanks,

Dave
 

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

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


coding practices with models

2009-12-27 Thread Christian
When i come across situations that I feel needs to be coded inside the
model I'm not sure whether (form the perspective of the controller or
a different model) to treat a model as an object, or just as a
collection of class methods.

For example:

If I want to peel a banana..

Is it correct to instantiate the Banana
$this-Banana-read(null,$id);

and then call the method
$this-Banana-peel();

and in banana.php:
function peel() {
   //since this method was called on a specific instance
   //it should have access to it's private variables (tuple from the
database)
}

OR do i just call the method on the id and sort that out in the model

$this-Banana-peel($id);

then...
function peel($id) {
   //need to instantiate the banana first before we can operate on it
  $this-Banana-read(null,$id);
}


I'm curious about the practices of some of you regular cakers.
thanks

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

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


power point reader in cakephp

2009-12-27 Thread puneet sharma
Hello Group,

Is there any way in cake php or in php itself, through which we can read
powerpoint files in php?

my development environment is linux,

I got some Dom classes, but these are not working in linux.






-- 
Thanks  Regards
Puneet R Sharma

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

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


Re: Sort 2 arrays into 1

2009-12-27 Thread peterchenadded
See code below...

?php

function cmp($a, $b) {
  $a = $a['Skill']['name'];
  $b = $b['Skill']['name'];

  if($a == $b) return 0;
  return ($a  $b) ? -1 : 1;
}

$a = array(
  0 = array(
'Skill' = array(
  'name' = 'Peter'
)
  ),
  1 = array(
'Skill' = array(
  'name' = 'Alla'
)
  ),
  2 = array(
'Skill' = array(
  'name' = 'Wu'
)
  )
);

print_r($a);

usort($a, 'cmp');
echo 'br /';

print_r($a);
?

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

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


RE: Sort 2 arrays into 1

2009-12-27 Thread Dave
Thanks for your response.

I ended up going with:

Set::sort($selections, '{n}.Skill.name', 'asc');


Dave

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of peterchenadded
Sent: December-28-09 12:00 AM
To: CakePHP
Subject: Re: Sort 2 arrays into 1

See code below...

?php

function cmp($a, $b) {
  $a = $a['Skill']['name'];
  $b = $b['Skill']['name'];

  if($a == $b) return 0;
  return ($a  $b) ? -1 : 1;
}

$a = array(
  0 = array(
'Skill' = array(
  'name' = 'Peter'
)
  ),
  1 = array(
'Skill' = array(
  'name' = 'Alla'
)
  ),
  2 = array(
'Skill' = array(
  'name' = 'Wu'
)
  )
);

print_r($a);

usort($a, 'cmp');
echo 'br /';

print_r($a);
?

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

You received this message because you are subscribed to the Google Groups
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com To
unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group 
cake-php+at http://groups.google.com/group/cake-php?hl=en
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.722 / Virus Database: 270.14.114/2575 - Release Date: 12/27/09
05:48:00

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

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


Re: paginating - several on one page

2009-12-27 Thread j0n4s.h4rtm...@googlemail.com
Hello Melanie,

as far as I know, the core's Pagination only works on one
query (e.g. one primary model and its associations aka contains/
joins) at a time.

I have opened an enhancement ticket for 1.3:
http://cakephp.lighthouseapp.com/projects/42648/tickets/102-support-for-multiple-pagination

I have started a component and a helper to support mutiple pagination
but its largely unfinished and currently I am not working on it - you
may grab the idea or current implementation and make it your own:
Component: 
http://github.com/ionas/Cake-spices/blob/master/app/controllers/components/paginator.php
Helper: 
http://github.com/ionas/Cake-spices/blob/master/app/views/helpers/paging.php

If you require that pagination of multiple models on the same http
request page works, but not at the same time, which means you paginate
a buddy list and then you paginate a shouts list and the buddy list is
still there but jumps back to page one the moment you paginate the
shouts list you might try this solution:
http://debuggable.com/posts/how-to-have-multiple-paginated-widgets-on-the-same-page-with-cakephp:48ad241e-b018-4532-a748-0ec74834cda3

Last but not least if you require javascript to be enabled for users
and do not require SEO friendlyness you can paginate just using ajax
fine. Like this: 
http://mark-story.com/posts/view/creating-simple-ajax-pagination-with-cakephp-1-3-and-mootools

Viel Glück.
 Jonas

On Dec 27, 7:11 pm, Melanie Sommer melanie-som...@mailinator.com
wrote:
 Hello,

 I try to have several tables with paginated data in one view.

 ###
 texttexttexttext

 div with paginated data 1

 div with paginated data 2

 div with paginated data 3
 ###

 When loading the page the first time everything seems correct except
 for all counters

 In the controller I have these lines:
 $data1= $this-paginate('data1');
 $data2= $this-paginate('data2');
 $data2= $this-paginate('data3');

 There seems to be only one counter (for data1)? What do I have to do
 to get several counters?

 When updating the paginated divs, alls three divs contain now data1.
 I have theese lines in my code - no check from which div the call
 came. Where can I access this data? Where do I have to put it
 $paginator-options()?

 if($this-RequestHandler-isAjax()){
         $this-viewPath = 'elements';
         $this-render('paging1');

 }

 I am sorry if my text is a bit confusing. English is a foreign
 language for me and I do not really know how to describe my problem.
 Thank you for any suggestions!

 Melanie

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

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