Re: [fw-general] Escaping constants in Zend_Date

2009-06-05 Thread Thomas Weidner
There are two examples within the chapter of Zend_Date which show that the ' 
char escapes sequences.

http://framework.zend.com/manual/en/zend.date.constants.html

So when you look into the manual your format should be defined like this:
"dd/MM/ 'at' HH:mm:ssa"

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

- Original Message - 
From: "petewilliams1983" 

To: 
Sent: Friday, June 05, 2009 3:04 PM
Subject: [fw-general] Escaping constants in Zend_Date




Hi, I'm trying to output a date using Zend_Date, in the form:

'05/06/2009 at 02:04:56pm'

But I can't figure out how to escape the 'a' in 'at', and it's getting
parsed into 'pm'. I've tried all sorts of escaping characters but none 
seem

to work, such as:

echo $date->toString('dd/MM/ \at HH:mm:ssa');

which outputs '05/06/2009 \pmt 02:04:56pm'

I've looked in the manual but can't find any reference to escaping
characters, can anyone help me out?

Thanks,

Pete
--
View this message in context: 
http://www.nabble.com/Escaping-constants-in-Zend_Date-tp23887792p23887792.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] filter and validator conflict

2009-06-05 Thread Thomas Weidner

Attach only the validator to the form.
After processing the form, initiate and call the filter manually before 
further processing like storing.


Actually it's not possible to define a validator->filter->validator chain. 
We're already aware of it and plan it for 2.0.


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

- Original Message - 
From: "Guillaume Oriol" 

To: 
Sent: Friday, June 05, 2009 3:23 PM
Subject: [fw-general] filter and validator conflict




Let say I have an INPUT field in a form representing a password.
As I want to limit the password size to 10 characters, I add a
Zend_Validate_StringLength validator to the form element.

But, as this field is a password and I don't want to store a plain 
password

in the database, I need to encrypt it. May be I could write a
Zend_Filter_Encrypt variant? But what I want to store is a SHA1 digest. 
And,

if I do so, the filter produces a 20 hexadecimal characters that doesn't
validate.

How can I escape from this dead end?

-
Guillaume ORIOL
Sofware architect
Technema
--
View this message in context: 
http://www.nabble.com/filter-and-validator-conflict-tp23888075p23888075.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Cannot get validator to load

2009-06-05 Thread KimG

Sorry for the inconvenience.

it was an error in the validator code itself that prevented correct
execution.

somehow i used '<%php' as the script token instead of ' 
> Hi,
> 
> i'm running the Zend v 1.8.? and i have a problem regarding validators. I
> can't get them to load.
> 
> i think i've double checked everything but it still fails to work. Please
> help me out.
> 
> I've read the other posts in this forum where people seem to have the same
> problem. but no matter what i try it doesn't help.  I've tried to
> addprefixpath on the loader, add elementprefixpath on the form and
> addprefixpath on the element. but nothing works.
> 
> is it a path problem or what? i've read chap 30 (IIRC) in the zend manual
> about the Loader and i think i've followed the rules.
> 
> My include path is like this:
> 
> /var/www/pimp/application:/var/www/pimp/library::.:/usr/share/Zend/library:/usr/local/outlet-0.7/classes/outlet
> 
> my directory structure is like this:
> 
> var
>www
>   pimp
>  application
> configs
> controllers
> forms
> and so on
> library 
>Pimp
>   Validate
>   Authorise.php (file)
> 
> and everything works fine. it loads forms and views and finds controllers.
> nice.
> 
> but when i want to assign a custom validator to a field in my form i
> receive an error message:
> 
> ---
> 
>  Message: Plugin by name 'Authorise' was not found in the registry; used
> paths: Pimp_Validate_: Pimp/Validate/:Pimp/Validate/ Zend_Validate_:
> Zend/Validate/
> Stack trace:
> 
> #0 /usr/share/Zend/library/Zend/Form/Element.php(1992):
> Zend_Loader_PluginLoader->load('Authorise')
> #1 /usr/share/Zend/library/Zend/Form/Element.php(1211):
> Zend_Form_Element->_loadValidator(Array)
> #2 /usr/share/Zend/library/Zend/Form/Element.php(1295):
> Zend_Form_Element->getValidators()
> 
> --
> 
> when submiting the form.
> 
> 
> My form look like this:
> 
> 
> 
> 
> 
>  //var_dump(set_include_path('./'));
> 
> //include_once 'Zend/Form.php';
> 
> class Form_Login extends Zend_Form{
>   
>   public function __construct($options = null){
> parent::__construct($options);
> 
> 
> //$loader = new Zend_Loader_PluginLoader();
> //$loader->addPrefixPath('Pimp_Validate', 'Pimp/Validate/');
> 
> $this->setMethod('post');
> $this->setAttrib('class','zend_form');
> $username=$this->CreateElement('text','username')->setLabel('User
> Name:');
> $username->setDecorators(array(
>'ViewHelper',
>'Description',
>'Errors',
>array(array('data'=>'HtmlTag'), 
>array('tag' => 'td')),
>array('Label', array('tag' => 'td')),
>   
> array(array('row'=>'HtmlTag'),array('tag'=>'tr')
>  )));
> 
> 
> //$this->addElementPrefixPath('Pimp_Validate', 'Pimp/Validate/',
> 'validate');
>
> $username->addValidator('alnum')->setRequired(true)->addValidator('NotEmpty',
> true)->addFilter('StringTrim');
> $username->addPrefixPath('Pimp_Validate', 'Pimp/Validate/',
> 'validate');
> $username->addValidator('Authorise');
> $username->getValidator('alnum')->setMessage('Only letters and numbers
> are allowed in username');
> $username->getValidator('NotEmpty')->setMessage('Username cannot be
> empty');
> 
> 
>
> $password=$this->CreateElement('password','password')->setLabel('Password:');
> $password->setDecorators(array(
>'ViewHelper',
>'Description',
>'Errors',
>array(array('data'=>'HtmlTag'),
> array('tag' => 'td')),
>array('Label', array('tag' => 'td')),
>   
> array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
>   ));
>
> $password->addValidator('alnum')->setRequired(true)->addValidator('NotEmpty',
> true)->addFilter('StringTrim')->addValidator('stringLength', true,
> array(6));
> $password->getValidator('stringLength')->setMessage('Password is too
> short');
> $password->getValidator('NotEmpty')->setMessage('Password cannot be
> empty');
> 
> $submit=$this->CreateElement('submit','submit')->setLabel('Login');
> $submit->setAttrib('class', 'submit_log');
> 
> $submit->setAttrib('onmouseout', 'MM_swapImgRestore()');
> $submit->setAttrib('onmouseover',
> "MM_swapImage('images/btn-register','','images/btn-register_on.png',1)");
> 
> $submit->setDecorators(array(
>  'ViewHelper',
>  'Description',
>  'Errors', 
>  

[fw-general] Cannot get validator to load

2009-06-05 Thread KimG

Hi,

i'm running the Zend v 1.8.? and i have a problem regarding validators. I
can't get them to load.

i think i've double checked everything but it still fails to work. Please
help me out.

I've read the other posts in this forum where people seem to have the same
problem. but no matter what i try it doesn't help.  I've tried to
addprefixpath on the loader, add elementprefixpath on the form and
addprefixpath on the element. but nothing works.

is it a path problem or what? i've read chap 30 (IIRC) in the zend manual
about the Loader and i think i've followed the rules.

My include path is like this:

/var/www/pimp/application:/var/www/pimp/library::.:/usr/share/Zend/library:/usr/local/outlet-0.7/classes/outlet

my directory structure is like this:

var
   www
  pimp
 application
configs
controllers
forms
and so on
library 
   Pimp
  Validate
  Authorise.php (file)

and everything works fine. it loads forms and views and finds controllers.
nice.

but when i want to assign a custom validator to a field in my form i receive
an error message:

---

 Message: Plugin by name 'Authorise' was not found in the registry; used
paths: Pimp_Validate_: Pimp/Validate/:Pimp/Validate/ Zend_Validate_:
Zend/Validate/
Stack trace:

#0 /usr/share/Zend/library/Zend/Form/Element.php(1992):
Zend_Loader_PluginLoader->load('Authorise')
#1 /usr/share/Zend/library/Zend/Form/Element.php(1211):
Zend_Form_Element->_loadValidator(Array)
#2 /usr/share/Zend/library/Zend/Form/Element.php(1295):
Zend_Form_Element->getValidators()

--

when submiting the form.


My form look like this:





addPrefixPath('Pimp_Validate', 'Pimp/Validate/');

$this->setMethod('post');
$this->setAttrib('class','zend_form');
$username=$this->CreateElement('text','username')->setLabel('User
Name:');
$username->setDecorators(array(
   'ViewHelper',
   'Description',
   'Errors',
   array(array('data'=>'HtmlTag'), 
   array('tag' => 'td')),
   array('Label', array('tag' => 'td')),
  
array(array('row'=>'HtmlTag'),array('tag'=>'tr')
 )));


//$this->addElementPrefixPath('Pimp_Validate', 'Pimp/Validate/',
'validate');
   
$username->addValidator('alnum')->setRequired(true)->addValidator('NotEmpty',
true)->addFilter('StringTrim');
$username->addPrefixPath('Pimp_Validate', 'Pimp/Validate/', 'validate');
$username->addValidator('Authorise');
$username->getValidator('alnum')->setMessage('Only letters and numbers
are allowed in username');
$username->getValidator('NotEmpty')->setMessage('Username cannot be
empty');


   
$password=$this->CreateElement('password','password')->setLabel('Password:');
$password->setDecorators(array(
   'ViewHelper',
   'Description',
   'Errors',
   array(array('data'=>'HtmlTag'),
array('tag' => 'td')),
   array('Label', array('tag' => 'td')),
  
array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
  ));
   
$password->addValidator('alnum')->setRequired(true)->addValidator('NotEmpty',
true)->addFilter('StringTrim')->addValidator('stringLength', true,
array(6));
$password->getValidator('stringLength')->setMessage('Password is too
short');
$password->getValidator('NotEmpty')->setMessage('Password cannot be
empty');

$submit=$this->CreateElement('submit','submit')->setLabel('Login');
$submit->setAttrib('class', 'submit_log');

$submit->setAttrib('onmouseout', 'MM_swapImgRestore()');
$submit->setAttrib('onmouseover',
"MM_swapImage('images/btn-register','','images/btn-register_on.png',1)");

$submit->setDecorators(array(
 'ViewHelper',
 'Description',
 'Errors', 
 array(array('data'=>'HtmlTag'), array('tag'
=> 'td')),

array(array('row'=>'HtmlTag'),array('tag'=>'tr', 'openOnly'=>'true'))

   ));

   
$register=$this->CreateElement('submit','register')->setLabel('Register');
$register->setAttrib('class', 'submit_reg');
$register->setDecorators(array(
 'ViewHelper',
 'Description',
 'Errors', 
 array(array('data'=>'HtmlTag'), array('tag'
=> 'td')),

array(array('row'=>'HtmlTag'),array('tag'=>'tr', 'closeOnly'=>'true'))

  

[fw-general] filter and validator conflict

2009-06-05 Thread Guillaume Oriol

Let say I have an INPUT field in a form representing a password.
As I want to limit the password size to 10 characters, I add a
Zend_Validate_StringLength validator to the form element.

But, as this field is a password and I don't want to store a plain password
in the database, I need to encrypt it. May be I could write a
Zend_Filter_Encrypt variant? But what I want to store is a SHA1 digest. And,
if I do so, the filter produces a 20 hexadecimal characters that doesn't
validate.

How can I escape from this dead end?

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/filter-and-validator-conflict-tp23888075p23888075.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Escaping constants in Zend_Date

2009-06-05 Thread petewilliams1983

Hi, I'm trying to output a date using Zend_Date, in the form:

'05/06/2009 at 02:04:56pm'

But I can't figure out how to escape the 'a' in 'at', and it's getting
parsed into 'pm'. I've tried all sorts of escaping characters but none seem
to work, such as:

echo $date->toString('dd/MM/ \at HH:mm:ssa');

which outputs '05/06/2009 \pmt 02:04:56pm'

I've looked in the manual but can't find any reference to escaping
characters, can anyone help me out?

Thanks,

Pete
-- 
View this message in context: 
http://www.nabble.com/Escaping-constants-in-Zend_Date-tp23887792p23887792.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] - Using router

2009-06-05 Thread Vadim Gabriel
You will need to register the router stuff earlier then in the init function
since the request object was initiated already.

On Fri, Jun 5, 2009 at 1:42 PM, Vibhor Singh  wrote:

>  Hi all,
>
>
>
> I have a modular ZF application. I am trying to use the Standard Router to
> rewrite some urls. I want to make this link:
>
> http://domain.com/project_folder/news/news/view/id/67
>
>
>
> to be pointed as
>
> http://domain.com/project_folder/ 
> view/id/67
>
>
>
> In my NewsController, inside the init() I have done this:
>
> public function init()
>
> {
>
> parent:init();
>
>  $front = Zend_Controller_Front::getInstance();
>
>   $objRouter = $front->getRouter();
>
>
>
>   $route = new Zend_Controller_Router_Route(
>
> 'news/id/:id',
>
> array(
>
> 'module' => 'news',
>
> 'controller' => 'news',
>
> 'action'=> 'view',
>
> 'id'=> 'id'
>
> )
>
>   );
>
>
>
>
>
>   $objRouter->addRoute('news', $route);
>
> }
>
>
>
> When I point to http://domain.com/project_folder/ 
> view/id/67I get the following 
> error:
>
> *Message:* Invalid controller specified (id)
>
>
>
> Can someone pls tell me what is wrong here. Am I missing something.
>
> Any help will be greatly appreciated.
>
>
>
> Regards,
>
> Vibhor
>
>
>



-- 
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.
Zend Framework Certified Engineer.
-- http://www.vadimg.co.il/


[fw-general] - Using router

2009-06-05 Thread Vibhor Singh
Hi all,

 

I have a modular ZF application. I am trying to use the Standard Router to
rewrite some urls. I want to make this link:

http://domain.com/project_folder/news/news/view/id/67

 

to be pointed as

http://domain.com/project_folder/
  view/id/67

 

In my NewsController, inside the init() I have done this:

public function init()

{

parent:init();

 $front = Zend_Controller_Front::getInstance();

  $objRouter = $front->getRouter();

  

  $route = new Zend_Controller_Router_Route(

'news/id/:id',

array(

'module' => 'news',

'controller' => 'news',

'action'=> 'view',

'id'=> 'id'

)

  );

  

  

  $objRouter->addRoute('news', $route);

} 

 

When I point to http://domain.com/project_folder/
  view/id/67 I get the
following error:

Message: Invalid controller specified (id)

 

Can someone pls tell me what is wrong here. Am I missing something.

Any help will be greatly appreciated.

 

Regards,

Vibhor

 



Re: [fw-general] XML and paginator

2009-06-05 Thread umpirsky

Hi.

Implementing Zend_Paginator_Adapter_Xml sounds like zend style solution to
me.


PHPScriptor wrote:
> 
> Hello,
> 
> I've a xml-file with data in it. Is it possible to read this file and
> parse it through paginator?
> An example would be nice :-).
> 
> Greetings
> 

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



[fw-general] Zend_Form default decorators

2009-06-05 Thread Dalibor Karlović
I've extended Zend_Form with stuff like:

public function isSubmitted(Zend_Controller_Request_Http $request)
(handling multiple forms on the same page)

which all ove my forms extend instead of Zend_Form. I'd also like to set 
default decorators for form, display groups and elements. It's easy for the 
form with setDecorators(), but setDisplayGroupDecorators() and 
setElementDecorators() only add to groups/element already added to the form. 
Is there an easy way to set the default decorators for elements and display 
groups?

-- 
Dado


[fw-general] XML and paginator

2009-06-05 Thread PHPScriptor

Hello,

I've a xml-file with data in it. Is it possible to read this file and parse
it through paginator?
An example would be nice :-).

Greetings

-
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/XML-and-paginator-tp23884634p23884634.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] modules and Zend_Tool

2009-06-05 Thread Brenton Alker
swilhelm wrote:
> What is the status of Zend_Tool module support?

I've been looking at it yesterday and today, and it seems to all be
there, but is buggy.

This morning I uploaded some patches to the issue tracker that fix the
problems I ran into last night (most were already open issues), which
was enough to create modules with it. No idea how long it will take for
them to be reviewed and accepted/fixed before making it to SVN though
(or into a release if you're not on trunk)

But again, vast majority of the code is there, just slightly broken.
Shouldn't imagine it will be too far from being usable.

> 
> Matthew Weier O'Phinney-3 wrote:
>> -- David Mintz  wrote
>> (on Friday, 01 May 2009, 01:19 PM -0400):
>>> I've googled around quite a bit and not been able to figure this out: 
>>> what is
>>> the currently recommended way of creating modules in a project using
>>> Zend_Tool?
>>> Or creating a modular project to begin with?
>> The support doesn't exist yet. Ralph almost has it ready for people to
>> start testing; look for an announcement soon.
>>
>>> I've created a monomodular project with 'zf create project' and I am
>>> tempted to
>>> muck around with the folder hierarchy by hand, but that would surely
>>> break 
>>> .zfproject.xml
>> -- 
>> Matthew Weier O'Phinney
>> Project Lead| matt...@zend.com
>> Zend Framework  | http://framework.zend.com/
>>
>>
> 

-- 

Brenton Alker
PHP Developer - Brisbane, Australia

http://blog.tekerson.com/



signature.asc
Description: OpenPGP digital signature


Re: [fw-general] modules and Zend_Tool

2009-06-05 Thread Jurian Sluiman
Op Friday 05 June 2009 08:32:26 schreef swilhelm:
> What is the status of Zend_Tool module support?
>
> Matthew Weier O'Phinney-3 wrote:
> > -- David Mintz  wrote
> >
> > (on Friday, 01 May 2009, 01:19 PM -0400):
> >> I've googled around quite a bit and not been able to figure this out:
> >> what is
> >> the currently recommended way of creating modules in a project using
> >> Zend_Tool?
> >> Or creating a modular project to begin with?
> >
> > The support doesn't exist yet. Ralph almost has it ready for people to
> > start testing; look for an announcement soon.
> >
> >> I've created a monomodular project with 'zf create project' and I am
> >> tempted to
> >> muck around with the folder hierarchy by hand, but that would surely
> >> break
> >> .zfproject.xml
> >

With the new ZF1.8.2 out, the Zend_Tool has now built in support for modules.

Regards, Jurian
--
Jurian Sluiman
Soflomo.com