[fw-general] Zend_Form Decorator

2008-07-03 Thread chinaski

I need some help with form decorator. I need help decorating a radio group.
Here is the group as defined in the init() method of my form subclass:

  $user_active = $this->createElement('radio','user_active',array(
  'label' => 'Status',
  'multiOptions' => array('active' => 'active', 'inactive' =>
'inactive'),
  'separator' => ' ',
  'value' => 'inactive',
  'required' => true,
  'decorators' => $this->_standardElementDecorator,
  'validators' => array(
 array('InArray',false,array(array('active','inactive'))),
  )
  ));

This gives me the following output:

Statusrequired
active inactive


I need this output to look like this:

 
Statusrequired

   
  
  active
   
   
  
  inactive
   

 

Appreciate help on setting the decorators for this element.

Chinaski


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



Re: [fw-general] Why haven't you reviewed the Zend_Tool proposals?

2008-07-03 Thread Carlton Gibson


On 3 Jul 2008, at 20:17, Bill Karwin wrote:


Then you might want to recruit some folks in the ZF community who have
developed their own ZF apps, and ask them to do a similar  
exercise.  Work
with them closely, and give advice on the usage of Zend_Tool.   
Together

produce a script that can reproduce their web app from scratch.



I'd happily be involved in this.

Regards,
Carlton


Re: [fw-general] Using ZF in Non-MVC Setup

2008-07-03 Thread till
On Thu, Jul 3, 2008 at 3:10 PM, Panman <[EMAIL PROTECTED]> wrote:
>
> Currently we use Adobe Contribute for the users to edit pages, so that's why
> MVC doesn't work. Since we just purchased a few more copies of Contribute,
> we won't be going to a full blown Web based CMS. So I'm charged with
> building a new framework that works with Contribute and integrate it with
> some of our other systems. It's looking like I can "glue" some things
> together, which is what I'm looking for. At the moment I don't have any more
> specific questions but sure will later. Thanks

Can you explain why exactly it doesn't work? Is it because people
would need to touch the controllers for a new action/page, or what is
the obstacle here.

Till


Re: [fw-general] Using ZF in Non-MVC Setup

2008-07-03 Thread Panman


Matthew Weier O'Phinney-3 wrote:
> 
> Is it using WebDAV to do the publishing? If so, my idea is a no-go. If
> not, then the fact that it doesn't match up to an MVC URL is okay -- the
> 'fallback' will find the page and deliver it when it cannot match a
> controller/action pair.
It can use WebDAV but we do not, just local/network file share connections.
I'm still unsure about how Contribute would handle it. Ex, currently:

http://www.myserver.com/directory/page.php
=
\\Server\Public\directory\page.php

Would turn into something like:

http://www.myserver.com/directory/page/
=
???

The beginning of this video kind of shows what Contribute does.
http://www.adobe.com//designcenter/video_workshop/index.html?id=vid0177 
-- 
View this message in context: 
http://www.nabble.com/Using-ZF-in-Non-MVC-Setup-tp18263528p18267942.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] SOAP support

2008-07-03 Thread Eric Marden
If its based on soap/ext then it probably will not work for our service
either. Soap/ext choked on namespaces pretty badly, which is used
extensively by our service. I'll play with it an let you know.

-e


On 7/3/08 8:04 AM, "Ionut Gabriel Stan" <[EMAIL PROTECTED]> wrote:

> I took a look at this package, especially Zend_Soap_Client as right now I'm
> involved in developing some SOAP consumers.
> Before I go any further I should mention that these are my first SOAP projects
> so I'm not that versed in this field.
> So... in my opinion and at this moment I see no real benefit in using
> Zend_Soap_Client over PHP's builtin SoapClient class.
> 
> 
> 1. Problems I see so far:
> 
> Matthew once said that a Zend_Soap_Client should be a wrapper for SoapClient,
> which more or less will get all the options that one
> can pass to SoapClient constructor and provide them getters and setters,
> basically giving them ZF-like interfaces.
> 
>a) First problem: Zend_Soap_Client does that but only partially and is
> not sticking to a common interface.
> For example, in Zend I can't toggle the value of the *trace* options.
> I understand this is because
> Zend has two methods that count on this: getLastRequest and
> getLastResponse, but I assume tracing
> requests and responses adds a little bit of overhead that one might
> want to avoid in production. Then, why
> do we have these two methods but not getLastRequestHeaders and
> getLastResponseHeaders?
> Again, altghough we don't have them, the presence of the __call magic
> method inside Zend makes the two reachable.
> There are missing options, like stream_context, features, cache_wsdl,
> user_agent and typemap.
> There is getFunctions() but not getTypes().
> If I can't have access to all these options, then at least give me
> access  to the internal SoapClient
> 
> About the common interface, some of the options can be set by using
> setters, some only in bulk mode, by passing them
> to the constructor or to setOptions().
> For some of the options there is possibility for exceptions, although
> in cases where
> I don't see that much need for such a strict check (Ex: setEncoding
> checks if the passed parameter is a string).  On the
> other hand, other string options do not get this treatment.
> Options names should be standardized. setOptions() allows me both
> soapVersion and soap_version, while getOptions only
> returns soap_version.
> 
> b) A big problem of SoapClient, in my opinion, is that I can't change the
> values of the different supported options between consecutive calls.
> It's a function with lots of parameters in disguise of a class.
> It would be nice if Zend could do this, although I'm not so sure how
> useful this might be.
> One way to do this is that, at every call to a remote service, the
> soap object to be reinitialized. Another one I see is to
> use __soapCall() every time a call is made, but this is harder or
> impossible in WSDL mode.
> 
> c) The *biggest* problem of SoapClient is that it doesn't give me access
> to the *real* raw DOM. Not even with getLastResponse()
> and getLastRequest() or __doRequest(). Why am I stressing the word
> real? Because, a few days ago, I noticed that any request I
> made with SoapClient to a specific WS returned null and
> getLastResponse() returned... some sort of XML.
> After scratching my head, reading docs on the php.net manual and even
> PHP source code,
> I finally noticed that our partners sent us the return value of the
> method wrapped inside a CDATA element...
> How does SoapClient treats that? It encodes special characters inside
> CDATA, ex: <, >, & becomes < > &.
> While this might be correct (or not), because I'm sure returning the
> whole response inside CDATA certainly isn't, it doesn't help me.
> So, Zend should offer access to the real DOM if it wants to be a
> useful and extensible library that can overcome any situation out there.
> 
> 
> 2. Suggestions I have so far:
> 
>  a) Until ext/Soap gets better Zend_Soap_Client should be a factory for a
> Zend_Soap_Client_Builtin and a Zend_Soap_Client_Raw, where
>  Builtin in is the wrapper for SoapClient and Raw uses
> Zend_Http_Client for sending and receiving data. A Zend_Soap_Client_Raw should
>  be very simple, in that it should provide the general message
> skeleton (Envelope + HTTP headers)  and ways to inject
>  payloads (Header, Body, Fault?) inside it, where a payload could  be
> an xml string or a
>  DOMDocument/DOMNode/DOMElement/DOMDocumentFragment/SimpleXMLElement
> object. It should also be able to
>  schema validate the message before sending a request and it should
> support compression.
>  b) You should focus more on argument passing and return values. At this
> momen

Re: [fw-general] Using ZF in Non-MVC Setup

2008-07-03 Thread Matthew Weier O'Phinney
-- Panman <[EMAIL PROTECTED]> wrote
(on Thursday, 03 July 2008, 12:45 PM -0700):
> Matthew Weier O'Phinney-3 wrote:
> > Does Contribute simply publish individual page files? If so, I'd suggest
> > using the ZF MVC, and setting up ErrorController::errorAction() to check
> > the PATH_INFO ($this->getRequest()->getPathInfo()) to see if the
> > document exists in the system, and, if so, serve it up. This gets you
> > the benefit of being able to use Zend_Layout to inject the content into
> > a full page, as well as the ability to develop separate controllers and
> > routes via ZF.
> > 
> Interesting idea. Yes, contribute is basically a WYSIWYG editor. One problem
> I foresee is contribute finding the page to edit. In short, Contribute acts
> like a browser so the user "clicks" to the page they want to edit. Then they
> click the "Edit" button and Contribute locates the page on the server. I'm
> assuming that it does this by using the relative URI and matching it up to
> the server. So, I'm not sure it could work with a MVC URL. I'll do some
> research. Any ideas on that? Thanks

Is it using WebDAV to do the publishing? If so, my idea is a no-go. If
not, then the fact that it doesn't match up to an MVC URL is okay -- the
'fallback' will find the page and deliver it when it cannot match a
controller/action pair.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Using ZF in Non-MVC Setup

2008-07-03 Thread Panman


Matthew Weier O'Phinney-3 wrote:
> 
> Does Contribute simply publish individual page files? If so, I'd suggest
> using the ZF MVC, and setting up ErrorController::errorAction() to check
> the PATH_INFO ($this->getRequest()->getPathInfo()) to see if the
> document exists in the system, and, if so, serve it up. This gets you
> the benefit of being able to use Zend_Layout to inject the content into
> a full page, as well as the ability to develop separate controllers and
> routes via ZF.
> 
Interesting idea. Yes, contribute is basically a WYSIWYG editor. One problem
I foresee is contribute finding the page to edit. In short, Contribute acts
like a browser so the user "clicks" to the page they want to edit. Then they
click the "Edit" button and Contribute locates the page on the server. I'm
assuming that it does this by using the relative URI and matching it up to
the server. So, I'm not sure it could work with a MVC URL. I'll do some
research. Any ideas on that? Thanks
-- 
View this message in context: 
http://www.nabble.com/Using-ZF-in-Non-MVC-Setup-tp18263528p18266979.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Using ZF in Non-MVC Setup

2008-07-03 Thread Matthew Weier O'Phinney
-- Panman <[EMAIL PROTECTED]> wrote
(on Thursday, 03 July 2008, 12:10 PM -0700):
> 
> Currently we use Adobe Contribute for the users to edit pages, so that's why
> MVC doesn't work. Since we just purchased a few more copies of Contribute,
> we won't be going to a full blown Web based CMS. So I'm charged with
> building a new framework that works with Contribute and integrate it with
> some of our other systems. It's looking like I can "glue" some things
> together, which is what I'm looking for. At the moment I don't have any more
> specific questions but sure will later. Thanks

Does Contribute simply publish individual page files? If so, I'd suggest
using the ZF MVC, and setting up ErrorController::errorAction() to check
the PATH_INFO ($this->getRequest()->getPathInfo()) to see if the
document exists in the system, and, if so, serve it up. This gets you
the benefit of being able to use Zend_Layout to inject the content into
a full page, as well as the ability to develop separate controllers and
routes via ZF.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


RE: [fw-general] Why haven't you reviewed the Zend_Tool proposals?

2008-07-03 Thread Bill Karwin



wllm wrote:
> 
> this is a large initiative that Ralph could use some help
> with even before presenting class skeletons. That said, I also mentioned
> that we *really* need use cases in my comments; Ralph, it's clear that's
> our top priority here.
> 

What I was commenting on before is simply general proposal advice.  You need
a clear statement of the problem you're trying to solve.  Otherwise neither
you nor any reader can guess if the proposed solution is anything close to
solving the problem you're supposed to be solving.  

It's amazing how frequently this aspect of proposal design is overlooked.  I
couple of years ago I consulted for a VC to provide a review of a business
plan for a technology startup company.  The business plan said lots of great
things about their intended market, and then launched into a lot of
technobabble about their fancy software solution.  Nowhere did they say what
the software would actually _do_, or how that would connect with the needs
of the market they described.

So a proposal must include these three pieces:

1. Problem statement
2. Proposed solution
3. Explanation of how the proposed solution solves the problem 

Regarding use cases, here's a way you can jump-start them.  Many open-source
frameworks have come out of work that people are already doing.  They come
up with productivity tools that helped their own project, and then they
realized with a small effort they could package up those tools and others
could use them too.

You already have the code for a few modest-sized websites built with ZF: 
framework.zend.com, devzone.zend.com, and www.zend.com.  What I would
suggest is that Ralph take a look at these, figure out a sequence of
commands--a script--to invoke Zend_Tool that would reproduce these websites
(or something reasonably similar).  Then these become three real-world use
cases.  

This exercise is likely to reveal some requirements for Zend_Tool that have
been overlooked so far.  I haven't looked at the current design for
Zend_Tool in great detail, but I predict that you will find some features
needed even for the simple framework.zend.com app, that aren't handled
gracefully by Zend_Tool yet.

Then you might want to recruit some folks in the ZF community who have
developed their own ZF apps, and ask them to do a similar exercise.  Work
with them closely, and give advice on the usage of Zend_Tool.  Together
produce a script that can reproduce their web app from scratch.  

(These aren't actually use cases by the strict definition; they're more like
scenarios.)

By working with a community member, you will also learn some things about
the usability of Zend_Tool that will help you refine its interface and
documentation.

Obviously, any code-generator can't flesh out all the custom logic inside
functions, but it's worthwhile to add notes in your script where it's
necessary for the developer to write code, because it gives a reviewer a
good feel for which tasks of app development Zend_Tool can or can't
automate.

Regards,
Bill Karwin
-- 
View this message in context: 
http://www.nabble.com/Why-haven%27t-you-reviewed-the-Zend_Tool-proposals--tp18221384p18266535.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Form Without View

2008-07-03 Thread Panman


Matthew Weier O'Phinney-3 wrote:
> 
> As for your second option, if you want to use Zend_Form without a view
> object for some masochistic reason, you can, but you'll need to develop
> your own decorators. For that, you should read the tutorial I did on
> decorators:
> 
> http://devzone.zend.com/article/3450-Decorators-with-Zend_Form
> 
This looks interesting, I'll have to take a look. Thanks for the resource
-- 
View this message in context: 
http://www.nabble.com/Form-Without-View-tp1826p18266464.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Using ZF in Non-MVC Setup

2008-07-03 Thread Panman

Currently we use Adobe Contribute for the users to edit pages, so that's why
MVC doesn't work. Since we just purchased a few more copies of Contribute,
we won't be going to a full blown Web based CMS. So I'm charged with
building a new framework that works with Contribute and integrate it with
some of our other systems. It's looking like I can "glue" some things
together, which is what I'm looking for. At the moment I don't have any more
specific questions but sure will later. Thanks
-- 
View this message in context: 
http://www.nabble.com/Using-ZF-in-Non-MVC-Setup-tp18263528p18266417.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Form Without View

2008-07-03 Thread Matthew Weier O'Phinney
-- Panman <[EMAIL PROTECTED]> wrote
(on Thursday, 03 July 2008, 09:31 AM -0700):
> I am new to ZF and due to my current situation, cannot use the MVC way of
> things. So, I'm starting to play around with Zend_Form but cannot figure out
> how to render the form without Zend_View. What is the best way to use
> Zend_Form in a non-MVC setup? Thanks!

You have two options. First, Zend_Form by default uses Zend_View helpers
to render output. However, usage of Zend_View does not imply that you
are using the MVC.  Put those two facts together, and you can use
Zend_Form as is just by passing the form a view object:

$form->setView(new Zend_View);

Just do that anytime before echoing the form, and you'll be fine. (This
is in fact how I tested Zend_Form.)

As for your second option, if you want to use Zend_Form without a view
object for some masochistic reason, you can, but you'll need to develop
your own decorators. For that, you should read the tutorial I did on
decorators:

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

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Using ZF in Non-MVC Setup

2008-07-03 Thread Jack Sleight
Well, using ZF in a non-MVC set-up is a simple as just not using the MVC 
components. All the components of ZF are standalone (ish), so if you 
just want to use the DB component then just use that, if you just need 
to build/consume RSS feeds then just use the feed component. What is it 
you want to use ZF for?


Panman wrote:

Does anyone have any links, suggestions, anything, about the best ways to use
ZF in a non-MVC setup? I'm trying to get a handle on using ZF but am
struggling because most of the docs talk about MVC. Thanks in advance.
  


--
Jack


Re: [fw-general] Why haven't you reviewed the Zend_Tool proposals?

2008-07-03 Thread Ralph Schindler


> with the stuff already committed over the weekend. Publicity aside, folk can
> only blame themselves when it reaches Core without comments ;). It really is

I will be looking forward to what you come up with Paddy.  Again, try and
use the Quickstart in the wiki (ZFDEV/Zend_Tool section), as it will help
you get started.


> I was wondering - where is Ralph's blog? Usually I'd expect to see a few posts
> somewhere introducing and throwing out updates on this sort of thing. With the

That too is on its way, although I must admit, I've had a lot on my plate
recently.  Needless to say, I'll be going through your 'building a blog'
posts you've got on your blog.

-ralph


-- 
Ralph Schindler
Software Engineer | [EMAIL PROTECTED]
Zend Framework| http://framework.zend.com/



[fw-general] Re: [fw-mvc] Re: [fw-general] Re: [fw-mvc] dojo.data component

2008-07-03 Thread Fabrice Terrasson
Matthew Weier O'Phinney a écrit :
> ...
>
> Should be fixed now -- please test!
>
>
>   

Thank you :-)

$p= new Catalogue();
$rows= $p->fetchAll()->toArray();
   
$f= new Zend_Dojo_Data();  
$f->setIdentifier('produit');
$f->addItems( $rows );  
/*
  $array = array(
'identifier' => 'produit',
'items'  => $rows,
);
*/
// context is json
$this->getResponse()->setBody( $f );

renders:

{"identifier":"produit",
"items":[
{"id":"1","produit":"pomme"},
{"id":"2","produit":"orange"},
]}

FT


Re: [fw-general] Zend_Form : Subforms, dynamic element creation and best practices

2008-07-03 Thread maxarbos



Matthew Weier O'Phinney-3 wrote:
> 
>> Matthew Weier O'Phinney-3 wrote:
>> > 
>> > Yes. Create an element for each child, and attach each with a different
>> > form element name:
>> > 
>> > foreach ($children as $key => $child) {
>> > $form->addElement('text', 'child' . $key, array('value' =>
>> > $child'));
>> > }
>> > 
>> > 
> 


So since all of my elements are being created in the init() method and that
seems to run even before the __construct , how to I get the value to
$children ?

If i call $renderform = new TestForm() from my Controller, the form is
already built by the time I try to set the $children by
$renderform->children = array('aaa', 'bbb', 'ccc');

I have been following the tutorials at:
http://blog.astrumfutura.com/archives/360-Example-Zend-Framework-Blog-Application-Tutorial-Part-6-Introduction-to-Zend_Form-and-Authentication-with-Zend_Auth.html

Is this still the recommended way to create a form with my needs?

-- 
View this message in context: 
http://www.nabble.com/Zend_Form-%3A-Subforms%2C-dynamic-element-creation-and-best-practices-tp18203896p18263554.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Using ZF in Non-MVC Setup

2008-07-03 Thread Panman

Does anyone have any links, suggestions, anything, about the best ways to use
ZF in a non-MVC setup? I'm trying to get a handle on using ZF but am
struggling because most of the docs talk about MVC. Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/Using-ZF-in-Non-MVC-Setup-tp18263528p18263528.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Form Without View

2008-07-03 Thread Panman

LOL, just after posting this I found a thread on ZF Forums about this. Any
other suggestions are welcome! Such has best way to process without MVC
setup and such.

http://www.zfforums.com/zend-framework-components-13/core-infrastructure-19/zend_form-howto-render-748.html
-- 
View this message in context: 
http://www.nabble.com/Form-Without-View-tp1826p18263435.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Form Without View

2008-07-03 Thread Panman

I am new to ZF and due to my current situation, cannot use the MVC way of
things. So, I'm starting to play around with Zend_Form but cannot figure out
how to render the form without Zend_View. What is the best way to use
Zend_Form in a non-MVC setup? Thanks!
-- 
View this message in context: 
http://www.nabble.com/Form-Without-View-tp1826p1826.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Re: [fw-mvc] dojo.data component

2008-07-03 Thread Matthew Weier O'Phinney
-- Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote
(on Thursday, 03 July 2008, 12:12 PM -0400):
> -- Fabrice Terrasson <[EMAIL PROTECTED]> wrote
> (on Thursday, 03 July 2008, 03:10 PM +0200):
> > Matthew Weier O'Phinney a écrit :
> > > -- Fabrice Terrasson <[EMAIL PROTECTED]> wrote
> > > (on Wednesday, 02 July 2008, 06:33 PM +0200):
> > dojo.data.ItemFileReadStore  seems to accept by default json like:
> > {"identifier":"produit",
> > "items":[
> > {"id":"1","produit":"pomme"},
> > {"id":"2","produit":"orange"},
> > {"id":"3","produit":"poire"},
> > {"id":"4","produit":"abricot"}
> > ]}
> > (each item in curly brackets).
> > 
> > Zend_Dojo_Data->toJson() returns a json like:
> > {"identifier":"produit",
> > "items":{
> > "pomme":{"id":"1","produit":"pomme"},
> > "orange":{"id":"2","produit":"orange"},
> > "poire":{"id":"3","produit":"poire"},
> > "abricot":{"id":"4","produit":"abricot"}
> > }}
> > (no simple bracket around items [ ] and a sole value facing item)
> > and the dojo store (dojo.data.ItemFileReadStore) is empty.
> 
> Aha -- good catch! I can fix that easily, and will do so momentarily.
> Thanks!

Should be fixed now -- please test!


-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


[fw-general] Re: [fw-mvc] dojo.data component

2008-07-03 Thread Matthew Weier O'Phinney
-- Cory D. Wiles <[EMAIL PROTECTED]> wrote
(on Thursday, 03 July 2008, 10:55 AM -0500):
> Instead of doing the following:
> 
> $this->_helper->viewRenderer-
> 
> >setNoRender(true);
>$this->_helper->layout->disableLayout(true);
>$response = $this->getResponse();
>$response->setHeader('Content-Type', 'application/json')
> ->setBody($f->toJson());
> 
> 
> Would you be able to achieve the same effect by using the ajaxContext switch
> since it by default disables layout and viewRender?

In the next week, you won't need to do any of the above anyways. :)


> On Wed, Jul 2, 2008 at 11:51 AM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
> wrote:
> 
> -- Fabrice Terrasson <[EMAIL PROTECTED]> wrote
> (on Wednesday, 02 July 2008, 06:33 PM +0200):
> > Matthew Weier O'Phinney a écrit :
> > > Greets, all --
> > >
> > > I've committed the complete Zend_Dojo_Data implementation to the
> > >
> > Thank you !!!
> >
> > What's the handy way to get a proper json ?
> >
> > I tried a bit, in my controller:
> >
> > public function autocompleteAction() {
> > $p= new Catalogue();
> > $rows= $p->fetchAll();
> >
> > $f= new Zend_Dojo_Data();
> > $f->setIdentifier('id');
> > $f->addItems( $rows );
> >
> > $this->_helper->autoCompleteDojo( $f );
> > //echo $f;
> > }
> 
> Well, you've got one big problem here: autoCompleteDojo() isn't yet
> wrapping Zend_Dojo_Data, so you'll get an inaccurate and invalid
> structure as you show below.
> 
> For now, until I refactor autoCompleteDojo(), do this in your action
> instead:
> 
> 
>$this->_helper->viewRenderer->setNoRender(true);
>$this->_helper->layout->disableLayout(true);
>$response = $this->getResponse();
>$response->setHeader('Content-Type', 'application/json')
> ->setBody($f->toJson());
> 
> I'll be refactoring autoCompleteDojo() in the coming week to allow
> passing Zend_Dojo_Data objects, as well as to consume Zend_Dojo_Data to
> create the payload when other types are passed to it.
> 
> > I m getting a well formated json file but complicated :
> > {"identifier":"name",
> > "items":  [{
> > "label": {"id":"1","produit":"pomme"},
> > "name": {"id":"1","produit":"pomme"}
> > },{
> > "label": {"id":"2","produit":"orange"},
> > "name": {"id":"2","produit":"orange"}
> > }]}
> >
> > I'd prefer and "dojo.data.ItemFileReadStore" too, a simpler json like :
> > {"identifier": "name",
> > "items": [{
> > "label":"pomme",
> > "name":"pomme"
> > },{
> > "label":"orange",
> > "name":"orange"}
> > }]}
> >
> > fyi, this is the schema SQL :
> > CREATE TABLE `catalogue` (
> >   `id` int(11) NOT NULL auto_increment,
> >   `produit` varchar(100) NOT NULL,
> >   PRIMARY KEY  (`id`) );
> >
> > FT.
> >
> 
> --
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend Framework   | http://framework.zend.com/
> 
> 
> 
> 
> 
> --
> Cory Wiles
> [EMAIL PROTECTED]
> http://www.corywiles.com
> http://www.400mtogo.com

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


[fw-general] Re: [fw-mvc] dojo.data component

2008-07-03 Thread Matthew Weier O'Phinney
-- Fabrice Terrasson <[EMAIL PROTECTED]> wrote
(on Thursday, 03 July 2008, 03:10 PM +0200):
> Matthew Weier O'Phinney a écrit :
> > -- Fabrice Terrasson <[EMAIL PROTECTED]> wrote
> > (on Wednesday, 02 July 2008, 06:33 PM +0200):
> >   
> > 
> >   
> 
> > Well, you've got one big problem here: autoCompleteDojo() isn't yet
> > wrapping Zend_Dojo_Data, so you'll get an inaccurate and invalid
> > structure as you show below.
> >
> > For now, until I refactor autoCompleteDojo(), do this in your action
> > instead:
> >
> >
> > $this->_helper->viewRenderer->setNoRender(true);
> > $this->_helper->layout->disableLayout(true);
> > $response = $this->getResponse();
> > $response->setHeader('Content-Type', 'application/json')
> >  ->setBody($f->toJson());
> >
> > I'll be refactoring autoCompleteDojo() in the coming week to allow
> > passing Zend_Dojo_Data objects, as well as to consume Zend_Dojo_Data to
> > create the payload when other types are passed to it.
> >
> >   
> I was confused by this helper :)
> 
> Thanks for your help !
> dojo.data.ItemFileReadStore  seems to accept by default json like:
> {"identifier":"produit",
> "items":[
> {"id":"1","produit":"pomme"},
> {"id":"2","produit":"orange"},
> {"id":"3","produit":"poire"},
> {"id":"4","produit":"abricot"}
> ]}
> (each item in curly brackets).
> 
> Zend_Dojo_Data->toJson() returns a json like:
> {"identifier":"produit",
> "items":{
> "pomme":{"id":"1","produit":"pomme"},
> "orange":{"id":"2","produit":"orange"},
> "poire":{"id":"3","produit":"poire"},
> "abricot":{"id":"4","produit":"abricot"}
> }}
> (no simple bracket around items [ ] and a sole value facing item)
> and the dojo store (dojo.data.ItemFileReadStore) is empty.

Aha -- good catch! I can fix that easily, and will do so momentarily.
Thanks!

> bypassing Zend_Dojo_Data like that, fill the dojo store correctly :
> 
> $p= new Catalogue();
> $rows= $p->fetchAll()->toArray();
>  
> /*
> $f= new Zend_Dojo_Data();  
> $f->setIdentifier('produit');
> $f->addItems( $rows );  
> */
>
>   $array = array(
> 'identifier' => 'produit',
> 'items'  => $rows,
> );
> 
> $f= Zend_Json::encode( $array );
> // context is json
> $this->getResponse()->setBody( $f );
> 
> I am using firebug to watch the json Response + aol cdn (
> $this->dojo->enable() ).

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


[fw-general] SecurityMetrics Support is apart of the fw-general@lists.zend.com list

2008-07-03 Thread Support

Hi,

It has come to our attention that over the past three days we have been 
receiving emails based on the fw-general@lists.zend.com email list. We 
don't believe we are a necessary member of this list. Can you please 
confirm that any email with @securitymetrics.com is a necessary member 
of this list? Also, how did we become a member?


Thank you for your help.

Regards,

Ben
SecurityMetrics Technical Support
[EMAIL PROTECTED]
US Support: 801-705-5700
UK Support: 020.7993.8031



smime.p7s
Description: S/MIME Cryptographic Signature


[fw-general] Re: [fw-mvc] dojo.data component

2008-07-03 Thread Cory D. Wiles
Matthew,

Instead of doing the following:

*$this->_helper->viewRenderer-*
>
> *>setNoRender(true);
>$this->_helper->layout-**>disableLayout(true);
>$response = $this->getResponse();
>$response->setHeader('Content**-Type', 'application/json')
> ->setBody($f->toJson());*


Would you be able to achieve the same effect by using the ajaxContext switch
since it by default disables layout and viewRender?


On Wed, Jul 2, 2008 at 11:51 AM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
wrote:

> -- Fabrice Terrasson <[EMAIL PROTECTED]> wrote
> (on Wednesday, 02 July 2008, 06:33 PM +0200):
> > Matthew Weier O'Phinney a écrit :
> > > Greets, all --
> > >
> > > I've committed the complete Zend_Dojo_Data implementation to the
> > >
> > Thank you !!!
> >
> > What's the handy way to get a proper json ?
> >
> > I tried a bit, in my controller:
> >
> > public function autocompleteAction() {
> > $p= new Catalogue();
> > $rows= $p->fetchAll();
> >
> > $f= new Zend_Dojo_Data();
> > $f->setIdentifier('id');
> > $f->addItems( $rows );
> >
> > $this->_helper->autoCompleteDojo( $f );
> > //echo $f;
> > }
>
> Well, you've got one big problem here: autoCompleteDojo() isn't yet
> wrapping Zend_Dojo_Data, so you'll get an inaccurate and invalid
> structure as you show below.
>
> For now, until I refactor autoCompleteDojo(), do this in your action
> instead:
>
>
>$this->_helper->viewRenderer->setNoRender(true);
>$this->_helper->layout->disableLayout(true);
>$response = $this->getResponse();
>$response->setHeader('Content-Type', 'application/json')
> ->setBody($f->toJson());
>
> I'll be refactoring autoCompleteDojo() in the coming week to allow
> passing Zend_Dojo_Data objects, as well as to consume Zend_Dojo_Data to
> create the payload when other types are passed to it.
>
> > I m getting a well formated json file but complicated :
> > {"identifier":"name",
> > "items":  [{
> > "label": {"id":"1","produit":"pomme"},
> > "name": {"id":"1","produit":"pomme"}
> > },{
> > "label": {"id":"2","produit":"orange"},
> > "name": {"id":"2","produit":"orange"}
> > }]}
> >
> > I'd prefer and "dojo.data.ItemFileReadStore" too, a simpler json like :
> > {"identifier": "name",
> > "items": [{
> > "label":"pomme",
> > "name":"pomme"
> > },{
> > "label":"orange",
> > "name":"orange"}
> > }]}
> >
> > fyi, this is the schema SQL :
> > CREATE TABLE `catalogue` (
> >   `id` int(11) NOT NULL auto_increment,
> >   `produit` varchar(100) NOT NULL,
> >   PRIMARY KEY  (`id`) );
> >
> > FT.
> >
>
> --
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend Framework   | http://framework.zend.com/
>
>


-- 
Cory Wiles
[EMAIL PROTECTED]
http://www.corywiles.com
http://www.400mtogo.com


Re: [fw-general] Why haven't you reviewed the Zend_Tool proposals?

2008-07-03 Thread Rob Allen


On 3 Jul 2008, at 14:00, Pádraic Brady wrote:

I was wondering - where is Ralph's blog? Usually I'd expect to see a  
few posts somewhere introducing and throwing out updates on this  
sort of thing. With the little information publicly available, being  
unaware there even is a Zend_Tool project isn't surprising.



I didn't realise there was any code outside of Ralph's local machine  
tbh.



Regards,


Rob...

Re: [fw-general] Why haven't you reviewed the Zend_Tool proposals?

2008-07-03 Thread Laurent Melmoux
It is a big piece, so my guess is that the day to day developer will 
have to invest more time to review it because is not familiar with the 
architecture behind this kind of tools (at list this is my case) compare 
to MVC. And as it is a productivity tools and not a vital component that 
he realy need to develop his app like Zend_Form or Zend_View enhanced , 
Zend_Tool get  "less interest". $0.2 :)


So as Paddy said more stuff demonstrating the proposals will be good.

Regards,
Laurent

--
Laurent Melmoux
Conseil et Solutions Web | [EMAIL PROTECTED]
2mx - Annecy, France | http://www.2mx.fr/




Pádraic Brady a écrit :
Part of the problem may be lack of publicity - I haven't seen anything 
advocating or demonstrating the proposals outside of infrequent 
mentions on the mailing list. While the mailing lists are great they 
aren't the best forum to grab the attention of everyone who's not a 
mail machine. I will play around with the stuff already committed over 
the weekend. Publicity aside, folk can only blame themselves when it 
reaches Core without comments ;). It really is one of those features 
that bind up, package and present the concept of "build an 
application" allowing developer's skip at least some of the head 
wrecking repetition and uncertainty you have when your first and only 
applicaton file is a lonely "

I was wondering - where is Ralph's blog? Usually I'd expect to see a 
few posts somewhere introducing and throwing out updates on this sort 
of thing. With the little information publicly available, being 
unaware there even is a Zend_Tool project isn't surprising.


Best regards,
Paddy
 
Pádraic Brady


http://blog.astrumfutura.com
http://www.patternsforphp.com
OpenID Europe Foundation 


- Original Message 
From: Wil Sinclair <[EMAIL PROTECTED]>
To: Bill Karwin <[EMAIL PROTECTED]>; fw-general@lists.zend.com
Sent: Thursday, July 3, 2008 6:40:32 AM
Subject: RE: [fw-general] Why haven't you reviewed the Zend_Tool 
proposals?


Hey Bill- this is just the feedback we need. I'm embarrassed to admit
that I had them bookmarked and hadn't noticed that they were still in
"New". I agree with you that "New" is where they should be, but- as you
well know- this is a large initiative that Ralph could use some help
with even before presenting class skeletons. That said, I also mentioned
that we *really* need use cases in my comments; Ralph, it's clear that's
our top priority here.
I would like to stress that both Ralph and I feel that we need
continuous community feedback during the process of bring these
proposals to a first draft state. Ralph has taken on a monumental task;
it's somewhat analogous to creating our entire MVC implementation in one
go. I guess I should have made it clearer that these proposals are
exceptional in that regard; please do *not* wait to give your feedback
until they've been fully polished up. Ralph needs all the feedback he
can get right now.

Thanks.
,Wil

> -Original Message-
> From: Bill Karwin [mailto:[EMAIL PROTECTED] ]
> Sent: Wednesday, July 02, 2008 4:49 PM
> To: fw-general@lists.zend.com 
> Subject: Re: [fw-general] Why haven't you reviewed the Zend_Tool
> proposals?
>
>
>
> wllm wrote:
> >
> > Why haven't you reviewed the Zend_Tool proposals?
> >
>
> Well, the first thing I notice is that the proposals aren't filed
under
> "Ready for Review!"
>
> They're filed under "New", which is honestly where they should be at
> this
> stage, because the proposals are far from complete.
>
> Zend_Tool_CodeGenerator:
> - nothing written under Requirements and Acceptance Criteria (only
that
> it
> should use Zend_Reflection, which is an implementation detail, not a
> requirement)
> - nothing written under Use Cases
> - nothing written under Class Skeletons
>
> Zend_Tool_Project:
> - only two lines under Requirements and Acceptance Criteria
> - only one Use Case written
> - nothing written under Class Skeletons
>
> Zend_Tool_Rpc:
> - only four lines under Requirements and Acceptance Criteria (two of
> which
> are "will not" exclusions)
> - nothing written under Use Cases
> - nothing written under Class Skeletons
>
> Regards,
> Bill Karwin
> --
> View this message in context: http://www.nabble.com/Why-haven%27t-you-
> reviewed-the-Zend_Tool-proposals--tp18221384p18249243.html
> Sent from the Zend Framework mailing list archive at Nabble.com 
.







AW: AW: [fw-general] Re: sql lower encoding

2008-07-03 Thread Stefan Gehrig
Hi Anders,

yes it is... Actually it's not very nice, but it works.

[database]
adapter = Pdo_Mysql
params.host = localhost
params.username = user
params.password = pa$$w0rd
params.dbname = dbname
params.driver_options.1002 = "SET NAMES utf8"

1002 is the value of the PDO::MYSQL_ATTR_INIT_COMMAND constant.

Best regards

Stefan


-Ursprüngliche Nachricht-
Von: Anders Gunnarsson [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 27. Juni 2008 13:36
An: fw-general@lists.zend.com
Betreff: Re: AW: [fw-general] Re: sql lower encoding

Okey, thanks.

Is it also possible to do this using a config.ini file?




Stefan Gehrig wrote:
> Hi Anders,
>
> you can use the following to create the adapter if you're using the
> PDO-adapters:
>
> $db=Zend_Db::factory('Pdo_Mysql', array(
>   'host'   => 'localhost',
>   'username'   => 'user',
>   'password'   => 'pa$$w0rd',
>   'dbname' => 'database',
>   'driver_options' => array(
>   PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
>   )
> ));
>
> This ensures that the SET-NAMES-Command is issued with every reconnect of
> the underlying adapter.
>
> Best regards
>
> Stefan
>
> -Ursprüngliche Nachricht-
> Von: Anders Gunnarsson [mailto:[EMAIL PROTECTED] 
> Gesendet: Freitag, 27. Juni 2008 09:10
> An: fw-general@lists.zend.com
> Betreff: Re: [fw-general] Re: sql lower encoding
>
> The encoding problems ended when setting
> $this->query('SET NAMES utf8');
> at both insert and select.
>
> Is there a better way to do this? At db-connection time?
>
>
>
>
> Johannes Schill wrote:
>   
>> If you're inserting with a form, you can always try adding 
>> accept-charset="UTF-8" on your form-tag.
>>
>> Johannes 
>>
>>
>> 2008/6/26, Anders Gunnarsson <[EMAIL PROTECTED] 
>> >:
>>
>> I found out that my problem must be on inserting.
>>
>> How can I be sure that I'm inserting with utf8?
>>
>> If I insert ÅÄÖ in phpmyadmin, they are inserted correctly,
>> but not when inserting from my own forms.
>>
>> I've tried
>> $this->query('SET NAMES utf8');
>> before inserting, but it doesn't seem to help.
>>
>> can I use config.ini to specify utf8?
>> and would that help?
>>
>> regards
>> Anders
>>
>>
>> Anders Gunnarsson wrote:
>>
>> Hi!
>>
>> I'm doing a SQL LIKE() with non-western characters.
>>
>> SELECT * FROM users WHERE LOWER(userName) LIKE '%'.
>> mb_strtolower($searchStr, mb_detect_encoding($searchStr)) .'%'
>>
>> The php is converting the characters right,
>> but the SQL isn't.
>>
>> I'm using mysql 5.0.38
>> and utf8_unicode_ci
>>
>> Maybe somebody has an other sollution to searching
>> case-insensitive with non-western characters?
>>
>>
>>
>> 
>
>
>   



[fw-general] Re: [fw-mvc] dojo.data component

2008-07-03 Thread Fabrice Terrasson
Matthew Weier O'Phinney a écrit :
> -- Fabrice Terrasson <[EMAIL PROTECTED]> wrote
> (on Wednesday, 02 July 2008, 06:33 PM +0200):
>   
> 
>   

> Well, you've got one big problem here: autoCompleteDojo() isn't yet
> wrapping Zend_Dojo_Data, so you'll get an inaccurate and invalid
> structure as you show below.
>
> For now, until I refactor autoCompleteDojo(), do this in your action
> instead:
>
>
> $this->_helper->viewRenderer->setNoRender(true);
> $this->_helper->layout->disableLayout(true);
> $response = $this->getResponse();
> $response->setHeader('Content-Type', 'application/json')
>  ->setBody($f->toJson());
>
> I'll be refactoring autoCompleteDojo() in the coming week to allow
> passing Zend_Dojo_Data objects, as well as to consume Zend_Dojo_Data to
> create the payload when other types are passed to it.
>
>   
I was confused by this helper :)

Thanks for your help !
dojo.data.ItemFileReadStore  seems to accept by default json like:
{"identifier":"produit",
"items":[
{"id":"1","produit":"pomme"},
{"id":"2","produit":"orange"},
{"id":"3","produit":"poire"},
{"id":"4","produit":"abricot"}
]}
(each item in curly brackets).

Zend_Dojo_Data->toJson() returns a json like:
{"identifier":"produit",
"items":{
"pomme":{"id":"1","produit":"pomme"},
"orange":{"id":"2","produit":"orange"},
"poire":{"id":"3","produit":"poire"},
"abricot":{"id":"4","produit":"abricot"}
}}
(no simple bracket around items [ ] and a sole value facing item)
and the dojo store (dojo.data.ItemFileReadStore) is empty.

bypassing Zend_Dojo_Data like that, fill the dojo store correctly :

$p= new Catalogue();
$rows= $p->fetchAll()->toArray();
 
/*
$f= new Zend_Dojo_Data();  
$f->setIdentifier('produit');
$f->addItems( $rows );  
*/
   
  $array = array(
'identifier' => 'produit',
'items'  => $rows,
);

$f= Zend_Json::encode( $array );
// context is json
$this->getResponse()->setBody( $f );

I am using firebug to watch the json Response + aol cdn (
$this->dojo->enable() ).

FT


Re: [fw-general] Why haven't you reviewed the Zend_Tool proposals?

2008-07-03 Thread Pádraic Brady
Part of the problem may be lack of publicity - I haven't seen anything 
advocating or demonstrating the proposals outside of infrequent mentions on the 
mailing list. While the mailing lists are great they aren't the best forum to 
grab the attention of everyone who's not a mail machine. I will play around 
with the stuff already committed over the weekend. Publicity aside, folk can 
only blame themselves when it reaches Core without comments ;). It really is 
one of those features that bind up, package and present the concept of "build 
an application" allowing developer's skip at least some of the head wrecking 
repetition and uncertainty you have when your first and only applicaton file is 
a lonely "http://blog.astrumfutura.com
http://www.patternsforphp.com
OpenID Europe Foundation




- Original Message 
From: Wil Sinclair <[EMAIL PROTECTED]>
To: Bill Karwin <[EMAIL PROTECTED]>; fw-general@lists.zend.com
Sent: Thursday, July 3, 2008 6:40:32 AM
Subject: RE: [fw-general] Why haven't you reviewed the Zend_Tool proposals?

Hey Bill- this is just the feedback we need. I'm embarrassed to admit
that I had them bookmarked and hadn't noticed that they were still in
"New". I agree with you that "New" is where they should be, but- as you
well know- this is a large initiative that Ralph could use some help
with even before presenting class skeletons. That said, I also mentioned
that we *really* need use cases in my comments; Ralph, it's clear that's
our top priority here.
I would like to stress that both Ralph and I feel that we need
continuous community feedback during the process of bring these
proposals to a first draft state. Ralph has taken on a monumental task;
it's somewhat analogous to creating our entire MVC implementation in one
go. I guess I should have made it clearer that these proposals are
exceptional in that regard; please do *not* wait to give your feedback
until they've been fully polished up. Ralph needs all the feedback he
can get right now.

Thanks.
,Wil

> -Original Message-
> From: Bill Karwin [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 02, 2008 4:49 PM
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Why haven't you reviewed the Zend_Tool
> proposals?
> 
> 
> 
> wllm wrote:
> >
> > Why haven't you reviewed the Zend_Tool proposals?
> >
> 
> Well, the first thing I notice is that the proposals aren't filed
under
> "Ready for Review!"
> 
> They're filed under "New", which is honestly where they should be at
> this
> stage, because the proposals are far from complete.
> 
> Zend_Tool_CodeGenerator:
> - nothing written under Requirements and Acceptance Criteria (only
that
> it
> should use Zend_Reflection, which is an implementation detail, not a
> requirement)
> - nothing written under Use Cases
> - nothing written under Class Skeletons
> 
> Zend_Tool_Project:
> - only two lines under Requirements and Acceptance Criteria
> - only one Use Case written
> - nothing written under Class Skeletons
> 
> Zend_Tool_Rpc:
> - only four lines under Requirements and Acceptance Criteria (two of
> which
> are "will not" exclusions)
> - nothing written under Use Cases
> - nothing written under Class Skeletons
> 
> Regards,
> Bill Karwin
> --
> View this message in context: http://www.nabble.com/Why-haven%27t-you-
> reviewed-the-Zend_Tool-proposals--tp18221384p18249243.html
> Sent from the Zend Framework mailing list archive at Nabble.com.

Re: [fw-general] XML-RPC startup

2008-07-03 Thread Matthew Weier O'Phinney
-- Ahmed Abdel-Aliem <[EMAIL PROTECTED]> wrote
(on Thursday, 03 July 2008, 03:14 PM +0300):
> Hi all,
> 
> i am trying to make a simple web service using XML-RPC to return the time 
> stamp
> 
> i am putting  the server in the index controller :
> 
> ---
> require_once 'Zend/XmlRpc/Server.php';
> 
> function theTime(){
> return time();
> }

First problem spotted. The above needs a docblock that minimally details
the return type:

/**
 * Return current timestamp
 *
 * @return int
 */
function theTime()
{
return time();
}


> $server = new Zend_XmlRpc_Server();
> $server->addFunction('theTime');
> echo $server->handle();

Second, make sure you have display_errors off in your servers script:

ini_set('display_errors', false);

This should be at the top of your script.

If you still have issues after making those changes, write back to the
list.

> ---
> 
> and the client in request controller :
> 
> ---
> require_once 'Zend/XmlRpc/Client.php';
> 
> try{
> $client = new Zend_XmlRpc_Client('http://me2resh/services/html/
> Index');
>
> echo $client->call('theTime');
> }catch (Zend_XmlRpc_Client_FaultException $e){
> echo $e->getMessage();
> }
> ---
> 
> when i do this i get the following error :
> 
> Failed to parse response
> 
> what could be wrong here ?
> 
> 
> 
> --
> Ahmed Abdel-Aliem

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


RE: [fw-general] XML-RPC startup

2008-07-03 Thread Robert Castley
 
Try the following:

In your controller put something like:

class XmlRpcController extends Zend_Controller_Action
{
/**
 * Index
 *
 * @return void
 */
public function indexAction()
{
$this->_helper->viewRenderer->setNoRender();

$cacheFile = CACHE . DS . 'xmlrpc.cache';

$server = new Zend_XmlRpc_Server();

if (!Zend_XmlRpc_Server_Cache::get($cacheFile, $server)) {
$server->setClass('Time', 'time');
Zend_XmlRpc_Server_Cache::save($cacheFile, $server);
}

echo $server->handle();

//$getRequest  = $server->getRequest()->saveXML();
//$getResponse = $server->handle()->saveXML();
//echo 'Request: ' . $getRequest;
//echo 'Response: ' . $getResponse;
}
}


Uncomment the last for lines for debugging.

Then in your library directory create a file called Time.php

class Time
{
/**
 * Time
 * @return int
 */
function getTime()
{
return $time();
}
}


You would then make an xmlrpc call to the method time.getTime



- Robert


From: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED] 
Sent: 03 July 2008 13:42
To: Robert Castley
Subject: Re: [fw-general] XML-RPC startup


i added it and still getting the same error 

here is how my code is now :

i am putting  the server in the index controller :


-
require_once 'Zend/XmlRpc/Server.php';

/**
 * @return int 
 */
function theTime(){
return time();
}

$server = new Zend_XmlRpc_Server();
$server->addFunction('theTime');
echo $server->handle();
---

and the client in request controller :

---
require_once 'Zend/XmlRpc/Client.php';

try{
$client = new
Zend_XmlRpc_Client('http://me2resh/services/html/Index'
 );

echo $client->call('theTime');
}catch (Zend_XmlRpc_Client_FaultException $e){
echo $e->getMessage();
}
---

when i do this i get the following error :

Failed to parse response 



On Thu, Jul 3, 2008 at 3:26 PM, Robert Castley <[EMAIL PROTECTED]>
wrote:


You need to add phpdoc info about your function e.g.
 

/** 

* Get time

* @return string

*/




From: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED] 
Sent: 03 July 2008 13:15
To: fw-general@lists.zend.com
Subject: [fw-general] XML-RPC startup


Hi all,

i am trying to make a simple web service using XML-RPC to return the
time stamp

i am putting  the server in the index controller :

---
require_once 'Zend/XmlRpc/Server.php';

function theTime(){
return time();
}

$server = new Zend_XmlRpc_Server();
$server->addFunction('theTime');
echo $server->handle();
---

and the client in request controller :

---
require_once 'Zend/XmlRpc/Client.php';

try{
$client = new
Zend_XmlRpc_Client('http://me2resh/services/html/Index'
 );

echo $client->call('theTime');
}catch (Zend_XmlRpc_Client_FaultException $e){
echo $e->getMessage();
}
---

when i do this i get the following error :

Failed to parse response 

what could be wrong here ?



-- 
Ahmed Abdel-Aliem 



This email has been scanned for all known viruses by the MessageLabs
Email Security Service and the Macro 4 plc internal virus protection system.





This email has been scanned for all known viruses by the MessageLabs
Email Security Service and the Macro 4 plc internal virus protection system.







-- 
Ahmed Abdel-Aliem 

This email has been scanned for all k

RE: [fw-general] XML-RPC startup

2008-07-03 Thread Robert Castley
You need to add phpdoc info about your function e.g.
 
/**

* Get time

* @return string

*/


  _  

From: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED] 
Sent: 03 July 2008 13:15
To: fw-general@lists.zend.com
Subject: [fw-general] XML-RPC startup


Hi all,

i am trying to make a simple web service using XML-RPC to return the time
stamp

i am putting  the server in the index controller :

---
require_once 'Zend/XmlRpc/Server.php';

function theTime(){
return time();
}

$server = new Zend_XmlRpc_Server();
$server->addFunction('theTime');
echo $server->handle();
---

and the client in request controller :

---
require_once 'Zend/XmlRpc/Client.php';

try{
$client = new
Zend_XmlRpc_Client('http://me2resh/services/html/Index'
 );

echo $client->call('theTime');
}catch (Zend_XmlRpc_Client_FaultException $e){
echo $e->getMessage();
}
---

when i do this i get the following error :

Failed to parse response 

what could be wrong here ?



-- 
Ahmed Abdel-Aliem 

This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.





This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


Re: [fw-general] Setting up controllers for common vars etc

2008-07-03 Thread Carlton Gibson


On 3 Jul 2008, at 12:51, AJ McKee wrote:

I have several Controllers that all do various things. However there
are common things I wish them all to do. Mostly just set up vars for
ease of use. Eample

protected $_myRegistry = null;
protected $_myDebug = false;

public function init()
{
$this->_myRegistry = $this->_registry =  
Zend_Registry::getInstance();

%this->_myDebug = $this->_myRegistry->get('debug');
}

I am trying to apply the principle of DRY here, because as the
application grows, I am repeating myself more and more.



Does anyone have any pointers to me about how I would accomplish this,
if its possible.


Hi AJ,

One thing you **could do** is extend Zend_Controller_Action in order  
to override the constructor.


(You then have your application controllers extend from that).

The key thing is to call parent::_construct() which runs init() as  
its last action. Also you can't access things like $this->getRequest 
() until after you've done so (however they are already in scope so  
you may not want to...)


I use this approach myself for loading module include paths. In  
general though I'd want to avoid loading too much into the controller  
this way as plugins and action helpers are more flexible in the main.


(Note to self: move module include path stuff to a plugin! :-)

I hope this helps.

regards,
Carlton


Re: [fw-general] Setting up controllers for common vars etc

2008-07-03 Thread Matthew Weier O'Phinney
-- AJ McKee <[EMAIL PROTECTED]> wrote
(on Thursday, 03 July 2008, 12:51 PM +0100):
> Please excuse my ignorance here.
> 
> I have several Controllers that all do various things. However there
> are common things I wish them all to do. Mostly just set up vars for
> ease of use. Eample
> 
> protected $_myRegistry = null;
> protected $_myDebug = false;
> 
> public function init()
> {
> $this->_myRegistry = $this->_registry = Zend_Registry::getInstance();
> %this->_myDebug = $this->_myRegistry->get('debug');
> }
> 
> I am trying to apply the principle of DRY here, because as the
> application grows, I am repeating myself more and more.
> 
> I created an action plugin thinking I was on the right track, however
> I discovered I was not. Basically, I want all this stuff setup before
> my controller is called, but have it available to my controller in a
> manner similar to $this->_myRegistry. Or would I best be doing this in
> an action helper?

Action Helper is the way to go here. An action helper has introspection
into the action controller, and its primary purpose is to push all those
bits of code you need to re-use to a common place so that they can be
used on-demand by any controller.

Additionally, you can have action helpers listen on controller
intialization and pre/postDispatch() events; this can be useful for
injecting variables into your action controllers. The variables will
need to be public, obviously, but there are very few cases where this
should be an issue.

> Does anyone have any pointers to me about how I would accomplish this,
> if its possible.

I've written a tutorial on action helpers on DevZone:

http://devzone.zend.com/article/3350-Action-Helpers-in-Zend-Framework

that should serve as a good starting point.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


[fw-general] XML-RPC startup

2008-07-03 Thread Ahmed Abdel-Aliem
Hi all,

i am trying to make a simple web service using XML-RPC to return the time
stamp

i am putting  the server in the index controller :

---
require_once 'Zend/XmlRpc/Server.php';

function theTime(){
return time();
}

$server = new Zend_XmlRpc_Server();
$server->addFunction('theTime');
echo $server->handle();
---

and the client in request controller :

---
require_once 'Zend/XmlRpc/Client.php';

try{
$client = new Zend_XmlRpc_Client('
http://me2resh/services/html/Index');

echo $client->call('theTime');
}catch (Zend_XmlRpc_Client_FaultException $e){
echo $e->getMessage();
}
---

when i do this i get the following error :

Failed to parse response

what could be wrong here ?



-- 
Ahmed Abdel-Aliem


Re: [fw-general] SOAP support

2008-07-03 Thread Ionut Gabriel Stan
I took a look at this package, especially Zend_Soap_Client as right now I'm 
involved in developing some SOAP consumers.
Before I go any further I should mention that these are my first SOAP projects 
so I'm not that versed in this field.
So... in my opinion and at this moment I see no real benefit in using 
Zend_Soap_Client over PHP's builtin SoapClient class.


1. Problems I see so far:

Matthew once said that a Zend_Soap_Client should be a wrapper for SoapClient, 
which more or less will get all the options that one
can pass to SoapClient constructor and provide them getters and setters, 
basically giving them ZF-like interfaces.

   a) First problem: Zend_Soap_Client does that but only partially and is 
not sticking to a common interface.
For example, in Zend I can't toggle the value of the *trace* options. I 
understand this is because
Zend has two methods that count on this: getLastRequest and 
getLastResponse, but I assume tracing
requests and responses adds a little bit of overhead that one might 
want to avoid in production. Then, why
do we have these two methods but not getLastRequestHeaders and 
getLastResponseHeaders?
Again, altghough we don't have them, the presence of the __call magic 
method inside Zend makes the two reachable.
There are missing options, like stream_context, features, cache_wsdl, 
user_agent and typemap.
There is getFunctions() but not getTypes().
If I can't have access to all these options, then at least give me 
access  to the internal SoapClient

About the common interface, some of the options can be set by using 
setters, some only in bulk mode, by passing them
to the constructor or to setOptions().
For some of the options there is possibility for exceptions, although 
in cases where
I don't see that much need for such a strict check (Ex: setEncoding 
checks if the passed parameter is a string).  On the
other hand, other string options do not get this treatment.
Options names should be standardized. setOptions() allows me both 
soapVersion and soap_version, while getOptions only
returns soap_version.

b) A big problem of SoapClient, in my opinion, is that I can't change the 
values of the different supported options between consecutive calls.
It's a function with lots of parameters in disguise of a class.
It would be nice if Zend could do this, although I'm not so sure how 
useful this might be.
One way to do this is that, at every call to a remote service, the soap 
object to be reinitialized. Another one I see is to
use __soapCall() every time a call is made, but this is harder or 
impossible in WSDL mode.

c) The *biggest* problem of SoapClient is that it doesn't give me access to 
the *real* raw DOM. Not even with getLastResponse()
and getLastRequest() or __doRequest(). Why am I stressing the word 
real? Because, a few days ago, I noticed that any request I
made with SoapClient to a specific WS returned null and 
getLastResponse() returned... some sort of XML.
After scratching my head, reading docs on the php.net manual and even 
PHP source code,
I finally noticed that our partners sent us the return value of the 
method wrapped inside a CDATA element...
How does SoapClient treats that? It encodes special characters inside 
CDATA, ex: <, >, & becomes < > &.
While this might be correct (or not), because I'm sure returning the 
whole response inside CDATA certainly isn't, it doesn't help me.
So, Zend should offer access to the real DOM if it wants to be a useful 
and extensible library that can overcome any situation out there.


2. Suggestions I have so far:

 a) Until ext/Soap gets better Zend_Soap_Client should be a factory for a 
Zend_Soap_Client_Builtin and a Zend_Soap_Client_Raw, where
 Builtin in is the wrapper for SoapClient and Raw uses Zend_Http_Client 
for sending and receiving data. A Zend_Soap_Client_Raw should
 be very simple, in that it should provide the general message skeleton 
(Envelope + HTTP headers)  and ways to inject
 payloads (Header, Body, Fault?) inside it, where a payload could  be 
an xml string or a
 DOMDocument/DOMNode/DOMElement/DOMDocumentFragment/SimpleXMLElement 
object. It should also be able to
 schema validate the message before sending a request and it should 
support compression.
 b) You should focus more on argument passing and return values. At this 
moment, with SoapClient things get a little bit messy
 when passing or getting complex types.
 Some of the people have no idea how to set attributes for different 
XML tags with the current API of SoapClient,
 and it's ok, because it's counter intuitive and sometimes impossible.
 I feel better diving into the DOM API than what we have so far inside 
ext/Soap.


Well, that's what I have t

[fw-general] Setting up controllers for common vars etc

2008-07-03 Thread AJ McKee
Hi All,

Please excuse my ignorance here.

I have several Controllers that all do various things. However there
are common things I wish them all to do. Mostly just set up vars for
ease of use. Eample

protected $_myRegistry = null;
protected $_myDebug = false;

public function init()
{
$this->_myRegistry = $this->_registry = Zend_Registry::getInstance();
%this->_myDebug = $this->_myRegistry->get('debug');
}

I am trying to apply the principle of DRY here, because as the
application grows, I am repeating myself more and more.

I created an action plugin thinking I was on the right track, however
I discovered I was not. Basically, I want all this stuff setup before
my controller is called, but have it available to my controller in a
manner similar to $this->_myRegistry. Or would I best be doing this in
an action helper?

Does anyone have any pointers to me about how I would accomplish this,
if its possible.

Thanks in advance
AJ


[fw-general] Cannot get last insert id on mysqli

2008-07-03 Thread Xavier Vidal Piera
Can anybody test this issue in his machine?

Thanks


The table definition:

idmessage int (primary key, autoincrement (serial in PostgreSQL))
iduser int
message varchar(255)

I'm testing now in PostgreSQL and it works fine, maybe is something related
to MySQL?

On Thu, Jun 19, 2008 at 5:43 AM, Xavier Vidal Piera
<[EMAIL 
PROTECTED]>
wrote:

> Hi
>
> When i do a manual insert i can get the last insert id:
>
> /* Primary key: "idmessage", with auto_increment */
> $sql = "INSERT INTO messages (iduser, message) VALUES (?, ?)";
> $binds = array(1, 'test');
> $db->query($sql, $binds);
> echo $db->lastInsertId('messages'); // works
>
> But when i use Zend_Db_Table the last insert id is always is zero:
>
> $mMessages = new Model_Messages();
> $row = $mMessages->createRow();
> $row->iduser  = 1;
> $row->message = 'test message';
> $row->save();
>
> And this exception is shown : *"Cannot refresh row as parent is 
> missing"*because the "save" method is trying to refresh the row from the 
> database but
> with no ID is unable to get the row.
>
> Any clue?
>
> --
> Xavier Vidal Piera
> Enginyer Tècnic Informàtic de Gestió
> Tècnic Especialista Informàtic d'equips
> [EMAIL 
> PROTECTED]
> [EMAIL 
> PROTECTED]
> http://web.xaviervidal.net
> 610.68.41.78


[fw-general] confirmation with zend_form?

2008-07-03 Thread Michał Zieliński

After submiting form with data and before it`s saved sometimes it is usefull
to offer user a chance to confirm sending data. How it should be done?

Should I use subform for this or just another param checking if it is not
only sent but also confirmed.
I`m not sure if this case is right for use subform (assuming only one form
to be confirmed).

Thanks in advance for advice :)
-- 
View this message in context: 
http://www.nabble.com/confirmation-with-zend_form--tp18252836p18252836.html
Sent from the Zend Framework mailing list archive at Nabble.com.