Re: [fw-general] Zend_Form_Element_Hash

2008-09-11 Thread Matthew Lurz

I don't know whether you have seen or read Matthew's article on devzone, but
it proved to be an invaluable resource to me when trying to understand the
usage of the Decorator pattern in Zend_Form. Take a look if you haven't
already:

http://devzone.zend.com/article/3450-Decorators-with-Zend_Form

The article states:

The standard decorators, in the order they are registered, for most
elements are:

- ViewHelper
- Errors
- HtmlTag (dd)
- Label (with wrapping dt tag)

Of course for the Hash element you don't want the errors. While there are
other ways to skin this cat, what I did was to create a custom element like
so:

class My_Form_Element_Hash extends Zend_Form_Element_Hash
{
public function loadDefaultDecorators()
{
$this-setDecorators(
array(
'ViewHelper',
'HtmlTag',
)
);
}

}

If you take this approach then you also need to tell the form how to locate
your custom element(s):

$form-addPrefixPath('My_Form_Element', 'My/Form/Element/', 'element');


dowker wrote:
 
 I use a single composite decorator for many of my forms. I find it much 
 easier to work with since most forms for a given project are similar. 
 I'm simply trying to add a Zend_Form_Element_Hash field to a Contact 
 Us form on one of my websites.
 
 I've built up the form and everything works fine with the standard 
 decorators. As soon as I implement my custom decorator, when I submit 
 the form, I get the error No token was provided to match against and I 
 can't seem to find the difference between the standard decorators and my 
 custom composite decorator.
 
 Would anyone know why this is happening or could you point me in the 
 right direction?
 
 Thanks.
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Form_Element_Hash-tp19421913p19428568.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Inter-page messaging - How do I display information in my layout?

2008-09-11 Thread stav


Sudheer Satyanarayana wrote:
 
 See what happens when you do
 $this-view-flash_messages =
 $this-_flashMessenger-getCurrentMessages();
 

Thanks Sudheer,  that did the trick putting it in the postDispatch.  Now it
works on either redirect or forward.

  public function init()
  {
if ($this-_flashMessenger-hasMessages())
  $this-view-flash_messages = $this-_flashMessenger-getMessages();
  }
  
  public function postDispatch()
  {
if ($this-_flashMessenger-hasCurrentMessages())
  $this-view-flash_messages =
$this-_flashMessenger-getCurrentMessages();
  }

-- 
View this message in context: 
http://www.nabble.com/Inter-page-messaging---How-do-I-display-information-in-my-layout--tp19408777p19428618.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Use Zend_Search_Lucene with many different fields

2008-09-11 Thread Ralf Eggert
Hi,

I am currently analyzing, if Zend_Search_Lucene is the right choice for
me to implement the following:

I have about 20.000 data sets with about 50 different fields. 20 of
these fields are used for sorting and selecting the data sets. These
fields are not fixed and can be changed at any time by the admins. But
basically this will probably only happen once or twice a month, but it
will happen. Another problem is that not all of these 50 fields are used
for all data sets. As a matter of fact none of these 20.000 data sets
will ever need all these 50 fields.

Currently, I was thinking of implementing this with a couple of MySQL
tables which hold all these fields. So sorting and selecting shouldn't
be such a problem. But whenever new fields are added then the tables
need to be amended. As well most rows will have more empty columns than
filled columns due to the fact that none of the datasets use all 50 fields.

Now I am thinking about implementing the selecting and sorting with
Zend_Search_Lucene. In my MySQL table I will only have a small number of
columns (primary key, some foreign keys, date columns and a text column
which hold the serialized data of all other fields). This data should be
indexed by Zend_Search_Lucene and the index should be used for searching
and sorting the data.

Has anybody build an index with such an amount of fields (20, not 50
because only 20 are used for searching and sorting), which can change
from time to time and maybe grow up to 40 or even 50 fields by the time?
Did you run into any problems?

My queries could be quite complex with using up to 10 fields combined by
AND to get the results. Does this work without any problems? Or should I
limit the number of fields that can be choosed for a single query?

I am worried a lot about the performance. I understand that
Zend_Search_Lucene has no real support for paginating. So when I only
want to get the first 20 results for a query with 5 fields then the
whole index will be searched and all results will be returned. Will
performance be really an issue?

What do you think in general about my ideas?

Thanks for your comments.

Best regards,

Ralf


[fw-general] Bug with Zend_File_Transfer

2008-09-11 Thread Jacky Chen
Hi there,

there is a bug in the Zend_File_Transfer_Abstract::setOptions() , the code
in the setOptions() as bellow:

if (is_array($options)) {
 $this-_options += $options;
}


Maybe the following code should it be:

if (is_array($options)) {
$this-_options = $options + $this-_options;
}


Re: [fw-general] Zend_Pdf - Text in Box

2008-09-11 Thread Michał Zieliński

There is no free class which supports everything, afaik. If one gives you
line wrapping than doesn`t support UTF-8.


Dimitri van Hees wrote:
 
 this is exactly the reason why i don't use Zend_PDF ;-)
 
 Karol Grecki wrote:
 Matthias

 There's no ready solution for it, but it can be done.
 You can use Style information to calculate line height and how much text
 you
 can fit on each line
 Then you just split it and offset each line 

 Karol


 Matthias Coy-2 wrote:
   
 Hi there,

 I would like to create a Textbox, in which the text I'm writing is 
 automatically wrapped, so that it fits into that box. Is there a 
 possibility to do that? As far as I looked through the Manual and Api 
 there is no possibilty.

 Regards
 Matthias Coy


 

   
 
 
 -- 
 
 - -
 
 *freshheads* grafisch ontwerp en internet applicaties
 Dunantstraat 1c | 5017 KC Tilburg | Nederland
 tel. +31 (0)13 5448761 | fax. +31 (0)13 5448762
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] | www.freshheads.com 
 http://www.freshheads.com
 
 Laatste berichten op het Freshheads blog:
 Eindelijk, stage @ Freshheads! 
 http://blog.freshheads.com/2008/09/eindelijk-stage-freshheads/
 ?Hé, dit is toch beter dan we dachten? 
 http://blog.freshheads.com/2008/09/he-dit-is-toch-beter-dan-we-dachten/
 Omroepen kondigen plannen aan tijdens Immovator ZomerCafé 
 http://blog.freshheads.com/2008/09/omroepen-kondigen-plannen-aan-tijdens-immovator-zomercafe/
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Pdf---Text-in-Box-tp19408842p19429767.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Pdf - Text in Box

2008-09-11 Thread Dimitri van Hees

that's true

Michał Zieliński wrote:

There is no free class which supports everything, afaik. If one gives you
line wrapping than doesn`t support UTF-8.


Dimitri van Hees wrote:
  

this is exactly the reason why i don't use Zend_PDF ;-)

Karol Grecki wrote:


Matthias

There's no ready solution for it, but it can be done.
You can use Style information to calculate line height and how much text
you
can fit on each line
Then you just split it and offset each line 


Karol


Matthias Coy-2 wrote:
  
  

Hi there,

I would like to create a Textbox, in which the text I'm writing is 
automatically wrapped, so that it fits into that box. Is there a 
possibility to do that? As far as I looked through the Manual and Api 
there is no possibilty.


Regards
Matthias Coy




  
  

--

- -

*freshheads* grafisch ontwerp en internet applicaties
Dunantstraat 1c | 5017 KC Tilburg | Nederland
tel. +31 (0)13 5448761 | fax. +31 (0)13 5448762
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] | www.freshheads.com 
http://www.freshheads.com


Laatste berichten op het Freshheads blog:
Eindelijk, stage @ Freshheads! 
http://blog.freshheads.com/2008/09/eindelijk-stage-freshheads/
?Hé, dit is toch beter dan we dachten? 
http://blog.freshheads.com/2008/09/he-dit-is-toch-beter-dan-we-dachten/
Omroepen kondigen plannen aan tijdens Immovator ZomerCafé 
http://blog.freshheads.com/2008/09/omroepen-kondigen-plannen-aan-tijdens-immovator-zomercafe/






  



--

- -

*freshheads* grafisch ontwerp en internet applicaties
Dunantstraat 1c | 5017 KC Tilburg | Nederland
tel. +31 (0)13 5448761 | fax. +31 (0)13 5448762
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] | www.freshheads.com 
http://www.freshheads.com


Laatste berichten op het Freshheads blog:
Eindelijk, stage @ Freshheads! 
http://blog.freshheads.com/2008/09/eindelijk-stage-freshheads/
?Hé, dit is toch beter dan we dachten? 
http://blog.freshheads.com/2008/09/he-dit-is-toch-beter-dan-we-dachten/
Omroepen kondigen plannen aan tijdens Immovator ZomerCafé 
http://blog.freshheads.com/2008/09/omroepen-kondigen-plannen-aan-tijdens-immovator-zomercafe/


Re: [fw-general] Zend_Pdf - Text in Box

2008-09-11 Thread Andrew Yager
Actually this is possible (and I havw done it) with FPDF, although it  
doesn't always work very well.


Andrew.



On 11/09/2008, at 6:01 PM, Michał Zieliński [EMAIL PROTECTED] wrote:



There is no free class which supports everything, afaik. If one  
gives you

line wrapping than doesn`t support UTF-8.


Dimitri van Hees wrote:


this is exactly the reason why i don't use Zend_PDF ;-)

Karol Grecki wrote:

Matthias

There's no ready solution for it, but it can be done.
You can use Style information to calculate line height and how  
much text

you
can fit on each line
Then you just split it and offset each line

Karol


Matthias Coy-2 wrote:


Hi there,

I would like to create a Textbox, in which the text I'm writing  
is

automatically wrapped, so that it fits into that box. Is there a
possibility to do that? As far as I looked through the Manual and  
Api

there is no possibilty.

Regards
   Matthias Coy









--

- -

*freshheads* grafisch ontwerp en internet applicaties
Dunantstraat 1c | 5017 KC Tilburg | Nederland
tel. +31 (0)13 5448761 | fax. +31 (0)13 5448762
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] | www.freshheads.com
http://www.freshheads.com

Laatste berichten op het Freshheads blog:
Eindelijk, stage @ Freshheads!
http://blog.freshheads.com/2008/09/eindelijk-stage-freshheads/
?Hé, dit is toch beter dan we dachten?
http://blog.freshheads.com/2008/09/he-dit-is-toch-beter-dan-we-dachten/ 


Omroepen kondigen plannen aan tijdens Immovator ZomerCafé
http://blog.freshheads.com/2008/09/omroepen-kondigen-plannen-aan-tijdens-immovator-zomercafe/ 






--
View this message in context: 
http://www.nabble.com/Zend_Pdf---Text-in-Box-tp19408842p19429767.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Class attribute of label and element

2008-09-11 Thread Lorenz, Marcus
Hi,

i have a problem with the setting of the class atribute of an element by
config. I have the following config part:

elements.businessCard.type = checkbox
elements.businessCard.name = businessCard
elements.businessCard.options.id=businessCard
elements.businessCard.options.label = FORM_BUSINESS_PARK_CARD
elements.businessCard.options.class=checkbox
elements.businessCard.options.tabindex=1
elements.businessCard.options.order=1
elements.businessCard.options.decorators.helper = ViewHelper
elements.businessCard.options.decorators.label.decorator = Label
elements.businessCard.options.decorators.label.options.class = 

I want to set the class of the element, and only of the element, to
checkbox, but when i look at my form i have this output:

label for=businessCard class=checkbox optional.../label
input type=hidden name=businessCard value=0 /
input type=checkbox name=businessCard id=businessCard value=1
class=checkbox tabindex=1 /

How can i get rid of the checkbox class within the label? I just want
it to be used in the input-Element.

Regards,

Marcus


This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.



Re: [fw-general] Zend_Pdf - Text in Box

2008-09-11 Thread Ben Scholzen 'DASPRiD'
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yeah but FPDF is yet the best free class, and has many extensions. The
only negative point imho is, that it is still written in PHP4.

Andrew Yager schrieb:
 Actually this is possible (and I havw done it) with FPDF, although it
 doesn't always work very well.
 
 Andrew.
 
 
 
 On 11/09/2008, at 6:01 PM, Michał Zieliński [EMAIL PROTECTED] wrote:
 

 There is no free class which supports everything, afaik. If one gives you
 line wrapping than doesn`t support UTF-8.


 Dimitri van Hees wrote:

 this is exactly the reason why i don't use Zend_PDF ;-)

 Karol Grecki wrote:
 Matthias

 There's no ready solution for it, but it can be done.
 You can use Style information to calculate line height and how much
 text
 you
 can fit on each line
 Then you just split it and offset each line

 Karol


 Matthias Coy-2 wrote:

 Hi there,

 I would like to create a Textbox, in which the text I'm writing is
 automatically wrapped, so that it fits into that box. Is there a
 possibility to do that? As far as I looked through the Manual and Api
 there is no possibilty.

 Regards
Matthias Coy







 -- 

 - -

 *freshheads* grafisch ontwerp en internet applicaties
 Dunantstraat 1c | 5017 KC Tilburg | Nederland
 tel. +31 (0)13 5448761 | fax. +31 (0)13 5448762
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] | www.freshheads.com
 http://www.freshheads.com

 Laatste berichten op het Freshheads blog:
 Eindelijk, stage @ Freshheads!
 http://blog.freshheads.com/2008/09/eindelijk-stage-freshheads/
 ?Hé, dit is toch beter dan we dachten?
 http://blog.freshheads.com/2008/09/he-dit-is-toch-beter-dan-we-dachten/

 Omroepen kondigen plannen aan tijdens Immovator ZomerCafé
 http://blog.freshheads.com/2008/09/omroepen-kondigen-plannen-aan-tijdens-immovator-zomercafe/




 -- 
 View this message in context:
 http://www.nabble.com/Zend_Pdf---Text-in-Box-tp19408842p19429767.html
 Sent from the Zend Framework mailing list archive at Nabble.com.


- --
...
:  ___   _   ___ ___ ___ _ ___:
: |   \ /_\ / __| _ \ _ (_)   \   :
: | |) / _ \\__ \  _/   / | |) |  :
: |___/_/:\_\___/_| |_|_\_|___/   :
:::
: Web: http://www.dasprids.de :
: E-mail : [EMAIL PROTECTED]   :
: Jabber : [EMAIL PROTECTED] :
: ICQ: 105677955  :
:::
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIyNN80HfT5Ws789ARAjJvAKDPlXcKI2NQ3k1Ik1gom3pQNyxavgCeO3O+
22lYxq4GDRUe0JVbqpadsSc=
=72d7
-END PGP SIGNATURE-


Re: [fw-general] Bug with Zend_File_Transfer

2008-09-11 Thread Thomas Weidner

No, actually it should not.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: Jacky Chen [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Thursday, September 11, 2008 9:32 AM
Subject: [fw-general] Bug with Zend_File_Transfer



Hi there,

there is a bug in the Zend_File_Transfer_Abstract::setOptions() , the code
in the setOptions() as bellow:

if (is_array($options)) {
$this-_options += $options;
}


Maybe the following code should it be:

if (is_array($options)) {
   $this-_options = $options + $this-_options;
}





Re: [fw-general] Zend_Dojo_Form and Checkbox Element

2008-09-11 Thread Andrew Yager

On 11/09/2008, at 1:31 AM, Matthew Weier O'Phinney wrote:


The value default checked values have correctly returned the value of
'enroll'. The additional checked value has returned 'notenroll'  
rather

than 'enroll'. The values not checked have returned '0'.


Can you check this against current trunk? I corrected an issue with
dojo checkboxes late last week that may have affected this behavior  
(for

the better).



I've just tried trunk, and have the same behaviour.

Having looked again at the HTML being generated, it seems quite odd:
dd input name=courseList[CEAudio] value=0 type=hiddeninput  
options=enroll notenroll id=courseList[CEAudio]  
name=courseList[CEAudio] value=notenroll type=checkbox/dd


Most Dojo widgits have their id's generated as (for example)  
courseList-CEAudio ([] replaced by -), and I'm still confused as to  
how the hidden/checkbox of the same name are supposed to function  
(although they seem to, so I can't complain).



I would value the input of any minds who understand Dojo/ZF better  
than I :-)


Andrew

--
Andrew Yager, Managing Director   (MACS BCompSc MCP)
Real World Technology Solutions Pty Ltd
ph: 1300 798 718 or (02) 9037 0500
fax: (02) 9037 0591 mob: 0405 152 568
http://www.rwts.com.au/ or http://www.stonebridgecomputing.com.au/



[fw-general] [SVN] Latest stable release

2008-09-11 Thread Steve Reed

Hello

Has the idea of a 'latest stable release' tag been discussed? Something
like:

release-1.5.3
release-1.6.0
release-1.6.0RC1
release-1.6.0RC2
release-1.6.0RC3
release-latest   -- contains 1.6.0 at time of posting

I can't offer up many reasons why it would be useful except that I would use
it for a server-wide checkout on my development machine knowing I was using
the latest stable release to write new code.

Cheers

Steve
-- 
View this message in context: 
http://www.nabble.com/-SVN--Latest-stable-release-tp19432988p19432988.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] [SVN] Latest stable release

2008-09-11 Thread Giorgio Sironi
2008/9/11 Steve Reed [EMAIL PROTECTED]:
 release-1.6.0RC3
 release-latest   -- contains 1.6.0 at time of posting

Convention in Subversion is that tags are read-only copy. It will be confusing.

 I can't offer up many reasons why it would be useful except that I would use
 it for a server-wide checkout on my development machine knowing I was using
 the latest stable release to write new code.

Hovewer, the point is that this is simplicistic. While it could be
useful for mini release, between 1.5 and 1.6 for example you encounter
compatibility issues, and will be also true when updating to the
future 2.0 (where the Api changes).

-- 
Giorgio Sironi
Piccolo Principe  Ossigeno Scripter
http://www.sourceforge.net/projects/ossigeno


Re: [fw-general] Selective Routing -- Questions about Configuration of Zend_Controller_Router_*

2008-09-11 Thread jlevy

Sometimes it's hard to see the forest through the trees. What you propose is
more than sensible, it really is the way to do this particular task.

I have put some thought to what you have proposed, and I will be refactoring
my code to give it a go. Thank you for giving me another path to explore. 



Jason Webster wrote:
 
 Is it possible that this is a problem better solved with class 
 inheritance and extension rather than an overly complicated routing 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Selective-RoutingQuestions-about-Configuration-of-Zend_Controller_Router_*-tp19423018p19433596.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Dojo_Form and Checkbox Element

2008-09-11 Thread Matthew Weier O'Phinney
-- Andrew Yager [EMAIL PROTECTED] wrote
(on Thursday, 11 September 2008, 09:18 PM +1000):
 On 11/09/2008, at 1:31 AM, Matthew Weier O'Phinney wrote:
   The value default checked values have correctly returned the value of
   'enroll'. The additional checked value has returned 'notenroll'  
   rather
   than 'enroll'. The values not checked have returned '0'.
 
  Can you check this against current trunk? I corrected an issue with
  dojo checkboxes late last week that may have affected this behavior
  (for the better).


 I've just tried trunk, and have the same behaviour.

 Having looked again at the HTML being generated, it seems quite odd:
 dd input name=courseList[CEAudio] value=0 type=hidden input  
 options=enroll notenroll id=courseList[CEAudio]  
 name=courseList[CEAudio] value=notenroll type=checkbox /dd

You can't be using trunk. IDs on dijit CheckBoxes were fixed three days
ago. Please update your svn checkout and re-verify.

 Most Dojo widgits have their id's generated as (for example)  
 courseList-CEAudio ([] replaced by -), and I'm still confused as to how 
 the hidden/checkbox of the same name are supposed to function (although 
 they seem to, so I can't complain).

Basically, when a checkbox is unchecked, either no value is submitted or
an empty string is submitted for it (depending on the browser). This
causes issues on the server-side, particularly if the value is required.
The hidden element ensures a value is returned when the checkbox is
unchecked.

Within Zend_Form/Zend_Dojo, we allow you to set both the checked and
unchecked values; the unchecked value is placed in the hidden element,
the checked value in the checkbox itself. This way you get the
appropriate value back based on the status of the checkbox at
submission.

 I would value the input of any minds who understand Dojo/ZF better than I 
 :-)

 Andrew

 --
 Andrew Yager, Managing Director   (MACS BCompSc MCP)
 Real World Technology Solutions Pty Ltd
 ph: 1300 798 718 or (02) 9037 0500
 fax: (02) 9037 0591 mob: 0405 152 568
 http://www.rwts.com.au/ or http://www.stonebridgecomputing.com.au/


-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Zend Layouts for Default and Admin

2008-09-11 Thread Matthew Lurz

In case you are still looking for a solution:

class My_Layout_Controller_Plugin_Layout extends
Zend_Layout_Controller_Plugin_Layout
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$module = $request-getModuleName();
if ('admin' == $module) {
  $this-getLayout()-setLayout($module);
}
}
}


Opel wrote:
 
 I have set up my app directory as follows :
 
 application
  modules
  templates
 -default
 -admin
  models
 library
 
 
 What I am trying to do is use default template for my public view and
 admin template for the admin module. I need to set my bootstrap up to
 switch the template for that single admin module. This was covered in
 Padraic Brady's tutorial but seems to have been taken down and I didn't
 have a copy of the source. 
 
 Could anyone advice me how to do this. The searches on forum for answers
 all seem to be different layouts per module.
 

-- 
View this message in context: 
http://www.nabble.com/Zend-Layouts-for-Default-and-Admin-tp19340002p19434831.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Setting value on Zend_Form_Element_Select

2008-09-11 Thread Chris Tankersley
I have a select element inside of a form object where I call
-setValue() on the form's initialization to select a default value.
When I do a $form-populate($data) in my controller the value for this
select element is not being set correctly and always defaults to the
default value from initialization. My other select elements in the
form work fine except for this one.

FORM
$protClass = new Zend_Form_Element_Select('protClass');
$protClass-setLable('Protection Class:')
-setRequired(true)
-setValue(9)
-setMultiOptions($protClassRange);

CONTROLLER
$form-populate($rate-toArray()); // this has protClass at the correct value


[fw-general] HowTo Zend_Test_PHPUnit_ControllerTestCase + Zend_Session

2008-09-11 Thread Bruno Friedmann
I'm facing a problem how to do this.

I've a application bootstrap which relies on Zend_Session. And I want to test 
controllers with the new (not so)
Zend_Test_PHPUnit_ControllerTestCase.

It's the first time I've to do this so excuse me for the newb questions.

I've follow the documentation and also the Mathew post blog and wiki.

On a simple Hello world example  tests are working nicely. (not too 
difficult, but just here to prove the env is correctly setup)

So when I launch my test on the complicate bootstrap I've received this error :

PHPUnit 3.2.21 by Sebastian Bergmann.

IndexControllerTest
E

Time: 0 seconds

There were 1 errors:

1) testIndexAction(IndexControllerTest)
Zend_Session_Exception: Session must be started before any output has been sent 
to the browser; output started in
/usr/share/php5/PEAR/PHPUnit/Util/Printer.php/139
/ioda/data/web-include/ZF/library.160/Zend/Session/Namespace.php:116
/home/bruno/workspace/socketfinder/sf/ZfApplication.php:155
/home/bruno/workspace/socketfinder/sf/ZfApplication.php:118
/home/bruno/workspace/socketfinder/sf/ZfApplication.php:98
/home/bruno/workspace/socketfinder/sf/tests/Sf/controllers/IndexControllerTest.php:22

I'm pretty sure I would have to do some sort of ouput_buffering but google was 
not my friend today.
It only give me what phpunit session conference I've missed.

Any path to a solution or any advice are welcome.




-- 

 Bruno Friedmann



[fw-general] Zend_Server_Reflection don't work with interfaces.

2008-09-11 Thread a_d_j_i

Hi. 
I'm using Zend Soap Autodiscovery and want to do autodicover over an php
interface (I think is a good idea because I want to export only some methods
of my class, and also it give me a more nice way to declare the client and
server class interfaces). When I pass the interface name to the autodiscover
class-setClass I get an error in the relfection code.
I solved this problem adding two lines (see below) in the code and want to
know if there is a problem with my modification and if there is a way to
patch the framework code ?

Thank in advance [EMAIL PROTECTED]

{
if (is_object($class)) {
$reflection = new ReflectionObject($class);
} elseif (interface_exists($class)) {
$reflection = new ReflectionClass($class);
} elseif (class_exists($class)) {
$reflection = new ReflectionClass($class);
} else {
throw new Zend_Server_Reflection_Exception('Invalid class or
object passed to attachClass()');
}

-- 
View this message in context: 
http://www.nabble.com/Zend_Server_Reflection-don%27t-work-with-interfaces.-tp19435866p19435866.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Setting value on Zend_Form_Element_Select

2008-09-11 Thread Bruno Friedmann
Chris Tankersley wrote:
 I have a select element inside of a form object where I call
 -setValue() on the form's initialization to select a default value.
 When I do a $form-populate($data) in my controller the value for this
 select element is not being set correctly and always defaults to the
 default value from initialization. My other select elements in the
 form work fine except for this one.
 
 FORM
 $protClass = new Zend_Form_Element_Select('protClass');
 $protClass-setLable('Protection Class:')
 -setRequired(true)
 -setValue(9)
 -setMultiOptions($protClassRange);
 
 CONTROLLER
 $form-populate($rate-toArray()); // this has protClass at the correct value

Dear Chris, in my case there's no need to setValue when populate ..
it's done auto.


-- 

 Bruno Friedmann



Re: [fw-general] Setting value on Zend_Form_Element_Select

2008-09-11 Thread Chris Tankersley
In my case I want the default to be the last value added instead of
the first which is why I manually do a setValue in the init.

Chris


On Thu, Sep 11, 2008 at 10:19 AM, Bruno Friedmann [EMAIL PROTECTED] wrote:
 Chris Tankersley wrote:
 I have a select element inside of a form object where I call
 -setValue() on the form's initialization to select a default value.
 When I do a $form-populate($data) in my controller the value for this
 select element is not being set correctly and always defaults to the
 default value from initialization. My other select elements in the
 form work fine except for this one.

 FORM
 $protClass = new Zend_Form_Element_Select('protClass');
 $protClass-setLable('Protection Class:')
 -setRequired(true)
 -setValue(9)
 -setMultiOptions($protClassRange);

 CONTROLLER
 $form-populate($rate-toArray()); // this has protClass at the correct value

 Dear Chris, in my case there's no need to setValue when populate ..
 it's done auto.


 --

 Bruno Friedmann




Re: [fw-general] Image Captcha + Load Time

2008-09-11 Thread Bruno Friedmann
But that should not be the only tricks ...

I've 2 debugger loaded :-)
 with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans
with Zend Debugger v5.2.14, Copyright (c) 1999-2008, by Zend Technologies
And also a lot's of extensions ( like pdflib, mapserver, clam loaded )

But I have also apc

With ZF 1.6.0 It take between 1.97 (apc cache empty) to 1.64 seconds to 
generated my form with captcha image inside.

Opensuse linux 32bits Centrino 2.4Ghz 4Go Ram sata II 7200rpm hardrive (with 
encryption)
apache 2.2.4 and php 5.2.6.



Matthew Lurz wrote:
 Yes. I'm sorry if I wasn't clear on this.
 
 
 Matthew Weier O'Phinney-3 wrote:
 -- Matthew Lurz [EMAIL PROTECTED] wrote
 (on Wednesday, 10 September 2008, 12:30 PM -0700):
 To say that I am embarrassed would be an understatement. So sorry to have
 wasted your time Matthew. I thought Xdebug had been disabled when I
 initially noticed the hit. Apparently not. I just asked my boss for the
 RETARD stamp for my forehead in hopes that this would provide a modicum
 of
 consolation and comic relief to you. And now it's in the historical
 record.
 So I take it to mean that the debugger was the issue? :)


 How long have I been doing this? Is it time to consider a less
 challenging
 profession? I think I could still flip a burger but who the hell knows. 
 Anyhow, thanks for your patience.


 Matthew Weier O'Phinney-3 wrote:
 -- Matthew Lurz [EMAIL PROTECTED] wrote
 (on Wednesday, 10 September 2008, 09:17 AM -0700):
 I recently noticed that a form using Zend_Captcha_Image was taking
 15-20
 seconds to load. I reviewed my code but couldn't find the source of
 the
 issue though it was obviously related to the Captcha element. So, I
 setup
 a
 form in a test environment that does nothing more than load an image
 Captcha. The trace is 189,253 lines and the page takes over 12 seconds
 to
 load. This wasn't always the case. Did I miss something or is this a
 bug?
 A couple of things: first off, GD and imagick typically suffer a pretty
 large performance hit when you have a debugger enabled in your PHP
 profile. Try benching with no debugger enabled (disable it in your
 php.ini and restart the web server).

 Second, what OS are you on, and what version of PHP?
 -- 
 Matthew Weier O'Phinney
 Software Architect   | [EMAIL PROTECTED]
 Zend Framework   | http://framework.zend.com/


 


-- 

 Bruno Friedmann

Ioda-Net Sàrl
  2830 Vellerat - Switzerland

  Tél : ++41 32 435 7171
  Fax : ++41 32 435 7172
  gsm : ++41 78 802 6760
  www.ioda-net.ch

 Centre de Formation et de Coaching En Ligne
 www.cfcel.com



Re: [fw-general] Setting value on Zend_Form_Element_Select

2008-09-11 Thread Bruno Friedmann
Ok sorry.

I'm doing what you want in several forms but index are always called by string.
Have you try a setValue('9')  if I imagine you have a id='9' value='Something 
in the list'

Hope this help a bit more ...


Chris Tankersley wrote:
 In my case I want the default to be the last value added instead of
 the first which is why I manually do a setValue in the init.
 
 Chris
 
 
 On Thu, Sep 11, 2008 at 10:19 AM, Bruno Friedmann [EMAIL PROTECTED] wrote:
 Chris Tankersley wrote:
 I have a select element inside of a form object where I call
 -setValue() on the form's initialization to select a default value.
 When I do a $form-populate($data) in my controller the value for this
 select element is not being set correctly and always defaults to the
 default value from initialization. My other select elements in the
 form work fine except for this one.

 FORM
 $protClass = new Zend_Form_Element_Select('protClass');
 $protClass-setLable('Protection Class:')
 -setRequired(true)
 -setValue(9)
 -setMultiOptions($protClassRange);

 CONTROLLER
 $form-populate($rate-toArray()); // this has protClass at the correct 
 value
 Dear Chris, in my case there's no need to setValue when populate ..
 it's done auto.


 --

 Bruno Friedmann




-- 

 Bruno Friedmann

Ioda-Net Sàrl
  2830 Vellerat - Switzerland

  Tél : ++41 32 435 7171
  Fax : ++41 32 435 7172
  gsm : ++41 78 802 6760
  www.ioda-net.ch

 Centre de Formation et de Coaching En Ligne
 www.cfcel.com



[fw-general] Max. number of concurrent connection in Zend_Http_Client

2008-09-11 Thread Robert Castley
Hi,
 
What is the maximum number of concurrent connections Zend_Http_Client can
handle?
 
I am asking the question because at the moment my app builds up using AJAX
requests and in IE 6 I am limited to max. 2 connections per session which
really slows things down.
 
So, I thought I would use Zend_Http_Client to do the building for me but I
don't know if this can perform 1,2 or a 1000 requests.
 
Also, this needs to be fast :-)
 
TIA,
 
- Robert



This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


Re: [fw-general] HowTo Zend_Test_PHPUnit_ControllerTestCase + Zend_Session

2008-09-11 Thread Bruno Friedmann
Bruno Friedmann wrote:
 I'm facing a problem how to do this.
 
 I've a application bootstrap which relies on Zend_Session. And I want to test 
 controllers with the new (not so)
 Zend_Test_PHPUnit_ControllerTestCase.
 
 It's the first time I've to do this so excuse me for the newb questions.
 
 I've follow the documentation and also the Mathew post blog and wiki.
 
 On a simple Hello world example  tests are working nicely. (not too 
 difficult, but just here to prove the env is correctly setup)
 
 So when I launch my test on the complicate bootstrap I've received this error 
 :
 
 PHPUnit 3.2.21 by Sebastian Bergmann.
 
 IndexControllerTest
 E
 
 Time: 0 seconds
 
 There were 1 errors:
 
 1) testIndexAction(IndexControllerTest)
 Zend_Session_Exception: Session must be started before any output has been 
 sent to the browser; output started in
 /usr/share/php5/PEAR/PHPUnit/Util/Printer.php/139
 /ioda/data/web-include/ZF/library.160/Zend/Session/Namespace.php:116
 /home/bruno/workspace/socketfinder/sf/ZfApplication.php:155
 /home/bruno/workspace/socketfinder/sf/ZfApplication.php:118
 /home/bruno/workspace/socketfinder/sf/ZfApplication.php:98
 /home/bruno/workspace/socketfinder/sf/tests/Sf/controllers/IndexControllerTest.php:22
 
 I'm pretty sure I would have to do some sort of ouput_buffering but google 
 was not my friend today.
 It only give me what phpunit session conference I've missed.
 
 Any path to a solution or any advice are welcome.
 

Ok a little step futher
I've found that we can change this.
Zend_Session::$_unitTestEnabled = true;

but I've always a error ...

testIndexAction(IndexControllerTest)
Undefined variable: _SESSION
/ioda/data/web-include/ZF/library.160/Zend/Session.php:522
/ioda/data/web-include/ZF/library.160/Zend/Session.php:448
/ioda/data/web-include/ZF/library.160/Zend/Session/Namespace.php:116
/home/bruno/workspace/socketfinder/sf/ZfApplication.php:156



-- 

 Bruno Friedmann




[fw-general] minial release contains .svn dirs

2008-09-11 Thread till
Hey,

I just downloaded the 1.6.0 minimal release from here:
http://framework.zend.com/download/latest

It contains .svn directories, which is a bit annoying when you are
trying to check it into your own repo. I am thinking you guys want to
do svn export before you bundle it up. At least that seems to have
been the way you distribute the regular (= full) releases.

Just a heads up,
Till


Re: [fw-general] Zend Form Grouping Elements

2008-09-11 Thread vladimirn

Hello Mathew,
I tried this, but wont work for me.
$form-addDisplayGroupPrefixPath('forms_Decorator', 'forms/Decorator');
.
 $form-addDisplayGroup(array('username', 'password'), 'login', array(
'legend' = 'Please Login:',
'decorators' = array(
'FormElements',
array('DivWrapper', array(
'labelFor'   = 'login',
'labelClass' = 'required left optional',
))
), 
..
and i have application/forms/Decorator/ with DivWrapper.php in it.
in bootstrap:
$base  = realpath(dirname(__FILE__) . '/../');
$paths = array(
'.', 
$base . '/library',
$base . '/application',
$base . '/application/forms',
$base . '/application/models',
);
ini_set('include_path', implode(PATH_SEPARATOR, $paths));

Error i am getting:
exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name
DivWrapper was not found in the registry.' in

Any suggestion?
Thanks
Vladimir

Matthew Weier O'Phinney-3 wrote:
 
 What did you try? :)
 
 Here's what I'd try: you'll need to create a custom decorator for the
 display group, which I'll detail below, and then the following
 element/group definitions.
 
 $form-addDisplayGroupPrefixPath('My_Form_Decorator',
 'My/Form/Decorator');
 $form-addElement('text', 'txtZipcode', array(
 'size'   = 10,
 'maxlength'  = 10,
 'class'  = 'true',
 'required'   = 'true',
 'decorators' = array('ViewHelper'),
 ));
 $form-addElement('text', 'txtCity', array(
 'size'   = 30,
 'maxlength'  = 20,
 'class'  = 'true',
 'required'   = 'true',
 'decorators' = array('ViewHelper'),
 ));
 $form-addDisplayGroup(array('txtZipcode', 'txtCity'), 'zipCity',
 array(
 'legend' = 'Zipcode/City',
 'decorators' = array(
 'FormElements',
 array('DivWrapper', array(
 'labelFor'   = 'txtZipcode', 
 'labelClass' = 'required left optional',
 ))
 ),
 ));
 
 The DivWrapper decorator would look like this:
 
 My_Form_Decorator_DivWrapper extends Zend_Form_Decorator_Abstract()
 {
 public function render($content)
 {
 $group = $this-getElement();
 if (null === $group) {
 return $content;
 }
 
 $labelFor   = $this-getOption('labelFor');
 $labelClass = $this-getOption('labelClass');
 $label  = $group-getLegend();
 
 $html =EOH
 div class=row
 label for=$labelFor class=$labelClass$label/label
 div class=element
 $content
 /div
 /div
 EOH;
 return $html;
 }
 }
 
 Put the above in My/Form/Decorator/DivWrapper.php on your include path,
 and you should be set.
 
 I think this is a common problem. So hopefully some can give me a hint
 how my decorator needs to look like...
 
 -- 
 Matthew Weier O'Phinney
 Software Architect   | [EMAIL PROTECTED]
 Zend Framework   | http://framework.zend.com/
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend-Form-Grouping-Elements-tp18890779p19439080.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Setting value on Zend_Form_Element_Select

2008-09-11 Thread Chris Tankersley
Actually, the setValue in the init is working fine. What I'm having a
problem with is after I populate the form with data the select isn't
changing to the populated value.

Chris

On Thu, Sep 11, 2008 at 10:50 AM, Bruno Friedmann [EMAIL PROTECTED] wrote:
 Ok sorry.

 I'm doing what you want in several forms but index are always called by 
 string.
 Have you try a setValue('9')  if I imagine you have a id='9' value='Something 
 in the list'

 Hope this help a bit more ...


 Chris Tankersley wrote:
 In my case I want the default to be the last value added instead of
 the first which is why I manually do a setValue in the init.

 Chris


 On Thu, Sep 11, 2008 at 10:19 AM, Bruno Friedmann [EMAIL PROTECTED] wrote:
 Chris Tankersley wrote:
 I have a select element inside of a form object where I call
 -setValue() on the form's initialization to select a default value.
 When I do a $form-populate($data) in my controller the value for this
 select element is not being set correctly and always defaults to the
 default value from initialization. My other select elements in the
 form work fine except for this one.

 FORM
 $protClass = new Zend_Form_Element_Select('protClass');
 $protClass-setLable('Protection Class:')
 -setRequired(true)
 -setValue(9)
 -setMultiOptions($protClassRange);

 CONTROLLER
 $form-populate($rate-toArray()); // this has protClass at the correct 
 value
 Dear Chris, in my case there's no need to setValue when populate ..
 it's done auto.


 --

 Bruno Friedmann




 --

 Bruno Friedmann

 Ioda-Net Sàrl
  2830 Vellerat - Switzerland

  Tél : ++41 32 435 7171
  Fax : ++41 32 435 7172
  gsm : ++41 78 802 6760
  www.ioda-net.ch

  Centre de Formation et de Coaching En Ligne
  www.cfcel.com




Re: [fw-general] minial release contains .svn dirs

2008-09-11 Thread Jordan Moore
I just downloaded both minimal zip and tar.gz archives, and neither
one contained any .svn directories.

On Thu, Sep 11, 2008 at 10:20 AM, till [EMAIL PROTECTED] wrote:
 Hey,

 I just downloaded the 1.6.0 minimal release from here:
 http://framework.zend.com/download/latest

 It contains .svn directories, which is a bit annoying when you are
 trying to check it into your own repo. I am thinking you guys want to
 do svn export before you bundle it up. At least that seems to have
 been the way you distribute the regular (= full) releases.

 Just a heads up,
 Till




-- 
Jordan Ryan Moore


Re: [fw-general] minial release contains .svn dirs

2008-09-11 Thread till
On Thu, Sep 11, 2008 at 7:54 PM, Jordan Moore [EMAIL PROTECTED] wrote:
 I just downloaded both minimal zip and tar.gz archives, and neither
 one contained any .svn directories.

Do you think I was dreaming? =)

Thanks for fixing, whoever did it.


Re: [fw-general] Setting value on Zend_Form_Element_Select

2008-09-11 Thread Bruno Friedmann
here's how one of the select is declared in form

$element = new Zend_Form_Element_Select('patientid');
$element-addMultiOptions($this-patients_array)
-setRequired(true)
-setLabel('label_db_patient_select')
-setAttrib('size', 1)
-setAttrib('maxlength', 1)
-addFilter($filterTags)
-addFilter($filterTrim)
-addValidator($validatorNotEmpty, true)
-addValidator($validatorNum, true)
;
$this-addElement($element);

When I get data from db I just do a populate.

$this-_form-populate($rowset-current()-toArray());

So you can see I never use the setValue.
In your case I think you should try without it and for a new record
after initializing the form
do a
$this-_form-getElement('whatever')-setValue(9);

After I've no idea ...


Chris Tankersley wrote:
 Actually, the setValue in the init is working fine. What I'm having a
 problem with is after I populate the form with data the select isn't
 changing to the populated value.
 
 Chris
 
 On Thu, Sep 11, 2008 at 10:50 AM, Bruno Friedmann [EMAIL PROTECTED] wrote:
 Ok sorry.

 I'm doing what you want in several forms but index are always called by 
 string.
 Have you try a setValue('9')  if I imagine you have a id='9' 
 value='Something in the list'

 Hope this help a bit more ...


 Chris Tankersley wrote:
 In my case I want the default to be the last value added instead of
 the first which is why I manually do a setValue in the init.

 Chris


 On Thu, Sep 11, 2008 at 10:19 AM, Bruno Friedmann [EMAIL PROTECTED] wrote:
 Chris Tankersley wrote:
 I have a select element inside of a form object where I call
 -setValue() on the form's initialization to select a default value.
 When I do a $form-populate($data) in my controller the value for this
 select element is not being set correctly and always defaults to the
 default value from initialization. My other select elements in the
 form work fine except for this one.

 FORM
 $protClass = new Zend_Form_Element_Select('protClass');
 $protClass-setLable('Protection Class:')
 -setRequired(true)
 -setValue(9)
 -setMultiOptions($protClassRange);

 CONTROLLER
 $form-populate($rate-toArray()); // this has protClass at the correct 
 value
 Dear Chris, in my case there's no need to setValue when populate ..
 it's done auto.


 --


-- 

 Bruno Friedmann



Re: [fw-general] How to integrate a Dojo date picker to Zend_Form?

2008-09-11 Thread stav


Micah Gersten wrote:
 
 What type of object is $this below?
 

In a view script $this is the Zend_View (layout is a view script as well)
-- 
View this message in context: 
http://www.nabble.com/How-to-integrate-a-Dojo-date-picker-to-Zend_Form--tp18914917p19442994.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Form_Element_File getValue()

2008-09-11 Thread gerardroche

thanks.

thomasW wrote:
 
 Yes, this is expected behaviour.
 Because otherwise you would never be able to call getValue() before you 
 received the file in eighter of  both directions.
 
 To check if a file was uploaded simply use isValid()...
 
 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com
 
 - Original Message - 
 From: gerardroche [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Tuesday, September 09, 2008 2:15 PM
 Subject: [fw-general] Zend_Form_Element_File  getValue()
 
 

 If a file is submitted via Zend_Form_Element_File it returns the files
 location.

 i.e. $location = $form-foo-getValue();

 But if no file is submitted it returns the the destination directory,
 i.e.
 by default, the system temp directory.

 Is this expected behavior?

 Would it not be better for it to return null, if no file is uploaded?

 -- 
 View this message in context: 
 http://www.nabble.com/Zend_Form_Element_File---getValue%28%29-tp19391067p19391067.html
 Sent from the Zend Framework mailing list archive at Nabble.com. 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Form_Element_File---getValue%28%29-tp19391067p19443025.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] minial release contains .svn dirs

2008-09-11 Thread vladimirn

I just downloaded minimal, 3 min ago and there is .svn inside 

tfk wrote:
 
 On Thu, Sep 11, 2008 at 7:54 PM, Jordan Moore [EMAIL PROTECTED]
 wrote:
 I just downloaded both minimal zip and tar.gz archives, and neither
 one contained any .svn directories.
 
 Do you think I was dreaming? =)
 
 Thanks for fixing, whoever did it.
 
 

-- 
View this message in context: 
http://www.nabble.com/minial-release-contains-.svn-dirs-tp19440003p19444848.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] validation without a postback?

2008-09-11 Thread Lior Messinger

 validation without postback?

Hi

I wonder how one can do validation without postback, in PHP. In .NET,
ill-validated fields are showing an error on the browser, using javascript,
without any post back (except if it's a custom validator) .

Specifically, I'm using Zend. is there a way to do it here? I mean, using
some unified approach, and not by just having included javascript functions
customized ot every page. any other framework that does it? code samples?

thanks so much for _any_ idea
Lior
-- 
View this message in context: 
http://www.nabble.com/validation-without-a-postback--tp19444905p19444905.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] minial release contains .svn dirs

2008-09-11 Thread Jordan Moore
I used the direct download link, not the CDN, so that's probably the difference.

On Thu, Sep 11, 2008 at 2:10 PM, vladimirn [EMAIL PROTECTED] wrote:

 I just downloaded minimal, 3 min ago and there is .svn inside 

 tfk wrote:

 On Thu, Sep 11, 2008 at 7:54 PM, Jordan Moore [EMAIL PROTECTED]
 wrote:
 I just downloaded both minimal zip and tar.gz archives, and neither
 one contained any .svn directories.

 Do you think I was dreaming? =)

 Thanks for fixing, whoever did it.



 --
 View this message in context: 
 http://www.nabble.com/minial-release-contains-.svn-dirs-tp19440003p19444848.html
 Sent from the Zend Framework mailing list archive at Nabble.com.





-- 
Jordan Ryan Moore


Re: [fw-general] minial release contains .svn dirs

2008-09-11 Thread vladimirn

Oh, my bad, i am sorry, i was looking in the wrong folder with the same
name... i am sorry :)

vladimirn wrote:
 
 I just downloaded minimal, 3 min ago and there is .svn inside 
 
 tfk wrote:
 
 On Thu, Sep 11, 2008 at 7:54 PM, Jordan Moore [EMAIL PROTECTED]
 wrote:
 I just downloaded both minimal zip and tar.gz archives, and neither
 one contained any .svn directories.
 
 Do you think I was dreaming? =)
 
 Thanks for fixing, whoever did it.
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/minial-release-contains-.svn-dirs-tp19440003p19445012.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] validation without a postback?

2008-09-11 Thread Matthew Weier O'Phinney
-- Lior Messinger [EMAIL PROTECTED] wrote
(on Thursday, 11 September 2008, 02:13 PM -0700):
 ill-validated fields are showing an error on the browser, using javascript,
 without any post back (except if it's a custom validator) .
 
 Specifically, I'm using Zend. is there a way to do it here? I mean, using
 some unified approach, and not by just having included javascript functions
 customized ot every page. any other framework that does it? code samples?
 
 thanks so much for _any_ idea

You may want to look at Zend_Dojo; most dojo widgets allow specifying
validation constraints and messages (both tooltip and error). ;)

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


[fw-general] Fatal Error in Zend_Search_Lucene_Document_Html

2008-09-11 Thread Jan Brucek
Hi, I noticed some strange (for me) behavior when setting up  
Zend_Search_Lucene_Document_Html.


I use the following code:

---
$client = new Zend_Http_Client();
$client-setConfig(array('timeout'=30));
$client-setUri('http://www.example.com/');

$response_html = $client-request()-getBody();

$doc = Zend_Search_Lucene_Document_Html::loadHTML($response_html, true);
$index-addDocument($doc);

// the code continues without using the $index variable
---

and when I do not work with the $index later in the code, it returns  
Fatal error: Exception thrown without a stack frame in Unknown on  
line 0 at the end. When I call $index-optimize() or even  
unset($index) the fatal error is not triggered.


Is this normal, am I missing something really obvious or is it my PHP  
settings that causes that?


Thanks,

JB



[fw-general] Zend_Dojo Email validation, checkbox and Submit dojo form question- please?

2008-09-11 Thread vladimirn

Hello guys,
I made my first Zend_dojo_form and I have 3 questions so far :)


I've attached file with my signupController.php because its to long to be
posted here. http://www.nabble.com/file/p19441003/signupController.php.txt
signupController.php.txt 
Its .txt but you can see whats inside.


I dont know how to do next things:
1. All fields in my form are required. But if you hit Submit button, all
validation are some kind a avoided and i am redirected to my form action
(signup/process). How to prevent form to do this?
My Code:
$footer= new Zend_Dojo_Form_SubForm();
$footer-setAttribs(array('name' = 'footerData','legend' =
'Submit','style' = 'clear:both')); 
$footer-addElement('SubmitButton', 'submit', 
array(
'label' = 'Submit!'
));

$form = $form   -addSubForm($personalData, 'personalData')
-addSubForm($agreements,'agreements')
-addSubForm($footer,'footerData');
2. I also have a 3 checkbox. All 3 must be checked to procced. But form
procced no matter what.
My code:
$agreements= new Zend_Dojo_Form_SubForm();
$agreements-setAttribs(array('name' = 'agreements','legend' =
'Submit','class' = 'agreements'));
$agreements -addElement('checkbox','ages',array('required'
=true,'checked'=true,'style'='float:left' ,'label'='I\'m Over 18 years
old','invalidMessage' = 'You must validate that you are over 18',))

-addElement('checkbox','promotions',array('required'
=true,'checked'=true,'style'='float:left' ,'label'='I agree NOT to send
any email promotions promoting this web site','invalidMessage' = 'You must
validate that you are over 18',))
-addElement('checkbox','terms',array('required'
=true,'checked'=true,'style'='float:left' ,'label'='I agree to the Terms
 Conditions','invalidMessage' = 'You must validate that you are over
18',));

3. Is there any way to validate a field if i need that this field have a
valid URL address? 
My code:
$personalData-addElement ( 
'validationTextBox', 
'url', 
array ( 
'label' = 'Main Site URL:', 
'lowercase' = 'true', 
'maxlength' = 40, 
'value'='http://', 
'required' = true, 
'invalidMessage' = 'Please enter your web site 
URL.', 
'filters' = array (
'StringTrim', 
'StringToLower' ), 
'validators' = array (
'NotEmpty',) ) )

4. Is it possible to validate Email address with Zend_Dojo_Form?
My code is like this:
$personalData-addElement( 
'validationTextBox', 
'email', 
array(
'required' = true , 
'label' = 'Email address' , 
'invalidMessage' = 'Please provide valid Email 
address.', 
'filters' = array('StringTrim', 
'StringToLower') , 
'validators' = array('NotEmpty',

array('StringLength', true, array (6, 20 ) ),

array('EmailAddress' , true, array(
)

This aint work :)
Can someone help me on this please?
Thanks Vladimir
-- 
View this message in context: 
http://www.nabble.com/Zend_Dojo-Email-validation%2C-checkbox-and-Submit-dojo-form-question--please--tp19441003p19441003.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] One simple problem tooks me 2 hour- hope it will help someone..

2008-09-11 Thread vladimirn

I am windows user.
So i had in my signupForm:
-addElement ( 'MultiSelect', 'promotion', 

everything works fine on my computer (windows vista) and when i uploaded
file on the web server(linux) i got error message that Plugin MultiSelect
wasnt found

After two hours of updating library from zend framewrok, and headache, i
found that
-addElement ( 'multiselect', 'promotion', ... is working.
All cases had to be lowered.

Hope this will help someone...
-- 
View this message in context: 
http://www.nabble.com/One-simple-problem-tooks-me-2-hour--hope-it-will-help-someone..-tp19445706p19445706.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Dojo Email validation, checkbox and Submit dojo form question- please?

2008-09-11 Thread Matthew Weier O'Phinney
-- vladimirn [EMAIL PROTECTED] wrote
(on Thursday, 11 September 2008, 02:52 PM -0700):
 I've attached file with my signupController.php because its to long to be
 posted here. http://www.nabble.com/file/p19441003/signupController.php.txt
 signupController.php.txt 
 Its .txt but you can see whats inside.
 
 
 I dont know how to do next things:
 1. All fields in my form are required. But if you hit Submit button, all
 validation are some kind a avoided and i am redirected to my form action
 (signup/process). How to prevent form to do this?

You need to bind to the onSubmit event of your form, and validate in
your callback. One way to do this is as follows, from your view script:

? $this-dojo()-javascriptCaptureStart() ?
function validateForm() {
var form = dijit.byId(formId);
if (!form.validate()) {
alert(Invalid form);
return false;
}
return true;
}
? $this-dojo()-javascriptCaptureEnd() ?
? $this-dojo()-onLoadCaptureStart() ?
function () {
dojo.connect(dijit.byId(formId), onSubmit, validateForm);
}
? $this-dojo()-onLoadCaptureEnd() ?

What the above does is connect the onSubmit event to the form, which
then executes the validateForm() function; if this returns false,
submission is halted, and, in this case, an alert raised. You could also
popup a dialog box or some other notification.

 2. I also have a 3 checkbox. All 3 must be checked to procced. But form
 procced no matter what.

The above should also correct this.

 3. Is there any way to validate a field if i need that this field have a
 valid URL address? 

Google for a good URL regular expression, and add it to your element as
the regExp option. Make sure it doesn't contain boundaries (i.e., the
/^\d+$/ you'd pass to preg_match() would become ^\d+$ for dojo).

 4. Is it possible to validate Email address with Zend_Dojo_Form?

Yes. Again, google for a reasonable email regexp, and add it as the
regExp option to your element.


-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] One simple problem tooks me 2 hour- hope it will help someone..

2008-09-11 Thread Matthew Weier O'Phinney
-- vladimirn [EMAIL PROTECTED] wrote
(on Thursday, 11 September 2008, 03:02 PM -0700):
 
 I am windows user.
 So i had in my signupForm:
 -addElement ( 'MultiSelect', 'promotion', 
 
 everything works fine on my computer (windows vista) and when i uploaded
 file on the web server(linux) i got error message that Plugin MultiSelect
 wasnt found
 
 After two hours of updating library from zend framewrok, and headache, i
 found that
 -addElement ( 'multiselect', 'promotion', ... is working.
 All cases had to be lowered.

Not quite. It's more a case of case matters. Plugins are passed to
ucfirst(), and then passed as is to the plugin loader. Both
Multiselect and multiselect will work here, but not multiSelect or
MultiSelect. On the flip side, you want to use MultiCheckbox or
multiCheckbox, but not Multicheckbox or multicheckbox. 

The only character where case does not matter is the first character;
all other characters in the plugin name are case sensitive.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Zend_Form_Element_File MimeType validator

2008-09-11 Thread gerardroche

ok, trying this out out with the latest trunk.

It doesn't appear to throwing an error on submitting the form, e.g. Error:
Wrong Mime Type, though the file is not uploaded? $form-isValid() doesn't
catch it.



thomasW wrote:
 
 I've already added it several days ago.
 You can try it out by using the trunk repository or you have to wait until 
 the next subrelease comes out.
 
 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com
 
 - Original Message - 
 From: gerardroche [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Thursday, September 04, 2008 5:45 PM
 Subject: [fw-general] Zend_Form_Element_File  MimeType validator
 
 

 Is the MimeType validator available in Zend_Form_Element_File ZF1.6?


 http://framework.zend.com/manual/en/zend.file.transfer.validators.html


 $upload = new Zend_File_Transfer();

 // Limit the mimetype of all given files to gif images
 $upload-addValidator('MimeType', 'image/gif');

 // Limit the mimetype of all given files to gif and jpeg images
 $upload-setValidator('MimeType', array('image/gif', 'image/jpeg');

 // Limit the mimetype of all given files to the group images
 $upload-setValidator('MimeType', 'image');
 -- 
 View this message in context: 
 http://www.nabble.com/Zend_Form_Element_File---MimeType-validator-tp19313492p19313492.html
 Sent from the Zend Framework mailing list archive at Nabble.com. 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Form_Element_File---MimeType-validator-tp19313492p19448410.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Form_Element_File MimeType validator

2008-09-11 Thread gerardroche

ok, getting some funny goings on.

The problem has something to do with setRequired() set to false. Set to true
there are no problems.

Also, when you add a second File upload element to the form, the second
element will recieve the error from the first element?

so this is fine:

$element = new Zend_Form_Element_File('image');
$element-setDecorators($this-_standardElementDecorator)
-setLabel('Upload an image:')
-setRequired()
-addValidator('Count', false, 1)
-addValidator('Size', false, 102400)
-addValidator('Extension', false, 'jpg,png,gif')
-addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
$this-addElement($element);


remove setRequired() and no error

$element = new Zend_Form_Element_File('image');
$element-setDecorators($this-_standardElementDecorator)
-setLabel('Upload an image:')
-addValidator('Count', false, 1)
-addValidator('Size', false, 102400)
-addValidator('Extension', false, 'jpg,png,gif')
-addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
$this-addElement($element);

remove setRequired() and add extra file upload element and you get one
error (the error of the first element on the second element)

$element = new Zend_Form_Element_File('image');
$element-setDecorators($this-_standardElementDecorator)
-setLabel('Upload an image:')
-addValidator('Count', false, 1)
-addValidator('Size', false, 102400)
-addValidator('Extension', false, 'jpg,png,gif')
-addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
$this-addElement($element);


$element = new Zend_Form_Element_File('image 2');
$element-setDecorators($this-_standardElementDecorator)
-setLabel('Upload an image 2:')
-addValidator('Count', false, 1)
-addValidator('Size', false, 102400)
-addValidator('Extension', false, 'jpg,png,gif')
-addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
$this-addElement($element);




thomasW wrote:
 
 I've already added it several days ago.
 You can try it out by using the trunk repository or you have to wait until 
 the next subrelease comes out.
 
 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com
 
 - Original Message - 
 From: gerardroche [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Thursday, September 04, 2008 5:45 PM
 Subject: [fw-general] Zend_Form_Element_File  MimeType validator
 
 

 Is the MimeType validator available in Zend_Form_Element_File ZF1.6?


 http://framework.zend.com/manual/en/zend.file.transfer.validators.html


 $upload = new Zend_File_Transfer();

 // Limit the mimetype of all given files to gif images
 $upload-addValidator('MimeType', 'image/gif');

 // Limit the mimetype of all given files to gif and jpeg images
 $upload-setValidator('MimeType', array('image/gif', 'image/jpeg');

 // Limit the mimetype of all given files to the group images
 $upload-setValidator('MimeType', 'image');
 -- 
 View this message in context: 
 http://www.nabble.com/Zend_Form_Element_File---MimeType-validator-tp19313492p19313492.html
 Sent from the Zend Framework mailing list archive at Nabble.com. 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Form_Element_File---MimeType-validator-tp19313492p19448537.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] validation without a postback?

2008-09-11 Thread Lior Messinger

Hi

thanks for this. But, these mothod use Ajax to talk to the server. I, on the
other hands, am looking for some javascript function to validate on the
client. with no trip to the server. there are many types of validation that
can be done just on the client. for example, a require field

any ideas there?

thanks again
Lior

Matthew Weier O'Phinney-3 wrote:
 
 -- Lior Messinger [EMAIL PROTECTED] wrote
 (on Thursday, 11 September 2008, 02:13 PM -0700):
 ill-validated fields are showing an error on the browser, using
 javascript,
 without any post back (except if it's a custom validator) .
 
 Specifically, I'm using Zend. is there a way to do it here? I mean, using
 some unified approach, and not by just having included javascript
 functions
 customized ot every page. any other framework that does it? code samples?
 
 thanks so much for _any_ idea
 
 You may want to look at Zend_Dojo; most dojo widgets allow specifying
 validation constraints and messages (both tooltip and error). ;)
 
 -- 
 Matthew Weier O'Phinney
 Software Architect   | [EMAIL PROTECTED]
 Zend Framework   | http://framework.zend.com/
 
 

-- 
View this message in context: 
http://www.nabble.com/validation-without-a-postback--tp19444905p19448652.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Pdf - Text in Box

2008-09-11 Thread Rick Gigger
There's a pdf class that supports UTF-8???  I didn't think that any of  
them supported it???



On Sep 11, 2008, at 2:01 AM, Michał Zieliński wrote:



There is no free class which supports everything, afaik. If one  
gives you

line wrapping than doesn`t support UTF-8.


Dimitri van Hees wrote:


this is exactly the reason why i don't use Zend_PDF ;-)

Karol Grecki wrote:

Matthias

There's no ready solution for it, but it can be done.
You can use Style information to calculate line height and how  
much text

you
can fit on each line
Then you just split it and offset each line

Karol


Matthias Coy-2 wrote:


Hi there,

I would like to create a Textbox, in which the text I'm writing  
is

automatically wrapped, so that it fits into that box. Is there a
possibility to do that? As far as I looked through the Manual and  
Api

there is no possibilty.

Regards
Matthias Coy









--

- -

*freshheads* grafisch ontwerp en internet applicaties
Dunantstraat 1c | 5017 KC Tilburg | Nederland
tel. +31 (0)13 5448761 | fax. +31 (0)13 5448762
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] | www.freshheads.com
http://www.freshheads.com

Laatste berichten op het Freshheads blog:
Eindelijk, stage @ Freshheads!
http://blog.freshheads.com/2008/09/eindelijk-stage-freshheads/
?Hé, dit is toch beter dan we dachten?
http://blog.freshheads.com/2008/09/he-dit-is-toch-beter-dan-we-dachten/ 


Omroepen kondigen plannen aan tijdens Immovator ZomerCafé
http://blog.freshheads.com/2008/09/omroepen-kondigen-plannen-aan-tijdens-immovator-zomercafe/ 






--
View this message in context: 
http://www.nabble.com/Zend_Pdf---Text-in-Box-tp19408842p19429767.html
Sent from the Zend Framework mailing list archive at Nabble.com.





Re: [fw-general] Zend_Form_Element_File MimeType validator

2008-09-11 Thread Thomas Weidner

The setRequired problem has been solved some days ago.
You have to use r11364 or later where the last change for this component has 
been made.


Also I think that setRequired needs a boolean.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: gerardroche [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Friday, September 12, 2008 4:54 AM
Subject: Re: [fw-general] Zend_Form_Element_File  MimeType validator




ok, getting some funny goings on.

The problem has something to do with setRequired() set to false. Set to 
true

there are no problems.

Also, when you add a second File upload element to the form, the second
element will recieve the error from the first element?

so this is fine:

   $element = new Zend_Form_Element_File('image');
   $element-setDecorators($this-_standardElementDecorator)
   -setLabel('Upload an image:')
   -setRequired()
   -addValidator('Count', false, 1)
   -addValidator('Size', false, 102400)
   -addValidator('Extension', false, 'jpg,png,gif')
   -addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
   $this-addElement($element);


remove setRequired() and no error

   $element = new Zend_Form_Element_File('image');
   $element-setDecorators($this-_standardElementDecorator)
   -setLabel('Upload an image:')
   -addValidator('Count', false, 1)
   -addValidator('Size', false, 102400)
   -addValidator('Extension', false, 'jpg,png,gif')
   -addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
   $this-addElement($element);

remove setRequired() and add extra file upload element and you get one
error (the error of the first element on the second element)

   $element = new Zend_Form_Element_File('image');
   $element-setDecorators($this-_standardElementDecorator)
   -setLabel('Upload an image:')
   -addValidator('Count', false, 1)
   -addValidator('Size', false, 102400)
   -addValidator('Extension', false, 'jpg,png,gif')
   -addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
   $this-addElement($element);


   $element = new Zend_Form_Element_File('image 2');
   $element-setDecorators($this-_standardElementDecorator)
   -setLabel('Upload an image 2:')
   -addValidator('Count', false, 1)
   -addValidator('Size', false, 102400)
   -addValidator('Extension', false, 'jpg,png,gif')
   -addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
   $this-addElement($element);




thomasW wrote:


I've already added it several days ago.
You can try it out by using the trunk repository or you have to wait 
until

the next subrelease comes out.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: gerardroche [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Thursday, September 04, 2008 5:45 PM
Subject: [fw-general] Zend_Form_Element_File  MimeType validator




Is the MimeType validator available in Zend_Form_Element_File ZF1.6?


http://framework.zend.com/manual/en/zend.file.transfer.validators.html


$upload = new Zend_File_Transfer();

// Limit the mimetype of all given files to gif images
$upload-addValidator('MimeType', 'image/gif');

// Limit the mimetype of all given files to gif and jpeg images
$upload-setValidator('MimeType', array('image/gif', 'image/jpeg');

// Limit the mimetype of all given files to the group images
$upload-setValidator('MimeType', 'image');
--
View this message in context:
http://www.nabble.com/Zend_Form_Element_File---MimeType-validator-tp19313492p19313492.html
Sent from the Zend Framework mailing list archive at Nabble.com.






--
View this message in context: 
http://www.nabble.com/Zend_Form_Element_File---MimeType-validator-tp19313492p19448537.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Models and folder grouping

2008-09-11 Thread jkush1121

I have a similar setup... Here's what I've done...

In the bootstrap, I loop through all of my modules, and add the models
folder to the inclusion path

$paths[] = BP . DS . 'app' . DS . 'modules';
$dir = new DirectoryIterator($paths[0]);
foreach($dir as $file){
if ($file-isDot() || !$file-isDir()) {
continue;
}

$moduleName= $file-getFilename();
$moduleDir = $file-getPathname();

if (preg_match('/^[^a-z]/i', $moduleName) || ('CVS' == $moduleName)) {
   continue;
}
$paths[] = $moduleDir.DS.'models';
}
$paths[] = BP . DS . 'lib';
set_include_path( implode(PS, $paths) . PS . get_include_path());

So, at this point, 

/app/modules/core/models 

is within my inclusion path.

Now, I create a subfolder within models called Core ( same module name, just
uppercased ).  Lastly, I now place all my models that I want within the core
module, within :

/app/modules/core/models/Core/User.php
/app/modules/core/models/Core/Website.php
/app/modules/core/models/Securepay/Payment.php

Now, I am able to utilize spl_autoload with the proper syntax ( Core_User ). 
All of my models that are db-base will extend from my lib model (
Project_Db_Table_Abstract ). With this, I have the ability to declare the
tablename as either the classname, or maybe a variation. 

Another cool thing I did, was create something like this:

final class Project
{
  public static function getModel($classId,$args=array()){
$classArr = explode('/', trim($classId));
$group = $classArr[0];
$class = !empty($classArr[1]) ? $classArr[1] : null;
   $className = $group.'_';
   if (!empty($class)) {
$className .= '_'.$class;
   }
  $className = uc_words($className);
  if (class_exists($className)) {
return new $className($args);
  }
}

So you ask, how does this actually benefit?

Project::getModel('core/website')-insert($data);

kinda cool.

Anyway, I hope this helps a bit.


Ghrae wrote:
 
 I have a lot of tables in my database.  And I could make a model for each
 one, but at that point, the folder gets a bit unmanageable.  So in the
 effort of organizing it a bit:
 
 1) How do I create sub folders under the model folder such that I can use
 the Zend_Loader::loadClass to find and load them?
 
 2) some of the tables have underscores (i.e. acl_users).  I would like to
 put all ACL tables in an ACL folder.  At that point I don't care if the
 individual models are named Users or ACL_Users or whatever, as long as
 they are grouped and the name is intuitive.  What naming convention should
 I use for the models once in the sub folders
 
 3) Does naming tables with underscores cause any issues with Zend's
 current naming conventions?  And if so, is there a better or different
 naming convention that anyone would like to suggest?
 
 This is a pet project of mine that I'm reworking in a development
 environment in an effort to learn Zend and teach me better programming
 habits (most of my PHP has been self-taught by using examples across the
 web and most of those do not teach good habits of programming).
 

-- 
View this message in context: 
http://www.nabble.com/Models-and-folder-grouping-tp19412763p19449359.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Form_Element_File MimeType validator

2008-09-11 Thread gerardroche

i'm using r11367 and running into quite a few problems with the
Zend_Form_Element_File component, e.g. adding two file upload elements to a
form causes a few problems.

The setRequired() element has been given a default

/**
 * Set required flag
 * 
 * @param  bool $flag Default value is true
 * @return Zend_Form_Element
 */
public function setRequired($flag = true)
{
$this-_required = (bool) $flag;
return $this;
}


thomasW wrote:
 
 The setRequired problem has been solved some days ago.
 You have to use r11364 or later where the last change for this component
 has 
 been made.
 
 Also I think that setRequired needs a boolean.
 
 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com
 
 - Original Message - 
 From: gerardroche [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Friday, September 12, 2008 4:54 AM
 Subject: Re: [fw-general] Zend_Form_Element_File  MimeType validator
 
 

 ok, getting some funny goings on.

 The problem has something to do with setRequired() set to false. Set to 
 true
 there are no problems.

 Also, when you add a second File upload element to the form, the second
 element will recieve the error from the first element?

 so this is fine:

$element = new Zend_Form_Element_File('image');
$element-setDecorators($this-_standardElementDecorator)
-setLabel('Upload an image:')
-setRequired()
-addValidator('Count', false, 1)
-addValidator('Size', false, 102400)
-addValidator('Extension', false, 'jpg,png,gif')
-addValidator('MimeType', false, array('image/jpeg',
 'image/png', 'image/gif'));
$this-addElement($element);


 remove setRequired() and no error

$element = new Zend_Form_Element_File('image');
$element-setDecorators($this-_standardElementDecorator)
-setLabel('Upload an image:')
-addValidator('Count', false, 1)
-addValidator('Size', false, 102400)
-addValidator('Extension', false, 'jpg,png,gif')
-addValidator('MimeType', false, array('image/jpeg',
 'image/png', 'image/gif'));
$this-addElement($element);

 remove setRequired() and add extra file upload element and you get one
 error (the error of the first element on the second element)

$element = new Zend_Form_Element_File('image');
$element-setDecorators($this-_standardElementDecorator)
-setLabel('Upload an image:')
-addValidator('Count', false, 1)
-addValidator('Size', false, 102400)
-addValidator('Extension', false, 'jpg,png,gif')
-addValidator('MimeType', false, array('image/jpeg',
 'image/png', 'image/gif'));
$this-addElement($element);


$element = new Zend_Form_Element_File('image 2');
$element-setDecorators($this-_standardElementDecorator)
-setLabel('Upload an image 2:')
-addValidator('Count', false, 1)
-addValidator('Size', false, 102400)
-addValidator('Extension', false, 'jpg,png,gif')
-addValidator('MimeType', false, array('image/jpeg',
 'image/png', 'image/gif'));
$this-addElement($element);




 thomasW wrote:

 I've already added it several days ago.
 You can try it out by using the trunk repository or you have to wait 
 until
 the next subrelease comes out.

 Greetings
 Thomas Weidner, I18N Team Leader, Zend Framework
 http://www.thomasweidner.com

 - Original Message - 
 From: gerardroche [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Thursday, September 04, 2008 5:45 PM
 Subject: [fw-general] Zend_Form_Element_File  MimeType validator



 Is the MimeType validator available in Zend_Form_Element_File ZF1.6?


 http://framework.zend.com/manual/en/zend.file.transfer.validators.html


 $upload = new Zend_File_Transfer();

 // Limit the mimetype of all given files to gif images
 $upload-addValidator('MimeType', 'image/gif');

 // Limit the mimetype of all given files to gif and jpeg images
 $upload-setValidator('MimeType', array('image/gif', 'image/jpeg');

 // Limit the mimetype of all given files to the group images
 $upload-setValidator('MimeType', 'image');
 -- 
 View this message in context:
 http://www.nabble.com/Zend_Form_Element_File---MimeType-validator-tp19313492p19313492.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




 -- 
 View this message in context: 
 http://www.nabble.com/Zend_Form_Element_File---MimeType-validator-tp19313492p19448537.html
 Sent from the Zend Framework mailing list archive at Nabble.com. 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Form_Element_File---MimeType-validator-tp19313492p19449437.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Form_Element_File MimeType validator

2008-09-11 Thread Thomas Weidner

You said youre having problems with setRequired.
Please declare in detail what problems you have got, what you expected and 
what you've done.


Also it would be nice to see what error you got...
Just to say I got an error, is not enough for reproduction especially when 
someone provides no additionally informations.


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: gerardroche [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Friday, September 12, 2008 6:58 AM
Subject: Re: [fw-general] Zend_Form_Element_File  MimeType validator




i'm using r11367 and running into quite a few problems with the
Zend_Form_Element_File component, e.g. adding two file upload elements to 
a

form causes a few problems.

The setRequired() element has been given a default

   /**
* Set required flag
*
* @param  bool $flag Default value is true
* @return Zend_Form_Element
*/
   public function setRequired($flag = true)
   {
   $this-_required = (bool) $flag;
   return $this;
   }


thomasW wrote:


The setRequired problem has been solved some days ago.
You have to use r11364 or later where the last change for this component
has
been made.

Also I think that setRequired needs a boolean.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: gerardroche [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Friday, September 12, 2008 4:54 AM
Subject: Re: [fw-general] Zend_Form_Element_File  MimeType validator




ok, getting some funny goings on.

The problem has something to do with setRequired() set to false. Set to
true
there are no problems.

Also, when you add a second File upload element to the form, the second
element will recieve the error from the first element?

so this is fine:

   $element = new Zend_Form_Element_File('image');
   $element-setDecorators($this-_standardElementDecorator)
   -setLabel('Upload an image:')
   -setRequired()
   -addValidator('Count', false, 1)
   -addValidator('Size', false, 102400)
   -addValidator('Extension', false, 'jpg,png,gif')
   -addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
   $this-addElement($element);


remove setRequired() and no error

   $element = new Zend_Form_Element_File('image');
   $element-setDecorators($this-_standardElementDecorator)
   -setLabel('Upload an image:')
   -addValidator('Count', false, 1)
   -addValidator('Size', false, 102400)
   -addValidator('Extension', false, 'jpg,png,gif')
   -addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
   $this-addElement($element);

remove setRequired() and add extra file upload element and you get one
error (the error of the first element on the second element)

   $element = new Zend_Form_Element_File('image');
   $element-setDecorators($this-_standardElementDecorator)
   -setLabel('Upload an image:')
   -addValidator('Count', false, 1)
   -addValidator('Size', false, 102400)
   -addValidator('Extension', false, 'jpg,png,gif')
   -addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
   $this-addElement($element);


   $element = new Zend_Form_Element_File('image 2');
   $element-setDecorators($this-_standardElementDecorator)
   -setLabel('Upload an image 2:')
   -addValidator('Count', false, 1)
   -addValidator('Size', false, 102400)
   -addValidator('Extension', false, 'jpg,png,gif')
   -addValidator('MimeType', false, array('image/jpeg',
'image/png', 'image/gif'));
   $this-addElement($element);




thomasW wrote:


I've already added it several days ago.
You can try it out by using the trunk repository or you have to wait
until
the next subrelease comes out.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: gerardroche [EMAIL PROTECTED]

To: fw-general@lists.zend.com
Sent: Thursday, September 04, 2008 5:45 PM
Subject: [fw-general] Zend_Form_Element_File  MimeType validator




Is the MimeType validator available in Zend_Form_Element_File ZF1.6?


http://framework.zend.com/manual/en/zend.file.transfer.validators.html


$upload = new Zend_File_Transfer();

// Limit the mimetype of all given files to gif images
$upload-addValidator('MimeType', 'image/gif');

// Limit the mimetype of all given files to gif and jpeg images
$upload-setValidator('MimeType', array('image/gif', 'image/jpeg');

// Limit the mimetype of all given files to the group images
$upload-setValidator('MimeType', 'image');
--
View this message in context: