Re: [fw-general] Zend_Form Logo upload

2009-03-12 Thread Thomas Weidner

Actually you missed to set a destination directory.
Without a given directory, all files are uploaded to the default temp path 
of PHP.


When receive does not return false, then the upload has succeeded and the 
file is on your server.


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

- Original Message - 
From: "Bob O" 

To: 
Sent: Friday, March 13, 2009 5:47 AM
Subject: [fw-general] Zend_Form Logo upload




I have been really struggling with this one. i have read and searched but
still am unable to get it to work correctly.

Im able to get the name of the image into the db..but I havent been
successfull at getting the image itself to upload to my usr/logos dir..

Please help..

This is my controller

**INIT**

   $config = new Zend_Config_Ini(APPLICATION_PATH .
'/config/advertiserCreateForm.ini');
   $this->_advertiserCreateForm = new
Zend_Form($config->reseller->advertiserCreate);
   $logo = new Zend_Form_Element_File('logo');
   $logo->removeDecorator('Label')
->setAttrib('size', '13')
->addValidator('Size', false, 102400) // limit to 100K
->setMaxFileSize(102400); // limits the filesize on the client
side
   $this->_advertiserCreateForm->addElement($logo);
   $this->view->assign('advertiserCreate',
$this->_advertiserCreateForm);

**Action Method**
   public function createAdvertiserPostAction()
   {
   if ($this->getRequest()->isPost())
   {
 $values = $this->getRequest()->getPost();
 $logofield = $this->_advertiserCreateForm->getElement('logo');
 $logofield->setDestination('usr/logos');

 if ($this->_fonrootsReseller)
 {
   if
($this->_advertiserCreateForm->isValid($this->getRequest()->getPost()))
   {
 $id = $this->_id;
 $advertiser =
$this->_fonrootsAdvertiser->createAdvertiser($values, $id);
 $this->_advertiserCreateForm->receive();
 $this->flash("Your Advertiser has been Setup", '',
'/reseller/create-advertiser');
   }
   else
   {
 foreach ($this->_advertiserCreateForm->getMessages() as
$messages)
 {
   foreach ($messages as $message)
   {
 $this->flash(("Invalid Data: $message\n"), 'error',
'/reseller/create-advertiser');
   }
 }
   }
 }
   }
   }

**MODEL**
public function createAdvertiser($values, $resellerId)
   {

 // get "salt" for better security
 $configuration = Zend_Registry::get('configuration');
 $salt = $configuration->auth->salt;

 $password = $salt . $values['password'];

 //setup for logo upload
 $filename = $values['logo'];

 $now = time();
 $niceName = FonRoots_Utilities::toNiceString($values['advertName']);

 $advertiserData = array('id' => null,
 'advertiser' => $values['advertName'],
 'nice_name' => $niceName,
 'contact_person_id' => $contactPersonId,
 'location_id' => $locationId,
 'reseller_id' => $resellerId,
 'date_created' => $now,
 'short_description' =>
$values['shortDescription'],
 'long_description' =>
$values['longDescription'],
 'url' => $values['advertiserURL'],
 'logo_url' => $filename,
 'date_created' => $now
 );

 $dbAdvertiser = new Advertiser();
 $dbAdvertiser->insert($advertiserData);
   }

-
Bob Hanson
Web Developer
SLC, UT
--
View this message in context: 
http://www.nabble.com/Zend_Form-Logo-upload-tp22490172p22490172.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




[fw-general] Zend Form Element Layout

2009-03-12 Thread GirishK

Hi all,
I have to design a form in Zend. The form layout should be similar to this

Login Details
username 
password 
confirm password 
country  state < STATE COMBO BOX>
ciy 

So as you can see, first 3 elements are 'one element per row', next 2
elements are '2 elements per row' and then again 'one element per row'.

Right now i am using fieldset -> table -> tr -> td but with this all
elements are 'one element per row'.
How to achieve this in Zend_Form? Which decorators to use?

thanks in advance. 
-- 
View this message in context: 
http://www.nabble.com/Zend-Form-Element-Layout-tp22491080p22491080.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Form Logo upload

2009-03-12 Thread Bob O

I have been really struggling with this one. i have read and searched but
still am unable to get it to work correctly.

Im able to get the name of the image into the db..but I havent been
successfull at getting the image itself to upload to my usr/logos dir..

Please help..

This is my controller

**INIT**

$config = new Zend_Config_Ini(APPLICATION_PATH .
'/config/advertiserCreateForm.ini');
$this->_advertiserCreateForm = new
Zend_Form($config->reseller->advertiserCreate);
$logo = new Zend_Form_Element_File('logo');
$logo->removeDecorator('Label')
 ->setAttrib('size', '13')
 ->addValidator('Size', false, 102400) // limit to 100K
 ->setMaxFileSize(102400); // limits the filesize on the client
side
$this->_advertiserCreateForm->addElement($logo);
$this->view->assign('advertiserCreate',
$this->_advertiserCreateForm);

**Action Method**
public function createAdvertiserPostAction()
{
if ($this->getRequest()->isPost())
{
  $values = $this->getRequest()->getPost();
  $logofield = $this->_advertiserCreateForm->getElement('logo');
  $logofield->setDestination('usr/logos');
  
  if ($this->_fonrootsReseller)
  {
if
($this->_advertiserCreateForm->isValid($this->getRequest()->getPost()))
{
  $id = $this->_id;
  $advertiser =
$this->_fonrootsAdvertiser->createAdvertiser($values, $id);
  $this->_advertiserCreateForm->receive();
  $this->flash("Your Advertiser has been Setup", '',
'/reseller/create-advertiser');
} 
else 
{
  foreach ($this->_advertiserCreateForm->getMessages() as
$messages)
  {
foreach ($messages as $message) 
{
  $this->flash(("Invalid Data: $message\n"), 'error',
'/reseller/create-advertiser');
}
  }
} 
  }
}
}

**MODEL**
public function createAdvertiser($values, $resellerId)
{ 
  
  // get "salt" for better security
  $configuration = Zend_Registry::get('configuration');
  $salt = $configuration->auth->salt;
  
  $password = $salt . $values['password'];
  
  //setup for logo upload
  $filename = $values['logo'];
  
  $now = time();
  $niceName = FonRoots_Utilities::toNiceString($values['advertName']);
  
  $advertiserData = array('id' => null,
  'advertiser' => $values['advertName'],
  'nice_name' => $niceName,
  'contact_person_id' => $contactPersonId,
  'location_id' => $locationId,
  'reseller_id' => $resellerId,
  'date_created' => $now,
  'short_description' =>
$values['shortDescription'],
  'long_description' =>
$values['longDescription'],
  'url' => $values['advertiserURL'],
  'logo_url' => $filename,
  'date_created' => $now
  );
  
  $dbAdvertiser = new Advertiser();
  $dbAdvertiser->insert($advertiserData);
}

-
Bob Hanson
Web Developer
SLC, UT
-- 
View this message in context: 
http://www.nabble.com/Zend_Form-Logo-upload-tp22490172p22490172.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?

2009-03-12 Thread fire-eyed-boy

Ben,

You're the man! The LIFO suggestion did the trick. The I wasn't ware of the 
LIFO evaluation. I had the default routes removed already by the way. Thanks a 
lot! Very sleek Route object.


Cheers.


> Date: Fri, 13 Mar 2009 01:21:44 +0100
> From: m...@dasprids.de
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Ah yeah, you should add them in the reverse direction. They are always
> evaluated LIFO. Also, you should remove the default routes.
> 
> Regards,
> Ben
> ...
> :  ___   _   ___ ___ ___ _ ___:
> : |   \ /_\ / __| _ \ _ (_)   \   :
> : | |) / _ \\__ \  _/   / | |) |  :
> : |___/_/:\_\___/_| |_|_\_|___/   :
> :::
> : Web: http://www.dasprids.de :
> : E-mail : m...@dasprids.de   :
> : Jabber : jab...@dasprids.de :
> : ICQ: 105677955  :
> :::
> 
> 
> fire-eyed-...@hotmail.com schrieb:
> > Ben,
> > 
> > You are absolutely right about SEO and administration of course. But it
> > was just to try a prove of concept. Cause I can see myself using this in
> > the current project or some project in the near future. Thing is... I
> > can't get it to work. I must be doing somethin wrong. I have my
> > controller directories set up with:
> > 
> > 
> > $frontController->setControllerDirectory(
> >   array(
> >   'default' => APPLICATION_PATH . '/modules/default/controllers',
> >   'admin' => APPLICATION_PATH . '/modules/admin/controllers'
> >   )
> >  );
> > 
> > And the rest as per my example in the other post (in which I missed a $
> > sign, but that was a typo by me). I also have the correct translations
> > set up. But when I try:
> > 
> > http://www.example.com/admin
> > 
> > It throws an exception stating: 'Invalid controller specified (admin)'.
> > Any idea of what I might have overlooked?
> > 
> > Cheers.
> > 
> > 
> > 
> > 
> >> Date: Thu, 12 Mar 2009 19:12:04 +0100
> >> From: m...@dasprids.de
> >> To: fw-general@lists.zend.com
> >> Subject: Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> >>
> > Pretty simple, you would make your route look like this:
> > 
> > :@controller/:@action or :@module/:@controller/:@action
> > 
> > But really copying the module-route by this is not possible. I suggest
> > you to create one route per action as usual. And personally, I wouldn't
> > use translatable routes in the administration, as SEO-urls are not
> > important there.
> > 
> > Regards,
> > Ben
> > ...
> > : ___ _ ___ ___ ___ _ ___ :
> > : | \ /_\ / __| _ \ _ (_) \ :
> > : | |) / _ \\__ \ _/ / | |) | :
> > : |___/_/:\_\___/_| |_|_\_|___/ :
> > :::
> > : Web : http://www.dasprids.de :
> > : E-mail : m...@dasprids.de :
> > : Jabber : jab...@dasprids.de :
> > : ICQ : 105677955 :
> > :::
> > 
> > 
> > fire-eyed-...@hotmail.com schrieb:
> >> Ben,
> > 
> >> I am implementing your Zend_Controller_Router_Route_Translatable right
> >> now. It works very nice. One thing I have a hard time figuring out
> >> though, is the following:
> > 
> > 
> >> How would I be able to mimic the default ZF route including optional
> >> modules, for instance such that:
> >> /nieuwsbrief/aanmelden (newsletter/subscribe in Dutch)
> >> routes to NewsletterController->subscribeAction() (default module)
> > 
> >> /beheerder/pagina/bewerken (admin/page/edit in Dutch)
> >> could route to Admin_PageController->editAction() (admin module)
> > 
> >> Any ideas? Thanks in advance.
> > 
> > 
> >> 
> >> From: fire-eyed-...@hotmail.com
> >> To: fw-general@lists.zend.com
> >> Date: Fri, 27 Feb 2009 19:24:24 +
> >> Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> > 
> >> Ben,
> > 
> >> I'll have to get my head around it a little more. But at first glance,
> >> this looks absolutely perfect for the job: just what I was looking for.
> >> Thanks a lot!
> > 
> > 
> >>> Date: Fri, 27 Feb 2009 19:36:47 +0100
> >>> From: m...@dasprids.de
> >>> To: fw-general@lists.zend.com
> >>> Subject: Re: [fw-general] Zend_Controller_Router_Route &
> >> Zend_Translate?
> > 
> >> Hehe, we just had the same topic some days ago. I solved the same
> >> problem some time ago, with simply a new route (which
> >> i will probably port to ZF in modified way some day). It works like
> >> this:
> > 
> >> Fixed text is prepended with an @, while translatable parameters are
> >> prepended with :@. For example:
> > 
> >> route.about.type = 'App_Controller_Router_Route_Translatable
> >> route.about.route = '@imprint'
> > 
> >> Now, the route looks for a Zend_Translate instance with the key
> >> Zend_Translate within Zend_Registry, searches for the message-id
> >> "imprint", translates it, and then tries to match the route.
> > 
> >> There

Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?

2009-03-12 Thread Ben Scholzen 'DASPRiD'
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ah yeah, you should add them in the reverse direction. They are always
evaluated LIFO. Also, you should remove the default routes.

Regards,
Ben
...
:  ___   _   ___ ___ ___ _ ___:
: |   \ /_\ / __| _ \ _ (_)   \   :
: | |) / _ \\__ \  _/   / | |) |  :
: |___/_/:\_\___/_| |_|_\_|___/   :
:::
: Web: http://www.dasprids.de :
: E-mail : m...@dasprids.de   :
: Jabber : jab...@dasprids.de :
: ICQ: 105677955  :
:::


fire-eyed-...@hotmail.com schrieb:
> Ben,
> 
> You are absolutely right about SEO and administration of course. But it
> was just to try a prove of concept. Cause I can see myself using this in
> the current project or some project in the near future. Thing is... I
> can't get it to work. I must be doing somethin wrong. I have my
> controller directories set up with:
> 
> 
> $frontController->setControllerDirectory(
>   array(
>   'default' => APPLICATION_PATH . '/modules/default/controllers',
>   'admin' => APPLICATION_PATH . '/modules/admin/controllers'
>   )
>  );
> 
> And the rest as per my example in the other post (in which I missed a $
> sign, but that was a typo by me). I also have the correct translations
> set up. But when I try:
> 
> http://www.example.com/admin
> 
> It throws an exception stating: 'Invalid controller specified (admin)'.
> Any idea of what I might have overlooked?
> 
> Cheers.
> 
> 
> 
> 
>> Date: Thu, 12 Mar 2009 19:12:04 +0100
>> From: m...@dasprids.de
>> To: fw-general@lists.zend.com
>> Subject: Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
>>
> Pretty simple, you would make your route look like this:
> 
> :@controller/:@action or :@module/:@controller/:@action
> 
> But really copying the module-route by this is not possible. I suggest
> you to create one route per action as usual. And personally, I wouldn't
> use translatable routes in the administration, as SEO-urls are not
> important there.
> 
> Regards,
> Ben
> ...
> : ___ _ ___ ___ ___ _ ___ :
> : | \ /_\ / __| _ \ _ (_) \ :
> : | |) / _ \\__ \ _/ / | |) | :
> : |___/_/:\_\___/_| |_|_\_|___/ :
> :::
> : Web : http://www.dasprids.de :
> : E-mail : m...@dasprids.de :
> : Jabber : jab...@dasprids.de :
> : ICQ : 105677955 :
> :::
> 
> 
> fire-eyed-...@hotmail.com schrieb:
>> Ben,
> 
>> I am implementing your Zend_Controller_Router_Route_Translatable right
>> now. It works very nice. One thing I have a hard time figuring out
>> though, is the following:
> 
> 
>> How would I be able to mimic the default ZF route including optional
>> modules, for instance such that:
>> /nieuwsbrief/aanmelden (newsletter/subscribe in Dutch)
>> routes to NewsletterController->subscribeAction() (default module)
> 
>> /beheerder/pagina/bewerken (admin/page/edit in Dutch)
>> could route to Admin_PageController->editAction() (admin module)
> 
>> Any ideas? Thanks in advance.
> 
> 
>> 
>> From: fire-eyed-...@hotmail.com
>> To: fw-general@lists.zend.com
>> Date: Fri, 27 Feb 2009 19:24:24 +
>> Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> 
>> Ben,
> 
>> I'll have to get my head around it a little more. But at first glance,
>> this looks absolutely perfect for the job: just what I was looking for.
>> Thanks a lot!
> 
> 
>>> Date: Fri, 27 Feb 2009 19:36:47 +0100
>>> From: m...@dasprids.de
>>> To: fw-general@lists.zend.com
>>> Subject: Re: [fw-general] Zend_Controller_Router_Route &
>> Zend_Translate?
> 
>> Hehe, we just had the same topic some days ago. I solved the same
>> problem some time ago, with simply a new route (which
>> i will probably port to ZF in modified way some day). It works like
>> this:
> 
>> Fixed text is prepended with an @, while translatable parameters are
>> prepended with :@. For example:
> 
>> route.about.type = 'App_Controller_Router_Route_Translatable
>> route.about.route = '@imprint'
> 
>> Now, the route looks for a Zend_Translate instance with the key
>> Zend_Translate within Zend_Registry, searches for the message-id
>> "imprint", translates it, and then tries to match the route.
> 
>> There are also translatable parameters as said before:
> 
>> route.statistics.type = 'App_Controller_Router_Route_Translatable
>> route.statistics.route = '@statistics/:@timerange'
> 
>> Here again, "statistics" is simply translated and matches. What the
>> :@timerange parameter does is the following:
> 
>> When you assemble the route like this:
> 
>> $urlHelper->url(array('timerange' => 'this-month'), 'statistics');
> 
>> The route looks for a message with the id "this-month" and if available,
>> puts it into the url, else the message id itself. When matching a URL,
>> it replaces the translated parameter with the message id again, so you
>> don't

RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?

2009-03-12 Thread fire-eyed-boy

Ben,

You are absolutely right about SEO and administration of course. But it was 
just to try a prove of concept. Cause I can see myself using this in the 
current project or some project in the near future. Thing is... I can't get it 
to work. I must be doing somethin wrong. I have my controller directories set 
up with:


$frontController->setControllerDirectory(
array(
'default' => APPLICATION_PATH . '/modules/default/controllers',
'admin' => APPLICATION_PATH . '/modules/admin/controllers'
)
 );

And the rest as per my example in the other post (in which I missed a $ sign, 
but that was a typo by me). I also have the correct translations set up. But 
when I try:

http://www.example.com/admin

It throws an exception stating: 'Invalid controller specified (admin)'. Any 
idea of what I might have overlooked?

Cheers.




> Date: Thu, 12 Mar 2009 19:12:04 +0100
> From: m...@dasprids.de
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Pretty simple, you would make your route look like this:
> 
> :@controller/:@action or :@module/:@controller/:@action
> 
> But really copying the module-route by this is not possible. I suggest
> you to create one route per action as usual. And personally, I wouldn't
> use translatable routes in the administration, as SEO-urls are not
> important there.
> 
> Regards,
> Ben
> ...
> :  ___   _   ___ ___ ___ _ ___:
> : |   \ /_\ / __| _ \ _ (_)   \   :
> : | |) / _ \\__ \  _/   / | |) |  :
> : |___/_/:\_\___/_| |_|_\_|___/   :
> :::
> : Web: http://www.dasprids.de :
> : E-mail : m...@dasprids.de   :
> : Jabber : jab...@dasprids.de :
> : ICQ: 105677955  :
> :::
> 
> 
> fire-eyed-...@hotmail.com schrieb:
> > Ben,
> > 
> > I am implementing your Zend_Controller_Router_Route_Translatable right
> > now. It works very nice. One thing I have a hard time figuring out
> > though, is the following:
> > 
> > 
> > How would I be able to mimic the default ZF route including optional
> > modules, for instance such that:
> > /nieuwsbrief/aanmelden (newsletter/subscribe in Dutch)
> > routes to NewsletterController->subscribeAction() (default module)
> > 
> > /beheerder/pagina/bewerken (admin/page/edit in Dutch)
> > could route to Admin_PageController->editAction() (admin module)
> > 
> > Any ideas? Thanks in advance.
> > 
> > 
> > 
> > From: fire-eyed-...@hotmail.com
> > To: fw-general@lists.zend.com
> > Date: Fri, 27 Feb 2009 19:24:24 +
> > Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> > 
> > Ben,
> > 
> > I'll have to get my head around it a little more. But at first glance,
> > this looks absolutely perfect for the job: just what I was looking for.
> > Thanks a lot!
> > 
> > 
> >> Date: Fri, 27 Feb 2009 19:36:47 +0100
> >> From: m...@dasprids.de
> >> To: fw-general@lists.zend.com
> >> Subject: Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> >>
> > Hehe, we just had the same topic some days ago. I solved the same
> > problem some time ago, with simply a new route (which
> > i will probably port to ZF in modified way some day). It works like this:
> > 
> > Fixed text is prepended with an @, while translatable parameters are
> > prepended with :@. For example:
> > 
> > route.about.type = 'App_Controller_Router_Route_Translatable
> > route.about.route = '@imprint'
> > 
> > Now, the route looks for a Zend_Translate instance with the key
> > Zend_Translate within Zend_Registry, searches for the message-id
> > "imprint", translates it, and then tries to match the route.
> > 
> > There are also translatable parameters as said before:
> > 
> > route.statistics.type = 'App_Controller_Router_Route_Translatable
> > route.statistics.route = '@statistics/:@timerange'
> > 
> > Here again, "statistics" is simply translated and matches. What the
> > :@timerange parameter does is the following:
> > 
> > When you assemble the route like this:
> > 
> > $urlHelper->url(array('timerange' => 'this-month'), 'statistics');
> > 
> > The route looks for a message with the id "this-month" and if available,
> > puts it into the url, else the message id itself. When matching a URL,
> > it replaces the translated parameter with the message id again, so you
> > don't have to care about it in your application itself.
> > 
> > For the route code, see the attached file.
> > 
> > Regards,
> > Ben
> > ...
> > : ___ _ ___ ___ ___ _ ___ :
> > : | \ /_\ / __| _ \ _ (_) \ :
> > : | |) / _ \\__ \ _/ / | |) | :
> > : |___/_/:\_\___/_| |_|_\_|___/ :
> > :::
> > : Web : http://www.dasprids.de :
> > : E-mail : m...@dasprids.de :
> > : Jabber : jab...@dasprids.de :
> 

Re: [fw-general] setValue for zend_form button

2009-03-12 Thread Matthew Weier O'Phinney
-- Bernd Matzner  wrote
(on Thursday, 12 March 2009, 03:13 PM -0700):
> 
> Hello,
> 
> I'm trying desperately to set a value for a button to generate the following
> HTML:
> 
> My Label
> 
> so that the value is submitted rather than the label.
> 
> Using $element->setValue('myValue'); however has no effect.
> 
> Any hints on how to achieve that?

The "value" of a button element is treated as a label within Zend_Form
as its primary purpose is display. Use setLabel() to set it.

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


Re: [fw-general] setValue for zend_form button

2009-03-12 Thread Bernd Matzner

Hi Ian,

thanks for the speedy response. 
In fact, it does matter to me - I was trying to figure a way to add multiple
submit buttons to do different things in one form. Obviously the only non-JS
way to work with IE6 is to use two forms. What a mess.

Thanks for that helpful blog post.

Bernd


Ian Young-6 wrote:
> 
> Perhaps this doesn't matter to you, but you should be aware that IE 
> screws up  elements in a big, big way, including submitting the 
> label as the value of the element[1]. My guess would be that this is why 
> Zend is setting your value and your label to the same thing - if you're 
> counting on regular form submission, they need to be the same for 
> compatibility's sake.
> 
> Ian
> 
> [1] http://radaschuetz.com/archive/2007/04/21/button-hell/
> 
> Bernd Matzner wrote:
>> Hello,
>> 
>> I'm trying desperately to set a value for a button to generate the
>> following
>> HTML:
>> 
>> My Label
>> 
>> so that the value is submitted rather than the label.
>> 
>> Using $element->setValue('myValue'); however has no effect.
>> 
>> Any hints on how to achieve that?
>> 
>> Thanks,
>> Bernd
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/setValue-for-zend_form-button-tp22486328p22486638.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] setValue for zend_form button

2009-03-12 Thread Ian Young
Perhaps this doesn't matter to you, but you should be aware that IE 
screws up  elements in a big, big way, including submitting the 
label as the value of the element[1]. My guess would be that this is why 
Zend is setting your value and your label to the same thing - if you're 
counting on regular form submission, they need to be the same for 
compatibility's sake.


Ian

[1] http://radaschuetz.com/archive/2007/04/21/button-hell/

Bernd Matzner wrote:

Hello,

I'm trying desperately to set a value for a button to generate the following
HTML:

My Label

so that the value is submitted rather than the label.

Using $element->setValue('myValue'); however has no effect.

Any hints on how to achieve that?

Thanks,
Bernd



[fw-general] setValue for zend_form button

2009-03-12 Thread Bernd Matzner

Hello,

I'm trying desperately to set a value for a button to generate the following
HTML:

My Label

so that the value is submitted rather than the label.

Using $element->setValue('myValue'); however has no effect.

Any hints on how to achieve that?

Thanks,
Bernd

-- 
View this message in context: 
http://www.nabble.com/setValue-for-zend_form-button-tp22486328p22486328.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] AJAX enabling of Zend + Dojo forms, and populating Select dependencies in an MVC environment, e.g. Country / State selects

2009-03-12 Thread alexroma

You will find some usefull answer here:
http://www.nabble.com/How-to-set-up-dependant-dropdowns-in-form-td20907379.html



Themselves wrote:
> 
> Phew. Big title.
> 
> I'm currently building a large scale application in Zend + Dojo, and with
> it
> being so new, I'm assuming I'm one of the first to attempt such
> undertaking.
> I have built it using Matthew Weier O'Phinney's Pastebox
> appas
> an example of the underlying MVC, and extended it to support accordian
> navigation, a heavily tabbed interface, JS onLoad for lazy-loaded content
> (it's all about WHERE you load it), XHR posts, extensive use of dojox
> grids
> (with AJAX search), it is a pretty full scale application so far, and it's
> all built in a very clean MVC fashion which I'm quite proud of. Now
> though,
> I'm up to one of the final stumbling blocks, and that is trying to AJAX up
> drop down selects built using Zend_Dojo_Form where there are dependencies,
> i.e., a select needs to be filled appropriately depending on the value of
> a
> parent select - a classic example being a Country select that changes the
> State select options.
> 
> It is very simple indeed to add AJAX options to a single select, simply by
> giving the ComboBox / FilteringSelect a dojox data store and a searchAttr
> (although I can't see how to have an id => value pair, the form only
> submits
> values so far...), however, I can't find any examples on the Internet of
> people building dependent select boxes in Zend + Dojo.
> 
> There's also a possible issue with the $form->populate method, meaning
> when
> we call the edit action in our controller, if too much of the logic that
> controls the multiple select boxes is client side, the populate method is
> going to act pretty weirdly.
> 
> Has anyone managed to build something like this yet? I know the Zend +
> Dojo
> combination is very new, and therefore not many examples of code are out
> there yet, but this sort of functionality is pretty fundamental for modern
> applications. What I'd like to do is solve this problem in a really clean,
> standard Zend MVC way once and for all, and post the results on the
> Interwebs for everyone to use.
> 
> As a starting point, I guess I should outline a list of ideal qualities in
> such a solution:
> 
> 
>- Uses basic Zend MVC layout, i.e. actions in a controller, separate
> form
>in the model
>- Form is built primarily in Zend_Dojo_Form and can use Dijit controls
>- The options in the select submit the id of the record, not the
> display
>value.
>- in the "edit" action of your controller, the $form->populate method
>functions correctly.
>- Ideally the data sources for the selects is a
> dojox.data.QueryReadStore
>that reads from a URL in the MVC structure that returns JSON (i.e.
> 'url' =>
>'/clients/list-data/format/ajax'), this actually works by default in
>   
> Pastebox
>- The Javascript for controlling the form's onChange is able to be
>included in a single 

Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?

2009-03-12 Thread Ben Scholzen 'DASPRiD'
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I see, you got so far yet. Well then, what's the actual problem?
...
:  ___   _   ___ ___ ___ _ ___:
: |   \ /_\ / __| _ \ _ (_)   \   :
: | |) / _ \\__ \  _/   / | |) |  :
: |___/_/:\_\___/_| |_|_\_|___/   :
:::
: Web: http://www.dasprids.de :
: E-mail : m...@dasprids.de   :
: Jabber : jab...@dasprids.de :
: ICQ: 105677955  :
:::


fire-eyed-...@hotmail.com schrieb:
> Ugh, maybe I should have given an example of what I have done so far,
> no? ;-)
> Here goes:
> 
> 
> // bootstrap
> // ROUTES SETUP - Setup routes
> $router = $frontController->getRouter();
> $router->removeDefaultRoutes();
> 
> $defaultRoute = new nl_indetail_Controller_Router_Route_Translatable(
>  ':@module/:@controller/:@action/*',
>  array(
>   'module' => 'default',
>   'controller' => 'index',
>   'action' => 'index'
>  )
> );
> $router->addRoute( 'default', $defaultRoute );
> 
> $defaultModuleRoute = new nl_indetail_Controller_Router_Route_Translatable(
>  ':@controller/:@action/*',
>  array(
>   'module' => 'default',
>   'controller' => 'index',
>   'action' => 'index'
>  )
> );
> $router->addRoute( 'defaultModule', defaultModuleRoute );
> 
> 
> 
> 
> From: fire-eyed-...@hotmail.com
> To: fw-general@lists.zend.com
> Date: Thu, 12 Mar 2009 14:23:07 +
> Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> 
> Ben,
> 
> I am implementing your Zend_Controller_Router_Route_Translatable right
> now. It works very nice. One thing I have a hard time figuring out
> though, is the following:
> 
> 
> How would I be able to mimic the default ZF route including optional
> modules, for instance such that:
> /nieuwsbrief/aanmelden (newsletter/subscribe in Dutch)
> routes to NewsletterController->subscribeAction() (default module)
> 
> /beheerder/pagina/bewerken (admin/page/edit in Dutch)
> could route to Admin_PageController->editAction() (admin module)
> 
> Any ideas? Thanks in advance.
> 
> 
> 
> From: fire-eyed-...@hotmail.com
> To: fw-general@lists.zend.com
> Date: Fri, 27 Feb 2009 19:24:24 +
> Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> 
> Ben,
> 
> I'll have to get my head around it a little more. But at first glance,
> this looks absolutely perfect for the job: just what I was looking for.
> Thanks a lot!
> 
> 
>> Date: Fri, 27 Feb 2009 19:36:47 +0100
>> From: m...@dasprids.de
>> To: fw-general@lists.zend.com
>> Subject: Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
>>
> Hehe, we just had the same topic some days ago. I solved the same
> problem some time ago, with simply a new route (which
> i will probably port to ZF in modified way some day). It works like this:
> 
> Fixed text is prepended with an @, while translatable parameters are
> prepended with :@. For example:
> 
> route.about.type = 'App_Controller_Router_Route_Translatable
> route.about.route = '@imprint'
> 
> Now, the route looks for a Zend_Translate instance with the key
> Zend_Translate within Zend_Registry, searches for the message-id
> "imprint", translates it, and then tries to match the route.
> 
> There are also translatable parameters as said before:
> 
> route.statistics.type = 'App_Controller_Router_Route_Translatable
> route.statistics.route = '@statistics/:@timerange'
> 
> Here again, "statistics" is simply translated and matches. What the
> :@timerange parameter does is the following:
> 
> When you assemble the route like this:
> 
> $urlHelper->url(array('timerange' => 'this-month'), 'statistics');
> 
> The route looks for a message with the id "this-month" and if available,
> puts it into the url, else the message id itself. When matching a URL,
> it replaces the translated parameter with the message id again, so you
> don't have to care about it in your application itself.
> 
> For the route code, see the attached file.
> 
> Regards,
> Ben
> ...
> : ___ _ ___ ___ ___ _ ___ :
> : | \ /_\ / __| _ \ _ (_) \ :
> : | |) / _ \\__ \ _/ / | |) | :
> : |___/_/:\_\___/_| |_|_\_|___/ :
> :::
> : Web : http://www.dasprids.de :
> : E-mail : m...@dasprids.de :
> : Jabber : jab...@dasprids.de :
> : ICQ : 105677955 :
> :::
> 
> 
> fire-eyed-...@hotmail.com schrieb:
>> Hi y'all,
> 
>> Is there any easy way to implement routes such that they honour
>> translations as well, without having to manually create routes for them?
> 
>> For instance:
>> /gebruiker/aanmelden
>> /benutzer/anmelden
>> Should both route to
>> /user/sign-up
> 
>> Or something similar.
> 
>> Cheers
> 
>> 
>> Deel en publiceer je favoriete foto's met Windo

Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?

2009-03-12 Thread Ben Scholzen 'DASPRiD'
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Pretty simple, you would make your route look like this:

:@controller/:@action or :@module/:@controller/:@action

But really copying the module-route by this is not possible. I suggest
you to create one route per action as usual. And personally, I wouldn't
use translatable routes in the administration, as SEO-urls are not
important there.

Regards,
Ben
...
:  ___   _   ___ ___ ___ _ ___:
: |   \ /_\ / __| _ \ _ (_)   \   :
: | |) / _ \\__ \  _/   / | |) |  :
: |___/_/:\_\___/_| |_|_\_|___/   :
:::
: Web: http://www.dasprids.de :
: E-mail : m...@dasprids.de   :
: Jabber : jab...@dasprids.de :
: ICQ: 105677955  :
:::


fire-eyed-...@hotmail.com schrieb:
> Ben,
> 
> I am implementing your Zend_Controller_Router_Route_Translatable right
> now. It works very nice. One thing I have a hard time figuring out
> though, is the following:
> 
> 
> How would I be able to mimic the default ZF route including optional
> modules, for instance such that:
> /nieuwsbrief/aanmelden (newsletter/subscribe in Dutch)
> routes to NewsletterController->subscribeAction() (default module)
> 
> /beheerder/pagina/bewerken (admin/page/edit in Dutch)
> could route to Admin_PageController->editAction() (admin module)
> 
> Any ideas? Thanks in advance.
> 
> 
> 
> From: fire-eyed-...@hotmail.com
> To: fw-general@lists.zend.com
> Date: Fri, 27 Feb 2009 19:24:24 +
> Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> 
> Ben,
> 
> I'll have to get my head around it a little more. But at first glance,
> this looks absolutely perfect for the job: just what I was looking for.
> Thanks a lot!
> 
> 
>> Date: Fri, 27 Feb 2009 19:36:47 +0100
>> From: m...@dasprids.de
>> To: fw-general@lists.zend.com
>> Subject: Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
>>
> Hehe, we just had the same topic some days ago. I solved the same
> problem some time ago, with simply a new route (which
> i will probably port to ZF in modified way some day). It works like this:
> 
> Fixed text is prepended with an @, while translatable parameters are
> prepended with :@. For example:
> 
> route.about.type = 'App_Controller_Router_Route_Translatable
> route.about.route = '@imprint'
> 
> Now, the route looks for a Zend_Translate instance with the key
> Zend_Translate within Zend_Registry, searches for the message-id
> "imprint", translates it, and then tries to match the route.
> 
> There are also translatable parameters as said before:
> 
> route.statistics.type = 'App_Controller_Router_Route_Translatable
> route.statistics.route = '@statistics/:@timerange'
> 
> Here again, "statistics" is simply translated and matches. What the
> :@timerange parameter does is the following:
> 
> When you assemble the route like this:
> 
> $urlHelper->url(array('timerange' => 'this-month'), 'statistics');
> 
> The route looks for a message with the id "this-month" and if available,
> puts it into the url, else the message id itself. When matching a URL,
> it replaces the translated parameter with the message id again, so you
> don't have to care about it in your application itself.
> 
> For the route code, see the attached file.
> 
> Regards,
> Ben
> ...
> : ___ _ ___ ___ ___ _ ___ :
> : | \ /_\ / __| _ \ _ (_) \ :
> : | |) / _ \\__ \ _/ / | |) | :
> : |___/_/:\_\___/_| |_|_\_|___/ :
> :::
> : Web : http://www.dasprids.de :
> : E-mail : m...@dasprids.de :
> : Jabber : jab...@dasprids.de :
> : ICQ : 105677955 :
> :::
> 
> 
> fire-eyed-...@hotmail.com schrieb:
>> Hi y'all,
> 
>> Is there any easy way to implement routes such that they honour
>> translations as well, without having to manually create routes for them?
> 
>> For instance:
>> /gebruiker/aanmelden
>> /benutzer/anmelden
>> Should both route to
>> /user/sign-up
> 
>> Or something similar.
> 
>> Cheers
> 
>> 
>> Deel en publiceer je favoriete foto's met Windows Live Photos
>> 

> 
> Deel en publiceer je favoriete foto's met Windows Live Photos
> 
> 
> Ook nieuwsgierig naar de nieuwe Messenger? Download 'm hier
> 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkm5UHAACgkQ0HfT5Ws789AS2wCff12NSz7tAsDO8uEAwk5JY0a9
EQQAn25wXKE6uwmdTE1/U3xrGvqDkGHi
=r4xA
-END PGP SIGNATURE-


Re: [fw-general] Re: Handling timezones?

2009-03-12 Thread Thomas Weidner

Read A.J. comment, to which I replied.

There is nothing more to say as it's correct.
And read the manual... timezone handling is described.

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

- Original Message - 
From: "Alex" 

To: 
Sent: Thursday, March 12, 2009 6:55 PM
Subject: Re: [fw-general] Re: Handling timezones?



Hi Thomas,


Right, I understand UTC dates are UTC.

My question is how to convert to the user's timezone application wide. 
How
does Zend Date know the date I'm giving it for creation is UTC and that 
the

date I want output is in the user's timezone?

- Alex



On Thu, Mar 12, 2009 at 2:49 PM, Thomas Weidner 
wrote:



You can't display UTC dates with local time.

UTC is per definition without any timezone.
Local dates/times are per definition with a timezone.

This is why the time does also change when you set another timezone.
f.e. 10:00 UTC == 12:00 GMT+2

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

- Original Message - From: "A.J. Brown" 
To: "Alex" 
Cc: 
Sent: Thursday, March 12, 2009 6:37 PM
Subject: Re: [fw-general] Re: Handling timezones?



 First, you'll want to make sure MySQL and your applications are using 
the

same timezone.  MySQL doesn't store the timezone, so it doesn't care in
regards to dates being passed in, but you'll run into consitency 
problems

if
you use MySQL date functions in combination.

The documentation is unclear on how to display UTC dates as locale 
times

(within proper timezone), but it does state that Zend_Date works
independently of the internal php timezone.  I would try reading the 
date

from the database into a Zend_Date object, then setting the timezone to
the
user's timezone before returning the date.

Let us know how that works out.


On Thu, Mar 12, 2009 at 10:12 AM, Alex  wrote:

 Anyone?


- Alex



On Wed, Mar 11, 2009 at 12:50 PM, Alex  wrote:

 Hello,


What's the recommended strategy for handling timezones with 
Zend_Date?

I
use the datetime in mysql to store dates.

What's the right combination of date_default_timezone_set and 
Zend_date

so
that everything is always stored in UTC and the user always sees 
dates

in
his local time?

- Alex








--
A.J. Brown
web | http://ajbrown.org
phone | (937) 660-3969












Re: [fw-general] Re: Handling timezones?

2009-03-12 Thread Alex
Hi Thomas,
>
> Right, I understand UTC dates are UTC.
>
> My question is how to convert to the user's timezone application wide. How
> does Zend Date know the date I'm giving it for creation is UTC and that the
> date I want output is in the user's timezone?
>
> - Alex
>
>
>
> On Thu, Mar 12, 2009 at 2:49 PM, Thomas Weidner wrote:
>
>> You can't display UTC dates with local time.
>>
>> UTC is per definition without any timezone.
>> Local dates/times are per definition with a timezone.
>>
>> This is why the time does also change when you set another timezone.
>> f.e. 10:00 UTC == 12:00 GMT+2
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>>
>> - Original Message - From: "A.J. Brown" 
>> To: "Alex" 
>> Cc: 
>> Sent: Thursday, March 12, 2009 6:37 PM
>> Subject: Re: [fw-general] Re: Handling timezones?
>>
>>
>>
>>  First, you'll want to make sure MySQL and your applications are using the
>>> same timezone.  MySQL doesn't store the timezone, so it doesn't care in
>>> regards to dates being passed in, but you'll run into consitency problems
>>> if
>>> you use MySQL date functions in combination.
>>>
>>> The documentation is unclear on how to display UTC dates as locale times
>>> (within proper timezone), but it does state that Zend_Date works
>>> independently of the internal php timezone.  I would try reading the date
>>> from the database into a Zend_Date object, then setting the timezone to
>>> the
>>> user's timezone before returning the date.
>>>
>>> Let us know how that works out.
>>>
>>>
>>> On Thu, Mar 12, 2009 at 10:12 AM, Alex  wrote:
>>>
>>>  Anyone?

 - Alex



 On Wed, Mar 11, 2009 at 12:50 PM, Alex  wrote:

  Hello,
>
> What's the recommended strategy for handling timezones with Zend_Date?
> I
> use the datetime in mysql to store dates.
>
> What's the right combination of date_default_timezone_set and Zend_date
> so
> that everything is always stored in UTC and the user always sees dates
> in
> his local time?
>
> - Alex
>




>>>
>>> --
>>> A.J. Brown
>>> web | http://ajbrown.org
>>> phone | (937) 660-3969
>>>
>>>
>>
>


Re: [fw-general] Re: Handling timezones?

2009-03-12 Thread Thomas Weidner

You can't display UTC dates with local time.

UTC is per definition without any timezone.
Local dates/times are per definition with a timezone.

This is why the time does also change when you set another timezone.
f.e. 10:00 UTC == 12:00 GMT+2

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

- Original Message - 
From: "A.J. Brown" 

To: "Alex" 
Cc: 
Sent: Thursday, March 12, 2009 6:37 PM
Subject: Re: [fw-general] Re: Handling timezones?



First, you'll want to make sure MySQL and your applications are using the
same timezone.  MySQL doesn't store the timezone, so it doesn't care in
regards to dates being passed in, but you'll run into consitency problems 
if

you use MySQL date functions in combination.

The documentation is unclear on how to display UTC dates as locale times
(within proper timezone), but it does state that Zend_Date works
independently of the internal php timezone.  I would try reading the date
from the database into a Zend_Date object, then setting the timezone to 
the

user's timezone before returning the date.

Let us know how that works out.


On Thu, Mar 12, 2009 at 10:12 AM, Alex  wrote:


Anyone?

- Alex



On Wed, Mar 11, 2009 at 12:50 PM, Alex  wrote:


Hello,

What's the recommended strategy for handling timezones with Zend_Date? I
use the datetime in mysql to store dates.

What's the right combination of date_default_timezone_set and Zend_date 
so
that everything is always stored in UTC and the user always sees dates 
in

his local time?

- Alex







--
A.J. Brown
web | http://ajbrown.org
phone | (937) 660-3969





Re: [fw-general] Re: Handling timezones?

2009-03-12 Thread A.J. Brown
First, you'll want to make sure MySQL and your applications are using the
same timezone.  MySQL doesn't store the timezone, so it doesn't care in
regards to dates being passed in, but you'll run into consitency problems if
you use MySQL date functions in combination.

The documentation is unclear on how to display UTC dates as locale times
(within proper timezone), but it does state that Zend_Date works
independently of the internal php timezone.  I would try reading the date
from the database into a Zend_Date object, then setting the timezone to the
user's timezone before returning the date.

Let us know how that works out.


On Thu, Mar 12, 2009 at 10:12 AM, Alex  wrote:

> Anyone?
>
> - Alex
>
>
>
> On Wed, Mar 11, 2009 at 12:50 PM, Alex  wrote:
>
>> Hello,
>>
>> What's the recommended strategy for handling timezones with Zend_Date? I
>> use the datetime in mysql to store dates.
>>
>> What's the right combination of date_default_timezone_set and Zend_date so
>> that everything is always stored in UTC and the user always sees dates in
>> his local time?
>>
>> - Alex
>
>
>


-- 
A.J. Brown
web | http://ajbrown.org
phone | (937) 660-3969


Re: [fw-general] HTML Tags and Zend Form

2009-03-12 Thread Matthew Weier O'Phinney
-- J DeBord  wrote
(on Thursday, 12 March 2009, 04:58 PM +0100):
> When using Zend_Form, is there a way to get rid of the default decorators all
> together?

Three ways:

  * Call clearDecorators(), and then define your decorators
  * Call setDecorators(), which implicitly calls clearDecorators()
  * Pass a 'decorators' option to your constructor... which implicitly
calls setDecorators().

> I read this article, but still do not understand how to change the html tags
> used to generate the form.
> 
> http://devzone.zend.com/article/3450-Decorators-with-Zend_Form
> 
> I would like the following HTML format:
> 
> 
>   
>     
>     
>     ...
>   
> 
> 
> Basically get rid of the definition list completey.
> 
> Frankly, I have never understood why a definition list would be used to layout
> a form, however this is really secondary to knowing how to remove it.

Every developer has their own opinion on how forms should be laid out,
and every designer has their own needs as well. Definition lists provide
a pretty easy and cheap semantic relationship between labels and
elements that also allows for easy manipulation via CSS (for instance,
you can easily get the two to align side-by-side, or one above the
other, etc).

The decorator system gives you the flexibility to choose and define your
own layout.

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


[fw-general] Navigation view helper

2009-03-12 Thread J DeBord
I would like to add a navigation view helper to my layout.phtml

Something along the lines of:

layout()->nav; ?> which would work like layout()->content ?>, except common navigation would be displayed.

I would then make two files, defaultNav.phtml and adminNav.phtml. I would
like to show the default Navigation on every controller except one.

I've read this, but am still having trouble.

http://teethgrinder.co.uk/perm.php?a=Zend-Framework-Menus-Navigation

Would someone please get me started.

Thanks!


[fw-general] Re: Handling timezones?

2009-03-12 Thread Alex
Anyone?

- Alex


On Wed, Mar 11, 2009 at 12:50 PM, Alex  wrote:

> Hello,
>
> What's the recommended strategy for handling timezones with Zend_Date? I
> use the datetime in mysql to store dates.
>
> What's the right combination of date_default_timezone_set and Zend_date so
> that everything is always stored in UTC and the user always sees dates in
> his local time?
>
> - Alex


[fw-general] HTML Tags and Zend Form

2009-03-12 Thread J DeBord
When using Zend_Form, is there a way to get rid of the default decorators
all together?

I read this article, but still do not understand how to change the html tags
used to generate the form.

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

I would like the following HTML format:


  


...
  


Basically get rid of the definition list completey.

Frankly, I have never understood why a definition list would be used to
layout a form, however this is really secondary to knowing how to remove it.

Thanks.


Re: [fw-general] CrudController vs. Action helpers

2009-03-12 Thread Matthew Weier O'Phinney
-- Marko Korhonen  wrote
(on Wednesday, 11 March 2009, 10:27 PM -0700):
> Earlier I converted all my "Base" controllers to action helpers (thanks,
> Matthew), except for one.
> I still have CrudController which basicly has create/read/update/delete
> actions and lot's of event methods.
> 
> I also found the old CrudController slides from Matthew (any updates coming
> to this Matthew?):
> http://weierophinney.net/matthew/uploads/2007-02-28-FrameworkPresentation.pdf

That was pre-1.0 -- a ton has changed since then, and there were
actually a number of changes that came about because of that
presentation and the venue at which I presented it.

Ralph is working on some scaffolding for Zend_Tool for creating CRUD
apps, which will hopefully make it into 1.8 -- that will be the
"recommended" practice in the future.

> This makes the same thing, it's just a bit old.
> 
> I'll include some of my CrufController methods below.
> 
> Any comments/feedback or suggestions would be great!
> 
> br, Marko
> 
> protected function _setForm()
> {
> 
>   // load the form and creates it
> }
> 
> protected function _processForm($data = array())
> {
>   $this->_alterForm(); // Event
> 
> //processing + event calls here and there
> }
> 
> // Gets the name of the Model we are creating/reading/updating/deleting
> protected function _getModel()
> {
>   return $this->_request->getModuleName();
> }
> 
> // Do something when empty row is created in createAction()
> protected function _onRowCreation()
> {
> 
> }
> 
> // Alter the form somehow (my forms are loaded from ini files and then
> altered if needed)
> protected function _alterForm()
> {
> 
> }
> 
> // After form is altered you can still do something like set some element
> values
> protected function _alterFormPostProcess()
> {
> 
> }
> 
> // Do something before form validation starts 
> protected function _onBeforeValidation(array $post)
> {
>   return $post;
> }
> 
> // Do something after form validation succeeded
> protected function _onValidationSucceed(array $post)
> {
>   return $post;
> }
> 
> // Do something if form was not valid
> protected function _onValidationFailed(array $post)
> {
>   return $post;
> }
> 
> // Do something just before when saving the row
> protected function _onBeforeSave()
> {
>   return true;
> }
> 
> // Do something just before deleting the row
> protected function _onBeforeDelete()
> {
>   return true;
> }
> 
> // Do something just after row has been saved
> protected function _onSave()
> {
> 
> }
> 
> // Do something after all saving and other stuff have been made
> protected function _onSaveComplete()
> {
>   if ($this->_request->isXmlHttpRequest())
>   {
>   $this->_helper->json(array("redirect" => 
> $this->_getRedirectOnSave()));
>   }
>   else
>   {
>   // Redirect to the next page
>   $this->_redirect($this->_getRedirectOnSave(), 
> array("prependBase" =>
> false));
>   }
> }
> 
> // Get the redirect url after save > normally goes to readAction
> protected function _getRedirectOnSave()
> {
>   if ($this->_hasParam("redirect_url"))
>   {
>   return $this->_getParam("redirect_url",
> $this->getFrontController()->getBaseUrl());
>   }
>   else
>   {
>   return $this->getFrontController()->getBaseUrl();
>   }
> }
> 
> // Get the redirect url after delete
> protected function _getRedirectOnDelete(array $data)
> {
>   return $this->getFrontController()->getBaseUrl();
> }
> 
> // Gets the form section name for the ini file [user_form]
> protected function _getFormName()
> {
>   return "{$this->_request->getModuleName()}_form";
> }
> -- 
> View this message in context: 
> http://www.nabble.com/CrudController-vs.-Action-helpers-tp22470068p22470068.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

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


RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?

2009-03-12 Thread fire-eyed-boy

Ugh, maybe I should have given an example of what I have done so far, no? ;-)
Here goes:


// bootstrap
// ROUTES SETUP - Setup routes
$router = $frontController->getRouter();
$router->removeDefaultRoutes();

$defaultRoute = new nl_indetail_Controller_Router_Route_Translatable(
 ':@module/:@controller/:@action/*',
 array(
'module' => 'default',
'controller' => 'index',
'action' => 'index'
 )
);
$router->addRoute( 'default', $defaultRoute );

$defaultModuleRoute = new nl_indetail_Controller_Router_Route_Translatable(
 ':@controller/:@action/*',
 array(
'module' => 'default',
'controller' => 'index',
'action' => 'index'
 )
);
$router->addRoute( 'defaultModule', defaultModuleRoute );



From: fire-eyed-...@hotmail.com
To: fw-general@lists.zend.com
Date: Thu, 12 Mar 2009 14:23:07 +
Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?








Ben,

I am implementing your Zend_Controller_Router_Route_Translatable right now. It 
works very nice. One thing I have a hard time figuring out though, is the 
following: 


How would I be able to mimic the default ZF route including optional modules, 
for instance such that:
/nieuwsbrief/aanmelden (newsletter/subscribe in Dutch)
routes to NewsletterController->subscribeAction() (default module)

/beheerder/pagina/bewerken (admin/page/edit in Dutch)
could route to Admin_PageController->editAction() (admin module)

Any ideas? Thanks in advance.


From: fire-eyed-...@hotmail.com
To: fw-general@lists.zend.com
Date: Fri, 27 Feb 2009 19:24:24 +
Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?








Ben,

I'll have to get my head around it a little more. But at first glance,  this 
looks absolutely perfect for the job: just what I was looking for. Thanks a lot!


> Date: Fri, 27 Feb 2009 19:36:47 +0100
> From: m...@dasprids.de
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hehe, we just had the same topic some days ago. I solved the same
> problem some time ago, with simply a new route (which
> i will probably port to ZF in modified way some day). It works like this:
> 
> Fixed text is prepended with an @, while translatable parameters are
> prepended with :@. For example:
> 
> route.about.type  = 'App_Controller_Router_Route_Translatable
> route.about.route = '@imprint'
> 
> Now, the route looks for a Zend_Translate instance with the key
> Zend_Translate within Zend_Registry, searches for the message-id
> "imprint", translates it, and then tries to match the route.
> 
> There are also translatable parameters as said before:
> 
> route.statistics.type  = 'App_Controller_Router_Route_Translatable
> route.statistics.route = '@statistics/:@timerange'
> 
> Here again, "statistics" is simply translated and matches. What the
> :@timerange parameter does is the following:
> 
> When you assemble the route like this:
> 
> $urlHelper->url(array('timerange' => 'this-month'), 'statistics');
> 
> The route looks for a message with the id "this-month" and if available,
> puts it into the url, else the message id itself. When matching a URL,
> it replaces the translated parameter with the message id again, so you
> don't have to care about it in your application itself.
> 
> For the route code, see the attached file.
> 
> Regards,
> Ben
> ...
> :  ___   _   ___ ___ ___ _ ___:
> : |   \ /_\ / __| _ \ _ (_)   \   :
> : | |) / _ \\__ \  _/   / | |) |  :
> : |___/_/:\_\___/_| |_|_\_|___/   :
> :::
> : Web: http://www.dasprids.de :
> : E-mail : m...@dasprids.de   :
> : Jabber : jab...@dasprids.de :
> : ICQ: 105677955  :
> :::
> 
> 
> fire-eyed-...@hotmail.com schrieb:
> > Hi y'all,
> > 
> > Is there any easy way to implement routes such that they honour
> > translations as well, without having to manually create routes for them?
> > 
> > For instance:
> > /gebruiker/aanmelden
> > /benutzer/anmelden
> > Should both route to
> > /user/sign-up
> > 
> > Or something similar.
> > 
> > Cheers
> > 
> > 
> > Deel en publiceer je favoriete foto's met Windows Live Photos
> > 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkmoMrwACgkQ0HfT5Ws789Di2wCdFPoG4xyooS/VDQ8Q1OVYTWZi
> NSIAn1N4NvuZbftpFiQnRJumFvvKQH2A
> =b4Va
> -END PGP SIGNATURE-

Deel en publiceer je favoriete foto's met Windows Live Photos
Ook nieuwsgierig naar de nieuwe Messenger? Download 'm hier
_
De leukste online filmpjes vind je op MSN Video!
http://video.msn.com/video.aspx?mkt=nl-nl

[fw-general] headScript helper problem

2009-03-12 Thread Jacky Chen
Hi guys,
i enable zend_layout in my application, there are four template files,
layout.phtml, header.phtml, index.phtml, footer.phtml ,to render.
layout.phtml is the layout template,and header.phtml and footer.phtml
rendered in layout.phtml,the code as following:

layout.phtml
--


layout template
headScript(); ?>



render('header.phtml'); ?>

layout()->content; ?>

render('footer.phtml'); ?>




header.phtml
---


headScript()->captureStart(); ?>
// script in header
headScript()->captureEnd(); ?>


..



index.phtml
-


headScript()->captureStart(); ?>
// script in the index
headScript()->captureEnd(); ?>


.



i capture scripts in both header.phtml and index.phtml templates,but only
scripts that captured in index.phtml be output. why,and how to solve that?

Greetings,
Jacky


RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?

2009-03-12 Thread fire-eyed-boy

Ben,

I am implementing your Zend_Controller_Router_Route_Translatable right now. It 
works very nice. One thing I have a hard time figuring out though, is the 
following: 


How would I be able to mimic the default ZF route including optional modules, 
for instance such that:
/nieuwsbrief/aanmelden (newsletter/subscribe in Dutch)
routes to NewsletterController->subscribeAction() (default module)

/beheerder/pagina/bewerken (admin/page/edit in Dutch)
could route to Admin_PageController->editAction() (admin module)

Any ideas? Thanks in advance.


From: fire-eyed-...@hotmail.com
To: fw-general@lists.zend.com
Date: Fri, 27 Feb 2009 19:24:24 +
Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?








Ben,

I'll have to get my head around it a little more. But at first glance,  this 
looks absolutely perfect for the job: just what I was looking for. Thanks a lot!


> Date: Fri, 27 Feb 2009 19:36:47 +0100
> From: m...@dasprids.de
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hehe, we just had the same topic some days ago. I solved the same
> problem some time ago, with simply a new route (which
> i will probably port to ZF in modified way some day). It works like this:
> 
> Fixed text is prepended with an @, while translatable parameters are
> prepended with :@. For example:
> 
> route.about.type  = 'App_Controller_Router_Route_Translatable
> route.about.route = '@imprint'
> 
> Now, the route looks for a Zend_Translate instance with the key
> Zend_Translate within Zend_Registry, searches for the message-id
> "imprint", translates it, and then tries to match the route.
> 
> There are also translatable parameters as said before:
> 
> route.statistics.type  = 'App_Controller_Router_Route_Translatable
> route.statistics.route = '@statistics/:@timerange'
> 
> Here again, "statistics" is simply translated and matches. What the
> :@timerange parameter does is the following:
> 
> When you assemble the route like this:
> 
> $urlHelper->url(array('timerange' => 'this-month'), 'statistics');
> 
> The route looks for a message with the id "this-month" and if available,
> puts it into the url, else the message id itself. When matching a URL,
> it replaces the translated parameter with the message id again, so you
> don't have to care about it in your application itself.
> 
> For the route code, see the attached file.
> 
> Regards,
> Ben
> ...
> :  ___   _   ___ ___ ___ _ ___:
> : |   \ /_\ / __| _ \ _ (_)   \   :
> : | |) / _ \\__ \  _/   / | |) |  :
> : |___/_/:\_\___/_| |_|_\_|___/   :
> :::
> : Web: http://www.dasprids.de :
> : E-mail : m...@dasprids.de   :
> : Jabber : jab...@dasprids.de :
> : ICQ: 105677955  :
> :::
> 
> 
> fire-eyed-...@hotmail.com schrieb:
> > Hi y'all,
> > 
> > Is there any easy way to implement routes such that they honour
> > translations as well, without having to manually create routes for them?
> > 
> > For instance:
> > /gebruiker/aanmelden
> > /benutzer/anmelden
> > Should both route to
> > /user/sign-up
> > 
> > Or something similar.
> > 
> > Cheers
> > 
> > 
> > Deel en publiceer je favoriete foto's met Windows Live Photos
> > 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkmoMrwACgkQ0HfT5Ws789Di2wCdFPoG4xyooS/VDQ8Q1OVYTWZi
> NSIAn1N4NvuZbftpFiQnRJumFvvKQH2A
> =b4Va
> -END PGP SIGNATURE-

Deel en publiceer je favoriete foto's met Windows Live Photos
_
Haal meer uit je leven met Windows Live
http://windowslive.microsoft.nl/WL/Home