[fw-general] how to add file field to zend_form

2008-04-11 Thread Jacky Chen
Hi All,
How can i add file field to Zend_Form?

Best Regards.


Re: [fw-general] How to destroy a session

2008-04-11 Thread xing93111

Thank you, Sudheer.


Sudheer Satyanarayana wrote:
> 
> Sudheer wrote:
>> xing93111 wrote:
>>> Hi,
>>>
>>> I create a default session namespace using:
>>>
>>> $s = new Zend_Session_Namespace();
>>>
>>> How do I destroy it?
>>>
>>> Thanks
>>>   
>> |Looks like the answer is
>> Zend_Session::namespaceUnset($a)
>>
> Oops!
> 
> Zend_Session::namespaceUnset($s)
>>
>> Regards,
>> Sudheer
>>
>> |
>>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-destroy-a-session-tp16629043p16645193.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] How to destroy a session

2008-04-11 Thread Sudheer

Sudheer wrote:

xing93111 wrote:

Hi,

I create a default session namespace using:

$s = new Zend_Session_Namespace();

How do I destroy it?

Thanks
  

|Looks like the answer is
Zend_Session::namespaceUnset($a)


Oops!

Zend_Session::namespaceUnset($s)


Regards,
Sudheer

|





Re: [fw-general] How to destroy a session

2008-04-11 Thread Sudheer

xing93111 wrote:

Hi,

I create a default session namespace using:

$s = new Zend_Session_Namespace();

How do I destroy it?

Thanks
  

|Looks like the answer is
Zend_Session::namespaceUnset($a)


Regards,
Sudheer

|


Re: [fw-general] Zend_Log_Writer_FirePHP

2008-04-11 Thread Ramon de la Fuente
I've installed it - took about 4 minutes to get up-and-running... I love 
it already! Debugging without breaking the application output - it is 
exactly what the doctor ordered!*grin*





Eric Marden wrote:
I'm intrigued. Keep us abreast of the progress of this extension. 



 
--

Eric Marden


-Original Message-
From: Christoph Dorn [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 10, 2008 6:21 PM

To: fw-general@lists.zend.com
Subject: [fw-general] Zend_Log_Writer_FirePHP

Hi All,

I have written a simple log writer for the FirePHP Firefox extension
that allows you to log from PHP directly to the Firebug Console.

FirePHP is unique in that it sends the log messages in response headers
instead of the page content. Thus the page content is not affected.

It is ideally suited for AJAX development as the server response must be
clean XML or JSON. It can also be used to debug scripts that send back
images etc...

You can find more information at: http://www.firephp.org/

The Zend Log Writer for FirePHP can be downloaded from the homepage.

Any feedback would be great!

Christoph


  


Re: [fw-general] Is anyone processing Zend_Form forms manually in the views?

2008-04-11 Thread Matthew Weier O'Phinney
-- asadkn <[EMAIL PROTECTED]> wrote
(on Friday, 11 April 2008, 02:25 PM -0700):
> I want to keep the forms separated in the views and thus would like to parse
> generated forms in views. Instead of relying on Zend_Form decorators
> generated HTML, I would like to do it all manually. It gets extremely messy
> when I have to use decorators with few of my HTML-rich forms. 

Please check out the ViewScript decorator in the documentation; this is
probably the best fit for your needs. Set your form to use this
decorator, and then you can customize the output of your form as you see
fit. You can find that documentation on the following manual page:


http://framework.zend.com/manual/en/zend.form.standardDecorators.html#zend.form.standardDecorators.viewScript

> Perhaps I want to create  and other such HTML elements myself, but use
> Zend_Form's decorators to create the input, select, etc. (and obviously have
> them filled when editing). That still should save me from writing lot of
> repeated code. 
> 
> In views, I wish if something like this was possible: (where $this->form is
> a form created using Zend_Form in the controller) 
> 
>   - form->getElement('username')->render(); ?>

In your view script (used with the ViewScript decorator, as recomended
above), you could do exactly that, only easier:

form->username ?>

> As I see it, each element's data is protected and thus cannot be accessed
> from outside. Maybe I should try sub-classing Zend_Form each time but that
> still will require me to spend a lot of time to figure out how to do it
> right. 

Not true -- there are accessors for every member stored in the form
elements, and most metadata is actually directly accessible as virtual
members using overloading. Please read up on the documentation:


http://framework.zend.com/manual/en/zend.form.elements.html#zend.form.elements.metadata


-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Is anyone processing Zend_Form forms manually in the views?

2008-04-11 Thread asadkn

I want to keep the forms separated in the views and thus would like to parse
generated forms in views. Instead of relying on Zend_Form decorators
generated HTML, I would like to do it all manually. It gets extremely messy
when I have to use decorators with few of my HTML-rich forms. 

Perhaps I want to create  and other such HTML elements myself, but use
Zend_Form's decorators to create the input, select, etc. (and obviously have
them filled when editing). That still should save me from writing lot of
repeated code. 

In views, I wish if something like this was possible: (where $this->form is
a form created using Zend_Form in the controller) 

  - form->getElement('username')->render(); ?>

As I see it, each element's data is protected and thus cannot be accessed
from outside. Maybe I should try sub-classing Zend_Form each time but that
still will require me to spend a lot of time to figure out how to do it
right. 

If someone has already done something similar, please do let me know. 

-- 
View this message in context: 
http://www.nabble.com/Is-anyone-processing-Zend_Form-forms-manually-in-the-views--tp16629046p16629046.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] How to destroy a session

2008-04-11 Thread xing93111

Hi,

I create a default session namespace using:

$s = new Zend_Session_Namespace();

How do I destroy it?

Thanks
-- 
View this message in context: 
http://www.nabble.com/How-to-destroy-a-session-tp16629043p16629043.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] custom form validator

2008-04-11 Thread Matthew Weier O'Phinney
-- chinaski <[EMAIL PROTECTED]> wrote
(on Friday, 11 April 2008, 01:38 PM -0700):
> This seems simple, but I can't make it work (path issue). I'm experimenting
> with Zend_Form, and I want to add a custom validator to a form field.
> 
> I have written the a test validator and saved it as follows:
> 
> I have saved the file as /My/Validate/TestVal.php.

Is that on your include_path? Check that -- it's likely the issue.

The 'My/' directory should be at the same leve as your 'Zend/'
directory:

application/
controllers/
...
library/
Zend/
My/
Validate/
TestVal.php

If it is, then the code you show below should work; if not, then you
have an include_path issue.

> 
> I have a script that builds the form:
> 
>  
> class forms_ContactForm extends Zend_Form
> {
>public function __construct($options = null)
>{
>   parent::__construct($options);
>   
>   $this->addElementPrefixPath('My_Validate','My/Validate/','validate');
>   
>   $testing = new Zend_Form_Element_Text('testing');
>   $testing->setLabel('Title')
>  ->setRequired(true);
> 
>   $validators = $testing->getValidators();
>   $testval   = array('validator' => 'TestVal');
>   array_unshift($validators, $testval);
>   
>   $testing->setValidators($validators);
> 
>   //etc...
>}
> }
> 
> This fails at $testing->setValidators with the following message...
> 
> Error: Plugin by name My_Validate_TestVal was not found in the registry.
> 
> How to get the custom validator attached to the element? 
> 
> Thanks.
> 
> Sam
> 
> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/custom-form-validator-tp16628634p16628634.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] Zend_XMLRPC_Server overwrite/ response customized Fault-Msgs.

2008-04-11 Thread Matthew Weier O'Phinney
-- James Dempster <[EMAIL PROTECTED]> wrote
(on Friday, 11 April 2008, 09:13 PM +0100):
> I'd like the same features on Zend_Rest_Server also, but just noticed that the
> Zend_Rest_Server::fault returns a DOMDocument

Interesting -- it should likely cast that to a string.

> ZF-3102 is the issue regarding throwExceptions

Saw that come in -- thanks.

> I've just noticed that Zend_XmlRpc_Server_Fault has the getException method so
> I don't think this needs an issue any more.

Great!


> On Fri, Apr 11, 2008 at 8:40 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
> wrote:
> 
> -- James Dempster <[EMAIL PROTECTED]> wrote
> (on Friday, 11 April 2008, 08:16 PM +0100):
> > That's the way I use SoapServer.
> > I would have thought it was more in keeping with the SoapServer API to
> allow
> > the Exception to be thrown but as it already doesn't maybe add the
> option.
> 
> G... you're right. The xml-rpc server was written a *lnggg* time
> ago, and I use that more than I use Soap, so I forget some details.
> 
> Could you open an issue, requesting two things?
> 
>  * Accesors for the exception in the fault object
>  * Flag to allow throwing exceptions from the server
> 
> Thanks!
> 
> 
> > Example
> > -- server.php --
> >  >
> > class MyPersonalException extends Exception {}
> >
> > class SoapTestClass {
> >
> > public function testOne($value) {
> > return "You sent $value";
> > }
> >
> > public function testTwo($value) {
> > throw new MyPersonalException('Ooops looks like we made a
> mistake, but
> > we can tell you about it');
> > }
> >
> > public function testThree($value) {
> > throw new Exception('You Shouldn\'t see this error, cause it is
> > unhandled');
> > }
> > }
> >
> > try {
> > $server = new SoapServer(null, array('uri' => 
> 'http://localhost/tests
> /soap/
> > server.php'));
> > $server->setClass('SoapTestClass');
> > $server->handle();
> > } catch(MyPersonalException $e) {
> > $server->fault($e->getCode(), $e->getMessage());
> > } catch(Exception $e) {
> > // do other things like logging, email the admin as this was an
> unexpected
> > error.
> > $server->fault('ERROR', 'An unknown error occured. Please try
> again.');
> > }
> > -- /server.php --
> > -- client.php --
> >  > $client = new SoapClient(
> > null,
> > array(
> > 'location'  => 'http://localhost/tests/soap/server.php',
> > 'uri'   => 'http://localhost/tests/soap/server.php',
> > 'trace' => 1
> > )
> > );
> >
> > echo 'Request One:';
> > try {
> > echo $client->testOne('FooBar');
> > } catch (SoapFault $soapFault) {
> > echo $soapFault;
> > }
> > echo '';
> >
> > echo 'Request Two:';
> > try {
> > echo $client->testTwo('FooBar');
> > } catch (SoapFault $soapFault) {
> > echo $soapFault;
> > }
> > echo '';
> >
> > echo 'Request Three:';
> > try {
> > echo $client->testThree('FooBar');
> > } catch (SoapFault $soapFault) {
> > echo $soapFault;
> > }
> > echo '';
> > -- /client.php --
> >
> > --
> > /James
> >
> > On Fri, Apr 11, 2008 at 7:30 PM, Matthew Weier O'Phinney <
> [EMAIL PROTECTED]>
> > wrote:
> >
> > -- James Dempster <[EMAIL PROTECTED]> wrote
> > (on Friday, 11 April 2008, 07:16 PM +0100):
> > > The problem with this is that you loose the actual exception
> object.
> >
> > Okay, how about storing the exception object in the fault response?
> That
> > would give you access to it should you want to log it or manipulate
> the
> > response based on the exception.
> >
> > > I would much prefer something along what the front controller 
> does.
> > > Zend_Controller_Front::getInstance()->throwExceptions(true);
> > >
> > > Something like this would be handy for example...
> > >
> > > $server->throwException(true);
> > > try {
> > > echo $server->handle();
> > > } catch (MyPersonalException $e) {
> > > echo $server->fault($e);
> > > } catch (Exception $e) {
> > > // do other things like logging, email the admin as this was 
> an
> > unexpected
> > > error.
> > > echo $server->fault(new Exception('An unknown error occured.
> Please
> > try
> > > again.'));
> > > }
> >
> > I'm not likely to implement this as we're trying to follow the
> > SoapServer API with our server components -- and that's not how
> > SoapServer works. Fault responses are still a normal respons

[fw-general] custom form validator

2008-04-11 Thread chinaski

Hello.

This seems simple, but I can't make it work (path issue). I'm experimenting
with Zend_Form, and I want to add a custom validator to a form field.

I have written the a test validator and saved it as follows:

I have saved the file as /My/Validate/TestVal.php.

I have a script that builds the form:

addElementPrefixPath('My_Validate','My/Validate/','validate');
  
  $testing = new Zend_Form_Element_Text('testing');
  $testing->setLabel('Title')
 ->setRequired(true);

  $validators = $testing->getValidators();
  $testval   = array('validator' => 'TestVal');
  array_unshift($validators, $testval);
  
  $testing->setValidators($validators);

  //etc...
   }
}

This fails at $testing->setValidators with the following message...

Error: Plugin by name My_Validate_TestVal was not found in the registry.

How to get the custom validator attached to the element? 

Thanks.

Sam



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



Re: [fw-general] Zend_XMLRPC_Server overwrite/ response customized Fault-Msgs.

2008-04-11 Thread James Dempster
I'd like the same features on Zend_Rest_Server also, but just noticed that
the Zend_Rest_Server::fault returns a DOMDocument

*ZF-3102 * is the issue
regarding throwExceptions*
*
I've just noticed that Zend_XmlRpc_Server_Fault has the getException method
so I don't think this needs an issue any more.

--
/James

On Fri, Apr 11, 2008 at 8:40 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
wrote:

> -- James Dempster <[EMAIL PROTECTED]> wrote
> (on Friday, 11 April 2008, 08:16 PM +0100):
> > That's the way I use SoapServer.
> > I would have thought it was more in keeping with the SoapServer API to
> allow
> > the Exception to be thrown but as it already doesn't maybe add the
> option.
>
> G... you're right. The xml-rpc server was written a *lnggg* time
> ago, and I use that more than I use Soap, so I forget some details.
>
> Could you open an issue, requesting two things?
>
>  * Accesors for the exception in the fault object
>  * Flag to allow throwing exceptions from the server
>
> Thanks!
>
>
> > Example
> > -- server.php --
> >  >
> > class MyPersonalException extends Exception {}
> >
> > class SoapTestClass {
> >
> > public function testOne($value) {
> > return "You sent $value";
> > }
> >
> > public function testTwo($value) {
> > throw new MyPersonalException('Ooops looks like we made a
> mistake, but
> > we can tell you about it');
> > }
> >
> > public function testThree($value) {
> > throw new Exception('You Shouldn\'t see this error, cause it is
> > unhandled');
> > }
> > }
> >
> > try {
> > $server = new SoapServer(null, array('uri' => '
> http://localhost/tests/soap/
> > server.php'));
> > $server->setClass('SoapTestClass');
> > $server->handle();
> > } catch(MyPersonalException $e) {
> > $server->fault($e->getCode(), $e->getMessage());
> > } catch(Exception $e) {
> > // do other things like logging, email the admin as this was an
> unexpected
> > error.
> > $server->fault('ERROR', 'An unknown error occured. Please try
> again.');
> > }
> > -- /server.php --
> > -- client.php --
> >  > $client = new SoapClient(
> > null,
> > array(
> > 'location'  => 'http://localhost/tests/soap/server.php',
> > 'uri'   => 'http://localhost/tests/soap/server.php',
> > 'trace' => 1
> > )
> > );
> >
> > echo 'Request One:';
> > try {
> > echo $client->testOne('FooBar');
> > } catch (SoapFault $soapFault) {
> > echo $soapFault;
> > }
> > echo '';
> >
> > echo 'Request Two:';
> > try {
> > echo $client->testTwo('FooBar');
> > } catch (SoapFault $soapFault) {
> > echo $soapFault;
> > }
> > echo '';
> >
> > echo 'Request Three:';
> > try {
> > echo $client->testThree('FooBar');
> > } catch (SoapFault $soapFault) {
> > echo $soapFault;
> > }
> > echo '';
> > -- /client.php --
> >
> > --
> > /James
> >
> > On Fri, Apr 11, 2008 at 7:30 PM, Matthew Weier O'Phinney <
> [EMAIL PROTECTED]>
> > wrote:
> >
> > -- James Dempster <[EMAIL PROTECTED]> wrote
> > (on Friday, 11 April 2008, 07:16 PM +0100):
> > > The problem with this is that you loose the actual exception
> object.
> >
> > Okay, how about storing the exception object in the fault response?
> That
> > would give you access to it should you want to log it or manipulate
> the
> > response based on the exception.
> >
> > > I would much prefer something along what the front controller
> does.
> > > Zend_Controller_Front::getInstance()->throwExceptions(true);
> > >
> > > Something like this would be handy for example...
> > >
> > > $server->throwException(true);
> > > try {
> > > echo $server->handle();
> > > } catch (MyPersonalException $e) {
> > > echo $server->fault($e);
> > > } catch (Exception $e) {
> > > // do other things like logging, email the admin as this was
> an
> > unexpected
> > > error.
> > > echo $server->fault(new Exception('An unknown error occured.
> Please
> > try
> > > again.'));
> > > }
> >
> > I'm not likely to implement this as we're trying to follow the
> > SoapServer API with our server components -- and that's not how
> > SoapServer works. Fault responses are still a normal response --
> they
> > just indicate an error occurred.
> >
> > > On Fri, Apr 11, 2008 at 6:05 PM, Matthew Weier O'Phinney <
> > [EMAIL PROTECTED]>
> > > wrote:
> > >
> > > -- James Dempster <[EMAIL PROTECTED]> wrote
> > > (on Friday, 11 April 2008, 04:33 PM +0100):
> > > > I have the very same problem.
> > > >
> > > > I'd much prefer to catch the Exceptions myself, and deal
> with them
> > by
> > > either
> > > > allowing the message though based on the type of Exception,
> or
> > change it
> > > to a
> > > > generic Exception.
> > > >
> > > > Mayb

Re: [fw-general] Zend_XMLRPC_Server overwrite/ response customized Fault-Msgs.

2008-04-11 Thread Matthew Weier O'Phinney
-- James Dempster <[EMAIL PROTECTED]> wrote
(on Friday, 11 April 2008, 08:16 PM +0100):
> That's the way I use SoapServer.
> I would have thought it was more in keeping with the SoapServer API to allow
> the Exception to be thrown but as it already doesn't maybe add the option.

G... you're right. The xml-rpc server was written a *lnggg* time
ago, and I use that more than I use Soap, so I forget some details.

Could you open an issue, requesting two things?

  * Accesors for the exception in the fault object
  * Flag to allow throwing exceptions from the server

Thanks!


> Example
> -- server.php --
>  
> class MyPersonalException extends Exception {}
> 
> class SoapTestClass {
> 
> public function testOne($value) {
> return "You sent $value";
> }
> 
> public function testTwo($value) {
> throw new MyPersonalException('Ooops looks like we made a mistake, but
> we can tell you about it');
> }
> 
> public function testThree($value) {
> throw new Exception('You Shouldn\'t see this error, cause it is
> unhandled');
> }
> }
> 
> try {
> $server = new SoapServer(null, array('uri' => 
> 'http://localhost/tests/soap/
> server.php'));
> $server->setClass('SoapTestClass');
> $server->handle();
> } catch(MyPersonalException $e) {
> $server->fault($e->getCode(), $e->getMessage());
> } catch(Exception $e) {
> // do other things like logging, email the admin as this was an unexpected
> error.
> $server->fault('ERROR', 'An unknown error occured. Please try again.');
> }
> -- /server.php --
> -- client.php --
>  $client = new SoapClient(
> null,
> array(
> 'location'  => 'http://localhost/tests/soap/server.php',
> 'uri'   => 'http://localhost/tests/soap/server.php',
> 'trace' => 1
> )
> );
> 
> echo 'Request One:';
> try {
> echo $client->testOne('FooBar');
> } catch (SoapFault $soapFault) {
> echo $soapFault;
> }
> echo '';
> 
> echo 'Request Two:';
> try {
> echo $client->testTwo('FooBar');
> } catch (SoapFault $soapFault) {
> echo $soapFault;
> }
> echo '';
> 
> echo 'Request Three:';
> try {
> echo $client->testThree('FooBar');
> } catch (SoapFault $soapFault) {
> echo $soapFault;
> }
> echo '';
> -- /client.php --
> 
> --
> /James
> 
> On Fri, Apr 11, 2008 at 7:30 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
> wrote:
> 
> -- James Dempster <[EMAIL PROTECTED]> wrote
> (on Friday, 11 April 2008, 07:16 PM +0100):
> > The problem with this is that you loose the actual exception object.
> 
> Okay, how about storing the exception object in the fault response? That
> would give you access to it should you want to log it or manipulate the
> response based on the exception.
> 
> > I would much prefer something along what the front controller does.
> > Zend_Controller_Front::getInstance()->throwExceptions(true);
> >
> > Something like this would be handy for example...
> >
> > $server->throwException(true);
> > try {
> > echo $server->handle();
> > } catch (MyPersonalException $e) {
> > echo $server->fault($e);
> > } catch (Exception $e) {
> > // do other things like logging, email the admin as this was an
> unexpected
> > error.
> > echo $server->fault(new Exception('An unknown error occured. Please
> try
> > again.'));
> > }
> 
> I'm not likely to implement this as we're trying to follow the
> SoapServer API with our server components -- and that's not how
> SoapServer works. Fault responses are still a normal response -- they
> just indicate an error occurred.
> 
> > On Fri, Apr 11, 2008 at 6:05 PM, Matthew Weier O'Phinney <
> [EMAIL PROTECTED]>
> > wrote:
> >
> > -- James Dempster <[EMAIL PROTECTED]> wrote
> > (on Friday, 11 April 2008, 04:33 PM +0100):
> > > I have the very same problem.
> > >
> > > I'd much prefer to catch the Exceptions myself, and deal with them
> by
> > either
> > > allowing the message though based on the type of Exception, or
> change it
> > to a
> > > generic Exception.
> > >
> > > Maybe time to submit an issue regarding this?
> >
> > Actually, you can capture the response, and test to see if it is a
> fault
> > response, and then modify it before sending:
> >
> > $response = $server->handle();
> >
> > if ($response instanceof Zend_XmlRpc_Server_Fault) {
> >// handle differently
> > } else {
> >echo $response;
> > }
> >
> >
> > > On Fri, Apr 11, 2008 at 3:28 PM, Peter Boehlke <
> [EMAIL PROTECTED]>
> > wrote:
> > >
> > >
> > > Hi there,
> > >
> > > i'm trying around with the Zend_XMLRPC-Server. So far, i'm 
> very
> > pleased
> > > wi

Re: [fw-general] Zend_XMLRPC_Server overwrite/ response customized Fault-Msgs.

2008-04-11 Thread James Dempster
That's the way I use SoapServer.
I would have thought it was more in keeping with the SoapServer API to allow
the Exception to be thrown but as it already doesn't maybe add the option.

Example
-- server.php --
 '
http://localhost/tests/soap/server.php'));
$server->setClass('SoapTestClass');
$server->handle();
} catch(MyPersonalException $e) {
$server->fault($e->getCode(), $e->getMessage());
} catch(Exception $e) {
// do other things like logging, email the admin as this was an
unexpected error.
$server->fault('ERROR', 'An unknown error occured. Please try again.');
}
-- /server.php --
-- client.php --
 'http://localhost/tests/soap/server.php',
'uri'   => 'http://localhost/tests/soap/server.php',
'trace' => 1
)
);

echo 'Request One:';
try {
echo $client->testOne('FooBar');
} catch (SoapFault $soapFault) {
echo $soapFault;
}
echo '';

echo 'Request Two:';
try {
echo $client->testTwo('FooBar');
} catch (SoapFault $soapFault) {
echo $soapFault;
}
echo '';

echo 'Request Three:';
try {
echo $client->testThree('FooBar');
} catch (SoapFault $soapFault) {
echo $soapFault;
}
echo '';
-- /client.php --

--
/James

On Fri, Apr 11, 2008 at 7:30 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
wrote:

> -- James Dempster <[EMAIL PROTECTED]> wrote
> (on Friday, 11 April 2008, 07:16 PM +0100):
> > The problem with this is that you loose the actual exception object.
>
> Okay, how about storing the exception object in the fault response? That
> would give you access to it should you want to log it or manipulate the
> response based on the exception.
>
> > I would much prefer something along what the front controller does.
> > Zend_Controller_Front::getInstance()->throwExceptions(true);
> >
> > Something like this would be handy for example...
> >
> > $server->throwException(true);
> > try {
> > echo $server->handle();
> > } catch (MyPersonalException $e) {
> > echo $server->fault($e);
> > } catch (Exception $e) {
> > // do other things like logging, email the admin as this was an
> unexpected
> > error.
> > echo $server->fault(new Exception('An unknown error occured. Please
> try
> > again.'));
> > }
>
> I'm not likely to implement this as we're trying to follow the
> SoapServer API with our server components -- and that's not how
> SoapServer works. Fault responses are still a normal response -- they
> just indicate an error occurred.
>
> > On Fri, Apr 11, 2008 at 6:05 PM, Matthew Weier O'Phinney <
> [EMAIL PROTECTED]>
> > wrote:
> >
> > -- James Dempster <[EMAIL PROTECTED]> wrote
> > (on Friday, 11 April 2008, 04:33 PM +0100):
> > > I have the very same problem.
> > >
> > > I'd much prefer to catch the Exceptions myself, and deal with them
> by
> > either
> > > allowing the message though based on the type of Exception, or
> change it
> > to a
> > > generic Exception.
> > >
> > > Maybe time to submit an issue regarding this?
> >
> > Actually, you can capture the response, and test to see if it is a
> fault
> > response, and then modify it before sending:
> >
> > $response = $server->handle();
> >
> > if ($response instanceof Zend_XmlRpc_Server_Fault) {
> >// handle differently
> > } else {
> >echo $response;
> > }
> >
> >
> > > On Fri, Apr 11, 2008 at 3:28 PM, Peter Boehlke <
> [EMAIL PROTECTED]>
> > wrote:
> > >
> > >
> > > Hi there,
> > >
> > > i'm trying around with the Zend_XMLRPC-Server. So far, i'm
> very
> > pleased
> > > with
> > > it. Everything runs without Problems etc.
> > >
> > > But i have one Problem concerning the Zend_XmlRpc_Server_Fault
> > > (standard)messages. I want to respond with my own
> fault-XML-grids, if
> > > something in the Request was wrong.
> > >
> > > Furthermore, i want to validate the Request by myself and
> generate
> > more
> > > exact error-messages in the fault-message;
> > >
> > > I hope this is understandable! ;)
> > > Thank you in advance,
> > >
> > > Peter Boehlke
> > > --
> > > View this message in context: http://www.nabble.com/
> > >
> >
> Zend_XMLRPC_Server-overwrite--response-customized-Fault-Msgs.-tp16627837p16627837.html
> > > Sent from the Zend Framework mailing list archive at
> Nabble.com.
> > >
> > >
> > >
> >
> > --
> > Matthew Weier O'Phinney
> > Software Architect   | [EMAIL PROTECTED]
> > Zend - The PHP Company   | http://www.zend.com/
> >
> >
>
> --
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
>


Re: [fw-general] Zend_XMLRPC_Server overwrite/ response customized Fault-Msgs.

2008-04-11 Thread Matthew Weier O'Phinney
-- James Dempster <[EMAIL PROTECTED]> wrote
(on Friday, 11 April 2008, 07:16 PM +0100):
> The problem with this is that you loose the actual exception object.

Okay, how about storing the exception object in the fault response? That
would give you access to it should you want to log it or manipulate the
response based on the exception.

> I would much prefer something along what the front controller does.
> Zend_Controller_Front::getInstance()->throwExceptions(true);
> 
> Something like this would be handy for example...
> 
> $server->throwException(true);
> try {
> echo $server->handle();
> } catch (MyPersonalException $e) {
> echo $server->fault($e);
> } catch (Exception $e) {
> // do other things like logging, email the admin as this was an unexpected
> error.
> echo $server->fault(new Exception('An unknown error occured. Please try
> again.'));
> }

I'm not likely to implement this as we're trying to follow the
SoapServer API with our server components -- and that's not how
SoapServer works. Fault responses are still a normal response -- they
just indicate an error occurred.

> On Fri, Apr 11, 2008 at 6:05 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
> wrote:
> 
> -- James Dempster <[EMAIL PROTECTED]> wrote
> (on Friday, 11 April 2008, 04:33 PM +0100):
> > I have the very same problem.
> >
> > I'd much prefer to catch the Exceptions myself, and deal with them by
> either
> > allowing the message though based on the type of Exception, or change it
> to a
> > generic Exception.
> >
> > Maybe time to submit an issue regarding this?
> 
> Actually, you can capture the response, and test to see if it is a fault
> response, and then modify it before sending:
> 
> $response = $server->handle();
> 
> if ($response instanceof Zend_XmlRpc_Server_Fault) {
>// handle differently
> } else {
>echo $response;
> }
> 
> 
> > On Fri, Apr 11, 2008 at 3:28 PM, Peter Boehlke <[EMAIL PROTECTED]>
> wrote:
> >
> >
> > Hi there,
> >
> > i'm trying around with the Zend_XMLRPC-Server. So far, i'm very
> pleased
> > with
> > it. Everything runs without Problems etc.
> >
> > But i have one Problem concerning the Zend_XmlRpc_Server_Fault
> > (standard)messages. I want to respond with my own fault-XML-grids, 
> if
> > something in the Request was wrong.
> >
> > Furthermore, i want to validate the Request by myself and generate
> more
> > exact error-messages in the fault-message;
> >
> > I hope this is understandable! ;)
> > Thank you in advance,
> >
> > Peter Boehlke
> > --
> > View this message in context: http://www.nabble.com/
> >
> 
> Zend_XMLRPC_Server-overwrite--response-customized-Fault-Msgs.-tp16627837p16627837.html
> > Sent from the Zend Framework mailing list archive at Nabble.com.
> >
> >
> >
> 
> --
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
> 
> 

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] Zend_XMLRPC_Server overwrite/ response customized Fault-Msgs.

2008-04-11 Thread James Dempster
The problem with this is that you loose the actual exception object.

I would much prefer something along what the front controller does.
Zend_Controller_Front::getInstance()->throwExceptions(true);

Something like this would be handy for example...

$server->throwException(true);
try {
echo $server->handle();
} catch (MyPersonalException $e) {
echo $server->fault($e);
} catch (Exception $e) {
// do other things like logging, email the admin as this was an
unexpected error.
echo $server->fault(new Exception('An unknown error occured. Please try
again.'));
}

--
/James

On Fri, Apr 11, 2008 at 6:05 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
wrote:

> -- James Dempster <[EMAIL PROTECTED]> wrote
> (on Friday, 11 April 2008, 04:33 PM +0100):
> > I have the very same problem.
> >
> > I'd much prefer to catch the Exceptions myself, and deal with them by
> either
> > allowing the message though based on the type of Exception, or change it
> to a
> > generic Exception.
> >
> > Maybe time to submit an issue regarding this?
>
> Actually, you can capture the response, and test to see if it is a fault
> response, and then modify it before sending:
>
> $response = $server->handle();
>
> if ($response instanceof Zend_XmlRpc_Server_Fault) {
>// handle differently
> } else {
>echo $response;
> }
>
>
> > On Fri, Apr 11, 2008 at 3:28 PM, Peter Boehlke <[EMAIL PROTECTED]>
> wrote:
> >
> >
> > Hi there,
> >
> > i'm trying around with the Zend_XMLRPC-Server. So far, i'm very
> pleased
> > with
> > it. Everything runs without Problems etc.
> >
> > But i have one Problem concerning the Zend_XmlRpc_Server_Fault
> > (standard)messages. I want to respond with my own fault-XML-grids,
> if
> > something in the Request was wrong.
> >
> > Furthermore, i want to validate the Request by myself and generate
> more
> > exact error-messages in the fault-message;
> >
> > I hope this is understandable! ;)
> > Thank you in advance,
> >
> > Peter Boehlke
> > --
> > View this message in context: http://www.nabble.com/
> >
> Zend_XMLRPC_Server-overwrite--response-customized-Fault-Msgs.-tp16627837p16627837.html
> > Sent from the Zend Framework mailing list archive at Nabble.com.
> >
> >
> >
>
> --
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
>


RE: [fw-general] Zend_Layout, urls and spaces in names

2008-04-11 Thread Eric Marden
You didn't really say why and where you wanted to do this at, as there
are different approaches to it. However, I recommend steering away from
files with spaces in them - especially if your target hosting platform
is running *nix.

> Is there a helper or method to convert those spaces to %20 in Zend?

Check these functions out, though they all operate differently and have
different goals (which may or may not fit the bill for you):

http://us2.php.net/urlencode

http://us2.php.net/htmlentities

http://us2.php.net/manual/en/function.htmlspecialchars.php



 
--
Eric Marden


Re: [fw-general] Zend_XMLRPC_Server overwrite/ response customized Fault-Msgs.

2008-04-11 Thread Matthew Weier O'Phinney
-- James Dempster <[EMAIL PROTECTED]> wrote
(on Friday, 11 April 2008, 04:33 PM +0100):
> I have the very same problem.
> 
> I'd much prefer to catch the Exceptions myself, and deal with them by either
> allowing the message though based on the type of Exception, or change it to a
> generic Exception.
> 
> Maybe time to submit an issue regarding this?

Actually, you can capture the response, and test to see if it is a fault
response, and then modify it before sending:

$response = $server->handle();

if ($response instanceof Zend_XmlRpc_Server_Fault) {
// handle differently
} else {
echo $response;
}


> On Fri, Apr 11, 2008 at 3:28 PM, Peter Boehlke <[EMAIL PROTECTED]> wrote:
> 
> 
> Hi there,
> 
> i'm trying around with the Zend_XMLRPC-Server. So far, i'm very pleased
> with
> it. Everything runs without Problems etc.
> 
> But i have one Problem concerning the Zend_XmlRpc_Server_Fault
> (standard)messages. I want to respond with my own fault-XML-grids, if
> something in the Request was wrong.
> 
> Furthermore, i want to validate the Request by myself and generate more
> exact error-messages in the fault-message;
> 
> I hope this is understandable! ;)
> Thank you in advance,
> 
> Peter Boehlke
> --
> View this message in context: http://www.nabble.com/
> 
> Zend_XMLRPC_Server-overwrite--response-customized-Fault-Msgs.-tp16627837p16627837.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> 
> 

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Comment on ZF-2978: Zend_XmlRpc_Client returning system.methodSignature

2008-04-11 Thread Jake McGraw
Matthew, anyone watching this issue:

The provided solution:

class My_XmlRpc_Client extends Zend_XmlRpc_Client
{
public function call($method, $params = array())
{
$request = new Zend_XmlRpc_Request($method, $params);

$this->doRequest($request);

if ($this->_lastResponse->isFault()) {
$fault = $this->_lastResponse->getFault();
throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(),
$fault->getCode());
}

return $this->_lastResponse->getReturnValue();
}
}

Doesn't work because $_lastRequest is **private** in
Zend_XmlRpc_Client, Line 91:

private $_lastRequest = null;

Here is a solution that works in the meantime (until 1.5.2?):

class My_XmlRpc_Client extends Zend_XmlRpc_Client
{
public function call($method, $params = array())
{
$request = new Zend_XmlRpc_Request($method, $params);

$this->doRequest($request);

if ($this->getLastResponse()->isFault()) {
$fault = $this->getLastResponse()->getFault();
throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(),
$fault->getCode());
}

return $this->getLastResponse()->getReturnValue();
}
}

I would have posted this on the tracker, but I didn't see a comment
field (even though I am registered to use the service).

- jake


Re: [fw-general] Splitting radio button options

2008-04-11 Thread Ronnie87


tim912 wrote:
> 
> Is there a way of splitting radio buttons on a page using the Zend_Form
> component? 
> 

http://framework.zend.com/issues/browse/ZF-2977
-- 
View this message in context: 
http://www.nabble.com/Splitting-radio-button-options-tp16627269p16627896.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Log_Writer_FirePHP

2008-04-11 Thread Christoph Dorn
> I'm intrigued. Keep us abreast of the progress of this extension. 

=> Will do. Any feedback on the current version is welcome.

The list for FirePHP is here: http://groups.google.com/group/FirePHP

Thanks!

Christoph


Re: [fw-general] Zend_Log_Writer_FirePHP

2008-04-11 Thread Christoph Dorn
> Have you written a proposal
> (http://framework.zend.com/wiki/display/ZFPROP/Home) on the Zend Wiki?

=> Not yet. We were going to wait until the proposal process has been
revamped.


> But, however it sounds great!!
> Perhaps it would be a nice addition for Zend_Debug::dump() too,

=> Sounds like it. We'll take a look at that.

Christoph



Re: [fw-general] Zend_XMLRPC_Server overwrite/ response customized Fault-Msgs.

2008-04-11 Thread James Dempster
I have the very same problem.

I'd much prefer to catch the Exceptions myself, and deal with them by either
allowing the message though based on the type of Exception, or change it to
a generic Exception.

Maybe time to submit an issue regarding this?

--
/James

On Fri, Apr 11, 2008 at 3:28 PM, Peter Boehlke <[EMAIL PROTECTED]> wrote:

>
> Hi there,
>
> i'm trying around with the Zend_XMLRPC-Server. So far, i'm very pleased
> with
> it. Everything runs without Problems etc.
>
> But i have one Problem concerning the Zend_XmlRpc_Server_Fault
> (standard)messages. I want to respond with my own fault-XML-grids, if
> something in the Request was wrong.
>
> Furthermore, i want to validate the Request by myself and generate more
> exact error-messages in the fault-message;
>
> I hope this is understandable! ;)
> Thank you in advance,
>
> Peter Boehlke
> --
> View this message in context:
> http://www.nabble.com/Zend_XMLRPC_Server-overwrite--response-customized-Fault-Msgs.-tp16627837p16627837.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


[fw-general] Zend_XMLRPC_Server overwrite/ response customized Fault-Msgs.

2008-04-11 Thread Peter Boehlke

Hi there,

i'm trying around with the Zend_XMLRPC-Server. So far, i'm very pleased with
it. Everything runs without Problems etc.

But i have one Problem concerning the Zend_XmlRpc_Server_Fault
(standard)messages. I want to respond with my own fault-XML-grids, if
something in the Request was wrong. 

Furthermore, i want to validate the Request by myself and generate more
exact error-messages in the fault-message;

I hope this is understandable! ;)
Thank you in advance,

Peter Boehlke
-- 
View this message in context: 
http://www.nabble.com/Zend_XMLRPC_Server-overwrite--response-customized-Fault-Msgs.-tp16627837p16627837.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Zend_Log_Writer_FirePHP

2008-04-11 Thread Eric Marden
I'm intrigued. Keep us abreast of the progress of this extension. 


 
--
Eric Marden


-Original Message-
From: Christoph Dorn [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 10, 2008 6:21 PM
To: fw-general@lists.zend.com
Subject: [fw-general] Zend_Log_Writer_FirePHP

Hi All,

I have written a simple log writer for the FirePHP Firefox extension
that allows you to log from PHP directly to the Firebug Console.

FirePHP is unique in that it sends the log messages in response headers
instead of the page content. Thus the page content is not affected.

It is ideally suited for AJAX development as the server response must be
clean XML or JSON. It can also be used to debug scripts that send back
images etc...

You can find more information at: http://www.firephp.org/

The Zend Log Writer for FirePHP can be downloaded from the homepage.

Any feedback would be great!

Christoph




[fw-general] Zend_Rest and POST

2008-04-11 Thread Kolkman, Chris
Hello,

 

I'm attempting to use Zend_Rest for posting an XML request document and
receiving a response.  Basically I'm attempting to do the following with
Zend_Rest:

function do_post_request($url, $data, $optional_headers
= null){

$params = array('http' => array(

 
'method' => 'POST',

 
'content' => $data

 
));

if( $optional_headers !== null )

 
$params['http']['header'] = $optional_headers;

$ctx = stream_context_create($params);

$fp = @fopen($url, 'rb', false, $ctx);

if( !$fp )

throw new
Exception("Problem with $url, $php_errormsg");

$response = @stream_get_contents($fp);

if( $response === false )

throw new
Exception("Problem reading data from $url, $php_errormsg");

return $response;

}

In that function the $data parameter is the XML request document - the
returned response is an XML document.

 

Here is what I've got using the Zend framework so far:

 

public function getResponse(){

$requestDoc = $this->_RSR->generateRequest();

$this->_rest = new
Zend_Rest_Client('https://full_url/goes_here');

//$result = $this->_rest->post($requestDoc);

$result =
$this->_rest->post('https://full_url/goes_here', $requestDoc);

return $result;

}

 

With the first way of calling the post I get a URI exception - so I put
the url as the first parameter, and the document as the second and then
I apparently get some sort of response (though not the expected XML
response), and that response causes simplexml_load_string to spit out
MANY errors.

 

Anybody know how I can do what I'm looking to do?  Maybe Zend_Rest isn't
the correct component - but I would like to use something in the Zend
Framework.

 

Thanks,

 

Chris Kolkman



Re: [fw-general] Zend_Log_Writer_FirePHP

2008-04-11 Thread Thomas Fritz
Have you written a proposal
(http://framework.zend.com/wiki/display/ZFPROP/Home) on the Zend Wiki?

But, however it sounds great!!
Perhaps it would be a nice addition for Zend_Debug::dump() too,

Thomas


2008/4/11, Christoph Dorn <[EMAIL PROTECTED]>:
> Hi All,
>
>  I have written a simple log writer for the FirePHP Firefox extension
>  that allows you to log from PHP directly to the Firebug Console.
>
>  FirePHP is unique in that it sends the log messages in response headers
>  instead of the page content. Thus the page content is not affected.
>
>  It is ideally suited for AJAX development as the server response must be
>  clean XML or JSON. It can also be used to debug scripts that send back
>  images etc...
>
>  You can find more information at: http://www.firephp.org/
>
>  The Zend Log Writer for FirePHP can be downloaded from the homepage.
>
>  Any feedback would be great!
>
>
>  Christoph
>
>
>


[fw-general] Haw i can get Radio button into desired position

2008-04-11 Thread robsg

I get something like this:
http://www.nabble.com/file/p16627785/ZRRtnF_gw9g57KTgh0q-b.jpg 

But i want to have like this:
http://www.nabble.com/file/p16627785/siM2Y_yJCCkq9za4JvrY5.jpg 

My code:

$test_options = array('N'=>'Ne', 'D'=>'Da');
$test = new Zend_Form_Element_Radio('radiotest',array('label_style' => ''));
$test -> setMultiOptions($test_options)
-> setOptions(array('separator' => ''))
-> addDecorators(array(
array('HtmlTag', array('' => '')),
array('Label', array('' => '')),
)); 

How i can do that? 
please help
-- 
View this message in context: 
http://www.nabble.com/Haw-i-can-get-Radio-button-into-desired-position-tp16627785p16627785.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Splitting radio button options

2008-04-11 Thread Matthew Weier O'Phinney
-- tim912 <[EMAIL PROTECTED]> wrote
(on Friday, 11 April 2008, 01:50 AM -0700):
> Is there a way of splitting radio buttons on a page using the Zend_Form
> component? I think that something along the lines of each option having its
> own decorators would solve the problem but I can't see a way of doing this.
> 
> The effect I want is to be able to have each option in its own div element
> with each div containing other information about the option. For example:
> 
> 
>1
>Other information
> 
> 
>2
>Other information
> 
> 
>2
>Other information
> 
> 
> Thanks for your help!

Honestly, the best solution for this is to create your own Radio
decorator that can achieve this. Let me know if you need additional
pointers on how to do this.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] DISTINCT clause in a select() over ZEND_Db_Table

2008-04-11 Thread Denis Fohl

i've tried this :

public function countLevels() {
$select = $this->select();
$select->distinct();
$select->from($this,array('nb' => 'COUNT(idparent)'));
return $this->fetchAll($select);
}

a call to the __toString method gives this sql statement :

SELECT DISTINCT COUNT(idparent) AS `nb` FROM `menu_element`

wich is not the one i'd like to perform :

select count(distinct idparent) from menu_element

i'm still looking for...

thanks for help


Denis Fohl a écrit :

Hi all,

i can't manage myself to get it work :

public function countLevels() {
$select = $this->select();
$select->from($this,'COUNT(DISTINCT idparent');
return $this->fetchAll($select);
}

this method is declared in a db_table object and i've got the following 
error :
Zend_Db_Statement_Exception: SQLSTATE[42S22]: Column not found: 1054 
Unknown column 'menu_element.COUNT(DISTINCT idparent' in 'field list' in 
E:\phplib\Zend\Db\Statement\Pdo.php on line 238


I've look to adding expression colomuns in documentation but can't find 
the way.


Thank you for your help






--
Denis Fohl
--
df-info
06 84 38 21 99



[fw-general] Splitting radio button options

2008-04-11 Thread tim912

Is there a way of splitting radio buttons on a page using the Zend_Form
component? I think that something along the lines of each option having its
own decorators would solve the problem but I can't see a way of doing this.

The effect I want is to be able to have each option in its own div element
with each div containing other information about the option. For example:


   1
   Other information


   2
   Other information


   2
   Other information


Thanks for your help!
   
-- 
View this message in context: 
http://www.nabble.com/Splitting-radio-button-options-tp16627269p16627269.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] DISTINCT clause in a select() over ZEND_Db_Table

2008-04-11 Thread Denis Fohl

Hi all,

i can't manage myself to get it work :

public function countLevels() {
$select = $this->select();
$select->from($this,'COUNT(DISTINCT idparent');
return $this->fetchAll($select);
}

this method is declared in a db_table object and i've got the following 
error :
Zend_Db_Statement_Exception: SQLSTATE[42S22]: Column not found: 1054 
Unknown column 'menu_element.COUNT(DISTINCT idparent' in 'field list' in 
E:\phplib\Zend\Db\Statement\Pdo.php on line 238


I've look to adding expression colomuns in documentation but can't find 
the way.


Thank you for your help