2009年6月30日星期二

[fw-mvc] What is the status on Zend_Model?

Hi there,

I remember the discussion about the model part in the Zend Framework
many moons ago. I also remember a few approaches discussed on these
issue, e.g. providing a set of interfaces or abstract classes to build a
model then "Zend Framework way" or adding a chapter to the reference
guide with best practices about writing models for the Zend Framework.
And I also remember that this was planned for the 1.9 release.

So, are there any news about Zend_Model or whatsoever it will be called?

Thanks and best regards,

Ralf

Re: [fw-mvc] Where to put my custom validators?

Typically what I have done with validators in the past is create another directory in the library folder (especially if I know I am going to use it again).

What I end up having is something like: library/MyCodeBase/Validators/* and add them into the autoloader.  You could essentially do this from within the module directory or even create a new directory under your file system.


You might also want to peak a bit more into the documentation on writing the custom validators: http://framework.zend.com/manual/en/zend.validate.writing_validators.html


Regards,


Mike

 

----- Original Message -----

From: dmitrybelyakov

Sent: 06/30/09 02:03 pm

To: fw-mvc@lists.zend.com

Subject: [fw-mvc] Where to put my custom validators?

 


Hello everybody,

I just wonder if there's a default or recommended location for custom
validator classes that go along with my module's forms. I am having trouble
getting it to work and actually autoload. Any help is greatly appreciated.

Dmitry.
--
View this message in context: http://www.nabble.com/Where-to-put-my-custom-validators--tp24277729p24277729.html
Sent from the Zend MVC mailing list archive at Nabble.com.

 


[fw-formats] Zend_Pdf text wrapping

Hello,

Has somebody experience with text (drawText function) wrapping in pdf documents created from Zend_Pdf?  What I want is wrap text in a defined area in the document. I will appreciate so much your help.

 

Jaime.

[fw-mvc] Where to put my custom validators?

Hello everybody,

I just wonder if there's a default or recommended location for custom
validator classes that go along with my module's forms. I am having trouble
getting it to work and actually autoload. Any help is greatly appreciated.

Dmitry.
--
View this message in context: http://www.nabble.com/Where-to-put-my-custom-validators--tp24277729p24277729.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-mvc] Validation _getParam Zend_Controller_Action

Hi. I saw in many tutorial a think like this
 $id = $this->_getParam('id', 0); if ($id > 0) {     // do something } 
I'm wondering if it's enough for the script security. Do you think is a waste of time to validate it with Zend_Validate_Digits or not ? Bye.

View this message in context: Validation _getParam Zend_Controller_Action
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-mvc] modular project developing

hi friends,
is there any cli tool that support module based project with ZF
i see a tutorial
(http://blog.keppens.biz/2009/06/create-modular-application-with-zend.html)
but my zf.sh doest nt support module action when i use like this
<code>
bash# zf create module myModuleName
</code>

--
View this message in context: http://www.nabble.com/modular-project-developing-tp24268954p24268954.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-db] Model/Mapper to populate form

Hi.
I should get data to populate a form for
the model/mapper I ended up with this code
 //mapper public function populate($id)     {         $result = $this->getDbTable()->find($id);         return $result->toArray();     } // model  function populate($id)     {         return $this->getMapper()->populate($id);              } 
It's a quick way but imho not very OOP (it break the logic of model/mapper) I mean the populate method should return a user objetc like this
 //mapper public function find($id, Model_UserModel $user)     {         $result = $this->getDbTable()->find($id);         if (0 === count($result)) {             return null;         }         $row = $result->current();         $user->setId($row->id)                     ->setAcl_role_id($row->acl_role_id)                     ->setUname($row->uname)                     ->setSurname($row->surname)                     ->setUsername($row->username)                     ->setPassword($row->password)                     ->setEmail($row->email)                     ->setCreated($row->created)                     ->setLogin($row->login)                     ->setActive($row->active);     } //model  public function find($id)     {         $this->getMapper()->find($id, $this);         return $this;     } 
or not ? Thanks in advance. Bye

View this message in context: Model/Mapper to populate form
Sent from the Zend DB mailing list archive at Nabble.com.

2009年6月29日星期一

[fw-webservices] Zend_Service_Tumblr Proposal - Ready for Review

Proposal:

http://framework.zend.com/wiki/display/ZFPROP/Zend_Service_Tumblr+-+Duo+Zheng

I would like to get general feedback and more specifically on the use cases
to make sure they are appropriate.

Thanks
--
View this message in context: http://www.nabble.com/Zend_Service_Tumblr-Proposal---Ready-for-Review-tp24261698p24261698.html
Sent from the Zend Web Services mailing list archive at Nabble.com.

[fw-mvc] Inconsistency with Zend_Controller_Request_Http

Hello,

I've run into a consistency issue with Zend_Controller_Request_Http (ZF 1.8.4). The constructor accepts a request uri, and there's also a setRequestUri method. I assumed the following two snippets of code would produce the same results:

// This works
$request = new Zend_Controller_Request_Http('http://www.example.com/foo/bar');

// This doesn't work
$request = new Zend_Controller_Request_Http();
$request->setRequestUri('http://www.example.com/foo/bar');

Looking at the source code, the constructor for Zend_Controller_Request_Http accepts a string/Zend_Uri as its only argument, but Zend_Controller_Request_Http::setRequestUri() only accepts a string. Also, they have different implementations when a string is passed in.

The constructor passes the string to Zend_Uri::factory(), validates the URI, joins the path and query with a question mark, and then passes the resulting string to setRequestUri().

setRequestUri() simply copies the string argument to the protected property $_requestUri (after extracting the query portion, if any).

It seems to me that these two implementations should be compatible. Or better yet, the constructor should proxy directly to setRequestUri() without doing any fancy work (let setRequestUri handle that).

Am I missing something or should I submit a bug report and a patch? Thanks!

--
Hector

[fw-mvc] Form - Add a method to populate a select .

Hi. To populate a select I ended up with this code
 class Form_User extends Zend_Form {     protected $_roleData;          public function init()     {                   $this->setMethod('post');         $this->setAttribs(array('id'=>'frm-user','class'=>'large center'));                  // Roles           $this->addElement('select', 'role_id', array(            'multiOptions' => $this->_roleData,             'value' => '0',             'required'   => true,             'validators' => array(                 'Digits'             )         ));              }          public function setRoleData($data){                   $this->_roleData = $data;     } } 
in the controller
 protected function _getform(array $data = null)     {         return $this->getHelper('FormLoader')->load('user',array(             'action' => $this->_helper->url('add'),'RoleData' => $data));            } 
I'm wondering if there is something built-in in zf (I know populate but I'm not able to apply it at this case) or an other way to populate a select. I'd like to avoid to put a model in the form. Bye.

View this message in context: Form - Add a method to populate a select .
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-mvc] Form Decorator Method getLabel does not exist

Thanks I got the point.

Mon Zafra wrote:
>
> It's because the Label decorator calls getLabel() on the object it
> decorates, but there's no such method in a form object. The Label
> decorator
> is for elements, not the form itself.
> -- Mon
>
>
> On Mon, Jun 29, 2009 at 4:06 PM, whisher <whisher@mp4.it> wrote:
>
>>
>> Hi.
>> Can you explain me why on earth this code get
>> the error in the subject:
>> class Form_User extends Zend_Form
>> {
>> public function init()
>> {
>> $this->setMethod('post');
>> $this->setAttribs(array('id'=>'frm-user','class'=>'large
>> center'));
>> // Name
>> $this->addElement('text', 'uname', array(
>> 'maxlength' => 50,
>> 'label' => 'form_User_Label_Name',
>> 'required' => true,
>> 'filters' => array('StringTrim'),
>> 'validators' => array(
>> 'Alnum',
>> array('StringLength', true, array(3, 50)),
>> array('Db_NoRecordExists', false, array('table' =>
>> 'users',
>> 'field' =>
>> 'uname'))
>> )
>> ));
>>
>> $this->setDisableLoadDefaultDecorators(true);
>> $this->setDecorators(array(
>> 'formElements',
>> array('HtmlTag', array('tag' => 'dl', 'class' =>
>> 'elements-frm-user')),
>> array('Label', array('tag' => 'dd', 'class' =>
>> 'labels-frm-user')),
>> 'Form'
>> ));
>>
>> }
>> }
>>
>> Bye.
>> --
>> View this message in context:
>> http://www.nabble.com/Form-Decorator-Method-getLabel-does-not-exist-tp24249990p24249990.html
>> Sent from the Zend MVC mailing list archive at Nabble.com.
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Form-Decorator-Method-getLabel-does-not-exist-tp24249990p24259350.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-mvc] Form Decorator Method getLabel does not exist

It's because the Label decorator calls getLabel() on the object it decorates, but there's no such method in a form object. The Label decorator is for elements, not the form itself.

   -- Mon


On Mon, Jun 29, 2009 at 4:06 PM, whisher <whisher@mp4.it> wrote:

Hi.
Can you explain me why on earth this code get
the error in the subject:
class Form_User extends Zend_Form
{
   public function init()
   {
       $this->setMethod('post');
       $this->setAttribs(array('id'=>'frm-user','class'=>'large center'));
       // Name
       $this->addElement('text', 'uname', array(
           'maxlength' => 50,
           'label'      => 'form_User_Label_Name',
           'required'   => true,
           'filters'    => array('StringTrim'),
           'validators' => array(
               'Alnum',
               array('StringLength', true, array(3, 50)),
               array('Db_NoRecordExists', false, array('table' => 'users',
                                                              'field' =>
'uname'))
           )
       ));

       $this->setDisableLoadDefaultDecorators(true);
       $this->setDecorators(array(
               'formElements',
               array('HtmlTag', array('tag' => 'dl', 'class' =>
'elements-frm-user')),
               array('Label', array('tag' => 'dd', 'class' =>
'labels-frm-user')),
               'Form'
       ));

   }
}

Bye.
--
View this message in context: http://www.nabble.com/Form-Decorator-Method-getLabel-does-not-exist-tp24249990p24249990.html
Sent from the Zend MVC mailing list archive at Nabble.com.


[fw-mvc] Form Decorator Method getLabel does not exist

Hi.
Can you explain me why on earth this code get
the error in the subject:
class Form_User extends Zend_Form
{
public function init()
{
$this->setMethod('post');
$this->setAttribs(array('id'=>'frm-user','class'=>'large center'));
// Name
$this->addElement('text', 'uname', array(
'maxlength' => 50,
'label' => 'form_User_Label_Name',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
'Alnum',
array('StringLength', true, array(3, 50)),
array('Db_NoRecordExists', false, array('table' => 'users',
'field' =>
'uname'))
)
));

$this->setDisableLoadDefaultDecorators(true);
$this->setDecorators(array(
'formElements',
array('HtmlTag', array('tag' => 'dl', 'class' =>
'elements-frm-user')),
array('Label', array('tag' => 'dd', 'class' =>
'labels-frm-user')),
'Form'
));

}
}

Bye.
--
View this message in context: http://www.nabble.com/Form-Decorator-Method-getLabel-does-not-exist-tp24249990p24249990.html
Sent from the Zend MVC mailing list archive at Nabble.com.

2009年6月28日星期日

Re: [fw-core] Disabling file upload field in form

Zoltan,


You can solve this by using javascript to enable the field on submit.  Essentially this is not code based for the framework itself but rather it does not get sent from the browser when the field is disabled. 


Regards,


Mike


----- Original Message -----

From: Zoltan Lippai

Sent: 06/28/09 01:11 pm

To: fw-core@lists.zend.com

Subject: [fw-core] Disabling file upload field in form

 

Hi,

I have a form, where I need to disable some items (the user can't
modify it, but he can see the fields values)
When the user submits the form, before validating it, I set the
initial values for the disabled fields, so this way I can be sure, that
a) The user can't modify any of the disabled fields values
b) The fields get their values (if a field is disabled, then zend_form
won't see its value)

This way everything was fine, until I needed a file upload field. When
it is disabled, I get the following error during form validation:

Fatal error: Uncaught exception 'Zend_File_Transfer_Exception' with
message '"newFile" not found by file transfer adapter' in /jail/web/
projekter.lativus.com/Zend/File/Transfer/Adapter/Abstract.php:1254
Stack trace:
#0 /jail/web/projekter.lativus.com/Zend/File/Transfer/Adapter/
Abstract.php(572): Zend_File_Transfer_Adapter_Abstract-
>_getFiles('newFile')
#1 /jail/web/projekter.lativus.com/Zend/Form/Element/File.php(435):
Zend_File_Transfer_Adapter_Abstract->isValid('newFile')
#2 /jail/web/projekter.lativus.com/Zend/Form.php(1985):
Zend_Form_Element_File->isValid(NULL, Array)
#3 /jail/web/projekter.lativus.com/application/default/controllers/
TaskController.php(311): Zend_Form->isValid(Array)
#4 /jail/web/projekter.lativus.com/Zend/Controller/Action.php(503):
TaskController->editAction()
#5 /jail/web/projekter.lativus.com/Zend/Controller/Dispatcher/
Standard.php(285): Zend_Controller_Action->dispatch('editAction')
#6 /jail/web/projekter.lativus.com/Zend/Controller/Front.php(934):
Zend_Controller_Dispatcher_Standard->dispatch(O in /jail/web/
projekter.lativus.com/Zend/File/Transfer/Adapter/Abstract.php on line
1254

I suppose the file upload fields value also doesn't get submitted, but
I don't think setting some value for it before validation will work in
this case.

Do you have any suggestions about dealing with this problem?

Thanks,
Zoltan

 


[fw-core] Disabling file upload field in form

Hi,

I have a form, where I need to disable some items (the user can't
modify it, but he can see the fields values)
When the user submits the form, before validating it, I set the
initial values for the disabled fields, so this way I can be sure, that
a) The user can't modify any of the disabled fields values
b) The fields get their values (if a field is disabled, then zend_form
won't see its value)

This way everything was fine, until I needed a file upload field. When
it is disabled, I get the following error during form validation:

Fatal error: Uncaught exception 'Zend_File_Transfer_Exception' with
message '"newFile" not found by file transfer adapter' in /jail/web/
projekter.lativus.com/Zend/File/Transfer/Adapter/Abstract.php:1254
Stack trace:
#0 /jail/web/projekter.lativus.com/Zend/File/Transfer/Adapter/
Abstract.php(572): Zend_File_Transfer_Adapter_Abstract-
>_getFiles('newFile')
#1 /jail/web/projekter.lativus.com/Zend/Form/Element/File.php(435):
Zend_File_Transfer_Adapter_Abstract->isValid('newFile')
#2 /jail/web/projekter.lativus.com/Zend/Form.php(1985):
Zend_Form_Element_File->isValid(NULL, Array)
#3 /jail/web/projekter.lativus.com/application/default/controllers/
TaskController.php(311): Zend_Form->isValid(Array)
#4 /jail/web/projekter.lativus.com/Zend/Controller/Action.php(503):
TaskController->editAction()
#5 /jail/web/projekter.lativus.com/Zend/Controller/Dispatcher/
Standard.php(285): Zend_Controller_Action->dispatch('editAction')
#6 /jail/web/projekter.lativus.com/Zend/Controller/Front.php(934):
Zend_Controller_Dispatcher_Standard->dispatch(O in /jail/web/
projekter.lativus.com/Zend/File/Transfer/Adapter/Abstract.php on line
1254

I suppose the file upload fields value also doesn't get submitted, but
I don't think setting some value for it before validation will work in
this case.

Do you have any suggestions about dealing with this problem?

Thanks,
Zoltan

Re: [fw-mvc] setHttpResponseCode doesn't work ?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpHcnYACgkQadOAzz84lo9vLQCfUm3uHFAUwx7igRxQJdh74Szz
rMoAnjd27KQdC9RZb1w67tQyoLAn7nBc
=Fzqd
-----END PGP SIGNATURE-----
Matthew Weier O'Phinney <matthew@zend.com>
[Sun, 28 Jun 2009 09:18:28 -0400] :

> -- ert256 <ert256@gmail.com> wrote
> (on Sunday, 28 June 2009, 02:51 PM +0200):
> > This is my index controller :
> > <?php
> >
> > class IndexController extends Zend_Controller_Action
> > {
> > public function indexAction()
> > {
> > $this->getResponse()->setHttpResponseCode(404);
> > }
> > }
> >
> > But the request returns HTTP 200 response. How can I force it to return
> > 404 ?
> >
> > I have configured layout, and ViewRenderer automatically, and I use
> > ZendFramework 1.8.2.
>
> I've just tested this locally, and it's working fine -- I received the
> expected HTTP response code when I checked in FireBug. Perhaps you're
> behind a proxy server?
Fals alarm - mea culpa.

I haven't checked that on client side. I was looking in apache logs, and i
found a mistake. I've used %s in Log expression instead of %>s which make
huge difference.

Thanks for help.

ß
Rafał (ert16) Trójniak
m@il : ert256@gmail.com
Jid : ert256@gmail.com
GPG key-ID : 3F38968F
4711 E3BC B674 C841 BED8
0F8F 69D3 80CF 3F38 968F

Re: [fw-mvc] setHttpResponseCode doesn't work ?

-- ert256 <ert256@gmail.com> wrote
(on Sunday, 28 June 2009, 02:51 PM +0200):
> This is my index controller :
> <?php
>
> class IndexController extends Zend_Controller_Action
> {
> public function indexAction()
> {
> $this->getResponse()->setHttpResponseCode(404);
> }
> }
>
> But the request returns HTTP 200 response. How can I force it to return
> 404 ?
>
> I have configured layout, and ViewRenderer automatically, and I use
> ZendFramework 1.8.2.

I've just tested this locally, and it's working fine -- I received the
expected HTTP response code when I checked in FireBug. Perhaps you're
behind a proxy server?

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

[fw-mvc] setHttpResponseCode doesn't work ?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpHZ0cACgkQadOAzz84lo96/QCghT7Wke2jfkWddip4w+m3fx61
eCoAn3bUtZBMLWCanCOyLu/w91YxzQ4x
=JMdG
-----END PGP SIGNATURE-----
Hello

This is my index controller :
<?php

class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
$this->getResponse()->setHttpResponseCode(404);
}
}

But the request returns HTTP 200 response. How can I force it to return
404 ?

I have configured layout, and ViewRenderer automatically, and I use
ZendFramework 1.8.2.

Greetings
ß
Rafał (ert16) Trójniak
m@il : ert256@gmail.com
Jid : ert256@gmail.com
GPG key-ID : 3F38968F
4711 E3BC B674 C841 BED8
0F8F 69D3 80CF 3F38 968F

2009年6月27日星期六

Re: [fw-mvc] zend pdf - align text at right

Well it looks like it does the job pretty well!
Thanks for your help,
Remy

On Sat, Jun 27, 2009 at 1:46 AM, Gina-Marie
Rollock<Gina-Marie.Rollock@networkts.com> wrote:
> I found the following function on the internet after some searching. It works wonderfully!
>
>        protected function word_width($string, $font, $fontSize) {
>                $drawingString = iconv('', 'UTF-16BE', $string);
>                $characters    = array();
>                for ($i = 0; $i < strlen($drawingString); $i++) {
>                        $characters[] = (ord($drawingString[$i++]) << 8) | ord ($drawingString[$i]);
>                }
>                $glyphs        = $font->glyphNumbersForCharacters($characters);
>                $widths        = $font->widthsForGlyphs($glyphs);
>                $stringWidth   = (array_sum($widths) / $font->getUnitsPerEm()) * $fontSize;
>                return $stringWidth;
>        }
>
> -----Original Message-----
> From: Remy Damour [mailto:remy.damour@gmail.com]
> Sent: Friday, June 26, 2009 6:30 PM
> To: Zend Framework MVC
> Subject: [fw-mvc] zend pdf - align text at right
>
> Hi,
>
> I'm currently giving a shot at pdf generation through Zend_Pdf, and
> first of all, thanks for the job done, it's great and quite easy to
> use.
>
> I have a question though, is it possible to know the size of
> text-string to be drawn (Zend_Pdf_Page::drawText())?
> I need it to be able to align my text on the right (if anyone has a
> better idea, do not hesitate!)
>
> Regards,
> Remy
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 4193 (20090626) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 4193 (20090626) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>

2009年6月26日星期五

RE: [fw-mvc] zend pdf - align text at right

I found the following function on the internet after some searching. It works wonderfully!

protected function word_width($string, $font, $fontSize) {
$drawingString = iconv('', 'UTF-16BE', $string);
$characters = array();
for ($i = 0; $i < strlen($drawingString); $i++) {
$characters[] = (ord($drawingString[$i++]) << 8) | ord ($drawingString[$i]);
}
$glyphs = $font->glyphNumbersForCharacters($characters);
$widths = $font->widthsForGlyphs($glyphs);
$stringWidth = (array_sum($widths) / $font->getUnitsPerEm()) * $fontSize;
return $stringWidth;
}

-----Original Message-----
From: Remy Damour [mailto:remy.damour@gmail.com]
Sent: Friday, June 26, 2009 6:30 PM
To: Zend Framework MVC
Subject: [fw-mvc] zend pdf - align text at right

Hi,

I'm currently giving a shot at pdf generation through Zend_Pdf, and
first of all, thanks for the job done, it's great and quite easy to
use.

I have a question though, is it possible to know the size of
text-string to be drawn (Zend_Pdf_Page::drawText())?
I need it to be able to align my text on the right (if anyone has a
better idea, do not hesitate!)

Regards,
Remy


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4193 (20090626) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4193 (20090626) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

[fw-mvc] zend pdf - align text at right

Hi,

I'm currently giving a shot at pdf generation through Zend_Pdf, and
first of all, thanks for the job done, it's great and quite easy to
use.

I have a question though, is it possible to know the size of
text-string to be drawn (Zend_Pdf_Page::drawText())?
I need it to be able to align my text on the right (if anyone has a
better idea, do not hesitate!)

Regards,
Remy

Re: [fw-formats] Plans for Zend_PDF

Nico Edtinger schrieb:
>>> we are considering adding support for cells and tables by ourselves.
>
> What's your current status?

We did indeed implement the needed funtionality by ourselves, but the
way I see it, it's not ready for contribution as-is, as the code was
tailored more to satisfy the immediate needs than to provide a
comprehensive feature set. No modifications were made to Zend_PDF
itself, but some new classes were put on top of it instead.

Also, while it basically does the job, there are some edge-cases that
are still not being solved, IIRC particularly concerning page breaks
(tables spanning more than one page). I'm not too sure about the
details, because I was not the one who this got assigned to.

>> As I myself found it quite complicated to draw even simple text I
>> started a new proposal for some enhancements:
>> <http://framework.zend.com/wiki/x/UwDI>.
>
> This proposal is now ready for review.
>
> I'm asking, because if you're still considering contributing we should
> coordinate our efforts.

The code is publicly viewable:

http://phprojekt.svn.sourceforge.net/viewvc/phprojekt/trunk/phprojekt/library/Phprojekt/Pdf/

And a usage example would be:

http://phprojekt.svn.sourceforge.net/viewvc/phprojekt/trunk/phprojekt/application/Minutes/Helpers/Pdf.php?revision=2079&view=markup

I don't know how much this is similar to your approach. The code
currently is licensed under LGPL, but if you can use any of it, I'm
pretty optimistic that the powers-that-be could be made to agree on
re-releasing this particular library under a different license.

CU
Markus

2009年6月25日星期四

Re: [fw-mvc] _forward() and custom context in contextSwitch

afx114 wrote:
>
> I have a custom context that is working fine -- except after I call
> _forward to move from one action to another. I get the following error:
> Error: Context "webwidget" does not exist
>

Here is the full error:

Error: Context "webwidget" does not exist

#0
/usr/share/pear/ZendFramework-1.8.3/library/Zend/Controller/Action/Helper/ContextSwitch.php(1239):
Zend_Controller_Action_Helper_ContextSwitch->hasContext('webwidget', true)
#1
/usr/share/pear/ZendFramework-1.8.3/library/Zend/Controller/Action/Helper/ContextSwitch.php(257):
Zend_Controller_Action_Helper_ContextSwitch->hasActionContext('flickr',
'webwidget')
#2
/usr/share/pear/ZendFramework-1.8.3/library/Zend/Controller/Action/Helper/AjaxContext.php(75):
Zend_Controller_Action_Helper_ContextSwitch->initContext(NULL)
#3
/home/username/application/default/controllers/AppimgtagController.php(16):
Zend_Controller_Action_Helper_AjaxContext->initContext()
#4
/usr/share/pear/ZendFramework-1.8.3/library/Zend/Controller/Action.php(132):
AppimgtagController->init()
#5
/usr/share/pear/ZendFramework-1.8.3/library/Zend/Controller/Dispatcher/Standard.php(261):
Zend_Controller_Action->__construct(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http), Array)
#6
/usr/share/pear/ZendFramework-1.8.3/library/Zend/Controller/Front.php(945):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http))
#7 /home/username/application/default/bootstrap.php(50):
Zend_Controller_Front->dispatch()
#8 /home/username/html/index.php(23): Bootstrap->__construct('username')
#9 {main}
--
View this message in context: http://www.nabble.com/_forward%28%29-and-custom-context-in-contextSwitch-tp24212567p24212594.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-mvc] _forward() and custom context in contextSwitch

I have a custom context that is working fine -- except after I call _forward
to move from one action to another. I get the following error:

Error: Context "webwidget" does not exist

It does in fact exist, and works fine when not calling _forward. I can call
/mycontroller/flickr/format/webwidget and it works fine. But if I call
/mycontroller/tag/format/webwidget I get the "Context 'webwidget' does not
exist" error. So my question is, does calling _forward not load any custom
contexts that I have declared? How to I get this to work? Any ideas?

My controller looks like this (simplified):

---------------------------------------------------------------

public function init()
{
$contextSwitch = $this->_helper->getHelper('contextSwitch');
$contextSwitch->addContext('html', array());
$contextSwitch->addActionContext('flickr', array('json',
'webwidget'));
$contextSwitch->setAutoJsonSerialization(false);
$contextSwitch->initContext();
}

public function tagAction()
{
... do some stuff ...
$params['format'] = 'webwidget';
$this->_forward('flickr', $controller = null, $module = null, $params);
}

public function flickrAction()
{
... do some stuff ...
}

---------------------------------------------------------------

My custom context looks like this:

---------------------------------------------------------------

class Myproj_Controller_Action_Helper_ContextSwitch extends
Zend_Controller_Action_Helper_ContextSwitch
{

public function __construct()
{
parent::__construct();

$webwidgetContextName = 'webwidget';
$webwidgetContexSpec = array(
'suffix' => 'webwidget',
'headers' => array('Content-type' => 'text/html'),
'callbacks' => array(
'init' => 'initWebwidgetContext',
'post' => 'postWebwidgetContext'
)
);
$this->addContext($webwidgetContextName, $webwidgetContexSpec);
}

public function initWebwidgetContext()
{
$layout = Zend_Layout::getMvcInstance();
if (null !== $layout) {
$layout->enableLayout(); // must enable layout because normally
they are disabled when switching context
$layout->setLayout('webwidget');
}
}

public function postWebwidgetContext() { }
}

--
View this message in context: http://www.nabble.com/_forward%28%29-and-custom-context-in-contextSwitch-tp24212567p24212567.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-mvc] Zend_Service_Amazon Product Advertising API change

-- Murphy <murphy@propaganda.io> wrote
(on Thursday, 25 June 2009, 07:05 PM +0200):
> I just noticed it has already been filed:
>
> http://framework.zend.com/issues/browse/ZF-7033
>
> Who wrote that Component? I would like to get in contact with him to
> help on this issue.
> I found some kind of SVN tag named "beberlei".
>
> It would be great to see this fixed before Aug 15.

The original author is no longer contributing to ZF, IIRC. "beberlei" is
Benjamin Eberlei, and he *is* an active contributor at this point.

If you supply a patch that fixes the issue, along with a unit test
verifying the patch, I'll be happy to apply it in time for 1.9 -- which
should hit prior to 15 August.


> On Jun 25, 2009, at 5:24 PM, Matthew Weier O'Phinney wrote:
>
>> -- Murphy <murphy@propaganda.io> wrote
>> (on Thursday, 25 June 2009, 04:56 PM +0200):
>>> I was reminded by Amazon that the Product Advertising API will
>>> change soon:
>>>
>>> ----
>>> We wanted to remind you that all Product Advertising API developers
>>> will be
>>> required to authenticate all calls to the Product Advertising API by
>>> August 15,
>>> 2009. We noticed that requests with your AWS Access Key ID are not
>>> being signed
>>> and, while you have more than 60 days until the date on which
>>> authentication is
>>> required, we are, as a courtesy, sending you this email to remind
>>> you of the
>>> new authentication requirement. Please remember that calls to the
>>> Product
>>> Advertising API that are not signed will not be processed after
>>> August 15,
>>> 2009.
>>> ----
>>>
>>> The Request for the API have to be signed with a secret developer
>>> API key.
>>> Is someone working on integrating this into Zend_Service_Amazon?
>>>
>>> Couldn't find any information on it through google.
>>
>> I'm not sure anyone is; can you file an issue in the tracker for it?
>>
>> --
>> Matthew Weier O'Phinney
>> Project Lead | matthew@zend.com
>> Zend Framework | http://framework.zend.com/
>>
>

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

Re: [fw-mvc] Zend_Service_Amazon Product Advertising API change

Hi,

I just noticed it has already been filed:

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

Who wrote that Component? I would like to get in contact with him to
help on this issue.
I found some kind of SVN tag named "beberlei".

It would be great to see this fixed before Aug 15.

bye,
Thomas

On Jun 25, 2009, at 5:24 PM, Matthew Weier O'Phinney wrote:

> -- Murphy <murphy@propaganda.io> wrote
> (on Thursday, 25 June 2009, 04:56 PM +0200):
>> I was reminded by Amazon that the Product Advertising API will
>> change soon:
>>
>> ----
>> We wanted to remind you that all Product Advertising API developers
>> will be
>> required to authenticate all calls to the Product Advertising API
>> by August 15,
>> 2009. We noticed that requests with your AWS Access Key ID are not
>> being signed
>> and, while you have more than 60 days until the date on which
>> authentication is
>> required, we are, as a courtesy, sending you this email to remind
>> you of the
>> new authentication requirement. Please remember that calls to the
>> Product
>> Advertising API that are not signed will not be processed after
>> August 15,
>> 2009.
>> ----
>>
>> The Request for the API have to be signed with a secret developer
>> API key.
>> Is someone working on integrating this into Zend_Service_Amazon?
>>
>> Couldn't find any information on it through google.
>
> I'm not sure anyone is; can you file an issue in the tracker for it?
>
> --
> Matthew Weier O'Phinney
> Project Lead | matthew@zend.com
> Zend Framework | http://framework.zend.com/
>

Re: [fw-mvc] Zend_Service_Amazon Product Advertising API change

Hi,

will do.

I'm going to look into this issue, maybe I can even provide a patch.

bye,
Thomas


On Jun 25, 2009, at 5:24 PM, Matthew Weier O'Phinney wrote:

> -- Murphy <murphy@propaganda.io> wrote
> (on Thursday, 25 June 2009, 04:56 PM +0200):
>> I was reminded by Amazon that the Product Advertising API will
>> change soon:
>>
>> ----
>> We wanted to remind you that all Product Advertising API developers
>> will be
>> required to authenticate all calls to the Product Advertising API
>> by August 15,
>> 2009. We noticed that requests with your AWS Access Key ID are not
>> being signed
>> and, while you have more than 60 days until the date on which
>> authentication is
>> required, we are, as a courtesy, sending you this email to remind
>> you of the
>> new authentication requirement. Please remember that calls to the
>> Product
>> Advertising API that are not signed will not be processed after
>> August 15,
>> 2009.
>> ----
>>
>> The Request for the API have to be signed with a secret developer
>> API key.
>> Is someone working on integrating this into Zend_Service_Amazon?
>>
>> Couldn't find any information on it through google.
>
> I'm not sure anyone is; can you file an issue in the tracker for it?
>
> --
> Matthew Weier O'Phinney
> Project Lead | matthew@zend.com
> Zend Framework | http://framework.zend.com/
>

Re: [fw-mvc] Zend_Service_Amazon Product Advertising API change

-- Murphy <murphy@propaganda.io> wrote
(on Thursday, 25 June 2009, 04:56 PM +0200):
> I was reminded by Amazon that the Product Advertising API will change soon:
>
> ----
> We wanted to remind you that all Product Advertising API developers will be
> required to authenticate all calls to the Product Advertising API by August 15,
> 2009. We noticed that requests with your AWS Access Key ID are not being signed
> and, while you have more than 60 days until the date on which authentication is
> required, we are, as a courtesy, sending you this email to remind you of the
> new authentication requirement. Please remember that calls to the Product
> Advertising API that are not signed will not be processed after August 15,
> 2009.
> ----
>
> The Request for the API have to be signed with a secret developer API key.
> Is someone working on integrating this into Zend_Service_Amazon?
>
> Couldn't find any information on it through google.

I'm not sure anyone is; can you file an issue in the tracker for it?

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

Re: [fw-auth] Acl with modules syntax doubt

May be I see the light ;)
http://oss.jasoneisen.com/2008/04/26/database-driven-acl-with-zend-framework/
http://oss.jasoneisen.com/2008/04/26/database-driven-acl-with-zend-framework/

In this case jasoneisen use the underscore to mark the $resourceId

$this->add(new
Zend_Acl_Resource($role['acl_module_name'].'_'.$role['acl_resource_name']));

$this->allow($role['acl_role_id'],
$role['acl_module_name'].'_'.$role['acl_resource_name'],
$role['acl_privilege_name']);


so it's all the same using the underscore or the colon imho.

I'd like to know if I'm right ;)

Bye.
--
View this message in context: http://www.nabble.com/Acl-with-modules-syntax-doubt-tp24174953p24204817.html
Sent from the Zend Auth mailing list archive at Nabble.com.

[fw-mvc] Zend_Service_Amazon Product Advertising API change

Hey guys,

I was reminded by Amazon that the Product Advertising API will change soon:

----
We wanted to remind you that all Product Advertising API developers will be required to authenticate all calls to the Product Advertising API by August 15, 2009. We noticed that requests with your AWS Access Key ID are not being signed and, while you have more than 60 days until the date on which authentication is required, we are, as a courtesy, sending you this email to remind you of the new authentication requirement. Please remember that calls to the Product Advertising API that are not signed will not be processed after August 15, 2009.
----

The Request for the API have to be signed with a secret developer API key.
Is someone working on integrating this into Zend_Service_Amazon?

Couldn't find any information on it through google.

bye,
Thomas

[fw-webservices] Re: Soap Server incompatiiblity with .NET Client

Ronny Srnka wrote:
> I am now using the trunk version of the Soap component. It resolves my
> previous issue

Good news!

> I ended up using Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex because
> Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence did not allow me gave a
> fatal error:
>
> Fatal error: Uncaught exception 'Zend_Soap_Wsdl_Exception' with message
> 'ArrayOfTypeSequence Strategy does not allow for complex types that are
> not in @return type[] syntax. "MyFirstObject" type was specified.' In
> ....
> [...]
>
> It seems that this would be a render ZF-6349 not fixed? Or is this a
> separate issue.
>

This is a separate issue for which you can find a patch in ZF-6742:
http://framework.zend.com/issues/browse/ZF-6742

So I would recommend using ArrayOfTypeSequence with the 'v2' patch. I hope it
will be applied to the official trunk before 1.9 ... it is not the best solution,
but it is simple and solves that particular issue.

- Fabien.

[fw-mvc] Removing default action context?

Hi,

is there a way to remove the default action context? I was experimenting a bit with the contexts and ran into following problem:

Example of my init:

    public function init()
    {
        $contextSwitch = $this->_helper->getHelper('contextSwitch');
        if (!$contextSwitch->hasContext('admin')) {
            $contextSwitch->addContext('admin', array(
                'suffix'        => '',
                'headers'       => array(),
                'callbacks'     => array(
                    'init'          => array('Amz_Controller_Action_Context_Admin', 'initAdminContext'),
                    'post'          => array('Amz_Controller_Action_Context_Admin', 'postAdminContext')
                )
            ));
        }
        $contextSwitch->clearActionContexts('test'); // no effect
        $contextSwitch->setActionContext('test', 'admin') // no effect
                      ->initContext();
    }

What I would want, is that I specify the admin context for certain actions. Trough hostname routinger ways (admin.domain.com) I'm already taken care of setting the format=admin, but I want to prevent that they load and render the page the default way. I know there are probably other ways but it seems strange to me that even if you specify that you only want context X, you still have to worry about the default context.

Tnx
Jeroen

2009年6月24日星期三

Re: [fw-gdata] Trouble using Gdata Calendar BA7-899

Leif Hetlesæther skrev:
> Been using zf since 1.7.2 and recently tried the later 1.8.2. It throws
> an error using the following code:
>
>
> require_once 'Zend/Loader/Autoloader.php';
> $loader = Zend_Loader_Autoloader::getInstance();
> $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
> try
> {
> $client = Zend_Gdata_ClientLogin::getHttpClient($email,
> $pass, $service);
> }
> catch (Zend_Gdata_App_Exception $e)
> {
> echo "Error: Authentication with Google failed. Reason:
> BadAuthentication";
> exit;
> }
> $gdataCal = new Zend_Gdata_Calendar($client);
> $query = $gdataCal->newEventQuery();
>
> The code gives the following error:
>
> *Warning*:
> Zend_Loader::include(Zend/Gdata/Calendar/Extension/EventQuery.php)
> [function.Zend-Loader-include
> <http://lh.dev.nettkompetanse.no/diverse/function.Zend-Loader-include>]:
> failed to open stream: No such file or directory in
> */usr/share/php/ZendFramework-1.8.2/library/Zend/Loader.php* on line *83*
>
> *Warning*: Zend_Loader::include() [function.include
> <http://lh.dev.nettkompetanse.no/diverse/function.include>]: Failed
> opening 'Zend/Gdata/Calendar/Extension/EventQuery.php' for inclusion
> (include_path='.:/home/lh/libs:/usr/share/pear') in
> */usr/share/php/ZendFramework-1.8.2/library/Zend/Loader.php* on line *83
>
>
> *Am i doing something wrong or is this something for the bug tracker?
>
Tried 1.8.4 and the errors still persists. Everything seems to work
despite the errors thrown by the autoloader.

Currently just supressing the not found warnings.

$loader = Zend_Loader_Autoloader::getInstance();
$loader->suppressNotFoundWarnings(true);

Re: [fw-gdata] Trouble using Gdata Calendar

Leif Hetlesæther skrev:
> Been using zf since 1.7.2 and recently tried the later 1.8.2. It throws
> an error using the following code:
>
>
> require_once 'Zend/Loader/Autoloader.php';
> $loader = Zend_Loader_Autoloader::getInstance();
> $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
> try
> {
> $client = Zend_Gdata_ClientLogin::getHttpClient($email,
> $pass, $service);
> }
> catch (Zend_Gdata_App_Exception $e)
> {
> echo "Error: Authentication with Google failed. Reason:
> BadAuthentication";
> exit;
> }
> $gdataCal = new Zend_Gdata_Calendar($client);
> $query = $gdataCal->newEventQuery();
>
> The code gives the following error:
>
> *Warning*:
> Zend_Loader::include(Zend/Gdata/Calendar/Extension/EventQuery.php)
> [function.Zend-Loader-include
> <http://lh.dev.nettkompetanse.no/diverse/function.Zend-Loader-include>]:
> failed to open stream: No such file or directory in
> */usr/share/php/ZendFramework-1.8.2/library/Zend/Loader.php* on line *83*
>
> *Warning*: Zend_Loader::include() [function.include
> <http://lh.dev.nettkompetanse.no/diverse/function.include>]: Failed
> opening 'Zend/Gdata/Calendar/Extension/EventQuery.php' for inclusion
> (include_path='.:/home/lh/libs:/usr/share/pear') in
> */usr/share/php/ZendFramework-1.8.2/library/Zend/Loader.php* on line *83
>
>
> *Am i doing something wrong or is this something for the bug tracker?
>
Tried 1.8.4 and the errors still persists. Everything seems to work
despite the errors thrown by the autoloader.

Currently just supressing the not found warnings.

$loader = Zend_Loader_Autoloader::getInstance();
$loader->suppressNotFoundWarnings(true);

Re: [fw-auth] Acl with modules syntax doubt

Matthew Weier O wrote:

>
> The last argument should be an array of strings.
>

Sorry Matthew I sent you a email by mistake ;)

Thanks for the quick reply.
But I've just a lot of troubles :(

My tree
application
-auth
--controllers
--forms
--views
-categories
--controllers
--forms
--views
-config
--config.ini
--nav.xml
-default
--controllers
--forms
--views
-languages
--en_US.php
--it_IT.php
-layout
--scripts
---layout.phtml
-log
-users
--controllers
--forms
--views


In my bootstrap

protected function _initRouter()
{
$this->bootstrap('frontController');
$front = $this->getResource('frontController');
$front->setControllerDirectory(array(
'default' => APPLICATION_PATH .'/default/controllers',
'auth' => APPLICATION_PATH .'/auth/controllers',
'users' => APPLICATION_PATH .'/users/controllers',
'categories' => APPLICATION_PATH .'/categories/controllers',
));
}

protected function _initPlugins()
{

//Zend_Controller_Action_HelperBroker::addPrefix('W_Controller_Action_Helper');
//$this->bootstrap('frontController');
$front = $this->getResource('frontController');

$acl = new Zend_Acl();
/* Add roles */
$acl->addRole(new Zend_Acl_Role('guest'));
$acl->addRole(new Zend_Acl_Role('member'), 'guest');
$acl->addRole(new Zend_Acl_Role('operator'), 'member');
$acl->addRole(new Zend_Acl_Role('admin'), 'operator');

/* Add default resourses */
$acl->add(new Zend_Acl_Resource('index'));
$acl->add(new Zend_Acl_Resource('error'));

/* Add resourses */
$acl->add(new Zend_Acl_Resource('auth'));
$acl->add(new Zend_Acl_Resource('auth:index'));
$acl->add(new Zend_Acl_Resource('auth:identify'));
$acl->add(new Zend_Acl_Resource('users'));
$acl->add(new Zend_Acl_Resource('users:index'));
$acl->add(new Zend_Acl_Resource('categories'));
$acl->add(new Zend_Acl_Resource('categories:index'));

/* It doesn't work'*/
/*$acl->allow('guest', 'error', array('error','denied'));
$acl->allow('guest', 'auth', array('index','identify') );
$acl->allow('guest', 'index' , array('index'));
$acl->allow('member', 'users', array('index'));
$acl->allow('admin', 'categories' , array('index'));*/

/* It works */
$acl->allow('guest', 'error');
$acl->allow('guest', 'index');
$acl->allow('guest', 'auth');
$acl->allow('guest', 'auth:index');
$acl->allow('guest', 'auth:identify');
$acl->allow('member', 'users');
$acl->allow('member', 'users:index');
$acl->allow('admin', 'categories');
$acl->allow('admin', 'categories:index');


$front->registerPlugin(new W_Controller_Plugin_Acl($acl,'member'));
// $front->registerPlugin(new W_Controller_Plugin_AclDb());
//$front->registerPlugin(new W_Controller_Plugin_FormLoader());
}

In the plugins

public function preDispatch(Zend_Controller_Request_Abstract $request)
{

$response = $this->getResponse();
if($response->isException()){
$this->_request->setModuleName('default');
$this->_request->setControllerName('error');
$this->_request->setActionName('error');
return null;
}
$resourceName = '';
if ($request->getModuleName() != 'default') {
$resourceName .= $request->getModuleName() . ':';
}

$resourceName .= $request->getControllerName();
//var_dump($resourceName.'-'.$request->getActionName()); RETURN like
categories:index-index
//var_dump($this->getAcl()->isAllowed('guess', 'categories', 'index'));
/** Check if the controller/action can be accessed by the current
user */
if (!$this->getAcl()->isAllowed($this->_roleName, $resourceName,
$request->getActionName())) {
/** Redirect to access denied page */
$this->denyAccess();
}
}


So I don't know which way to turn :(


What's the trouble ?
--
View this message in context: http://www.nabble.com/Acl-with-modules-syntax-doubt-tp24174953p24181262.html
Sent from the Zend Auth mailing list archive at Nabble.com.

2009年6月23日星期二

Re: [fw-auth] Acl with modules syntax doubt

-- whisher <whisher@mp4.it> wrote
(on Tuesday, 23 June 2009, 02:38 PM -0700):
> I'm set up an acl system with modules.
> This code works fine but I've never seen
> this syntax in the reference manual so
> I'm asking for advice.
>
> the code
>
> <pre>
> $this->_acl->allow('member','users');
> $this->_acl->allow('member', 'users:index');
> //$this->_acl->allow('member','users','index'); it doesn't work

The last argument should be an array of strings.

> </pre>
>
> Member has privileges to access to my
> modules users
> controller index
> action index
>
> Can you enlighten me, please ?

One more note -- the roles and resources must be defined *before* you
set the permissions -- otherwise you'll get an error. The resource and
role names must match those that you've defined as well.

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

[fw-auth] Acl with modules syntax doubt

Hi.
I'm set up an acl system with modules.
This code works fine but I've never seen
this syntax in the reference manual so
I'm asking for advice.

the code

<pre>
$this->_acl->allow('member','users');
$this->_acl->allow('member', 'users:index');
//$this->_acl->allow('member','users','index'); it doesn't work
</pre>

Member has privileges to access to my
modules users
controller index
action index


Can you enlighten me, please ?

Bye.

--
View this message in context: http://www.nabble.com/Acl-with-modules-syntax-doubt-tp24174953p24174953.html
Sent from the Zend Auth mailing list archive at Nabble.com.

Re: [fw-formats] Copying a sent Zend_Mail message into a folder?

Thanks Kevin


Kevin Jordan wrote:
>
>
>
> ritesh83 wrote:
>>
>> Hi Kevin,
>>
>> This is Ritesh here.
>> Did you find a solution to the problem?
>> Even I need to save sent messages using Zend Mail.
>> The mail server I'm using is Plesk.
>> Please do let me know.
>>
>> Thanks,
>> Ritesh
>>
>>
>>
>> Kevin Jordan wrote:
>>>
>>> I'm not seeing any way currently to copy a sent Zend_Mail message into
>>> an IMAP folder or equivalent. I could save the string part and append
>>> it directly in that way, but that wouldn't work for HTML messages or
>>> ones with attachments correct? Otherwise appendMessage takes a
>>> Zend_Mail_Message object which isn't compatible with a Zend_Mail object.
>>> So how does one convert one to the other?
>>>
>>
>>
> Well, I think if you can convert it to a string that can be appended to an
> IMAP folder using appendMessage, then you can. There's still no direct
> way to do it and in fact, I don't believe anything like toString on the
> Zend_Mail object will get you the correct string. Although it has been a
> few versions since I last tried to append a Zend_Mail object to an IMAP
> folder and I believe that was the problem I had. I've also started using
> JavaMail as more of my stuff is becoming Java as opposed to PHP. Zend
> Mail could learn a few things from that API as it's pretty well written
> and does allow you to do this kind of stuff.
>

--
View this message in context: http://www.nabble.com/Copying-a-sent-Zend_Mail-message-into-a-folder--tp12407509p24167500.html
Sent from the Zend MFS mailing list archive at Nabble.com.

RE: [fw-webservices] Re: Soap Server incompatiiblity with .NET Client

I am now using the trunk version of the Soap component. It resolves my
previous issue but I have uncovered another problem.

I want to return an array of objects with a method, so in the doc
comment I have the following prototype:

@return MySecondObject[]


I ended up using Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex because
Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence did not allow me gave a
fatal error:

Fatal error: Uncaught exception 'Zend_Soap_Wsdl_Exception' with message
'ArrayOfTypeSequence Strategy does not allow for complex types that are
not in @return type[] syntax. "MyFirstObject" type was specified.' In
....


The ArrayOfTypeComplex strategy generates a WSDL definition that is not
compatible with WSDL Basic 1.1 spec:
http://www.ws-i.org/Profiles/BasicProfile-1.1.html#soapenc_Array

This is the generated WSDL snippet:

<xsd:complexType name="ArrayOfMySecondObject">
<xsd:complexContent>
<xsd:restriction base="soap-enc:Array">
<xsd:attribute ref="soap-enc:arrayType"
wsdl:arrayType="tns:MySecondObject []" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>


I manually modified this to the following:

<xsd:complexType name="ArrayOfMySecondObject">
<xsd:sequence>
<xsd:element name="MySecondObject" type="tns:MySecondObject"

minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>


The unmodified version was not properly parsed by Visual Studio 2005 as
a Web Reference (the MySecondObject was never created), but the modified
version did work.

It seems that this would be a render ZF-6349 not fixed? Or is this a
separate issue.

Fabien Crespel wrote:
>
> Ronny Srnka wrote:
> > I found that putting a call to $this->addSchemaTypeSection(); in the
> > Zend_Soap_Wsdl::__construct() fixed this.
>
> Hello,
>
> This issue was fixed by ZF-6349:
http://framework.zend.com/issues/browse/ZF-6349
>
> Please try using the current Zend_Soap trunk, with an rpc/literal
style.
>
> - Fabien.

Re: [fw-formats] Copying a sent Zend_Mail message into a folder?

ritesh83 wrote:
>
> Hi Kevin,
>
> This is Ritesh here.
> Did you find a solution to the problem?
> Even I need to save sent messages using Zend Mail.
> The mail server I'm using is Plesk.
> Please do let me know.
>
> Thanks,
> Ritesh
>
>
>
> Kevin Jordan wrote:
>>
>> I'm not seeing any way currently to copy a sent Zend_Mail message into an
>> IMAP folder or equivalent. I could save the string part and append it
>> directly in that way, but that wouldn't work for HTML messages or ones
>> with attachments correct? Otherwise appendMessage takes a
>> Zend_Mail_Message object which isn't compatible with a Zend_Mail object.
>> So how does one convert one to the other?
>>
>
>
Well, I think if you can convert it to a string that can be appended to an
IMAP folder using appendMessage, then you can. There's still no direct way
to do it and in fact, I don't believe anything like toString on the
Zend_Mail object will get you the correct string. Although it has been a
few versions since I last tried to append a Zend_Mail object to an IMAP
folder and I believe that was the problem I had. I've also started using
JavaMail as more of my stuff is becoming Java as opposed to PHP. Zend Mail
could learn a few things from that API as it's pretty well written and does
allow you to do this kind of stuff.
--
View this message in context: http://www.nabble.com/Copying-a-sent-Zend_Mail-message-into-a-folder--tp12407509p24166003.html
Sent from the Zend MFS mailing list archive at Nabble.com.

2009年6月22日星期一

Re: [fw-formats] Copying a sent Zend_Mail message into a folder?

Hi Kevin,

This is Ritesh here.
Did you find a solution to the problem?
Even I need to save sent messages using Zend Mail.
The mail server I'm using is Plesk.
Please do let me know.

Thanks,
Ritesh

Kevin Jordan wrote:
>
> I'm not seeing any way currently to copy a sent Zend_Mail message into an
> IMAP folder or equivalent. I could save the string part and append it
> directly in that way, but that wouldn't work for HTML messages or ones
> with attachments correct? Otherwise appendMessage takes a
> Zend_Mail_Message object which isn't compatible with a Zend_Mail object.
> So how does one convert one to the other?
>

--
View this message in context: http://www.nabble.com/Copying-a-sent-Zend_Mail-message-into-a-folder--tp12407509p24157927.html
Sent from the Zend MFS mailing list archive at Nabble.com.

Re: [fw-mvc] Application resources & order

So this would mean that for my Amz_Application_Resource_Myresource I would call something like below?

class Amz_Application_Resource_Myresource
extends Zend_Application_Resource_ResourceAbstract
{

    public function init()
    {
        $this->getBootstrap()->bootstrap('otherresource');

        // Return myresource so bootstrap will store it in the registry
        return $this->getMyresource();
    }

    public function getMyresource()
    {
        // ...
    }

}

Wkr
Jeroen

On 22 Jun 2009, at 20:06, Hector Virgen wrote:

You can bootstrap any resource on demand by calling $this->bootstrap([resource]); This should help prevent any dependency issues.

Take a look at this section of the documentation for more details:

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

--
Hector


On Mon, Jun 22, 2009 at 10:53 AM, Jeroen Keppens <jeroen.keppens@gmail.com> wrote:
Hi,

Quick question regarding the order application resources are initialized.

Suppose I have in my config file:

resources.myresource.option1 = blah
resources.myresource.option2 = blah
resources.myresource.option3 = blah

This will execute (initialize) my Amz_Application_Resource_Myresource.

I could also use the init in the bootstrap like this:

protected function _initMyresource()
{
       $options = $this->getOptions();
       // do stuff
}

Now, if I add this line to the init, I can force that another resource is loaded/bootstrapped before myresource:

$this->bootstrap("anotherresource");

How can I enforce this with application resource classes that depend on something else? a) another resource class or even b) one initialized by the _init* bootstrap functions.

I hope this question makes sense, I'm a bit groggy of studying for my ZFC tomorrow. Think I'm ODing on ZF. ;-)

Jeroen Keppens
http://blog.keppens.biz



[fw-mvc] Application resources & order

Hi,

Quick question regarding the order application resources are
initialized.

Suppose I have in my config file:

resources.myresource.option1 = blah
resources.myresource.option2 = blah
resources.myresource.option3 = blah

This will execute (initialize) my Amz_Application_Resource_Myresource.

I could also use the init in the bootstrap like this:

protected function _initMyresource()
{
$options = $this->getOptions();
// do stuff
}

Now, if I add this line to the init, I can force that another resource
is loaded/bootstrapped before myresource:

$this->bootstrap("anotherresource");

How can I enforce this with application resource classes that depend
on something else? a) another resource class or even b) one
initialized by the _init* bootstrap functions.

I hope this question makes sense, I'm a bit groggy of studying for my
ZFC tomorrow. Think I'm ODing on ZF. ;-)

Jeroen Keppens
http://blog.keppens.biz

Re: [fw-mvc] Validator message templates

Well, cool. Thanks!
We're browsing your website right now, and it seems really interesting.
So far I'll keep you (the list) informed if I face any problem.

Regards,
-- Nicolas


Jeroen Keppens a écrit :
> You can write an application resource for it. That way the code is
> seperated for the bootstrap, but still initiated by it (be sure to add
> resources.resource_name to your app.ini).
>
> 2 examples of application resources I tried:
>
> http://blog.keppens.biz/2009/06/zendapplication-loading-logs.html
> http://blog.keppens.biz/2009/04/zendapplication-multiple-databases.html
>
> Note regarding the tutes: you actually don't need the run() if you
> have resource config in your ini if I'm not mistaken.
>
> Wkr
> Jeroen
>
> On 22 Jun 2009, at 14:43, Nicolas GREVET wrote:
>
>> Well, yes, thanks. That's the way I thought it should be done, but
>> still, it looks strange to me.
>> Isn't there a way to make this more convenient? Stuffing everything
>> in the bootstrap seems a bit clumsy.
>>
>> Regards,
>> -- Nicolas
>>
>>
>> Emanuel a écrit :
>>> I did it this way:
>>> In the Bootstrap file I added the following function:
>>>
>>> protected function _initValidationTranslator() {
>>> $translations = array();
>>> $translations[Zend_Validate_Alnum::NOT_ALNUM] = '%value%
>>> trebuie sa fie format doar din litere si cifre';
>>> $translator = new Zend_Translate('array', $translations);
>>> Zend_Validate_Abstract::setDefaultTranslator($translator);
>>> }
>>>
>>> I hope this helps.
>>>
>>> On Fri, Jun 19, 2009 at 15:27, Nicolas GREVET <ngrevet@alteo.fr
>>> <mailto:ngrevet@alteo.fr>> wrote:
>>>
>>> You're not alone at all.
>>> I'd find it particularily useful too, since I don't understand how
>>> we're supposed to override these messages the zend way.
>>>
>>> Regards,
>>> -- Nicolas
>>>
>>>
>>> Neil Garb a écrit :
>>>
>>> Hi ZF-MVC
>>>
>>> Would anyone else find it useful to be able to change
>>> validator messages in a static context?
>>>
>>> Use case:
>>> I don't like 'Value is empty, but non-empty value is required'
>>> in Zend_Validate_NotEmpty
>>> I specify in my controller's init() function:
>>> Zend_Validate_NotEmpty::setMessageTemplate('Please fill in
>>> this field', 'isEmpty');
>>>
>>> This is most valuable for the notempty and inarray validators,
>>> which get instantiated automatically by the form validation
>>> routines.
>>>
>>> - Neil
>>>
>>>
>>>
>>
>
>
>
>

Re: [fw-mvc] Validator message templates

You can write an application resource for it. That way the code is
seperated for the bootstrap, but still initiated by it (be sure to add
resources.resource_name to your app.ini).

2 examples of application resources I tried:

http://blog.keppens.biz/2009/06/zendapplication-loading-logs.html
http://blog.keppens.biz/2009/04/zendapplication-multiple-databases.html

Note regarding the tutes: you actually don't need the run() if you
have resource config in your ini if I'm not mistaken.

Wkr
Jeroen

On 22 Jun 2009, at 14:43, Nicolas GREVET wrote:

> Well, yes, thanks. That's the way I thought it should be done, but
> still, it looks strange to me.
> Isn't there a way to make this more convenient? Stuffing everything
> in the bootstrap seems a bit clumsy.
>
> Regards,
> -- Nicolas
>
>
> Emanuel a écrit :
>> I did it this way:
>> In the Bootstrap file I added the following function:
>>
>> protected function _initValidationTranslator() {
>> $translations = array();
>> $translations[Zend_Validate_Alnum::NOT_ALNUM] = '%value%
>> trebuie sa fie format doar din litere si cifre';
>> $translator = new Zend_Translate('array', $translations);
>> Zend_Validate_Abstract::setDefaultTranslator($translator);
>> }
>>
>> I hope this helps.
>>
>> On Fri, Jun 19, 2009 at 15:27, Nicolas GREVET <ngrevet@alteo.fr <mailto:ngrevet@alteo.fr
>> >> wrote:
>>
>> You're not alone at all.
>> I'd find it particularily useful too, since I don't understand how
>> we're supposed to override these messages the zend way.
>>
>> Regards,
>> -- Nicolas
>>
>>
>> Neil Garb a écrit :
>>
>> Hi ZF-MVC
>>
>> Would anyone else find it useful to be able to change
>> validator messages in a static context?
>>
>> Use case:
>> I don't like 'Value is empty, but non-empty value is required'
>> in Zend_Validate_NotEmpty
>> I specify in my controller's init() function:
>> Zend_Validate_NotEmpty::setMessageTemplate('Please fill in
>> this field', 'isEmpty');
>>
>> This is most valuable for the notempty and inarray validators,
>> which get instantiated automatically by the form validation
>> routines.
>>
>> - Neil
>>
>>
>>
>

Re: [fw-mvc] Validator message templates

Well, yes, thanks. That's the way I thought it should be done, but
still, it looks strange to me.
Isn't there a way to make this more convenient? Stuffing everything in
the bootstrap seems a bit clumsy.

Regards,
-- Nicolas


Emanuel a écrit :
> I did it this way:
> In the Bootstrap file I added the following function:
>
> protected function _initValidationTranslator() {
> $translations = array();
> $translations[Zend_Validate_Alnum::NOT_ALNUM] = '%value%
> trebuie sa fie format doar din litere si cifre';
> $translator = new Zend_Translate('array', $translations);
> Zend_Validate_Abstract::setDefaultTranslator($translator);
> }
>
> I hope this helps.
>
> On Fri, Jun 19, 2009 at 15:27, Nicolas GREVET <ngrevet@alteo.fr
> <mailto:ngrevet@alteo.fr>> wrote:
>
> You're not alone at all.
> I'd find it particularily useful too, since I don't understand how
> we're supposed to override these messages the zend way.
>
> Regards,
> -- Nicolas
>
>
> Neil Garb a écrit :
>
> Hi ZF-MVC
>
> Would anyone else find it useful to be able to change
> validator messages in a static context?
>
> Use case:
> I don't like 'Value is empty, but non-empty value is required'
> in Zend_Validate_NotEmpty
> I specify in my controller's init() function:
> Zend_Validate_NotEmpty::setMessageTemplate('Please fill in
> this field', 'isEmpty');
>
> This is most valuable for the notempty and inarray validators,
> which get instantiated automatically by the form validation
> routines.
>
> - Neil
>
>
>

Re: [fw-mvc] Validator message templates

I did it this way:
In the Bootstrap file I added the following function:

protected function _initValidationTranslator() {
        $translations = array();
        $translations[Zend_Validate_Alnum::NOT_ALNUM] = '%value% trebuie sa fie format doar din litere si cifre';
        $translator = new Zend_Translate('array', $translations);
        Zend_Validate_Abstract::setDefaultTranslator($translator);
    }

I hope this helps.

On Fri, Jun 19, 2009 at 15:27, Nicolas GREVET <ngrevet@alteo.fr> wrote:
You're not alone at all.
I'd find it particularily useful too, since I don't understand how we're supposed to override these messages the zend way.

Regards,
-- Nicolas


Neil Garb a écrit :

Hi ZF-MVC

Would anyone else find it useful to be able to change validator messages in a static context?

Use case:
I don't like 'Value is empty, but non-empty value is required' in Zend_Validate_NotEmpty
I specify in my controller's init() function: Zend_Validate_NotEmpty::setMessageTemplate('Please fill in this field', 'isEmpty');

This is most valuable for the notempty and inarray validators, which get instantiated automatically by the form validation routines.

- Neil


2009年6月20日星期六

[fw-core] Application -[Session] Form problem UPDATED

My setup PHP 5.2.9-1 and I'm currently using Zend Framework 1.7

I have been working on a solution to this rather perplexing problem.
My objective was to remove all active sessions. For some unforeseen reason
the
Native method to the Zend_Session class 'destroy' would not produced the
desired result.

I then instead decided to use the native PHP function 'session_destroy' to
handle my task.
Afterwards my session was annihilated, however anytime I tried to log back
in
I received the following warning message.

Warning: Exception caught by form: Method form does not exist
Stack Trace:
#0 [internal function]: Zend_Form->__call('form', Array)
#1 [internal function]: Schedule_Form->form(NULL, Array, '<dl
class="zend...')
#2 C:\wamp\www\library\Zend\View\Abstract.php(329):
call_user_func_array(Array, Array)
#3 [internal function]: Zend_View_Abstract->__call('form', Array)
#4 C:\wamp\www\library\Zend\Form\Decorator\Form.php(132):
Zend_View->form(NULL, Array, '<dl class="zend...')
#5 C:\wamp\www\library\Zend\Form.php(2595):
Zend_Form_Decorator_Form->render('<dl class="zend...')
#6 C:\wamp\www\library\Zend\Form.php(2610): Zend_Form->render()
#7
C:\wamp\www\ScheduleOnlineDeveopment\application\employee\views\scripts\requ
ests\create.phtml(5): Zend_Form->__toString()
#8 C:\wamp\www\library\Zend\View.php(107): include('C:\wamp\www\Sch...')
#9 C:\wamp\www\library\Zend\View\Abstract.php(820):
Zend_View->_run('C:\wamp\www\Sch...')
#10 C:\wamp\www\library\Zend\Controller\Action\Helper\ViewRenderer.php(902):
Zend_View_Abstract->render('requ in C:\wamp\www\library\Zend\Form.php on
line 2615

What is interesting about this warning, I didn't really change the
application code
Only with the exception of adding the session_destroy function (and removal)

This is where it starts to get interesting. After tearing apart my forms and
looking for this phantom function (that never existed)
I decide to change the class name from Schedule_Form to Schedule_Test, low
and behold everything worked... Once I changed the class name back to
Schedule_Form the same warning presented its self; to make sure it wasn't a
fluke I then changed the name to Schedule_Tree,
As expected it worked perfectly.

Recap, before calling session_destroy everything was working perfectly after
calling session destroy
My forms stopped working and presented me with a strange warning. The fix
(not really) changing the class name
>From Schedule_Form to Schedule_Test (or some other name), after that action
everything worked fine.

I'm more confused now then when I started. I have searched the internet
(googled it) to see if others had the
same problem, so far my results have come back negative.

Could someone explain to me why this is happening or point me to a resource
that could better answer my questions,
And even hopefully show me how to fix this problem the right way.

Thank you for reading this rather long dissertation I appreciate your time.


P.S. also I would like to apologize for the double post, however I believe
my last post was lacking some details.

Thanks again.
-Brandon