[fw-general] Zend+Dojo+ Edit Form

2009-07-08 Thread ierpe

Hi,

I am pretty new to ZF and I started building an MVC app with it.

I already implemented some models, controllers and simple views, but I have
a problem with my edit/update actions.
I cannot find a way to insert values retrieved from the db into my edit
forms.

I have seen in the and ZF documentation that there is a
$form-populate($data) method and a $form-setDefaults ($data) that are
supposed to fill the form with the $data values. My form input names are the
same than in the db, so im just retrieving the $data from the db and I
expected the function to fill it for me, but it doesnt...

Also I installed Dojo now and my forms are Dojo's now, could it be linked?
Please if you know a solution or a good post/tutorial on how to do this it
would be much appreciated!

-- 
View this message in context: 
http://www.nabble.com/Zend%2BDojo%2B-Edit-Form-tp24387814p24387814.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [Fwd: Re: [fw-general] Generate menu with variables with Zend Navigation]

2009-07-08 Thread Joakim Gerth
Anyone?

Regards,
Joakim

On Wed, Jul 1, 2009 at 7:39 AM, Joakim Gerth arma...@gmail.com wrote:

 Does anyone know how to do the below?

 I would like to generate a menu with dynamic parameters such as when visiting 
 page A, link should be /controller/action?id=A, when visiting page B link 
 should be /controller/action?id=B.

 Is it not possible to do? Any clean or workaround suggestions are welcome.

 Regards,
 Joakim

 On Tue, Jun 23, 2009 at 10:07 PM, Joakim Gerth arma...@gmail.com wrote:



 -- Forwarded message --
 From: Joakim Gerth arma...@gmail.com
 To: Josh Team josht...@gmail.com
 Date: Mon, 22 Jun 2009 18:54:03 +0200
 Subject: Re: [fw-general] Generate menu with variables with Zend Navigation
 And how to make id dynamical? So it can be rendered differently dependent on 
 where i am?

 On Mon, Jun 22, 2009 at 6:36 PM, Josh Team josht...@gmail.com wrote:

 params
  idxxx/id
 /params
 after /action and before /home

 On Mon, Jun 22, 2009 at 11:34 AM, Joakim Gertharma...@gmail.com wrote:
  Hi all,
  I would like to render a menu from xml config using Zend Navigation. My
  problem is to include action specific variables in the url.
 
  I.e. in my xml file
  home
      labelHome/label
      controllerindex/controller
      actionindex/action
  /home
 
  In my menu i would like the url pointing to /index/index/?id=xxx
 
  Is that possible?
  If yes, how, if no are there any possible workarounds?
 
  BR
  Joakim
 
 





Re: [Fwd: Re: [fw-general] Generate menu with variables with Zend Navigation]

2009-07-08 Thread Jurian Sluiman
Op Wednesday 08 July 2009 11:02:31 schreef Joakim Gerth:
 Anyone?

 Regards,
 Joakim

 On Wed, Jul 1, 2009 at 7:39 AM, Joakim Gerth arma...@gmail.com wrote:
  Does anyone know how to do the below?
 
  I would like to generate a menu with dynamic parameters such as when
  visiting page A, link should be /controller/action?id=A, when visiting
  page B link should be /controller/action?id=B.
 
  Is it not possible to do? Any clean or workaround suggestions are
  welcome.
 
  Regards,
  Joakim
 
  On Tue, Jun 23, 2009 at 10:07 PM, Joakim Gerth arma...@gmail.com wrote:
  -- Forwarded message --
  From: Joakim Gerth arma...@gmail.com
  To: Josh Team josht...@gmail.com
  Date: Mon, 22 Jun 2009 18:54:03 +0200
  Subject: Re: [fw-general] Generate menu with variables with Zend
  Navigation And how to make id dynamical? So it can be rendered
  differently dependent on where i am?
 
  On Mon, Jun 22, 2009 at 6:36 PM, Josh Team josht...@gmail.com wrote:
  params
   idxxx/id
  /params
  after /action and before /home
 
  On Mon, Jun 22, 2009 at 11:34 AM, Joakim Gertharma...@gmail.com wrote:
   Hi all,
   I would like to render a menu from xml config using Zend Navigation.
   My problem is to include action specific variables in the url.
  
   I.e. in my xml file
   home
   labelHome/label
   controllerindex/controller
   actionindex/action
   /home
  
   In my menu i would like the url pointing to /index/index/?id=xxx
  
   Is that possible?
   If yes, how, if no are there any possible workarounds?
  
   BR
   Joakim

Correct me if I'm wrong, but ZF is capable of doing such urls like 
/controller/action/id/1234. This is internally mapped like controller = 
controller, action = action, id = 1234. 
This is possible by the navigation xml structure Josh already said.


Regards, Jurian

--
Jurian Sluiman
Soflomo.com



Re: [Fwd: Re: [fw-general] Generate menu with variables with Zend Navigation]

2009-07-08 Thread Joakim Gerth
Thanks for your reply Jurian.

However, that seem to be static id values. I need to make dynamic
urls, i.e. this-view-id = 1234;, which would then render
controller/action/id/1234. That is not what you are referring to
right?

Regards,
Joakim

On Wed, Jul 8, 2009 at 11:13 AM, Jurian
Sluimansubscr...@juriansluiman.nl wrote:
 Op Wednesday 08 July 2009 11:02:31 schreef Joakim Gerth:
 Anyone?

 Regards,
 Joakim

 On Wed, Jul 1, 2009 at 7:39 AM, Joakim Gerth arma...@gmail.com wrote:
  Does anyone know how to do the below?
 
  I would like to generate a menu with dynamic parameters such as when
  visiting page A, link should be /controller/action?id=A, when visiting
  page B link should be /controller/action?id=B.
 
  Is it not possible to do? Any clean or workaround suggestions are
  welcome.
 
  Regards,
  Joakim
 
  On Tue, Jun 23, 2009 at 10:07 PM, Joakim Gerth arma...@gmail.com
  wrote:
  -- Forwarded message --
  From: Joakim Gerth arma...@gmail.com
  To: Josh Team josht...@gmail.com
  Date: Mon, 22 Jun 2009 18:54:03 +0200
  Subject: Re: [fw-general] Generate menu with variables with Zend
  Navigation And how to make id dynamical? So it can be rendered
  differently dependent on where i am?
 
  On Mon, Jun 22, 2009 at 6:36 PM, Josh Team josht...@gmail.com wrote:
  params
   idxxx/id
  /params
  after /action and before /home
 
  On Mon, Jun 22, 2009 at 11:34 AM, Joakim Gertharma...@gmail.com
  wrote:
   Hi all,
   I would like to render a menu from xml config using Zend Navigation.
   My problem is to include action specific variables in the url.
  
   I.e. in my xml file
   home
       labelHome/label
       controllerindex/controller
       actionindex/action
   /home
  
   In my menu i would like the url pointing to /index/index/?id=xxx
  
   Is that possible?
   If yes, how, if no are there any possible workarounds?
  
   BR
   Joakim

 Correct me if I'm wrong, but ZF is capable of doing such urls like
 /controller/action/id/1234. This is internally mapped like controller =
 controller, action = action, id = 1234.
 This is possible by the navigation xml structure Josh already said.


 Regards, Jurian

 --
 Jurian Sluiman
 Soflomo.com




Re: [fw-general] Zend+Dojo+ Edit Form

2009-07-08 Thread lightflowmark

The form-populate() method takes an array where the keys are the names of
the form fields.

The Zend_Db_Table_Row object implements a toArray() method which can be used
here (as do many other objects).  So you can do stuff like:

$form = new MyForm;

$table = new MyTable;
$rowset = $table-find($id);
$row = $rowset-current();

$form-populate($row-toArray());


Hope that helps!

Mark



ierpe wrote:
 
 Hi,
 
 I am pretty new to ZF and I started building an MVC app with it.
 
 I already implemented some models, controllers and simple views, but I
 have a problem with my edit/update actions.
 I cannot find a way to insert values retrieved from the db into my edit
 forms.
 
 I have seen in the and ZF documentation that there is a
 $form-populate($data) method and a $form-setDefaults ($data) that are
 supposed to fill the form with the $data values. My form input names are
 the same than in the db, so im just retrieving the $data from the db and I
 expected the function to fill it for me, but it doesnt...
 
 Also I installed Dojo now and my forms are Dojo's now, could it be linked?
 Please if you know a solution or a good post/tutorial on how to do this it
 would be much appreciated!
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend%2BDojo%2B-Edit-Form-tp24387814p24389098.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Determine Browser IR or Firefox

2009-07-08 Thread lightflowmark

There is an option in the HeadStyle (? I think) view helper to conditionally
include styles based on the browser, this may be an option depending on what
you want to know the user agent for.



Juan Felipe Alvarez Saldarriaga-2 wrote:
 
 Hum, I don't think so, there's a proposal about user agents
 http://framework.zend.com/wiki/display/ZFPROP/Zend_UserAgent+-+Christer+Edvartsen,
 you could use $request-getServer( HTTP_USER_AGENT ); instead.
 
 On Tue, Jul 7, 2009 at 8:46 PM, jigen7i_love_ji...@yahoo.com wrote:

 is  there a function in zend wherein it returns what browser the user is
 currently using?
 --
 View this message in context:
 http://www.nabble.com/Determine-Browser-IR-or-Firefox-tp24384077p24384077.html
 Sent from the Zend Framework mailing list archive at Nabble.com.


 
 

-- 
View this message in context: 
http://www.nabble.com/Determine-Browser-IR-or-Firefox-tp24384077p24389117.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend+Dojo+ Edit Form

2009-07-08 Thread ierpe

Thats what I do in my controller:

$obj = new...
$obj-setId($id);
$data = $obj-select();

My select method returns:
$result = $this-dbConnect()-fetchAll($query,2);
return $result;

When I try to use $data-current(); or $data-toArray(); like you said, I
get: Fatal error: Call to a member function current() on a non-object or
Fatal error: Call to a member function toArray() on a non-object

...?
-- 
View this message in context: 
http://www.nabble.com/Zend%2BDojo%2B-Edit-Form-tp24387814p24389380.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend+Dojo+ Edit Form

2009-07-08 Thread ierpe

Solved it, my mistake was to think that my $data array was like
array(key=value,key=value) where in fact it was array(
[0](key=value,key=value)), so i wasnt pointing to the right thing...

 thanks for your time and sorry! :)
-- 
View this message in context: 
http://www.nabble.com/Zend%2BDojo%2B-Edit-Form-tp24387814p24390096.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend Framework + Doctrine Module Autoloader issue

2009-07-08 Thread dbroderick

I am using ZF 1.8.4 and Doctrine 1.1.2 with a module directory setup of


+---application
|   +---configs
|   \---modules
|   +---default
|   |   +---controllers
|   |   \---views
|   |   \---scripts
|   |   +---error
|   |   \---index
|   +---error
|   |   +---controllers
|   |   \---views
|   |   \---scripts
|   |   \---error
|   \---user
|   +---controllers
|   +---models
|   |   \---generated
|   \---views
|   \---scripts
|   \---index
+---library
|   \---App
|   \---Application
|   \---Resource
+---public
|   +---images
|   \---themes
|   \---default
|   \---css
\---tests
+---application
\---library


I have a resource file called Doctrine.php in my library folder which does
the following:


$zla = Zend_Loader_Autoloader::getInstance();
$zla-unshiftAutoloader( array( 'Doctrine', 'autoload' ), 'Doctrine'
)-setFallbackAutoloader( true );


$manager = Doctrine_Manager::connection( $this-_getConnectionString() );
$manager = Doctrine_Manager::getInstance();
$manager-setAttribute( Doctrine::ATTR_MODEL_LOADING, 
Doctrine::MODEL_LOADING_CONSERVATIVE );
$manager-setAttribute( Doctrine::ATTR_PORTABILITY,
Doctrine::PORTABILITY_NONE );
$manager-setAttribute( Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true );
$manager-setAttribute( Doctrine::ATTR_USE_DQL_CALLBACKS, true );
$manager-setAttribute( Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true );


My config xml file has this:


--- snip ---


pluginPaths

App_Application_Resource![CDATA[App/Application/Resource]]/App_Application_Resource
/pluginPaths  
resources
frontController

defaultmodule![CDATA[default]]/defaultmodule
params

prefixDefaultModule![CDATA[true]]/prefixDefaultModule

usedefaultcontrolleralways![CDATA[false]]/usedefaultcontrolleralways
/params
/frontController
modules
default![CDATA[default]]/default
error![CDATA[error]]/error
user![CDATA[user]]/user
/modules
!-- Doctrine application plugin --
doctrine
dbtype![CDATA[dbtype]]/dbtype
dbhost![CDATA[localhost]]/dbhost
dbname![CDATA[dbname]]/dbname
dbuser![CDATA[dbuser]]/dbuser
dbpass![CDATA[dbpass]]/dbpass
/doctrine 
!-- View application plugin --
view![CDATA[view]]/view
/resources


--- snip ---


The default Module Autoloader is loaded correctly during bootstrapping,
making available the default resource types (form, model, dbtable), but I
use Doctrine so dbtable is not used and I would like to insert, override or
even replace the default resource type(s) with a folder in models that
Doctrine uses which is 'generated'.


My preference is that when my Resource Plugin which configures Doctrine as
my DB layer, also can inject the needed resource type into the default
module autoloader, in order to make the configuration available in all
modules.


I have tried for the past day to get this to work but all of the examples I
find are to create a module autoloader in the module bootstrap file which
means (as I understand it) that I have to do this for each module bootstrap.


I am still new to Zend and struggling a bit with the changes in v1.8, so I
may have just missed the example that shows how this is done.


Of course my ultimate problem here is that when I try to load a model
User.php in the models folder which extends generated\BaseUser.php, the
BaseUser class is not found.

Thanks,
David
-- 
View this message in context: 
http://www.nabble.com/Zend-Framework-%2B-Doctrine-Module-Autoloader-issue-tp24392765p24392765.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Dojo IE issues, ugrent assistance needed!

2009-07-08 Thread Kostyantyn Shakhov
I need to submit a Dojo form by pressing Enter or Space on a submit button.

I use the following simple Dojo form with two submit buttons:

form action=  method=post id=  
input id=b2 name=b2 value=B2 type=submit /
input id=b2 name=b2 value=B2 type=submit /
/td

The browser is IE7.

If I use Dojo 1.2.3 the form submit by keyboard DOESN’T work.

If I update Dojo to either 1.3.0 or 1.3.1 the form submit by keyboard
works perfect but the POST data are incorrect under IE7:

array(1) {
  [b1] = string(292) SPAN class=dijitReset dijitInline
dojoAttachPoint=iconNode unselectable=onSPAN class=dijitReset
dijitToggleButtonIconChar unselectable=on✓/SPAN/SPANSPAN
class=dijitReset dijitInline dijitButtonText id=b1_label
dojoAttachPoint=containerNode unselectable=onB1/SPAN
}

instead of:

array(1) {
  [b1] = string(2) B1
}

The POST data is correct under Firefox3.

This Dojo-IE7 issue causing the
Zend_Dojo_Form_Element_Button::isChecked() method failure.

The issue is urgent and I appreciate any advices.


[fw-general] Zend_Service_ReCaptcha in Zend_Form

2009-07-08 Thread umpirsky

Hi zf gurus.

I have my form which extends Zend_Form, and in my init method I have
following code:

$recaptcha = new Zend_Service_ReCaptcha('*', '*');

$captcha = new Zend_Form_Element_Captcha('challenge',
array('captcha' = 'ReCaptcha',
'captchaOptions' = array('captcha' = 'ReCaptcha', 
'service' =
$recaptcha)));

$this-addElement($recaptcha);

running this with Zend_Version 1.8.1 throws error:

Notice: Undefined index: in \library\Zend\Form.php on line 1002

Fatal error: Call to a member function getOrder() on a non-object in
\library\Zend\Form.php on line 1002

Any idea why this fails?

Regards,
Sasa Stamenkovic
-- 
View this message in context: 
http://www.nabble.com/Zend_Service_ReCaptcha-in-Zend_Form-tp24395850p24395850.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Form repopulating and error messages corrupt Unicode characters

2009-07-08 Thread maritakous

Good day. A month ago I started playing with Zend Framework. Overall
impression - pretty good. But today I encountered a problem.

I have made a simple login form where only Latin symbols are accepted as
valid user name. Zend validators work fine and I got those error messages
for invalid form fields as long as I do not enter some non-Latin characters.
If I enter some Unicode characters, the invalid form field contains garbage
and the error message too (like this: '�' has not only alphabetic and
digit characters).

I tested if server environment is fine - the same symbols get displayed
correctly when I do 'echo' and when I insert them directly into the view.
And if I call Zend_Debug::dump($request-getPost());
in my controller then I see that those symbols are fine in the _POST. So I
guess there are no problems between browser and server but the problem lies
somewhere in Zend framework. I have read that I can set encoding for filters
in the form. But how can I force UTF-8 form elements and error messages? I
tried to look for the error message in Zend library source, found and saved
that file with UTF-8 but that did not help.

It seems I'll be implementing my own translated messages for validators but
still it would be nice to have the correct Unicode symbols with the default
messages.

Thanks for any ideas.


-- 
View this message in context: 
http://www.nabble.com/Zend_Form-repopulating-and-error-messages-corrupt-Unicode-characters-tp24396770p24396770.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] XML generated menu renders incorrect character encoding

2009-07-08 Thread Joakim Gerth




It did not help to download the 1.8.4 release. 

To summarize, in bootstrap charset=iso-8859-1 is set. I am generating a
menu with swedish characters from a xml file. 

Scenarios:

1. Bootstrap iso-8859-1, xml utf-8: inline text generated correctly,
menu displays Bcker
instead of bcker.

2. bootstrap iso-8859-1, xml iso-8859-1: Same as above.

3. Bootstrap utf-8, xml iso-8859-1: Menu looks correct, inline text
displays brjar instead of brjar.

4. Bootstrap uft-8, xml utf-8: Same as 3)

Could anyone please help out with this? How should I solve it?

Regards,
Joakim

Joakim Gerth skrev:
Actually it could be a manifestation of http://framework.zend.com/issues/browse/ZF-6857.
I will try out the latest version and take it from there.
  
  On Wed, Jul 1, 2009 at 7:34 AM, Joakim Gerth
  arma...@gmail.com wrote:
  I
am not sure how to do this. You are not talking about setting up the
encoding inside the xml file and my layout file (which is done). I am
using the Eclipse PDT that i suppose should have the same encoding set
for all files. 

Could you give me an example on how to make point 2 below?

Regards,
Joakim



On Mon, Jun 22, 2009 at 7:55 AM, Jonathan
Maron jonathan.a.ma...@gmail.com
wrote:
Switching
from ISO-8859-1 to UTF-8 can be tricky.
  
Here are a few things to check:
  
1. Your site returns the UTF-8 header.
2. All your PHTML/PHP/XML files are encoded in UTF-8.
3. You use multibyte functions to analyze strings (see: http://is.gd/18VwB).
  
In your case, I would guess that you have a mix of ISO-8859-1 and
UTF-8 encoded files -- this often creates a lot of problems.
  
Following step #2 above should solve the problem.
  
Jonathan Maron
  
  
  
  
  
On Mon, Jun 22, 2009 at 7:22 AM, Joakim Gerth arma...@gmail.com
wrote:

 Hi all,

 I am using zend_navigation to render my menus. The navigation
container is built from a xml configuration file.

 My problem is that the site is in swedish, hence a lot of ''.
The site uses iso-8859-1 to render them correctly. However, these
characters are incorrect when using the xml config. I have tried to
change xml encoding to iso.. but nothing changes. If I change the
encoding of entire site (made in bootstrap) to utf-8 the menus are
displaye correct , but the site content is now corrupt.

 Could anyone help out here?

 Regards,
 Joakim

  
  





  
  
  






Re: [fw-general] Zend_Service_ReCaptcha in Zend_Form

2009-07-08 Thread umpirsky

I don't know why, but now it works :jumping:

$recaptcha = new Zend_Service_ReCaptcha('*', '*');
$captcha = new Zend_Form_Element_Captcha('captcha', array(
'label' = Please verify you're a human,
'captcha' = 'ReCaptcha',
'captchaOptions' = array(
'service' = $recaptcha
)
));

$this-addElement($captcha);

Regards,
Sasa Stamenkovic


umpirsky wrote:
 
 Hi zf gurus.
 
 I have my form which extends Zend_Form, and in my init method I have
 following code:
 
 $recaptcha = new Zend_Service_ReCaptcha('*', '*');
 
 $captcha = new Zend_Form_Element_Captcha('challenge',
   array('captcha' = 'ReCaptcha',
   'captchaOptions' = array('captcha' = 'ReCaptcha', 
 'service' =
 $recaptcha)));
 
 $this-addElement($recaptcha);
 
 running this with Zend_Version 1.8.1 throws error:
 
 Notice: Undefined index: in \library\Zend\Form.php on line 1002
 
 Fatal error: Call to a member function getOrder() on a non-object in
 \library\Zend\Form.php on line 1002
 
 Any idea why this fails?
 
 Regards,
 Sasa Stamenkovic
 

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



[fw-general] Validator custom error messages, behavior different in ZF 1.7.8 vs 1.8.x ?

2009-07-08 Thread David Mintz
I have a model class that has a validate($data) method. It puts together an
array of validators and eventually comes down to

  $input = new Zend_Filter_Input($filters,$validators,$data);

In ZF 1.7.8, $input-getMessages() returns my custom error messages, works
just as I intend, but the same code in 1.8.2 (and 1.8.4) ignores my error
messages and instead returns the defaults

The following is the array of validators in question (don't look too hard,
it's rather ugly):

$validators = array(

'datetime' = array(
new SdnyDate(),
'fields' =array('date','time'),
'breakChainOnFailure' = true,
'presence' = 'required',
),
'time' = array(
'NotEmpty',
'presence' = 'required',
'messages' = Time is required,
),
'date' = array(

'NotEmpty',
'Date',

array('GreaterThan',date('Y-m-d',mktime(0,0,0,$today['mon'],$today['mday']-1,$today['year']))),
new Model_Validator_BusinessDay(),
'presence' = 'required',
'messages' =
array(0=Date is required,1=Invalid date ,2='This date
is in the past'),
'breakChainOnFailure' = true,
),
'language_id'=
array('NotEmpty',
array('InArray',(array_keys(Model_Languages::getAll(false,
'presence' = 'required',
'messages'=array(
0='The language field is required.',
1 ='Invalid language id',
),
'breakChainOnFailure' = true,

),

'judge_id'=array(
'NotEmpty',

 array('InArray',(array_keys(Model_Judges::getAllActive(false,
'presence' = 'required',
'messages'=array(0='The judge field is
required.',1='Invalid judge id'),
 'breakChainOnFailure' = true,
),

// make the docket required,
// and make it match this format: nn-(CR|CIV|MAG|MISC)-x[xxx]
// javascript will help them get it right
'docket'=array(
   'NotEmpty',
new Zend_Validate_Regex(self::DOCKET_REGEX),
'messages'=array(0='Docket number is
required',1='Malformed docket number'),
'breakChainOnFailure' = true,
),

 'proceeding_id'=array('NotEmpty',
 array('InArray',array_keys(

Model_EventTypes::getAllForUserGroup(Zend_Auth::getInstance()-getIdentity()-group,false)
 )),
'presence' = 'required',
'messages'=array(
0='The proceeding field is required yo.',
1='Invalid proceeding id'
),
 'breakChainOnFailure' = true,
),
'comments' =array(
new
Zend_Validate_StringLength(0,$this-getTable()-_metadata['comments']['LENGTH']),
'messages'
=array(Zend_Validate_StringLength::TOO_LONG='Comments field exceeds
maximum length')
),
// don't let them leave both defts and comments both empty
'all_fields'=array(
new Model_Validator_OneOrMoreFields(),
'fields'=array('comments','deft_ids'),
'messages'=array(Please enter the defendant(s)
name(s). If a defendant is not found by using the autocompleting field
below, please enter the name in the comments field.)
),
);

Any idea what am I doing wrong?

Thanks.

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


Re: [fw-general] Validator custom error messages, behavior different in ZF 1.7.8 vs 1.8.x ?

2009-07-08 Thread Jordan Moore
Somewhere between the 1.7.x branch and the current release, some major
changes were made in Zend_Filter_Input. These changes caused numerous
BC breaks, one of which I've reported:

http://framework.zend.com/issues/browse/ZF-7135

On Wed, Jul 8, 2009 at 1:45 PM, David Mintzda...@davidmintz.org wrote:
 I have a model class that has a validate($data) method. It puts together an
 array of validators and eventually comes down to

   $input = new Zend_Filter_Input($filters,$validators,$data);

 In ZF 1.7.8, $input-getMessages() returns my custom error messages, works
 just as I intend, but the same code in 1.8.2 (and 1.8.4) ignores my error
 messages and instead returns the defaults

 The following is the array of validators in question (don't look too hard,
 it's rather ugly):

 $validators = array(

             'datetime' = array(
                 new SdnyDate(),
                 'fields' =array('date','time'),
                 'breakChainOnFailure' = true,
                 'presence' = 'required',
             ),
             'time' = array(
                 'NotEmpty',
                 'presence' = 'required',
                 'messages' = Time is required,
             ),
             'date' = array(

                 'NotEmpty',
             'Date',

 array('GreaterThan',date('Y-m-d',mktime(0,0,0,$today['mon'],$today['mday']-1,$today['year']))),
                 new Model_Validator_BusinessDay(),
                 'presence' = 'required',
                 'messages' =
                 array(0=Date is required,1=Invalid date ,2='This date
 is in the past'),
                 'breakChainOnFailure' = true,
             ),
             'language_id'=
             array('NotEmpty',
             array('InArray',(array_keys(Model_Languages::getAll(false,
             'presence' = 'required',
             'messages'=array(
                 0='The language field is required.',
                 1 ='Invalid language id',
                 ),
             'breakChainOnFailure' = true,

             ),

             'judge_id'=array(
                 'NotEmpty',

  array('InArray',(array_keys(Model_Judges::getAllActive(false,
                 'presence' = 'required',
                 'messages'=array(0='The judge field is
 required.',1='Invalid judge id'),
                  'breakChainOnFailure' = true,
             ),

             // make the docket required,
             // and make it match this format: nn-(CR|CIV|MAG|MISC)-x[xxx]
             // javascript will help them get it right
             'docket'=array(
    'NotEmpty',
                 new Zend_Validate_Regex(self::DOCKET_REGEX),
                 'messages'=array(0='Docket number is
 required',1='Malformed docket number'),
                 'breakChainOnFailure' = true,
             ),

          'proceeding_id'=array('NotEmpty',
              array('InArray',array_keys(

 Model_EventTypes::getAllForUserGroup(Zend_Auth::getInstance()-getIdentity()-group,false)
              )),
                 'presence' = 'required',
                 'messages'=array(
                     0='The proceeding field is required yo.',
                     1='Invalid proceeding id'
                     ),
                  'breakChainOnFailure' = true,
             ),
             'comments' =array(
                 new
 Zend_Validate_StringLength(0,$this-getTable()-_metadata['comments']['LENGTH']),
                 'messages'
 =array(Zend_Validate_StringLength::TOO_LONG='Comments field exceeds
 maximum length')
             ),
             // don't let them leave both defts and comments both empty
             'all_fields'=array(
                     new Model_Validator_OneOrMoreFields(),
                     'fields'=array('comments','deft_ids'),
                     'messages'=array(Please enter the defendant(s)
 name(s). If a defendant is not found by using the autocompleting field
 below, please enter the name in the comments field.)
             ),
         );

 Any idea what am I doing wrong?

 Thanks.

 --
 David Mintz
 http://davidmintz.org/

 The subtle source is clear and bright
 The tributary streams flow through the darkness




-- 
Jordan Ryan Moore


Re: [fw-general] Validator custom error messages, behavior different in ZF 1.7.8 vs 1.8.x ?

2009-07-08 Thread David Mintz
On Wed, Jul 8, 2009 at 5:04 PM, Jordan Moore jordanryanmo...@gmail.comwrote:

 Somewhere between the 1.7.x branch and the current release, some major
 changes were made in Zend_Filter_Input.


I can see that (-: Just wondering how to fix. Or do we wait for the good
folks who broke BC to unbreak it in the next release ? I would kind of
expect more of an outcry... or maybe people who are plugging their
validators into the oh-so-popular Zend_Form don't have this issue? (I
haven't gotten around to biting the Zend_Form bullet as of yet).



 These changes caused numerous
 BC breaks, one of which I've reported:

 http://framework.zend.com/issues/browse/ZF-7135


Instructive. Thanks.
-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


[fw-general] confusion between resource plugins and resources in docs

2009-07-08 Thread ronnystalker


I'm reading through Zend application docs :

http://framework.zend.com/manual/en/zend.application.theory-of-operation.html#zend.application.theory-of-operation.resources

I'm a bit confused.

Under section 4.3.2. Resource Plugins

It says:
Resources need only implement Zend_Application_Resource_Resource, or, more
simply still, extend Zend_Application_Resource_ResourceAbstract. 


Under section 4.4. Examples

it says:
Resource plugins implement Zend_Application_Bootstrap_Resource, which
defines simply that they allow injection of the caller and options, and that
they have an init() method. 

 * Are these talking about two different things?
I.e. 'Resources' versus 'Resource plugins' - i suspect not, but need
clarifying.

 * If they are the same thing. Which interfaces do they really need to
implement?
i.e.
 * Resource plugins implement Zend_Application_Bootstrap_Resource
 * Resources need only implement Zend_Application_Resource_Resource

or is it both?

 * Is that a typo in the docs?
I can't seem to find the Zend_Application_Bootstrap_Resource class in my
Zend library?

I hope it is a typo, cos i thought i had a grasp of Zend application till i
sumbled accross what seems to be a contradiction.

Any help appreciated.






-- 
View this message in context: 
http://www.nabble.com/confusion-between-resource-plugins-and-resources-in-docs-tp24400044p24400044.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend Lucene problem with Swedish characters, code attached.

2009-07-08 Thread Jay Ess

The following code does not give any search result.
The error message is :
1 Documents indexed.
Index contains 1 documents.

Search for 'InsignificantQuery' returned 0 hits

Any suggestion to how i will be able to work with text in the Swedish language 
and with our chars åäöÅÄÖ?

Version used ZendFramework-1.8.4, linux platform.


?php
define('ZEND_DIR','/home/netrogenic/html-nyss/ZendFramework-1.8.4/library');
ini_set('include_path',ini_get('include_path').:.ZEND_DIR);
require_once 'Zend/Search/Lucene.php';

setlocale(LC_ALL,utf-8);

Zend_Search_Lucene_Analysis_Analyzer::setDefault(
new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8());

$index = new Zend_Search_Lucene('test_index',true);
$doc = new Zend_Search_Lucene_Document();
$doc-addField(Zend_Search_Lucene_Field::Keyword('link',test,'utf-8'));
$doc-addField(Zend_Search_Lucene_Field::Text('title',åäö,'utf-8'));
$index-addDocument($doc);
$index-commit();
echo $index-count(). Documents indexed.\n;


Zend_Search_Lucene_Analysis_Analyzer::setDefault(
new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8());
$index = new Zend_Search_Lucene('test_index');
$query = Zend_Search_Lucene_Search_QueryParser::parse(åäö,'utf-8');
$hits = $index-find($query);

echo Index contains .$index-count(). documents.\n\n;

echo Search for '.$query.' returned  .count($hits).  hits\n\n;

foreach ($hits as $hit) {
echo $hit-link.\n;
echo \tScore: .sprintf('%.2f', $hit-score).\n;
echo \tTitle: .$hit-title.\n;
echo \t.$hit-title.\n\n;
}
?


Re: [fw-general] confusion between resource plugins and resources in docs

2009-07-08 Thread Matthew Weier O'Phinney
-- ronnystalker ronnystal...@gmail.com wrote
(on Wednesday, 08 July 2009, 02:52 PM -0700):
 I'm reading through Zend application docs :
 
 http://framework.zend.com/manual/en/zend.application.theory-of-operation.html#zend.application.theory-of-operation.resources
 
 I'm a bit confused.
 
 Under section 4.3.2. Resource Plugins
 
 It says:
 Resources need only implement Zend_Application_Resource_Resource, or, more
 simply still, extend Zend_Application_Resource_ResourceAbstract. 
 
 
 Under section 4.4. Examples
 
 it says:
 Resource plugins implement Zend_Application_Bootstrap_Resource, which
 defines simply that they allow injection of the caller and options, and that
 they have an init() method. 
 
  * Are these talking about two different things?

No -- the latter should refer to Zend_Application_Resource_Resource.

 I.e. 'Resources' versus 'Resource plugins' - i suspect not, but need
 clarifying.
 
  * If they are the same thing. Which interfaces do they really need to
 implement?
 i.e.
  * Resource plugins implement Zend_Application_Bootstrap_Resource

As noted -- the one above does not exist. Use the one below.

  * Resources need only implement Zend_Application_Resource_Resource
 
 or is it both?
 
  * Is that a typo in the docs?

yes.

 I can't seem to find the Zend_Application_Bootstrap_Resource class in my
 Zend library?
 
 I hope it is a typo, cos i thought i had a grasp of Zend application till i
 sumbled accross what seems to be a contradiction.
 
 Any help appreciated.

If you could, please file an issue in the tracker regarding this; the
typo should be corrected.

-- 
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/