Re: [fw-general] implementation of Zend_Pdf_Action_JavaScript

2011-03-11 Thread Guillaume ORIOL
Though my first intention was less ambitious, I understand the need to add this feature as part of a 
subcomponent (that could be named Zend_Pdf_Form). As this is something I am interested in, I just 
wrote a very first draft of this proposal. I will complete it next week.


See http://framework.zend.com/wiki/display/ZFPROP/Zend_Pdf_Form

Regarding ZF2, I think it is not enough stable to be target at it.

Regards
--
Guillaume

Le 10/03/11 18:26, Alexander Veremyev a écrit :

JavaScript action implementation is not too large, but powerful feature. 
However, I think, it should
be added with other PDF forms related actions 
(submit-form/reset-form/import-data) which, in turn,
should be added after PDF forms support.

Other choice is to define and confirm Zend_Pdf forms support and forms actions 
API using
corresponding ZF 2.0 proposal and implement and "backport" JavaScript action 
feature into 1.x
That should guarantee a consistency and completeness of PDF forms support API 
for the future and
could give an ability to add JavaScript action support right now (include into 
the next mini-release).

Best regards,
Alexander Veremyev.

On 10.03.2011 19:27, Matthew Weier O'Phinney wrote:

-- Guillaume ORIOL wrote
(on Thursday, 10 March 2011, 04:36 PM +0100):

Zend_Pdf lacks implementation of some interactive features. I was
specifically looking for the *JavaScript action* of those features.
My need was related to the ability to open the print dialog box
automatically when the document is opened (displayed on the client
browser).

I wrote an implementation of the empty class
Zend_Pdf_Action_JavaScript that I would like to contribute to this
community.

Therefore, I just sent a signed CLA for it and I would like to know the next 
step.

This would be considered a new feature, and as such needs a formal
proposal. Also, new features at this point should generally be targetted
at ZF 2.0.

For proposal information:

* http://framework.zend.com/wiki/display/ZFPROP/Proposal+Process







[fw-general] implementation of Zend_Pdf_Action_JavaScript

2011-03-10 Thread Guillaume ORIOL

Dear Zend Framework community,

Zend_Pdf lacks implementation of some interactive features. I was specifically looking for the 
*JavaScript action* of those features. My need was related to the ability to open the print dialog 
box automatically when the document is opened (displayed on the client browser).


I wrote an implementation of the empty class Zend_Pdf_Action_JavaScript that I would like to 
contribute to this community.


Therefore, I just sent a signed CLA for it and I would like to know the next 
step.
--
Guillaume ORIOL
Software engineer
Technema


[fw-general] wrong 'type' attribute in SimpleTextarea

2011-03-08 Thread Guillaume ORIOL

Dear Zend framework community,

I just noticed the Zend_Dojo_Form_Element_SimpleTextarea element is not properly rendered by its 
view helper.
A 'type' attribute is added in contradiction with the HTML 4 specification 
(http://www.w3.org/TR/html4/interact/forms.html#edef-TEXTAREA).


I would suggest removing the commented line in the following code from the view helper 
(Zend_Dojo_View_Helper_SimpleTextarea):


public function simpleTextarea($id, $value = null, array $params = array(), array $attribs = 
array())

{
if (!array_key_exists('id', $attribs)) {
$attribs['id']= $id;
}
$attribs['name']  = $id;
$attribs['type']  = $this->_elementType; // <= REMOVE THIS LINE

$attribs = $this->_prepareDijit($attribs, $params, 'textarea');

$html = '_htmlAttribs($attribs) . '>'
  . $this->view->escape($value)
  . "\n";

return $html;
}

Regards
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] Re: adding a REST route chained with another route

2011-03-04 Thread Guillaume ORIOL

Le 02/03/11 21:39, nebiros a écrit :

Hey,

I was reading a devzone post: http://devzone.zend.com/article/12381 and
somebody post a comment about how to prepend something to the default
routes, in your case the account, in my case the region, so I wrote this in
my application.ini file:

resources.router.routes.module.type = "Zend_Controller_Router_Route_Module"
resources.router.routes.region.type = "Zend_Controller_Router_Route"
resources.router.routes.region.route = ":region"
resources.router.routes.region.reqs.region = "[a-z]{2}"
resources.router.routes.region.abstract = 1
resources.router.routes.default.type = "Zend_Controller_Router_Route_Chain"
resources.router.routes.default.chain = "region, module"

So all urls look this way: /:region/:module/:controller/:action

Maybe this can help you.

--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/adding-a-REST-route-chained-with-another-route-tp3297415p3332254.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Hi nebiros,

Correct me if I am wrong but your configuration file shows how to chain a 
Zend_Controller_Router_Route to a Zend_Controller_Router_Route_Module.


The problem I describe is that the :region variable will be removed from the request if you have two 
subsequent routes to test and the first one doesn't match.


Regards
--
Guillaume



Re: [fw-general] Re: adding a REST route chained with another route

2011-02-15 Thread Guillaume ORIOL

Le 12/02/11 12:24, Wil Moore III a écrit :

The first thing you will want to check when attempting to match a rest route
is whether or not you are trying the correct URI.

For example:

This Uri will likely not match via the rest route:
app.domain.com

but based on what I see in your route configuration, the following should
match:
app.domain.com/rest (indexAction)
app.domain.com/rest/id (getAction)
app.domain.com/rest/id/edit (editAction)
app.domain.com/rest/new (newAction)
...

If you want a dynamic  parameter, you'll likely have to chain the
rest route with the hostname route. I don't believe there is a way for the
rest route to match unless the first segment (where you currently have
) corresponds to a module directory.

On the other hand, the default route will look at the first segment, and if
there is no module directory that matches, it will use the default module
and use the first segment as the controller. I am not sure if the rest
router does this as well (I suspect it does but I haven't tested it), but if
it does, you should be able to put your rest controller under your default
module directory to get it to work. If you are having trouble figuring out
how to test this, post back on what you are having trouble with.

BTW, even if the above works, I'm not sure you'll be able to get the name of
the module as it may be replaced by the name of the default module. Again,
I'm not sure so you'll have to test for that.

If none of this works, you may have better luck writing the rest routes from
scratch (means you'll have to manually test for the correct HTTP method).
--
Wil Moore III


Hi Wil and thank you for your extensive reply.

To simplify the problem, I temporarily removed the hostname route. But the 
issue remained.
Let me give you my router configuration:

$defaultRoute = new Zend_Controller_Router_Route(
':account/:module/:controller/:action/*',
array(
'account'=> 'demo',
'module' => 'default',
'controller' => 'index',
'action' => 'index'
),
array('account' => '[a-z0-9]+')
);
$router->addRoute('default', $defaultRoute);

$restRoute = new Zend_Rest_Route($front, array(), array('rest'));
$accountRoute = new Zend_Controller_Router_Route(
':account',
array('account' => 'demo'),
array('account' => '[a-z0-9]+')
);
$router->addRoute('rest', $accountRoute->chain($restRoute));

And consider the following URL:
http://app.domain.com/customer1/default/invoice/index

The 'rest' route will be selected first.
'customer1' will properly be identified by the $accountRoute of the chain as 
the account
and 'default' will not match against the value 'rest' of the $restRoute. Up to 
now, everything is fine.

Then, the 'default' route will be selected. But only the subpath 'default/invoice/index' will be 
passed to it *as the chain consumes the matched part of its child routes* (when they match) and 
never restore them if a subsequent route doesn't match. Hence the parameters identification will be 
erroneous.


Won't you consider this a bug? Am I missing something?
--
Guillaume


[fw-general] different behaviour for different route version

2011-02-10 Thread Guillaume ORIOL

Dear Zend framework users,

Why does the default router (Zend_Controller_Router_Rewrite) use the complete request for some 
routes (Hostname) and only its pathinfo for others (Route, Static, Regex)? It is related to the 
version number (version 1 routes check against pathinfo).


When the router tests a V2 route with a specific parameter and then a V1 route, the parameter has 
been consumed from pathinfo and is no longer available for subsequent routes.


Could somebody give me some explanation of it?
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] Re: adding a REST route chained with another route

2011-02-10 Thread Guillaume ORIOL

Le 10/02/11 11:00, Wil Moore III a écrit :


Since routes are matched in reverse order you will want your least priority
routes to be defined first.
In other words, move your "default" route to the top.
-
--
Wil Moore III

Why is Bottom-posting better than Top-posting:
http://www.caliburn.nl/topposting.html

DO NOT TOP-POST and DO trim your replies:
http://linux.sgms-centre.com/misc/netiquette.php#toppost


Thank you for your reply Wil,

But if I move the 'default' route to the top, won't it match even for REST 
requests?
For instance:
http://app.domain.com//rest//
will match the 'default' route instead of the 'rest' one, I guess.

Let me explain my use case differently. With the current routes, I get the account properly, 
whatever URL is used:

http://.app.domain.com///
or:
http://app.domain.com

Now, I need to configure the routes in order to set a specific module as REST.
How can I do so?
--
Guillaume


[fw-general] adding a REST route chained with another route

2011-02-09 Thread Guillaume ORIOL

Dear Zend Framework users,

In the multi-account application I am working on, a user may access its 
application either by:
http://.app.domain.com///
or:
http://app.domain.com

To do so, I wrote this bootstrap method:

public function _initRoutes()
{
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();

$defaultRoute = new Zend_Controller_Router_Route(
':account/:module/:controller/:action/*',
array(
'account'=> 'demo',
'module' => 'default',
'controller' => 'index',
'action' => 'index'
),
array('account' => '([a-z0-9]+)')
);
$router->addRoute('default', $defaultRoute);

$pathRoute = new Zend_Controller_Router_Route(
':module/:controller/:action/*',
array(
'module' => 'default',
'controller' => 'index',
'action' => 'index'
)
);
$hostnameRoute = new Zend_Controller_Router_Route_Hostname(
':account.app.domain.com',
array('account' => 'demo'),
array('account' => '([a-z0-9]+)')
);
$router->addRoute('hostname', $hostnameRoute->chain($pathRoute));
}

Everything was ok, until I wanted to add a REST route for a whole module named 
"rest".
Adding the following at the end of the function consume the :account parameter that is never 
obtained by the first route :


$restRoute = new Zend_Rest_Route(
$front,
array(),
array('rest')
);
$accountRoute = new Zend_Controller_Router_Route(
':account',
array('account' => 'demo'),
array('account' => '([a-z0-9]+)')
);
$router->addRoute('default', $accountRoute->chain($restRoute));

What is the solution?
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] use of "new" parameter in Zend_Rest_Route

2010-10-07 Thread Guillaume ORIOL

As I use an MVC controller to retrieve the HTML form, I'll use the REST one with the 
"new"
parameter to get the resource initial state.

>>

That is actually not intended. When creating a resource, your application 
should reply with an url
(e.g. location header) where the created resource can be found. You should then 
go and GET the new
resource, not with the "new" param.

Regards
Christian


Hi Christian and thank you for your answer.

The "new" request I was talking about is not intended to create the resource. Instead, it is 
intended to get the default value of the resource, that will be used on client side to populate an 
almost blank form. The user will then complete the form and submit it. At that time, the resource 
will be actually created.


The question you could ask then is: why don't you setup default values on server side before 
rendering the new form? The answer is simple: as Dojo is widely used, the user is able to create 
many resources without refreshing the HTML. And some default values could be changed in the meantime.


Regards
--
Guillaume ORIOL



Re: [fw-general] use of "new" parameter in Zend_Rest_Route

2010-10-04 Thread Guillaume ORIOL

>  Two special parameters are checked when processing requests in 
Zend_Rest_Route:
>  "new" and "edit" (in the match() method).
>
>  What is the purpose of those special GET URI's?
>
>  I would like to use the "new" parameter to get the initial state of
>  a resource and try to figure if it is the right way to do so.

"new" is used to display an HTML form for entering data for a new
resource. The reason it is included is because GET will return a list of
resources; having the "new" parameter will allow you to do a GET request
that gives you that form.

"edit" is similarly for display of a form for updating an existing
resource. In this case, you have an ID, so normally GET would give you
that resource; adding the "edit" parameter allows you to retrieve the
edit form.

Thank you Matthew.

As I use an MVC controller to retrieve the HTML form, I'll use the REST one with the "new" parameter 
to get the resource initial state.

--
Guillaume ORIOL


[fw-general] use of "new" parameter in Zend_Rest_Route

2010-10-04 Thread Guillaume ORIOL

Two special parameters are checked when processing requests in Zend_Rest_Route:
"new" and "edit" (in the match() method).

What is the purpose of those special GET URI's?

I would like to use the "new" parameter to get the initial state of a resource and try to figure if 
it is the right way to do so.


Thanks in advance
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] default value not taken into account when validating a form

2010-08-10 Thread Guillaume ORIOL
Thank you for explaining how Zend_Form is supposed to work. I do better understand the meaning of 
"default value" in this context, but...


...the context where I use it is slightly different than a plain old HTML form. 
Let me explain.

The posted data come from an XHR sent by a dojox.data.JsonRestStore. (The user is able to 
create/edit items directly in the grid.) But the grid represents only a subset of the item 
properties as its width is limited. As a consequence, not all required form elements are sent by the 
XHR. This is not a problem for updates as I can use isValidPartial(). But for inserts, I need to 
complete the posted data with default values: that's why I try to use setDefault().


Le 11/08/10 01:01, Hector Virgen a écrit :

I'm not sure if that's how the "default" value is supposed to work. AFAIK, it 
sets the default value
for the form element when the page is loaded. The user can then overwrite this 
value by editing the
field. If the user empties the field, then I consider that a deliberate attempt 
to submit an empty
string for that field.

Btw, why doesn't that element appear in the post data?

--
Hector Virgen
Sent on my Droid X


On Aug 10, 2010 3:50 PM, "Guillaume ORIOL" mailto:go.li...@technema.fr>> wrote:

No, this is not a hidden field.
I already tried your suggestion with setValue() but it doesn't help.

I was able to trace my problem down to the Zend_Form::isValid() method. For 
each element, this
code block is executed:

   if (!isset($check[$key])) {
   $valid = $element->isValid(null, $context) && $valid;
   } else {
   $valid = $element->isValid($check[$key], $context) && $valid;
   $data = $this->_dissolveArrayUnsetKey($data, $belongsTo, $key);
   }

As you can see, the element is not validated against its (default) value when 
the value doesn't
exist in the posted data.

Le 11/08/10 00:42, Hector Virgen a écrit :

>
> Is it a hidden input? Try this to see if it helps:
>
> $form->getElement('nature')->setValue('co...

>> On Aug 10, 2010 3:38 PM, "Guillaume ORIOL" mailto:go.li...@technema.fr> <mailto:go.li...@technema.fr 
<mailto:go.li...@technema.fr>>>
w...

<mailto:go.li...@technema.fr <mailto:go.li...@technema.fr>> 
<mailto:go.li...@technema.fr
<mailto:go.li...@technema.fr> <mailto:go.li...@technema.fr
<mailto:go.li...@technema.fr>>>> w...



Re: [fw-general] default value not taken into account when validating a form

2010-08-10 Thread Guillaume ORIOL

No, this is not a hidden field.
I already tried your suggestion with setValue() but it doesn't help.

I was able to trace my problem down to the Zend_Form::isValid() method. For each element, this code 
block is executed:


if (!isset($check[$key])) {
$valid = $element->isValid(null, $context) && $valid;
} else {
$valid = $element->isValid($check[$key], $context) && $valid;
$data = $this->_dissolveArrayUnsetKey($data, $belongsTo, $key);
}

As you can see, the element is not validated against its (default) value when the value doesn't 
exist in the posted data.


Le 11/08/10 00:42, Hector Virgen a écrit :

Is it a hidden input? Try this to see if it helps:

$form->getElement('nature')->setValue('consignment');

--
Hector Virgen
Sent on my Droid X


On Aug 10, 2010 3:38 PM, "Guillaume ORIOL" mailto:go.li...@technema.fr>> wrote:

The "nature" element is not filled in by the user.
And the setDefault() is called after the element has been added to the form (as 
this element is
added in the init() method of the form class).

Le 11/08/10 00:30, Hector Virgen a écrit :

>
> When you view the form on the page, is the "nature" element's value 
filled in? Are you calling
>...

>> On Aug 10, 2010 3:17 PM, "Guillaume ORIOL" mailto:go.li...@technema.fr> <mailto:go.li...@technema.fr 
<mailto:go.li...@technema.fr>>> w...



Re: [fw-general] default value not taken into account when validating a form

2010-08-10 Thread Guillaume ORIOL

The "nature" element is not filled in by the user.
And the setDefault() is called after the element has been added to the form (as this element is 
added in the init() method of the form class).


Le 11/08/10 00:30, Hector Virgen a écrit :

When you view the form on the page, is the "nature" element's value filled in? 
Are you calling
setDefault() before or after adding the element to the form?

--
Hector Virgen
Sent on my Droid X


On Aug 10, 2010 3:17 PM, "Guillaume ORIOL" mailto:go.li...@technema.fr>> wrote:

Hi,

I simply don't understand why I can set a default value on a form element if 
this default value is
not taken into account when validating the form???

Here is my controller code:

$form = new My_Form(); // The form defines a element named 'nature' that is 
REQUIRED
$form->setDefault('nature', 'consignment');
...
// Content of the $_POST:
// array(
// 'foo' => 1,
// 'bar' => 2
// )
// NO 'nature' value is posted by the HTML form

if ($request->isPost()) {
   if ($form->isValid($_POST)) {
   // never reached as isValid() fails on 'nature'
   }
}

Any explanation?
--
Guillaume ORIOL
Software engineer
Technema




[fw-general] default value not taken into account when validating a form

2010-08-10 Thread Guillaume ORIOL

Hi,

I simply don't understand why I can set a default value on a form element if this default value is 
not taken into account when validating the form???


Here is my controller code:

$form = new My_Form(); // The form defines a element named 'nature' that is 
REQUIRED
$form->setDefault('nature', 'consignment');
...
// Content of the $_POST:
// array(
//'foo' => 1,
//'bar' => 2
// )
// NO 'nature' value is posted by the HTML form

if ($request->isPost()) {
if ($form->isValid($_POST)) {
    // never reached as isValid() fails on 'nature'
}
}

Any explanation?
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] Release of the ZF + Doctrine 1 Integration

2010-05-26 Thread Guillaume ORIOL

Just had a quick look to your code, Loïc.
Seems great!
Will have an in depth look to it this evening.

I wonder why I could find Symfony-related code in the Zend folder.
I guess the only needed class for Doctrine 2 is 
Zend/Application/Resource/Doctrine2.php

Thanks
--
Guillaume

Le 26/05/10 14:44, Loïc Frering a écrit :

Really great work guys! Can't wait to see that in ZF 1.11 :)

Concerning Doctrine 2 I wrote a simple Application Resource and several
components for integration with ZF (Generic Service and Dao,
scaffolding, integration with Symfony DI Container...).

You can grab my code on my Github:
http://github.com/loicfrering/losolib/blob/master/library/LoSo/.

Regards.

On Wed, May 26, 2010 at 12:27 PM, Guillaume ORIOL mailto:go.li...@technema.fr>> wrote:

Great work!

BTW, did anybody succeed in integrating Zend + Doctrine 2?

Regards
--
Guillaume

Le 24/05/10 19:03, Diego Potapczuk a écrit :

Very good!

I will take a look

::: Diego Potapczuk



On Mon, May 24, 2010 at 1:19 PM, Ralph Schindler
mailto:ralph.schind...@zend.com>
<mailto:ralph.schind...@zend.com
<mailto:ralph.schind...@zend.com>>> wrote:

This is great! Nice work to you and all others involved in
making it
happen!

-ralph


Benjamin Eberlei wrote:

Hello everyone,

I completed a first version of Zend + Doctrine 1 integration
today and
want to share it with all you. Since currently the
status on a 1.11
release is unclear I
contacted all the contributors to various Doctrine-related
components
and combined them into a single release and wrote some
documentation on
all the different parts and how they relate to each other.

http://github.com/beberlei/zf-doctrine

The code is under the New BSD License. There is a
comprehensive
getting
started guide
shipped with the Github Project.

The following parts are included in this release:

* Application Resource contributed by Matt Lurz
* Dynamic Form Generation contributed by Jani Hartikainen
* Paginator Adapter contributed by Matt Lurz and Juozas
Kaziukenas
* Zend Tool Provider and modular Zend Project Style Support

Thanks to all the contributors and various other people that
contributed
ideas and code.

For any feedback regarding this integration, you can use
the issue tracker on Github.

This release depends on Doctrine 1.2.2 to allow model
code-generation
from YAML files that supports Zend Framework Modular
projects
and their
directory structure.

Most of the current glue code out there is made obsolete by
generating
Models that follow the Zend Framework naming
conventions, into Zend
Framework models/ directories. Additionally there is also
support for
modular applications whose model classes should follow
the PEAR
naming
schema.

Additionally the dynamic form support allows to create
simple
forms that
allow to create and edit Doctrine_Record instances and their
relations. This is a great help to rapidly prototype
admin forms
(however support
for more complex forms is not yet included).

Since both projects are currently very focused on their 2.0
releases,
this release aims to glue all the existing code for
Doctrine 1.x and
Zend Framework integration 1.x together, giving them a
platform to
flourish.

greetings,
Benjamin





--
Loïc Frering
loic.frer...@gmail.com <mailto:loic.frer...@gmail.com>


Re: [fw-general] Release of the ZF + Doctrine 1 Integration

2010-05-26 Thread Guillaume ORIOL

Great work!

BTW, did anybody succeed in integrating Zend + Doctrine 2?

Regards
--
Guillaume

Le 24/05/10 19:03, Diego Potapczuk a écrit :

Very good!

I will take a look

::: Diego Potapczuk



On Mon, May 24, 2010 at 1:19 PM, Ralph Schindler
mailto:ralph.schind...@zend.com>> wrote:

This is great! Nice work to you and all others involved in making it
happen!

-ralph


Benjamin Eberlei wrote:

Hello everyone,

I completed a first version of Zend + Doctrine 1 integration
today and
want to share it with all you. Since currently the status on a 1.11
release is unclear I
contacted all the contributors to various Doctrine-related
components
and combined them into a single release and wrote some
documentation on
all the different parts and how they relate to each other.

http://github.com/beberlei/zf-doctrine

The code is under the New BSD License. There is a comprehensive
getting
started guide
shipped with the Github Project.

The following parts are included in this release:

* Application Resource contributed by Matt Lurz
* Dynamic Form Generation contributed by Jani Hartikainen
* Paginator Adapter contributed by Matt Lurz and Juozas Kaziukenas
* Zend Tool Provider and modular Zend Project Style Support

Thanks to all the contributors and various other people that
contributed
ideas and code.

For any feedback regarding this integration, you can use
the issue tracker on Github.

This release depends on Doctrine 1.2.2 to allow model
code-generation
from YAML files that supports Zend Framework Modular projects
and their
directory structure.

Most of the current glue code out there is made obsolete by
generating
Models that follow the Zend Framework naming conventions, into Zend
Framework models/ directories. Additionally there is also
support for
modular applications whose model classes should follow the PEAR
naming
schema.

Additionally the dynamic form support allows to create simple
forms that
allow to create and edit Doctrine_Record instances and their
relations. This is a great help to rapidly prototype admin forms
(however support
for more complex forms is not yet included).

Since both projects are currently very focused on their 2.0
releases,
this release aims to glue all the existing code for Doctrine 1.x and
Zend Framework integration 1.x together, giving them a platform to
flourish.

greetings,
Benjamin




Re: [fw-general] FlashMessenger and i18n

2010-04-30 Thread Guillaume ORIOL

I'll do it and if somebody else think it could be usefull in Zend Framework 
I'll provide the class.
--
Guillaume

Le 30/04/10 19:00, Hector Virgen a écrit :

I don't know if there's a plan for supporting this, but you should be
able to extend the flash messenger to support translations. Since action
controllers use the plugin loader and a LIFO stack for helper paths, you
can transparently add support by introducing your own flash messenger.

--
Hector


On Fri, Apr 30, 2010 at 9:26 AM, Guillaume ORIOL mailto:go.li...@technema.fr>> wrote:

I know it but I was looking for a transparent way to do it.
The way it has been done in Zend_Form for instance:

$element->setLabel('label');

will get a translated label if a Zend_Translate object is available.
--
Guillaume

Le 30/04/10 18:03, Hector Virgen a écrit :

You can manually translate your messages after pulling them out
of the
flash messenger.

--
Hector


    On Fri, Apr 30, 2010 at 8:53 AM, Guillaume ORIOL
mailto:go.li...@technema.fr>
<mailto:go.li...@technema.fr <mailto:go.li...@technema.fr>>> wrote:

Hi,

Is there any plan to make the FlashMessenger action helper
compatible with Zend_Translate?

    Best regards
--
Guillaume ORIOL
Software engineer
Technema





Re: [fw-general] FlashMessenger and i18n

2010-04-30 Thread Guillaume ORIOL

I know it but I was looking for a transparent way to do it.
The way it has been done in Zend_Form for instance:

$element->setLabel('label');

will get a translated label if a Zend_Translate object is available.
--
Guillaume

Le 30/04/10 18:03, Hector Virgen a écrit :

You can manually translate your messages after pulling them out of the
flash messenger.

--
Hector


On Fri, Apr 30, 2010 at 8:53 AM, Guillaume ORIOL mailto:go.li...@technema.fr>> wrote:

Hi,

Is there any plan to make the FlashMessenger action helper
compatible with Zend_Translate?

Best regards
    --
Guillaume ORIOL
Software engineer
Technema




[fw-general] FlashMessenger and i18n

2010-04-30 Thread Guillaume ORIOL

Hi,

Is there any plan to make the FlashMessenger action helper compatible with 
Zend_Translate?

Best regards
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] unable to setup REST route in application.ini

2010-04-30 Thread Guillaume ORIOL

Just found the post below regarding this topic.
Does anyone know if the bug was fixed ?

-- Hector Virgen <[hidden email]> wrote
(on Thursday, 14 January 2010, 10:57 AM -0800):
> How do I add a Zend_Rest_Route route to my application.ini? I want it to only
> match one controller in the default module.
>
> Right now I have this but it doesn't seem right.
>
> resources.router.routes.rest.type = "Zend_Rest_Route"
> resources.router.routes.rest.defaults.controller = "images"

Right now, you can't; there are some inconsistencies in its definition
that make creation via config next to impossible. I'm working with
another contributor on fixes, but they are proving hard to reconcile
with the current API. Keep an eye on the lists for further progress.

--
Matthew Weier O'Phinney

Le 29/04/10 16:50, Guillaume ORIOL a écrit :

Hi,

I am facing an issue with a REST route that I try to setup in
application.ini
I would like to enable a REST route for any controller in the module
named "rest".
In my application.ini, I put:

resources.router.routes.rest.type = "Zend_Rest_Route"
resources.router.routes.rest.rest =

But when a request like this:
http://www.domain.com/rest/stocks/
is received, the 'default' route is matched and not the 'rest' one.

any idea ?
--
Guillaume ORIOL
Software engineer
Technema


[fw-general] unable to setup REST route in application.ini

2010-04-29 Thread Guillaume ORIOL

Hi,

I am facing an issue with a REST route that I try to setup in application.ini
I would like to enable a REST route for any controller in the module named 
"rest".
In my application.ini, I put:

resources.router.routes.rest.type = "Zend_Rest_Route"
resources.router.routes.rest.rest =

But when a request like this:
http://www.domain.com/rest/stocks/
is received, the 'default' route is matched and not the 'rest' one.

any idea ?
--
Guillaume ORIOL
Software engineer
Technema


[fw-general] REST standard regarding filtering and sorting collections

2010-04-23 Thread Guillaume ORIOL

Hi,

Speaking about RESTful controllers, do you know if a standard/specification exists regarding 
filtering and sorting collections?


More precisely, if I want to retrieve only a subset of the resources (by a GET /resource/), I'll 
probably add a query parameter - for instance GET /resource/?category=active. When I google on this 
topic, I find many different proposals for doing this.

One of them 
(http://www.odata.org/developers/protocols/uri-conventions#UriComponents) 
suggests:
/Products?$filter=Price gt 20
Another one (http://wiki.opensocial.org/index.php?title=Developer's_Guide_REST) 
suggests:
/Products?filterBy=Price&filterOp=greaterThan&filterValue=20

Thanks for your feedback.
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] Zend_Paginator::toJson() incompatible with JsonRestStore

2010-04-22 Thread Guillaume ORIOL

Here is the filed issue:
http://zendframework.com/issues/browse/ZF-9731

Le 21/04/10 22:34, Matthew Weier O'Phinney a écrit :

-- Guillaume ORIOL  wrote
(on Wednesday, 21 April 2010, 10:22 PM +0200):

You are right, but the example you take is not the Json I get from 
$paginator->toJson().
It is the Json required by JsonRestStore.
Is there something I misunderstand?


I was saying that we need an issue filed so that $paginator->toJson()
returns the correct output -- which should be an array of objects, not
an object of objects.


Look at your example:

 [
 {"prop1":"value1","prop2":"value2", ...},
 {"prop1":"value1","prop2":"value2", ...}
 ]

That's an array of objects. :)

And yes, it will work for JsonRestStore -- I've used such formats
myself.


-- Guillaume ORIOL   wrote
(on Wednesday, 21 April 2010, 04:08 PM +0200):

As far as I know, dojox.data.JsonRestStore expects to receive
data in the form:
[
{"prop1":"value1", "prop2":"value2", ...},
{"prop1":"value1", "prop2":"value2", ...},
...
]

On the server side, I fetch data with a paginator
(Zend_Paginator_Adapter_DbSelect). This paginator implements a
toJson function. But whatever FETCH_MODE is used to get the data, I
get a Json representation like this one:
{
"0": {"prop1":"value1", "prop2":"value2", ...},
"1": {"prop1":"value1", "prop2":"value2", ...},
...
}

Is there something obvious I miss or do I have to write my own
implementation of the toJson() function?


Honestly, I'd consider that a bug -- numeric indices should be
returned
as an array, not as an object. Can you file an issue, please?

--
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc






[fw-general] should we separate the front-end controller from the REST one

2010-04-21 Thread Guillaume ORIOL

Hi,

I started a new project where I wish to display some data in a dojo grid. This grid is linked to a 
JsonRestStore that will interact with a REST controller.


I asked myself:
should I put the action that displays the grid (HTML+JS) in the same controller as the one which 
will return the data (JSON)? My first thought was to put the "grid" action in a separate controller, 
considering it should be seen as a consumer (or a front-end) of the REST one.


Then, I thought about the form action (the action displaying the form, not the one processing the 
data). The form action triggers a PUT or POST request toward the REST controller. If the data are 
valid, no problem. But what should we do in case of errors? If the postAction() is separated from 
the formAction(), we should do some redirect to the referrer. And if we merge the two actions (or 
controllers), the resulting controller would not be a "pure" REST anymore.


What would be your advice in such a situation?
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] Zend_Paginator::toJson() incompatible with JsonRestStore

2010-04-21 Thread Guillaume ORIOL

OK.
I'll file the issue.

Le 21/04/10 22:34, Matthew Weier O'Phinney a écrit :

-- Guillaume ORIOL  wrote
(on Wednesday, 21 April 2010, 10:22 PM +0200):

You are right, but the example you take is not the Json I get from 
$paginator->toJson().
It is the Json required by JsonRestStore.
Is there something I misunderstand?


I was saying that we need an issue filed so that $paginator->toJson()
returns the correct output -- which should be an array of objects, not
an object of objects.


Look at your example:

 [
 {"prop1":"value1","prop2":"value2", ...},
 {"prop1":"value1","prop2":"value2", ...}
 ]

That's an array of objects. :)

And yes, it will work for JsonRestStore -- I've used such formats
myself.


-- Guillaume ORIOL   wrote
(on Wednesday, 21 April 2010, 04:08 PM +0200):

As far as I know, dojox.data.JsonRestStore expects to receive
data in the form:
[
{"prop1":"value1", "prop2":"value2", ...},
{"prop1":"value1", "prop2":"value2", ...},
...
]

On the server side, I fetch data with a paginator
(Zend_Paginator_Adapter_DbSelect). This paginator implements a
toJson function. But whatever FETCH_MODE is used to get the data, I
get a Json representation like this one:
{
"0": {"prop1":"value1", "prop2":"value2", ...},
"1": {"prop1":"value1", "prop2":"value2", ...},
...
}

Is there something obvious I miss or do I have to write my own
implementation of the toJson() function?


Honestly, I'd consider that a bug -- numeric indices should be
returned
as an array, not as an object. Can you file an issue, please?

--
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc






Re: [fw-general] Zend_Paginator::toJson() incompatible with JsonRestStore

2010-04-21 Thread Guillaume ORIOL

You are right, but the example you take is not the Json I get from 
$paginator->toJson().
It is the Json required by JsonRestStore.
Is there something I misunderstand?


Look at your example:

 [
 {"prop1":"value1","prop2":"value2", ...},
 {"prop1":"value1","prop2":"value2", ...}
 ]

That's an array of objects. :)

And yes, it will work for JsonRestStore -- I've used such formats
myself.


-- Guillaume ORIOL  wrote
(on Wednesday, 21 April 2010, 04:08 PM +0200):

As far as I know, dojox.data.JsonRestStore expects to receive
data in the form:
[
{"prop1":"value1", "prop2":"value2", ...},
{"prop1":"value1", "prop2":"value2", ...},
...
]

On the server side, I fetch data with a paginator
(Zend_Paginator_Adapter_DbSelect). This paginator implements a
toJson function. But whatever FETCH_MODE is used to get the data, I
get a Json representation like this one:
{
"0": {"prop1":"value1", "prop2":"value2", ...},
"1": {"prop1":"value1", "prop2":"value2", ...},
...
}

Is there something obvious I miss or do I have to write my own
implementation of the toJson() function?


Honestly, I'd consider that a bug -- numeric indices should be
returned
as an array, not as an object. Can you file an issue, please?

--
Matthew Weier O'Phinney
Project Lead| matt...@zend.com
Zend Framework  | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc


[fw-general] Zend_Paginator::toJson() incompatible with JsonRestStore

2010-04-21 Thread Guillaume ORIOL

Hi,

As far as I know, dojox.data.JsonRestStore expects to receive data in the form:
[
  {"prop1":"value1", "prop2":"value2", ...},
  {"prop1":"value1", "prop2":"value2", ...},
  ...
]

On the server side, I fetch data with a paginator (Zend_Paginator_Adapter_DbSelect). This paginator 
implements a toJson function. But whatever FETCH_MODE is used to get the data, I get a Json 
representation like this one:

{
  "0": {"prop1":"value1", "prop2":"value2", ...},
  "1": {"prop1":"value1", "prop2":"value2", ...},
  ...
}

Is there something obvious I miss or do I have to write my own implementation 
of the toJson() function?
--
Guillaume ORIOL
Software engineer
Technema


[fw-general] best way to extend Zend_Pdf_Page

2010-04-06 Thread Guillaume ORIOL

Hi,

There have been many great evolutions in the Zend_Pdf package, and I would like the thank Alexander 
Veremyev for it, but some useful functions are still missing.


To be more precise, I am talking about functions like:
- drawXXX() with an additional parameter to specify the unit (may be this could be also implemented 
with a document-scope unit that would be taken into accout in Zend_Pdf_Element_Numeric).
- drawContentStream() that is declared but remains to implement (I guess it is the way to draw a 
block of text, but I may be confusing with drawLayoutBox())

- getStringWidth() to compute the width of a specified text
- drawTextAlignXXX() to draw some left/right/center-aligned text

But this will be for the future.

For now, I am asking the best way to add my own implementation of those functions to the 
Zend_Pdf_Page class. Of course I know I can extend Zend_Pdf and Zend_Pdf_Page to My_Pdf and 
My_Pdf_Page. But, if I load a PDF document from existing file with My_Pdf::load(), all the pages 
will still be created as instances of Zend_Pdf_Page and not My_Pdf_Page.


What would you suggest then?

Best regards
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] formatting data for merging into LiveDocx

2010-04-06 Thread Guillaume ORIOL
Sorry for the misunderstanding: I was not talking about the way to align values visually in the 
template.

When I fetch the values from the database, the decimal separator is a dot.
As the software I am working on is in french, I must accomodate french locale, which implies to 
convert the decimal separator to a comma.


Thanks in advance
--
Guillaume ORIOL
Software engineer
Technema


Hello Guillaume

In such cases, I would suggest using a table (without or without cell borders).

You would use one row per sub-array in $data.

For a very similar example to what you are trying to achieve, please
take a look athttp://is.gd/bgCNi, section "Assigning compound data
types in LiveDocx".

You can specify the decimal tab in your template, and all the decimal
points will line up on top of each other.

Best regards

Jonathan Maron






[fw-general] formatting data for merging into LiveDocx

2010-04-06 Thread Guillaume ORIOL

Hi,

I am working on LiveDocx document generation.
When dealing with arrays, it is sometimes necessary to format the data to be 
printed.
For instance, consider this data:

$data = array(
  0 => array(
'title' => 'item 1',
'width' => 65.00,
'height' => 54.00,
'purchase_price' => 29.95
 ),
 ...
);

I would like to print it this way:
title   dim. W x Hprice
-
item 1  65 x 54 cm29,95

The width and height should be converted to integer and the decimal separator should accomodate to 
locale.


What is the best practice to do it?

Best regards
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] compressing blank lines in Zend_Service_LiveDocx

2010-04-06 Thread Guillaume ORIOL

Thank you for your answer, Jonathan.

I'll do it the way you suggest... until you can implement a definitive solution 
in the Zend service :-)
I guess they do not interpret the template markup, as I tried with the following workaround for 
Word, but it did not work:

{ IF { MERGEFIELD address_1 } <> "" { MERGEFIELD address_1  } }

Best regards
--
Guillaume ORIOL
Software engineer
Technema

Le 06/04/10 16:08, Jonathan Maron a écrit :

Hello again Guillaume

I have just got word back from the template specialists.


>  When an address line is empty, how can I tell LiveDocx no to print the
>  entire line, including the?

Unfortunately, they confirmed exactly what I originally thought:
Currently, this is not directly supported. However, it may be added in
a future version of the backend service LiveDocx.MailMerge.

Please consider the following workaround:

Merge address data, including line breaks, into something like this.

ORGANIZATION
ADDRESS
POSTAL CODE, CITY

Although not a particularly elegant solution, this way you can avoid
getting empty lines.

Does this solve the issue you are having?

Jonathan Maron





[fw-general] compressing blank lines in Zend_Service_LiveDocx

2010-04-06 Thread Guillaume ORIOL

Hi,

Zend_Service_LiveDocx is a great Zend component! Many thanks to the contributors of this new 
service. I tried it this week-end and was able to produce DOC and PDF document really fast with the 
MailMerge class.


The only thing I was not able to do was compressing blank lines.
Let me explain what I need with this address example:

ORGANIZATION
ADDRESS 1
ADDRESS 2
ADDRESS 3
POSTAL CODE, CITY

When an address line is empty, how can I tell LiveDocx no to print the entire line, 
including the ?

Best regards
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] recurse on cascade delete

2010-03-29 Thread Guillaume ORIOL

Thank you for your advice.

I am using MySQL 5 with InnoDB engine which implements cascade deletes as well 
as triggers.
I have to confess I am not very comfortable with triggers. And the logic behind the cascade delete 
is fairly complex in my application. Therefore I tried to implement it with php code and ZF. Now, I 
know I have to learn more about triggers...


But let me ask one question: as a full implementation is not possible (or at least very complex), 
why not to remove it completely from Zend_Db? I find it inconsistent as it is.


Best regards
--
Guillaume

Le 29/03/10 18:51, Bill Karwin a écrit :

Thanks Jared, that's good to know.  It appears that version of SQLite
only came out in October 2009. Kudos to the contributors of SQLite who
made that feature possible! And thanks for pointing it out.

There's virtually no reason to avoid using RI constraints now.

The reasons to use MyISAM are dwindling. It used to be faster than
InnoDB, but this is less and less true now that the performance of the
InnoDB plugin storage engine has improved so much. If you want to use
the FULLTEXT index which only supports MyISAM, other options like Solr
and Sphinx are available and probably better.

Regards,
Bill Karwin

On Mar 29, 2010, at 9:21 AM, Jared Williams wrote:



Sqlite 3.6.19 and later have RI,
http://www.sqlite.org/foreignkeys.html .

Jared


-Original Message-
From: Bill Karwin [mailto:b...@karwin.com]
Sent: 29 March 2010 17:03
To: fw-general@lists.zend.com
Subject: Re: [fw-general] recurse on cascade delete

I regret implementing the cascading delete in Zend_Db_Table
even for one level. It was hard to do, required a lot of
code, and still doesn't work. Even fixing ZF-1103 won't be
enough. It's not possible to ensure data consistency when
cascading operations are implemented in PHP code.

You should implement cascading delete or cascading update by
defining
SQL constraints in your database. I know there are a couple of
technologies that don't support RI constraints (MyISAM,
SQLite). If you need cascading delete or update, you should
define triggers in the database, or else change to some other
storage engine.

Regards,
Bill Karwin

On Mar 29, 2010, at 3:54 AM, Guillaume ORIOL wrote:


Hi,

I was working on an application that uses cascade delete and
discovered a bug that was already known and reported.

I was wondering why the corresponding issue
http://zendframework.com/issues/browse/ZF-1103
had not been closed and included in a previous ZF release,

as a patch

was provided and no new activity was recorded on the ticket since
january the 2nd.

The lack of a consistent ON DELETE mechanism is rather awkward.

Best regards
--
Guillaume ORIOL
Software engineer
Technema


[fw-general] recurse on cascade delete

2010-03-29 Thread Guillaume ORIOL

Hi,

I was working on an application that uses cascade delete and discovered a bug that was already known 
and reported.


I was wondering why the corresponding issue
http://zendframework.com/issues/browse/ZF-1103
had not been closed and included in a previous ZF release,
as a patch was provided and no new activity was recorded on the ticket since 
january the 2nd.

The lack of a consistent ON DELETE mechanism is rather awkward.

Best regards
--
Guillaume ORIOL
Software engineer
Technema


[fw-general] Zend_Dojo_Data with compound keys

2010-03-16 Thread Guillaume ORIOL

Hi,

Looking at Zend_Dojo_Data.php, I realized I couldn't define a compound 
identifier.

public function setIdentifier($identifier)
{
if (null === $identifier) {
$this->_identifier = null;
} elseif (is_string($identifier)) {
$this->_identifier = $identifier;
} elseif (is_numeric($identifier)) {
$this->_identifier = (int) $identifier;
} else {
require_once 'Zend/Dojo/Exception.php';
throw new Zend_Dojo_Exception('Invalid identifier; please use a 
string or integer');
}
...
}

On the other hand, the dojo documentation for dojo.data.api.Identity states:
The identifiers must always be an object that can be converted to a string using the toString() 
JavaScript API. Note: This does not keep identities from being compound keys; they just must be able 
to be represented in a string fashion.


My question is: when dealing with tables that hold compound keys, what is the appropriate way to 
build dojo.data objects?

--
Guillaume ORIOL
Software engineer
Technema


[fw-general] proper way to instantiate a display group without $form->addDisplayGroup

2010-03-08 Thread Guillaume ORIOL

Hi,

I am new to i18n and, until now, I was adding display groups to my forms 
this way:


$form->addDisplayGroup(
array('field1', 'field2', 'field3'),
'global',
array(
'displayGroupClass' => 'My_DisplayGroup',
'legend' => 'My legend'
)
);

I setup a Zend_Translate object with the gettext adapter and I am using 
POEdit to write translations. Unfortunately, one can not enter keys 
manually in POEdit: it has to find them automatically in source files.
I configured it with keywords like "setLabel", "setDescription" and 
"setLegend". But in the code above, there is no "setLegend" function.

So, I would like to rewrite that code to something like:

$displayGroup = new My_DisplayGroup($options);
$displayGroup->setLegend('My legend');

But I can't find the proper way to instantiate my custom display group 
(the correct options to pass to it).


Could somebody help me?
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] any plan to change the dojo ComboBox behaviour?

2010-02-11 Thread Guillaume ORIOL

Thank you for having clarified this point.

-- Guillaume ORIOL  wrote
(on Wednesday, 10 February 2010, 12:49 PM +0100):
   

Searching for a solution to a dojo ComboBox issue, I've found an old
ticket 
(http://n4.nabble.com/Zend-Dojo-Comboboxes-and-form-populate-td648990.html)
on this topic.

The problem is: as the ComboBox dijit permits to enter a value that
is not in the list, once this value has been saved, how can we
display a form to edit the saved value.

Matthew Weier O'Phinney was pointing that "setting the value to a
value not in the list simply will not work". And Cameron suggested a
workaround for it.

Any plan to change the ComboBox behaviour?
 

Well, you'd have to change it in Dojo.

ComboBox is like a combination  and text. It allows you
to enter text freeform, and if that text matches selections provided to
it, makes it easy to choose one of those matches -- it's basically
autocompletion. That said, you can also simply use it as a dropdown, or
as a text input -- both are valid use cases. Additionally, the source
for the select options does not have to be present at element
definition; the dijit can point to a remote dojo.data store, and the
select options can be retrieved dynamically, and the server can use the
provided input to do selective matching when returning values.

The ComboBox dijit itself only allows setting a default value that
matches one of the select options; anything else will be ignored. The
only way we could counter that in ZF is to take the value provided and
add it to the select options. However, this is not viable in situations
where a remote dojo.data store is being used to populate the options.

Basically, the behaviour you want cannot be achieved with ComboBox;
you'd need to write your own custom dijit and corresponding ZF form
element.
   


--

Guillaume ORIOL
gor...@technema.fr
Technema
TECHNEMA
TÈl : 01 60 94 70 30
Fax : 01 60 03 12 40
Mob : 06 81 43 04 06



[fw-general] any plan to change the dojo ComboBox behaviour?

2010-02-10 Thread Guillaume ORIOL
Searching for a solution to a dojo ComboBox issue, I've found an old 
ticket 
(http://n4.nabble.com/Zend-Dojo-Comboboxes-and-form-populate-td648990.html) 
on this topic.


The problem is: as the ComboBox dijit permits to enter a value that is 
not in the list, once this value has been saved, how can we display a 
form to edit the saved value.


Matthew Weier O'Phinney was pointing that "setting the value to a value 
not in the list simply will not work". And Cameron suggested a 
workaround for it.


Any plan to change the ComboBox behaviour?
--
Guillaume ORIOL
Software engineer
Technema


[fw-general] any plan to change the dojo ComboBox behaviour?

2010-02-10 Thread Guillaume ORIOL
Searching for a solution to a dojo ComboBox issue, I've found an old 
ticket 
(http://n4.nabble.com/Zend-Dojo-Comboboxes-and-form-populate-td648990.html) 
on this topic.


The problem is: as the ComboBox dijit permits to enter a value that is 
not in the list, once this value has been saved, how can we display a 
form to edit the saved value.


Matthew Weier O'Phinney was pointing that "setting the value to a value 
not in the list simply will not work". And Cameron suggested a 
workaround for it.


Any plan to change the ComboBox behaviour?
--
Guillaume ORIOL
Software engineer
Technema


Re: [fw-general] query tracker in Zend_Db for some tables

2010-01-22 Thread Guillaume ORIOL




I know the potential impact on performance, Hector.
But I need only to store INSERT, UPDATE and DELETE queries, not SELECT
and as I stated, it is only for SOME tables.

The solution you suggest is not ne right one for me as the result could
not be managed in my application back-office.
And this is what I am looking for.

Writing to the database for every read can have a big
impact on performance. If you're using MySQL, I'd take a look at the
built in query logger, which writes queries to a file.
  
  
  http://dev.mysql.com/doc/refman/5.1/en/query-log.html
  
--
Hector
  
  
  On Fri, Jan 22, 2010 at 7:29 AM, Guillaume
ORIOL <gor...@technema.fr>
wrote:
  Hi,

I would like to implement a query tracker in Zend_Db for some tables.
The idea is to store in db an history of all SQL queries that were
executed on these tables.

Here is the kind of table schema I would like to populate with it:
CREATE TABLE table_history (
   id TIMESTAMP NOT NULL PRIMARY KEY,
   tablename CHAR(64),
   query VARCHAR(...)
);

I was thinking of using db profiling mechanism to do it. What would you
suggest?
-- 

Guillaume ORIOL


  
  
  



-- 
Guillaume
ORIOL
gor...@technema.fr

TECHNEMA
TÈl : 01 60 94 70 30
Fax : 01 60 03 12 40
Mob : 06 81 43 04 06





[fw-general] query tracker in Zend_Db for some tables

2010-01-22 Thread Guillaume ORIOL

Hi,

I would like to implement a query tracker in Zend_Db for some tables.
The idea is to store in db an history of all SQL queries that were 
executed on these tables.


Here is the kind of table schema I would like to populate with it:
CREATE TABLE table_history (
id TIMESTAMP NOT NULL PRIMARY KEY,
tablename CHAR(64),
query VARCHAR(...)
);

I was thinking of using db profiling mechanism to do it. What would you 
suggest?

--

Guillaume ORIOL



[fw-general] a Dojo tab container inherits forbidden attributes from the form

2010-01-06 Thread Guillaume ORIOL

Hi,

The mailing list was not very active on monday...
May be I will be more lucky today with the following question:

 Message original 
Sujet:  a Dojo tab container inherits forbidden attributes from the form
Date :  Mon, 04 Jan 2010 13:22:27 +0100
De :Guillaume ORIOL 
Pour :  fw-general@lists.zend.com


Hi,

While using tabs in Dojo forms (as explained in ZF doc), I encountered an issue:
the tab container inherits forbidden attributes from the form itself (name, 
method, action).

Likewise, would someone explain me how to get the submit button outside of the 
tab container?
(See below the way I tried.)

Thanks,
--
Guillaume

Here is the form class:
class Form_Customer extends Zend_Dojo_Form
{
public function init()
{
$this->setName(get_class($this))->setMethod('post');
$this->setDecorators(array(
'FormElements',
array('TabContainer', array(
'id'  =>  'tabContainer',
'style'   =>  'width: 100%; height: 450px;',
'dijitParams' =>  array('tabPosition' =>  'top'),
)),
'DijitForm',
));

$tab1 = new Zend_Dojo_Form_SubForm();
$tab1->setAttribs(array(
'name'   =>  'firsttab',
'legend' =>  'Legend 1',
'dijitParams' =>  array('title' =>  'Title 1')));

$el = new Zend_Dojo_Form_Element_TextBox('first_name');
$el->setLabel('first name');
$tab1->addElement($el);

$tab2 = new Zend_Dojo_Form_SubForm();
$tab2->setAttribs(array(
'name'   =>  'secondtab',
'legend' =>  'Legend 2',
'dijitParams' =>  array('title' =>  'Title 2')));

$el = new Zend_Dojo_Form_Element_TextBox('last_name');
$el->setLabel('last name');
$tab2->addElement($el);

$this->addSubForm($tab1, 'firsttab')
 ->addSubForm($tab2, 'secondtab')
 ->addElement('Button', 'foo', array('label' =>  'Button
Label'));
}
}

And the generated HTML code:


  

  first 
name
  



  last 
name
  


 
Button 
Label
  


--
Guillaume ORIOL




Re: [fw-general] Zend_Dojo_Form_Element_Editor returning Array using some browsers

2010-01-04 Thread Guillaume ORIOL

Just opened http://zendframework.com/issues/browse/ZF-8707

Regards
--
Guillaume ORIOL


When I use a Zend_Dojo_Form_Element_Editor in a form, the returned
>  value is an array with some browsers.
>  
>  For instance, $form->getValues() will return the following when I

>  use Safari (4.0.4 Mac):
>  array (
>   'last_name' =>  'Doe',
>   'content' =>
>   array (
> 'Editor' =>  'some text',
>   ),
>   ...
>  )
>  
>  But with Firefox 3.5.6, the following is returned:

>  array (
>   'last_name' =>  'Doe,
>   'content' =>  'some text',
>   ...
>  ),
>  
>  Searching on Nabble, I've found a few posts related to this question

>  - but none of them were answered.
   




Re: [fw-general] Zend_Dojo_Form_Element_Editor returning Array using some browsers

2010-01-04 Thread Guillaume ORIOL

I would prefer keeping the Dojo one.
But if nobody from Zend is able to find a solution with it, I'll give up 
and use the one you're talking about.
I had the same problem with Chrome... ended up just replacing it with 
ckeditor.


On Tue, Jan 5, 2010 at 12:31 AM, Guillaume ORIOL <mailto:gor...@technema.fr>> wrote:


Hi,

When I use a Zend_Dojo_Form_Element_Editor in a form, the returned
value is an array with some browsers.

For instance, $form->getValues() will return the following when I
use Safari (4.0.4 Mac):
array (
   'last_name' => 'Doe',
   'content' =>
   array (
 'Editor' => 'some text',
   ),
   ...
)

But with Firefox 3.5.6, the following is returned:
array (
   'last_name' => 'Doe,
   'content' => 'some text',
   ...
),

Searching on Nabble, I've found a few posts related to this
question - but none of them were answered.
Could someone help me find a solution?

Best regards
-- 


Guillaume ORIOL





[fw-general] Zend_Dojo_Form_Element_Editor returning Array using some browsers

2010-01-04 Thread Guillaume ORIOL

Hi,

When I use a Zend_Dojo_Form_Element_Editor in a form, the returned value 
is an array with some browsers.


For instance, $form->getValues() will return the following when I use 
Safari (4.0.4 Mac):

array (
'last_name' => 'Doe',
'content' =>
array (
  'Editor' => 'some text',
),
...
)

But with Firefox 3.5.6, the following is returned:
array (
'last_name' => 'Doe,
'content' => 'some text',
...
),

Searching on Nabble, I've found a few posts related to this question - 
but none of them were answered.

Could someone help me find a solution?

Best regards
--

Guillaume ORIOL



[fw-general] a Dojo tab container inherits forbidden attributes from the form

2010-01-04 Thread Guillaume ORIOL

Hi,

While using tabs in Dojo forms (as explained in ZF doc), I encountered 
an issue:
the tab container inherits forbidden attributes from the form itself 
(name, method, action).


Likewise, would someone explain me how to get the submit button outside 
of the tab container?

(See below the way I tried.)

Thanks,
--
Guillaume

Here is the form class:
class Form_Customer extends Zend_Dojo_Form
{
public function init()
{
$this->setName(get_class($this))->setMethod('post');
$this->setDecorators(array(
'FormElements',
array('TabContainer', array(
'id'  => 'tabContainer',
'style'   => 'width: 100%; height: 450px;',
'dijitParams' => array('tabPosition' => 'top'),
)),
'DijitForm',
));

$tab1 = new Zend_Dojo_Form_SubForm();
$tab1->setAttribs(array(
'name'   => 'firsttab',
'legend' => 'Legend 1',
'dijitParams' => array('title' => 'Title 1')));

$el = new Zend_Dojo_Form_Element_TextBox('first_name');
$el->setLabel('first name');
$tab1->addElement($el);

$tab2 = new Zend_Dojo_Form_SubForm();
$tab2->setAttribs(array(
'name'   => 'secondtab',
'legend' => 'Legend 2',
'dijitParams' => array('title' => 'Title 2')));

$el = new Zend_Dojo_Form_Element_TextBox('last_name');
$el->setLabel('last name');
    $tab2->addElement($el);

$this->addSubForm($tab1, 'firsttab')
 ->addSubForm($tab2, 'secondtab')
 ->addElement('Button', 'foo', array('label' => 'Button 
Label'));

}
}

And the generated HTML code:


  

  first 
name
  



  last 
name
  


 
Button 
Label
  


--

Guillaume ORIOL



Re: [fw-general] URL issue with multiple customers sharing the same application

2009-12-28 Thread Guillaume ORIOL

Thank you Ryan for your answer.
I found the right solution to this problem:

$router->setGlobalParam('account', $this->_account);

This way, the "account" parameter is added to every URL built.
--
Guillaume

Le 27/12/09 03:50, ryan.horn a écrit :

Can you give an example of the URL structure you are using to access your
page, what you are passing to the url helper and what the helper is
returning? Seems to work fine for me with the route definition you provided.



Guillaume ORIOL wrote:
   

Working on an application that is the same for multiple customers, I had
to face a design option.
I wanted to avoid installing the application as many times as we had
customers (for maintenance reasons).
Therefore I chose to have a unique code installation but several
databases.
Each customer would access its application by adding its account name to
the application base URL:
webapp.domain.com/account1/
webapp.domain.com/account2/
etc.

Following this URL prefix are the regular MVC parameters, ie:
webapp.domain.com/account1/module/controller/action

I define a default route replacement in my Bootstrap including the
account parameter (see below) and retrieve this special parameter from a
FrontController plugin where I setup the default database adapter.

I encounter a problem with functions that build URLs (for instance
$view->url(...) or $redirector->gotoRoute(...), etc.).
All of these functions should add the current account parameter at the
beginning of the URL, but none of them is aware of it.
(It should also apply to other functions like $page->getHref() for
Zend_Navigation.)

What design option would you suggest (overload all of these functions,
change dynamically the base URL of the application)?

Thanks for any help
- - - - -
Here is the redefined default route:
  $route = new Zend_Controller_Router_Route(
  ':account/:module/:controller/:action/*',
  array(
'account'=>  'demo',
'module' =>  'default',
'controller' =>  'index',
'action' =>  'index')
  );
  $router->addRoute('default', $route);

I would also like to make
"webapp.domain.com/account1/module/controller/action" equivalent to
"account1.webapp.domain.com/module/controller/action". I guess it is
possible with the Zend_Controller_Router_Route_Hostname, but did not try
already.

$route = new Zend_Controller_Router_Route_Hostname(
      ':account.webapp.domain.com',
  array(
  'module' =>  'default',
  'controller' =>  'index',
  'action' =>  'index'
  )
);
--

Guillaume ORIOL




Re: [fw-general] URL issue with multiple customers sharing the same application

2009-12-24 Thread Guillaume ORIOL

I use a supervisor database to store db credentials to customer databases.
Here is the schematic process (done in a plugin):
- determine which account was used, either from subdomain 
(account1.webapp.domain.com/... 
<http://webapp.domain.com/account1/module/controller/action>) or from 
the URL path (webapp.domain.com/account1/... 
<http://webapp.domain.com/account1/>)
- use the account to query supervisor database (the account is the 
primary key)

- retrieve the customer database credentials from this supervisor db
- define the default adapter with those credentials

Hope this help
--
Guillaume

Le 23/12/09 23:39, Daniel Latter a écrit :

Hi Guillaume,

How do you handle passwords for your customer databases? do you have a 
look up list - be it a file, database .. ?


For example if a sub-domain hits the server, how are db credentials 
gatherd/defined? We can determine username
from subdomain part but what about passwords? I just ask as I am 
thinking about the best approach to take.


Thanks for any advice.
Dan





2009/12/21 Guillaume ORIOL <mailto:gor...@technema.fr>>


Yes, I have exactly one database per customer and one more for
supervision purpose (where access to customer databases are defined).

Le 21/12/09 16:08, Daniel Latter a écrit :

Hi,

I have a situation very similar to yours, although I am not sure
about the answer to your question, I have a quesiton for you:
when you say you have several databases, what do you mean? do you
mean one per customer/application?

Thanks
Dan





    2009/12/21 Guillaume ORIOL mailto:gor...@technema.fr>>

Working on an application that is the same for multiple
customers, I had to face a design option.
I wanted to avoid installing the application as many times as
we had customers (for maintenance reasons).
Therefore I chose to have a unique code installation but
several databases.
Each customer would access its application by adding its
account name to the application base URL:
webapp.domain.com/account1/ <http://webapp.domain.com/account1/>
webapp.domain.com/account2/ <http://webapp.domain.com/account2/>
etc.

Following this URL prefix are the regular MVC parameters, ie:
webapp.domain.com/account1/module/controller/action
<http://webapp.domain.com/account1/module/controller/action>

I define a default route replacement in my Bootstrap
including the account parameter (see below) and retrieve this
special parameter from a FrontController plugin where I setup
the default database adapter.

I encounter a problem with functions that build URLs (for
instance $view->url(...) or $redirector->gotoRoute(...), etc.).
All of these functions should add the current account
parameter at the beginning of the URL, but none of them is
aware of it.
(It should also apply to other functions like
$page->getHref() for Zend_Navigation.)

What design option would you suggest (overload all of these
functions, change dynamically the base URL of the application)?

Thanks for any help
- - - - -
Here is the redefined default route:
   $route = new Zend_Controller_Router_Route(
   ':account/:module/:controller/:action/*',
   array(
 'account'=> 'demo',
 'module' => 'default',
 'controller' => 'index',
 'action' => 'index')
   );
   $router->addRoute('default', $route);

I would also like to make
"webapp.domain.com/account1/module/controller/action
<http://webapp.domain.com/account1/module/controller/action>"
equivalent to
"account1.webapp.domain.com/module/controller/action
<http://account1.webapp.domain.com/module/controller/action>". I
guess it is possible with the
Zend_Controller_Router_Route_Hostname, but did not try already.

$route = new Zend_Controller_Router_Route_Hostname(
   ':account.webapp.domain.com
<http://account.webapp.domain.com>',
   array(
   'module' => 'default',
   'controller' => 'index',
   'action' => 'index'
   )
);
-- 


Guillaume ORIOL






[fw-general] isValid not executed on multicheckbox when the element is not required and value is not set

2009-12-22 Thread Guillaume ORIOL

Here is a schematic view of the form I have:
(*) choice 1
[X] option 1
[_] option 2
[_] option 3
( ) choice 2

When "choice 1" is checked, at least one of the three options should be 
checked.

I wanted to write a specific validator for the options but...
as the "options" multi-checkbox is not required (as they are ignored if 
choice 2 is checked), when no option is checked, the validator is not 
executed at all.


Does anybody have a solution for it?

Thanks
--

Guillaume ORIOL



Re: [fw-general] URL issue with multiple customers sharing the same application

2009-12-22 Thread Guillaume ORIOL




The original question was fogotten in our discussion.
Does anyone have a suggestion for building URL in that situation?

  Thanks for the replies Jake and Guillaume, they have made me
think as I am currently adding somthing of the same to an app Im
Implementing, I was thinking of having a one database as I didn't want
to optimise prematurley but the benefits mentioned here especialy in
terms of scalability and also coding benefits I think far outweigh the
whiff of premature optimisation, more of a design decison as Guillame
said initially.
  
  
  Thanks again and Merry Xmas!
  
  
  On 21 Dec 2009, at 16:50, Guillaume ORIOL <gor...@technema.fr>
wrote:
  
  
  
I do agree with Jake.
It is not a big deal to manage 50 database if you have a good
back-office to do it.

  
  On Mon, Dec 21, 2009 at 11:10 AM, Daniel
Latter <dan.lat...@gmail.com>
wrote:
  OK
thanks
for the replies, I understand your reasons but this too seems
unmanageable, say if you have 50 customers, thats 50 databases!!? or am
I missing somthing?
  
  
  
  This isn't so terrible, sandboxing accounts to their own
databases makes your model code a lot simpler (for example, you don't
need to pass around an account id, join and filter every single query).
  
  
  You can also backup and restore whole accounts using
mysqldump
instead of some kind of custom built solution. You can also, (very
easily) break off clients to separate boxes should they generate enough
traffic (or pay for the privilege).
  
  
  The only con is building an administrative interface may be
a
bit more complicated, though I'd rather have the majority of bugs in an
app I deal with, than the one my customers work with.
  
  
  - jake
   
  
Thanks again.



Dan



    
    
    2009/12/21 Guillaume ORIOL <gor...@technema.fr>

  I had two reasons in
mind:
- security (the db user has rights only on its database)
- simplicity (no need to prefix table names or to add a customer column
in every table PK)
  
--
Guillaume
  
Le 21/12/09 16:40, Daniel Latter a écrit : 
  
  
  Thanks for the reply,

What was your main reason for using separate databases instead of one
single database?

Dan


    
    
2009/12/21 Guillaume ORIOL <gor...@technema.fr>

  Yes, I have exactly
one
database per customer and one more for
supervision purpose (where access to customer databases are defined).
  
Le 21/12/09 16:08, Daniel Latter a écrit :
  
  
  Hi,

I have a situation very similar to yours, although I am not sure about
the answer to your question, I have a quesiton for you: when you say
you have several databases, what do you mean? do you mean one per
customer/application? 

Thanks
Dan




    
2009/12/21 Guillaume ORIOL <gor...@technema.fr>
Working
on
an
application
that is the same for multiple customers, I had to
face a design option.
I wanted to avoid installing the application as many times as we had
customers (for maintenance reasons).
Therefore I chose to have a unique code installation but several
databases.
Each customer would access its application by adding its account name
to the application base URL:
  webapp.domain.com/account1/
  webapp.domain.com/account2/
etc.
  
Following this URL prefix are the regular MVC parameters, ie:
  webapp.domain.com/account1/module/controller/action
  
I define a default route replacement in my Bootstrap including the
account parameter (see below) and retrieve this special parameter from
a FrontController plugin where I setup the default database adapter.
  
I encounter a problem with functions that build URLs (for instance
$view->url(...) or $redirector->gotoRoute(...), etc.).
All of these functions should add the current account parameter at the
beginning of the URL, but none of them is aware of it.
(It should also apply to other functions like $page->getHref() for
Zend_Navigation.)
  
What design option would you suggest (overload all of these functions,
change dynamically the base URL of the application)?
  
Thanks for any help
- - - - -
Here is the redefined default route:
       $route = new Zend_Controller_Router_Route(
           ':account/:module/:controller/:action/*',
           array(
                 'account'    => 'demo',
                 'module'     => 'default',
                 'controller' => 

Re: [fw-general] URL issue with multiple customers sharing the same application

2009-12-21 Thread Guillaume ORIOL

I do agree with Jake.
It is not a big deal to manage 50 database if you have a good 
back-office to do it.



On Mon, Dec 21, 2009 at 11:10 AM, Daniel Latter <mailto:dan.lat...@gmail.com>> wrote:


OK thanks for the replies, I understand your reasons but this too
seems unmanageable, say if you have 50 customers, thats 50
databases!!? or am I missing somthing?


This isn't so terrible, sandboxing accounts to their own databases 
makes your model code a lot simpler (for example, you don't need to 
pass around an account id, join and filter every single query).


You can also backup and restore whole accounts using mysqldump instead 
of some kind of custom built solution. You can also, (very easily) 
break off clients to separate boxes should they generate enough 
traffic (or pay for the privilege).


The only con is building an administrative interface may be a bit more 
complicated, though I'd rather have the majority of bugs in an app I 
deal with, than the one my customers work with.


- jake


Thanks again.


Dan





    2009/12/21 Guillaume ORIOL mailto:gor...@technema.fr>>

I had two reasons in mind:
- security (the db user has rights only on its database)
- simplicity (no need to prefix table names or to add a
customer column in every table PK)

--
Guillaume

Le 21/12/09 16:40, Daniel Latter a écrit :

Thanks for the reply,

What was your main reason for using separate databases
instead of one single database?

    Dan




2009/12/21 Guillaume ORIOL mailto:gor...@technema.fr>>

Yes, I have exactly one database per customer and one
more for supervision purpose (where access to customer
databases are defined).

Le 21/12/09 16:08, Daniel Latter a écrit :

Hi,

I have a situation very similar to yours, although I am
not sure about the answer to your question, I have a
quesiton for you: when you say you have several
databases, what do you mean? do you mean one per
customer/application?

Thanks
Dan





    2009/12/21 Guillaume ORIOL mailto:gor...@technema.fr>>

Working on an application that is the same for
multiple customers, I had to face a design option.
I wanted to avoid installing the application as many
times as we had customers (for maintenance reasons).
Therefore I chose to have a unique code installation
but several databases.
Each customer would access its application by adding
its account name to the application base URL:
webapp.domain.com/account1/
<http://webapp.domain.com/account1/>
webapp.domain.com/account2/
<http://webapp.domain.com/account2/>
etc.

Following this URL prefix are the regular MVC
parameters, ie:
webapp.domain.com/account1/module/controller/action
<http://webapp.domain.com/account1/module/controller/action>

I define a default route replacement in my Bootstrap
including the account parameter (see below) and
retrieve this special parameter from a
FrontController plugin where I setup the default
database adapter.

I encounter a problem with functions that build URLs
(for instance $view->url(...) or
$redirector->gotoRoute(...), etc.).
All of these functions should add the current
account parameter at the beginning of the URL, but
none of them is aware of it.
(It should also apply to other functions like
$page->getHref() for Zend_Navigation.)

What design option would you suggest (overload all
of these functions, change dynamically the base URL
of the application)?

Thanks for any help
- - - - -
Here is the redefined default route:
   $route = new Zend_Controller_Router_Route(
   ':account/:module/:controller/:action/*',
   array(
 'account'=> 'demo',
 'module' => 'default',
 'controller' => 'index',
 'action' => 'index')
   );
   $router->addRoute('default', $route);

I would also like to make
&q

Re: [fw-general] URL issue with multiple customers sharing the same application

2009-12-21 Thread Guillaume ORIOL

I had two reasons in mind:
- security (the db user has rights only on its database)
- simplicity (no need to prefix table names or to add a customer column 
in every table PK)


--
Guillaume

Le 21/12/09 16:40, Daniel Latter a écrit :

Thanks for the reply,

What was your main reason for using separate databases instead of one 
single database?


Dan




2009/12/21 Guillaume ORIOL <mailto:gor...@technema.fr>>


Yes, I have exactly one database per customer and one more for
supervision purpose (where access to customer databases are defined).

Le 21/12/09 16:08, Daniel Latter a écrit :

Hi,

I have a situation very similar to yours, although I am not sure
about the answer to your question, I have a quesiton for you:
when you say you have several databases, what do you mean? do you
mean one per customer/application?

Thanks
Dan





2009/12/21 Guillaume ORIOL mailto:gor...@technema.fr>>

Working on an application that is the same for multiple
customers, I had to face a design option.
I wanted to avoid installing the application as many times as
we had customers (for maintenance reasons).
Therefore I chose to have a unique code installation but
several databases.
Each customer would access its application by adding its
account name to the application base URL:
webapp.domain.com/account1/ <http://webapp.domain.com/account1/>
webapp.domain.com/account2/ <http://webapp.domain.com/account2/>
etc.

Following this URL prefix are the regular MVC parameters, ie:
webapp.domain.com/account1/module/controller/action
<http://webapp.domain.com/account1/module/controller/action>

I define a default route replacement in my Bootstrap
including the account parameter (see below) and retrieve this
special parameter from a FrontController plugin where I setup
the default database adapter.

I encounter a problem with functions that build URLs (for
instance $view->url(...) or $redirector->gotoRoute(...), etc.).
All of these functions should add the current account
parameter at the beginning of the URL, but none of them is
aware of it.
(It should also apply to other functions like
$page->getHref() for Zend_Navigation.)

What design option would you suggest (overload all of these
functions, change dynamically the base URL of the application)?

Thanks for any help
- - - - -
Here is the redefined default route:
   $route = new Zend_Controller_Router_Route(
   ':account/:module/:controller/:action/*',
   array(
 'account'=> 'demo',
 'module' => 'default',
 'controller' => 'index',
 'action' => 'index')
   );
   $router->addRoute('default', $route);

I would also like to make
"webapp.domain.com/account1/module/controller/action
<http://webapp.domain.com/account1/module/controller/action>"
equivalent to
"account1.webapp.domain.com/module/controller/action
<http://account1.webapp.domain.com/module/controller/action>". I
guess it is possible with the
Zend_Controller_Router_Route_Hostname, but did not try already.

$route = new Zend_Controller_Router_Route_Hostname(
   ':account.webapp.domain.com
<http://account.webapp.domain.com>',
   array(
   'module' => 'default',
   'controller' => 'index',
   'action' => 'index'
   )
);
-- 


Guillaume ORIOL



Re: [fw-general] URL issue with multiple customers sharing the same application

2009-12-21 Thread Guillaume ORIOL




Yes, I have exactly one database per customer and one more for
supervision purpose (where access to customer databases are defined).

Le 21/12/09 16:08, Daniel Latter a écrit :
Hi,
  
I have a situation very similar to yours, although I am not sure about
the answer to your question, I have a quesiton for you: when you say
you have several databases, what do you mean? do you mean one per
customer/application? 
  
Thanks
Dan
  
  
  
  
  
  2009/12/21 Guillaume ORIOL <gor...@technema.fr>
  Working
on an application that is the same for multiple customers, I had to
face a design option.
I wanted to avoid installing the application as many times as we had
customers (for maintenance reasons).
Therefore I chose to have a unique code installation but several
databases.
Each customer would access its application by adding its account name
to the application base URL:
webapp.domain.com/account1/
webapp.domain.com/account2/
etc.

Following this URL prefix are the regular MVC parameters, ie:
webapp.domain.com/account1/module/controller/action

I define a default route replacement in my Bootstrap including the
account parameter (see below) and retrieve this special parameter from
a FrontController plugin where I setup the default database adapter.

I encounter a problem with functions that build URLs (for instance
$view->url(...) or $redirector->gotoRoute(...), etc.).
All of these functions should add the current account parameter at the
beginning of the URL, but none of them is aware of it.
(It should also apply to other functions like $page->getHref() for
Zend_Navigation.)

What design option would you suggest (overload all of these functions,
change dynamically the base URL of the application)?

Thanks for any help
- - - - -
Here is the redefined default route:
       $route = new Zend_Controller_Router_Route(
           ':account/:module/:controller/:action/*',
           array(
                 'account'    => 'demo',
                 'module'     => 'default',
                 'controller' => 'index',
                 'action'     => 'index')
       );
       $router->addRoute('default', $route);

I would also like to make "webapp.domain.com/account1/module/controller/action"
equivalent to "account1.webapp.domain.com/module/controller/action".
I guess it is possible with the Zend_Controller_Router_Route_Hostname,
but did not try already.

$route = new Zend_Controller_Router_Route_Hostname(
   ':account.webapp.domain.com',
   array(
       'module'     => 'default',
       'controller' => 'index',
       'action'     => 'index'
   )
);
-- 

Guillaume ORIOL


  
  



-- 
Guillaume
ORIOL
gor...@technema.fr

TECHNEMA
TÈl : 01 60 94 70 30
Fax : 01 60 03 12 40
Mob : 06 81 43 04 06





[fw-general] URL issue with multiple customers sharing the same application

2009-12-21 Thread Guillaume ORIOL
Working on an application that is the same for multiple customers, I had 
to face a design option.
I wanted to avoid installing the application as many times as we had 
customers (for maintenance reasons).

Therefore I chose to have a unique code installation but several databases.
Each customer would access its application by adding its account name to 
the application base URL:

webapp.domain.com/account1/
webapp.domain.com/account2/
etc.

Following this URL prefix are the regular MVC parameters, ie:
webapp.domain.com/account1/module/controller/action

I define a default route replacement in my Bootstrap including the 
account parameter (see below) and retrieve this special parameter from a 
FrontController plugin where I setup the default database adapter.


I encounter a problem with functions that build URLs (for instance 
$view->url(...) or $redirector->gotoRoute(...), etc.).
All of these functions should add the current account parameter at the 
beginning of the URL, but none of them is aware of it.
(It should also apply to other functions like $page->getHref() for 
Zend_Navigation.)


What design option would you suggest (overload all of these functions, 
change dynamically the base URL of the application)?


Thanks for any help
- - - - -
Here is the redefined default route:
$route = new Zend_Controller_Router_Route(
':account/:module/:controller/:action/*',
array(
  'account'=> 'demo',
  'module' => 'default',
  'controller' => 'index',
  'action' => 'index')
);
$router->addRoute('default', $route);

I would also like to make 
"webapp.domain.com/account1/module/controller/action" equivalent to 
"account1.webapp.domain.com/module/controller/action". I guess it is 
possible with the Zend_Controller_Router_Route_Hostname, but did not try 
already.


$route = new Zend_Controller_Router_Route_Hostname(
':account.webapp.domain.com',
array(
'module' => 'default',
'controller' => 'index',
'action' => 'index'
)
);
--

Guillaume ORIOL



Re: [fw-general] one of two view helpers cannot be found

2009-12-18 Thread Guillaume ORIOL

You assumption was right.
Either two followings directives worked:
resources.view.helperPath.View_Helper_ = APPLICATION_PATH 
"/modules/default/views/helpers"
resources.view.helperPath.View_Helper_ = 
"../application/modules/default/views/helpers"


Thanks
--
Guillaume

Le 18/12/09 03:16, Mon Zafra a écrit :
I think it's because the paths are relative to the public directory. 
Try APPLICATION_PATH "/modules/default/views/helpers" and 
APPLICATION_PATH "/views/helpers".


Also, I believe the second line would just overwrite the first.

   -- Mon


On Thu, Dec 17, 2009 at 4:08 AM, Guillaume ORIOL <mailto:gor...@technema.fr>> wrote:


Thank you Daniel.
I renamed the two helpers the way you told and everything went fine.

Do you know why none of those two parameters in application.ini
did work?
resources.view.helperPath.View_Helper_ =
"application/modules/default/views/helpers"
resources.view.helperPath.View_Helper_ = "views/helpers"

Le 16/12/09 16:49, Daniel Latter a écrit :

Hi,

Im no expert but Ill point out what I can see.

First, the reason why you are only getting one error because the
Profile helper has errors ( $this- view->url .. ) in it so my
guess is this one is silently dying, fix the error and you will
get 2 exceptions.

Second, if you want helpers to load automatically without setting
your own name-spaced helper paths you need to name them
appropriately, so in your case, providing they are in the folders
you state, you would use Zend_View_Helper_CustomFooter, and
Zend_View_Helper_Profile. If you do this both helpers should be
    found no probs.

Hope this helps.
Dan



2009/12/16 Guillaume ORIOL mailto:gor...@technema.fr>>


Hi,

I encountered an error which relates to view helpers. The
message says
"Uncaught exception 'Zend_Loader_PluginLoader_Exception' with
message
'Plugin by name 'CustomFooter' was not found in the
registry". I don't
understand why I get the error on one of the two helpers and
not on the
other.

In my layout file, I render two scripts for header and footer.
/* application/layouts/scripts/layout.phtml */
...
render('header.phtml'); ?>
layout()->content; ?>
render('footer.phtml'); ?>
...

In header.phtml, I use a view helper for user identification:
profile(); ?>
and in footer.phtml I use another view helper for adding a
custom footer:
customFooter(); ?>

Here are those view helpers:
/* application/modules/default/views/helpers/CustomFooter.php */
class View_Helper_CustomFooter extends Zend_View_Helper_Abstract
{
   public function customFooter()
   {
   $settings = new Model_Settings();
   $rowset = $settings->find(1);
   $row = $rowset->current();
   $footer = $row->footer;
   if ($footer) {
   return '' . $footer
. '' .
PHP_EOL;
   }
   return '';
   }
}

/* application/modules/default/views/helpers/Profile.php */
class View_Helper_Profile extends Zend_View_Helper_Abstract
{
   public function profile()
   {
   $auth = Zend_Auth::getInstance();
   if ($auth->hasIdentity()) {
   $id = $auth->getIdentity();
   return ''
. $this->view->escape($id->first_name) . ' '
. $this->view->escape($id->last_name) . ' '
. ''
. ' "'
. $this- view->url(array('controller' =>
'auth', 'action'
=> 'logout'), 'default', false)
. '">logout ' . PHP_EOL;
   } else {
   return ' "'
. $this- view->url(array('controller' =>
    'auth', 'action'
=> 'login'), 'default', false)
. '">login ' . PHP_EOL;
   }
   }
}


--
View this message in context:

http://n4.nabble.com/one-of-two-view-helpers-cannot-be-found-tp965101p965101.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 


Guillaume ORIOL



Re: [fw-general] why is every module bootstrap executed during initialization?

2009-12-16 Thread Guillaume ORIOL

Thank you Matthew but I don't understand your last remark.

Let's say I have two modules, each of which has its own plugin 
registered at bootstrap:

class Default_Bootstrap extends Zend_Application_Module_Bootstrap
{
public function _initPlugin()
{
$plugin = new Plugin_Foo();
$front = Zend_Controller_Front::getInstance();
$front->registerPlugin($plugin);
}
}

class Admin_Bootstrap extends Zend_Application_Module_Bootstrap
{
public function _initPlugin()
{
$plugin = new Admin_Plugin_Bar();
$front = Zend_Controller_Front::getInstance();
$front->registerPlugin($plugin);
}
}

If I perform a request on the default module, both plugins are executed.
According to your last remark, I thought only one plugin should have bee 
executed.

--
Guillaume

Le 16/12/09 21:54, Matthew Weier O'Phinney a écrit :

-- Guillaume ORIOL  wrote
(on Wednesday, 16 December 2009, 09:33 PM +0100):
   

I wonder why, in a modular application, all module bootstraps are
executed during initialization and not only the one corresponding to
the matched module?

What would be the way to get only one of them executed (I would like
to connect a different plugin to each module)?
 

All module bootstraps are executed... because at bootstrap time, the
requested module is not yet known. (It happens during _routing_.)

Module bootstraps should be used for:

  * Setting up autoloading of module resources (happens already,
automatically)

  * Performing any module-specific tasks that need to happen on every
request

  * Registering module-specific plugins

This latter area is where you should execute code that should only be
executed if the module is the one requested.
   





[fw-general] why is every module bootstrap executed during initialization?

2009-12-16 Thread Guillaume ORIOL

Hi,

I wonder why, in a modular application, all module bootstraps are 
executed during initialization and not only the one corresponding to the 
matched module?


What would be the way to get only one of them executed (I would like to 
connect a different plugin to each module)?


Thanks
--

Guillaume ORIOL



Re: [fw-general] one of two view helpers cannot be found

2009-12-16 Thread Guillaume ORIOL

Thank you Daniel.
I renamed the two helpers the way you told and everything went fine.

Do you know why none of those two parameters in application.ini did work?
resources.view.helperPath.View_Helper_ = 
"application/modules/default/views/helpers"

resources.view.helperPath.View_Helper_ = "views/helpers"

Le 16/12/09 16:49, Daniel Latter a écrit :

Hi,

Im no expert but Ill point out what I can see.

First, the reason why you are only getting one error because the 
Profile helper has errors ( $this- view->url .. ) in it so my guess is 
this one is silently dying, fix the error and you will get 2 exceptions.


Second, if you want helpers to load automatically without setting your 
own name-spaced helper paths you need to name them appropriately, so 
in your case, providing they are in the folders you state, you would 
use Zend_View_Helper_CustomFooter, and Zend_View_Helper_Profile. If 
you do this both helpers should be found no probs.


Hope this helps.
Dan



2009/12/16 Guillaume ORIOL <mailto:gor...@technema.fr>>



Hi,

I encountered an error which relates to view helpers. The message says
"Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message
'Plugin by name 'CustomFooter' was not found in the registry". I don't
understand why I get the error on one of the two helpers and not
on the
other.

In my layout file, I render two scripts for header and footer.
/* application/layouts/scripts/layout.phtml */
...
render('header.phtml'); ?>
layout()->content; ?>
render('footer.phtml'); ?>
...

In header.phtml, I use a view helper for user identification:
profile(); ?>
and in footer.phtml I use another view helper for adding a custom
footer:
customFooter(); ?>

Here are those view helpers:
/* application/modules/default/views/helpers/CustomFooter.php */
class View_Helper_CustomFooter extends Zend_View_Helper_Abstract
{
   public function customFooter()
   {
   $settings = new Model_Settings();
   $rowset = $settings->find(1);
   $row = $rowset->current();
   $footer = $row->footer;
   if ($footer) {
   return '' . $footer .
'' .
PHP_EOL;
   }
   return '';
   }
}

/* application/modules/default/views/helpers/Profile.php */
class View_Helper_Profile extends Zend_View_Helper_Abstract
{
   public function profile()
   {
   $auth = Zend_Auth::getInstance();
   if ($auth->hasIdentity()) {
   $id = $auth->getIdentity();
   return ''
. $this->view->escape($id->first_name) . ' '
. $this->view->escape($id->last_name) . ' '
. ''
. ' "'
. $this- view->url(array('controller' => 'auth',
'action'
=> 'logout'), 'default', false)
. '">logout ' . PHP_EOL;
   } else {
   return ' "'
. $this- view->url(array('controller' => 'auth',
'action'
=> 'login'), 'default', false)
. '">login ' . PHP_EOL;
   }
   }
}


--
View this message in context:

http://n4.nabble.com/one-of-two-view-helpers-cannot-be-found-tp965101p965101.html
Sent from the Zend Framework mailing list archive at Nabble.com.


--

Guillaume ORIOL



[fw-general] one of two view helpers cannot be found

2009-12-16 Thread Guillaume ORIOL

Hi,

I encountered an error which relates to view helpers. The message says
"Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message
'Plugin by name 'CustomFooter' was not found in the registry". I don't
understand why I get the error on one of the two helpers and not on the
other.

In my layout file, I render two scripts for header and footer.
/* application/layouts/scripts/layout.phtml */
...
render('header.phtml'); ?>
layout()->content; ?>
render('footer.phtml'); ?>
...

In header.phtml, I use a view helper for user identification:
profile(); ?>
and in footer.phtml I use another view helper for adding a custom footer:
customFooter(); ?>

Here are those view helpers:
/* application/modules/default/views/helpers/CustomFooter.php */
class View_Helper_CustomFooter extends Zend_View_Helper_Abstract
{
public function customFooter()
{
$settings = new Model_Settings();
$rowset = $settings->find(1);
$row = $rowset->current();
$footer = $row->footer;
if ($footer) {
return '' . $footer . '' .
PHP_EOL;
}
return '';
}
}

/* application/modules/default/views/helpers/Profile.php */
class View_Helper_Profile extends Zend_View_Helper_Abstract
{
public function profile()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$id = $auth->getIdentity();
return ''
 . $this->view->escape($id->first_name) . ' '
 . $this->view->escape($id->last_name) . ' '
 . ''
 . ' "'
 . $this- view->url(array('controller' => 'auth', 'action'
=> 'logout'), 'default', false)
 . '">logout ' . PHP_EOL;
} else {
return ' "'
 . $this- view->url(array('controller' => 'auth', 'action'
=> 'login'), 'default', false)
 . '">login ' . PHP_EOL;
}
}
}


-- 
View this message in context: 
http://n4.nabble.com/one-of-two-view-helpers-cannot-be-found-tp965101p965101.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] best practice to build a menu dynamically depending on ACL with assertions

2009-08-24 Thread Guillaume Oriol

Hi,

I use assertions in my ACL.
For example:
$this->allow('member', 'vehicle', 'index', new
belongsToMeAssertion());

This permission states that the vehicle list is allowed to the "member" role
if the vehicle belongs to a specific user (in fact, the user that is logged
in).
Consequently, in the requested URL (for example "/vehicle/index/user/john")
the "user" parameter must match the user id stored int the Zend_Auth storage
object.

When the user logs into the application, a menu is built dynamically
depending on its privileges.
To do so, I look into the application resources and test if the resource
isAllowed().
But the login URL doesn't include the parameter the assertion expects and
every permission containing an assertion fails.

What would you suggest to solve this use case?



-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/best-practice-to-build-a-menu-dynamically-depending-on-ACL-with-assertions-tp25120101p25120101.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] filter and validator conflict

2009-06-05 Thread Guillaume Oriol

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

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

How can I escape from this dead end?

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



Re: [fw-general] how to isolate $_GET or $_POST params from the rest of request

2009-05-22 Thread Guillaume Oriol

If you know the parameter name, then you are right. But I was looking for a
method to get the complete array of query parameters.
After reading your answer, I looked into ZF code and discovered the method
would return the array I was looking for when no parameter was given.

So, thank you for your help.


Brenton Alker-3 wrote:
> 
> Guillaume Oriol wrote:
>> Hi,
>> 
>> The Zend_Controller_Request_Http class merges all request parameters
>> (those
>> from the path and those from the query part) into one unique set. I guess
>> this was done on purpose because of the parameters written in the path.
>> 
>> But sometimes, it would be useful to get only query parameters (after the
>> "?") of a GET request. Why can't I find a method in that class to get
>> them?
>> (Such a method would probably be a thin enveloppe arout $_GET.)
> 
> The Zend_Controller_Request_Http class (this is probably the request
> class you're using) defines getPost($key, $default = null) and
> getQuery($key, $default = null) methods that are probably what you're
> after.
> 
> From Controller:
> $this->_request->getQuery('test');
> 
> -- 
> 
> Brenton Alker
> PHP Developer - Brisbane, Australia
> 
> http://blog.tekerson.com/
> 
> 
>  
> 


-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/how-to-isolate-%24_GET-or-%24_POST-params-from-the-rest-of-request-tp23666181p23670265.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] how to isolate $_GET or $_POST params from the rest of request

2009-05-22 Thread Guillaume Oriol

Hi,

The Zend_Controller_Request_Http class merges all request parameters (those
from the path and those from the query part) into one unique set. I guess
this was done on purpose because of the parameters written in the path.

But sometimes, it would be useful to get only query parameters (after the
"?") of a GET request. Why can't I find a method in that class to get them?
(Such a method would probably be a thin enveloppe arout $_GET.)

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/how-to-isolate-%24_GET-or-%24_POST-params-from-the-rest-of-request-tp23666181p23666181.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] expected behavior of getValues() on subform

2009-04-23 Thread Guillaume Oriol

I designed a generic CRUD controller doing the following operations for the
CREATE action:


if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
if ($form->isValid($formData)) {
$row = $this->_model->createRow();
$row->setFromArray($form->getValues());
$row->save();
$this->goBack(); // Exit here
}
// Repopulate the form if it is not valid
$form->populate($formData);
}
...


When my form has no subform, everything is okay, but when my form has
subforms, no data is saved.

What am I supposed to do when using subforms? Iterating thru subforms to get
the data?


Without subforms $form->getValues() returns an array like:

array (
  'name' => 'aaa',
  'description' => 'bbb',
  'submit' => 'submit',
)

With subforms, $form->getValues() returns something like:

array (
  'submit' => 'submit',
  '' => array (
'name' => 'aaa',
'description' => 'bbb',
  )
)


-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/expected-behavior-of-getValues%28%29-on-subform-tp23197354p23197354.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] size limit raised on javascriptCaptureStart()

2009-04-22 Thread Guillaume Oriol

Hi Matthew,

I missed something when tracking this bug:
if you look closely to the regexp, you'll see a question mark following ".*"
in parenthesis.
I guess this is an error as I don't understand its meaning.

On my server:

$a = str_repeat('a', 49997);
$a = preg_replace('/^\s*(.*?)\s*$/s', '$1', $a);

would return the string but:

$a = str_repeat('a', 49998);
$a = preg_replace('/^\s*(.*?)\s*$/s', '$1', $a);
would return NULL.

If I remove the question mark, preg_replace operates properly, whatever size
the string is.


Guillaume Oriol wrote:
> 
> Thank you Matthew for your answer but, according to PHP manual, the trim()
> function removes ALL whitespace characters from beginning/end of the
> string (and not only the first one). Furthermore, the trim() function
> removes not only space but also:
> * "\t" (ASCII 9 (0x09))
> * "\n" (ASCII 10 (0x0A))
> * "\r" (ASCII 13 (0x0D))
> * "\0" (ASCII 0 (0x00))
> * "\x0B" (ASCII 11 (0x0B))
> 
> I will post a message to php-internals regarding the issue on
> preg_replace.
> 
> 
> Matthew Weier O'Phinney-3 wrote:
>> 
>> -- Guillaume Oriol  wrote
>> (on Monday, 20 April 2009, 09:13 AM -0700):
>>> Hi, I discovered an issue with the
>>> javascriptCaptureStart/javascriptCaptureEnd
>>> function pair. When the captured text exceeds a certain limit (about
>>> 50kB in my
>>> case), the function returns only a semi-colon. I have the following code
>>> in a
>>> view script:
>>> 
>>> dojo()->javascriptCaptureStart(); ?>
>>> var data = data; ?>;
>>> ...
>>> dojo()->javascriptCaptureEnd(); ?>
>>> 
>>> And, as the number of rows in my database table is growing, $this->data
>>> is
>>> getting bigger and bigger. Finally, over ~50KB, the PHP tag returns a
>>> semi-colon and nothing else (not even the "var data =" preceeding that
>>> tag).
>>> I was able to trace this issue back to the function addJavascript($js)
>>> in
>>> Zend_Dojo_View_Helper_Dojo_Container and more precisely to the
>>> preg_replace
>>> function:
>>> 
>>> $js = preg_replace('/^\s*(.*?)\s*$/s', '$1', $js);
>>> 
>>> I replaced it by:
>>> 
>>> $js = trim($js);
>>> 
>>> and everything was fine. Therefore, I have two questions:
>>> - is there a know limitation on preg_replace()
>>> - why did you use a preg_replace function to trim the string ?
>> 
>> I'm not aware of any limitations on preg_replace(), but you might want
>> to either file a bug with php.net or ask on the php-internals mailing
>> list about it -- that seems like odd behavior.
>> 
>> We chose to use preg_replace over trim() as it allows removing more than
>> one whitespace character from front and back, and will include newlines
>> when doing so.
>> 
>> -- 
>> Matthew Weier O'Phinney
>> Project Lead| matt...@zend.com
>> Zend Framework  | http://framework.zend.com/
>> 
>> 
> 
> 


-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/size-limit-raised-on-javascriptCaptureStart%28%29-tp23139812p23175439.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] size limit raised on javascriptCaptureStart()

2009-04-22 Thread Guillaume Oriol

Thank you Matthew for your answer but, according to PHP manual, the trim()
function removes ALL whitespace characters from beginning/end of the string
(and not only the first one). Furthermore, the trim() function removes not
only space but also:
* "\t" (ASCII 9 (0x09))
* "\n" (ASCII 10 (0x0A))
* "\r" (ASCII 13 (0x0D))
* "\0" (ASCII 0 (0x00))
* "\x0B" (ASCII 11 (0x0B))

I will post a message to php-internals regarding the issue on preg_replace.


Matthew Weier O'Phinney-3 wrote:
> 
> -- Guillaume Oriol  wrote
> (on Monday, 20 April 2009, 09:13 AM -0700):
>> Hi, I discovered an issue with the
>> javascriptCaptureStart/javascriptCaptureEnd
>> function pair. When the captured text exceeds a certain limit (about 50kB
>> in my
>> case), the function returns only a semi-colon. I have the following code
>> in a
>> view script:
>> 
>> dojo()->javascriptCaptureStart(); ?>
>> var data = data; ?>;
>> ...
>> dojo()->javascriptCaptureEnd(); ?>
>> 
>> And, as the number of rows in my database table is growing, $this->data
>> is
>> getting bigger and bigger. Finally, over ~50KB, the PHP tag returns a
>> semi-colon and nothing else (not even the "var data =" preceeding that
>> tag).
>> I was able to trace this issue back to the function addJavascript($js) in
>> Zend_Dojo_View_Helper_Dojo_Container and more precisely to the
>> preg_replace
>> function:
>> 
>> $js = preg_replace('/^\s*(.*?)\s*$/s', '$1', $js);
>> 
>> I replaced it by:
>> 
>> $js = trim($js);
>> 
>> and everything was fine. Therefore, I have two questions:
>> - is there a know limitation on preg_replace()
>> - why did you use a preg_replace function to trim the string ?
> 
> I'm not aware of any limitations on preg_replace(), but you might want
> to either file a bug with php.net or ask on the php-internals mailing
> list about it -- that seems like odd behavior.
> 
> We chose to use preg_replace over trim() as it allows removing more than
> one whitespace character from front and back, and will include newlines
> when doing so.
> 
> -- 
> Matthew Weier O'Phinney
> Project Lead| matt...@zend.com
> Zend Framework  | http://framework.zend.com/
> 
> 


-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/size-limit-raised-on-javascriptCaptureStart%28%29-tp23139812p23172352.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] size limit raised on javascriptCaptureStart()

2009-04-20 Thread Guillaume Oriol

Hi,

I discovered an issue with the javascriptCaptureStart/javascriptCaptureEnd
function pair. When the captured text exceeds a certain limit (about 50kB in
my case), the function returns only a semi-colon.

I have the following code in a view script:


<?php $this->dojo()->javascriptCaptureStart(); ?>
var data = <?php echo $this->data; ?>;
...
<?php $this->dojo()->javascriptCaptureEnd(); ?>


And, as the number of rows in my database table is growing, $this->data is
getting bigger and bigger. Finally, over ~50KB, the PHP tag returns a
semi-colon and nothing else (not even the "var data =" preceeding that tag).


I was able to trace this issue back to the function addJavascript($js) in
Zend_Dojo_View_Helper_Dojo_Container and more precisely to the preg_replace
function:

$js = preg_replace('/^\s*(.*?)\s*$/s', '$1', $js);


I replaced it by:

$js = trim($js);

and everything was fine.

Therefore, I have two questions:

- is there a know limitation on preg_replace()

- why did you use a preg_replace function to trim the string ?

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/size-limit-raised-on-javascriptCaptureStart%28%29-tp23139812p23139812.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] No Dojo grid view helper

2008-12-09 Thread Guillaume Oriol

Thank you for the advice.
When do you expect to release the 1.8 version?


Matthew Weier O'Phinney-3 wrote:
> 
> -- Guillaume Oriol <[EMAIL PROTECTED]> wrote
> (on Tuesday, 09 December 2008, 06:27 AM -0800):
>> AFAIK, there is no View Helper for dojox.grid.Grid.
>> Is there such a class incubating at this time?
>> 
>> If not what would be the starting point to create it?
>> Create My_Dojo_View_Helper_Grid and extends what class (Dijit)?
>> What existing class could I use as a model?
> 
> Roy from the Studio team and I will be working on such a component for
> 1.8. Currently, It's relatively easy to accomplish -- create your grid
> markup, tie it to a data store that point to a ZF controller action.
> In that action pull from your model, and push the results into a
> Zend_Dojo_Data object and echo it.
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend Framework   | http://framework.zend.com/
> 
> 


-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/No-Dojo-grid-view-helper-tp20915645p20918182.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] No Dojo grid view helper

2008-12-09 Thread Guillaume Oriol

AFAIK, there is no View Helper for dojox.grid.Grid.
Is there such a class incubating at this time?

If not what would be the starting point to create it?
Create My_Dojo_View_Helper_Grid and extends what class (Dijit)?
What existing class could I use as a model?

Thanks

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/No-Dojo-grid-view-helper-tp20915645p20915645.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] unable to disable Dojo

2008-12-08 Thread Guillaume Oriol

Thank you Matthew.
Once again you've found the answer AND the solution.
--
Best regards


Matthew Weier O'Phinney-3 wrote:
> 
> -- Guillaume Oriol <[EMAIL PROTECTED]> wrote
> (on Thursday, 04 December 2008, 11:40 PM -0800):
>> Thank you Matthew for your answer
>> but I don't use Zend_Dojo_Form in my form, neither any Dijit.
>> My form extends Zend_Form.
>> 
>> Why would ZF enable Dojo in such a case?
> 
> I know what's going on.
> 
> There is a standard view helper, Form, and one of the same name in the
> Zend_Dojo_View_Helper tree. Because your view object has been
> initialized with the Dojo view helper path, it's finding the Dojo Form
> view helper and using that over the standard one.
> 
> The easiest way around this is to, in your form's render method, remove
> the Dojo view helper path:
> 
> public function render(Zend_View_Interface $view = null)
> {
> if (null === $view) {
> $view = $this->getView();
> }
> $loader = $view->getPluginLoader('helper');
> if ($loader->getPaths('Zend_Dojo_View_Helper')) {
> $loader->removePrefixPath('Zend_Dojo_View_Helper');
> }
> return parent::render($view);
> }
> 
> 
>> Matthew Weier O'Phinney-3 wrote:
>> > 
>> > -- Guillaume Oriol <[EMAIL PROTECTED]> wrote
>> > (on Thursday, 04 December 2008, 01:38 AM -0800):
>> >> Hi, I am facing a problem with Dojo: I set up Dojo to be disabled by
>> >> default
>> >> but it is still enabled in my login form.
>> >> 
>> >> 
>> >>  1. I've put in my bootstrap file those two lines (set up Dojo
>> >> environment but
>> >> disable it by default):
>> >  
>> >>  2. Then, in my authentication controller:
>> > 
>> >>  3. My form extends Zend_Form (NOT Zend_Dojo_Form). Furthermore, I
>> only
>> >> use
>> >> plain elements that are not Dijits : Zend_Form_Element_Text,
>> >> Zend_Form_Element_Password et Zend_Form_Element_Submit.
>> >>  4. My view script is very short:
>> > 
>> >>  5. And this view script is invoked by the layout where one can find:
>> >  
>> >> 
>> >> But, in the generated HTML page, I find in the HEAD tag:
>> > 
>> > 
>> > So, Zend_Dojo_Form utilizes the Dojo form view helper.. so rendering
>> > your form renders that helper. All Dijit view helpers, on
>> instantiation,
>> > enable the dojo() view helper. So, my recommendations are to either:
>> > 
>> >   * not use Zend_Dojo_Form if you're not actually using any
>> > dojo-specific elements
>> >   * Call $this->dojo()->disable(); after you render the form
>> > 
>> > -- 
>> > Matthew Weier O'Phinney
>> > Software Architect   | [EMAIL PROTECTED]
>> > Zend Framework   | http://framework.zend.com/
>> > 
>> > 
>> 
>> 
>> -
>> Guillaume ORIOL
>> Sofware architect
>> Technema
>> -- 
>> View this message in context:
>> http://www.nabble.com/unable-to-disable-Dojo-tp20830062p20849091.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>> 
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend Framework   | http://framework.zend.com/
> 
> 


-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/unable-to-disable-Dojo-tp20830062p20895715.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] unable to disable Dojo

2008-12-04 Thread Guillaume Oriol

Thank you Matthew for your answer
but I don't use Zend_Dojo_Form in my form, neither any Dijit.
My form extends Zend_Form.

Why would ZF enable Dojo in such a case?


Matthew Weier O'Phinney-3 wrote:
> 
> -- Guillaume Oriol <[EMAIL PROTECTED]> wrote
> (on Thursday, 04 December 2008, 01:38 AM -0800):
>> Hi, I am facing a problem with Dojo: I set up Dojo to be disabled by
>> default
>> but it is still enabled in my login form.
>> 
>> 
>>  1. I've put in my bootstrap file those two lines (set up Dojo
>> environment but
>> disable it by default):
>  
>>  2. Then, in my authentication controller:
> 
>>  3. My form extends Zend_Form (NOT Zend_Dojo_Form). Furthermore, I only
>> use
>> plain elements that are not Dijits : Zend_Form_Element_Text,
>> Zend_Form_Element_Password et Zend_Form_Element_Submit.
>>  4. My view script is very short:
> 
>>  5. And this view script is invoked by the layout where one can find:
>  
>> 
>> But, in the generated HTML page, I find in the HEAD tag:
> 
> 
> So, Zend_Dojo_Form utilizes the Dojo form view helper.. so rendering
> your form renders that helper. All Dijit view helpers, on instantiation,
> enable the dojo() view helper. So, my recommendations are to either:
> 
>   * not use Zend_Dojo_Form if you're not actually using any
> dojo-specific elements
>   * Call $this->dojo()->disable(); after you render the form
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend Framework   | http://framework.zend.com/
> 
> 


-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/unable-to-disable-Dojo-tp20830062p20849091.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] unable to disable Dojo

2008-12-04 Thread Guillaume Oriol

Hi,

I am facing a problem with Dojo: I set up Dojo to be disabled by default but
it is still enabled in my login form.


I've put in my bootstrap file those two lines (set up Dojo environment but
disable it by default):

  Zend_Dojo::enableView($view);
  $view->dojo()->disable();


Then, in my authentication controller:

  class AuthController extends Zend_Controller_Action
  {
  function loginAction()
  {
  $form = new Form_Login();
  // ...
  $this->view->dojo()->disable(); // just to be sure
  $this->view->title = "Authentication";
  $this->view->form = $form;
  }
  }

My form extends Zend_Form (NOT Zend_Dojo_Form). Furthermore, I only use
plain elements that are not Dijits : Zend_Form_Element_Text,
Zend_Form_Element_Password et Zend_Form_Element_Submit. 

My view script is very short:

  <?php
$this->headLink()->appendStylesheet($this->staticUrl('style/form.css'));
?>
  <h1><?php echo $this->escape($this->title); ?></h1>
  <?php echo $this->form; ?>


And this view script is invoked by the layout where one can find:

  <?php
  if ($this->dojo()->isEnabled()) {
  $this->dojo()->addStyleSheetModule('dijit.themes.tundra');
  echo $this->dojo();
  }
  ?>



But, in the generated HTML page, I find in the HEAD tag:

<style type="text/css">
<!--
@import
"http://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dijit/themes/tundra/tundra.css";;
-->
</style>

<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/dojo/1.2.0/dojo/dojo.xd.js"></script>;

<script type="text/javascript">
//<![CDATA[
dojo.require("dijit.form.Form");
dojo.require("dojo.parser");
dojo.addOnLoad(function() {
dojo.forEach(zendDijits, function(info) {
var n = dojo.byId(info.id);
if (null != n) {
    dojo.attr(n, dojo.mixin({ id: info.id }, info.params));
}
});
dojo.parser.parse();
});
var zendDijits = [{"id":"auth","params":{"dojoType":"dijit.form.Form"}}];
//]]>

</script>

What's wrong?

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/unable-to-disable-Dojo-tp20830062p20830062.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] class name instead of table name in reference map (Zend_Db)

2008-10-07 Thread Guillaume Oriol

Thank you Bill for this detailed answer.
I'll implement the solution you suggest.


Bill Karwin wrote:
> 
> 
> Guillaume Oriol wrote:
>  > I wonder why the developpers of Zend_Db component choose the class  
> name
>  > instead of  column name in the reference map of a Zend_Db_Table  
> object?
> 
> I designed and implemented the table-relationships feature.  The  
> answer to your question of "why" is that the reference map is to help  
> the Zend_Db_Table_Row object to instantiate related Table objects.  It  
> has nothing to do with designing custom SQL queries.  You are using  
> the $_referenceMap in a manner other than what it was designed for.
> 
> You could just as easily say, "I want to hammer in a nail.  I have a  
> screwdriver, but it has a tip that isn't flat or blunt, so it's hard  
> to use for nailing.  I wonder why the screwdriver was designed this  
> way?"
> 
> That's not to say that what you are doing is in any way wrong.   
> Hammering nails is a fine thing to do in many circumstances.  It's  
> just that the $_referenceMap doesn't contain the information to help  
> you, so it's not the right tool.
> 
>  > I need to build dynamically my joins in a findBy* method and try to  
> build them
>  > from the existing reference map. But to do so, I need the  
> referenced table name,
>  > not the table class name. As the $_referenceMap only contains the  
> table class
>  > name, I am obliged to instantiate the class just to get its table  
> name! Is there
>  > a better way to do so?
> 
> The $_referenceMap is simply a PHP associative array.  You can add  
> elements to it and use them in your custom methods.
> 
>protected $_referenceMap = array(
>  'Bug' => array(
>'columns'   => array('bug_id'),
>'refTableClass' => 'Bugs',
>'refColumns'=> array('bug_id'),
>// You can add a custom array element for example:
>'guillaume_table_name'=> 'bugs_tbl',
>  )
>);
> 
> You can use whatever string you want as the array key.  The above is  
> just an example.  Zend_Db_Table_Row_Abstract expects some array keys,  
> that that are documented, but you can create other keys in the same  
> array too.
> 
> Another solution is to name your Table classes the same as the  
> database tables they represent.  This is the default, by the way.   
> Only if you declare a Table class including the $_name attribute does  
> it use that name instead of the name of the class.
> 
>class bugs extends Zend_Db_Table_Abstract
>{
>  // no need to declare $_name if the class name is the same as the  
> table name
>}
> 
> Note that if you do this, your table name should conform to PEAR class  
> naming conventions.  E.g. a class named "bugs_tbl" should be defined  
> in file bugs/tbl.php.
> 
> Regards,
> Bill Karwin
> 
> 


-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/class-name-instead-of-table-name-in-reference-map-%28Zend_Db%29-tp19860024p19872857.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] class name instead of table name in reference map (Zend_Db)

2008-10-07 Thread Guillaume Oriol

Hi,

I wonder why the developpers of Zend_Db component choose the class name
instead of column name in the reference map of a Zend_Db_Table object?

I need to build dynamically my joins in a findBy* method and try to build
them from the existing reference map. But to do so, I need the referenced
table name, not the table class name. As the $_referenceMap only contains
the table class name, I am obliged to instantiate the class just to get its
table name! Is there a better way to do so?

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/class-name-instead-of-table-name-in-reference-map-%28Zend_Db%29-tp19860024p19860024.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] best way to mix a form and a grid

2008-10-07 Thread Guillaume Oriol

I am writing a component that will be a mix between list and form. And would
like to render that kind of HTML structure:


FORM
  TABLE
COLGROUP
  COL
  ...
/COLGROUP
THEAD
  TR
TD Column1Label
TD Column2Label
TD Column3Label
  /TR
  TR
TD INPUT
TD (no input)
TD INPUT
  /TR
/THEAD
TBODY
  (data)
/TBODY
  /TABLE
/FORM


I would like to use filtering and validating mechanisms that already exist
in Zend_Form (or Zend_Dojo_Form) not reinventing the wheel. One can find an
input field in the head of each column but some columns may lack of input
field (here, column 2).

The problem is: the form and the grid do really intricate each other in
terms of HTML. The FORM is OUTSIDE the table and INSIDE it at the same time.

What is the best way to do it?

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/best-way-to-mix-a-form-and-a-grid-tp19858283p19858283.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Dojo always enabled

2008-10-02 Thread Guillaume Oriol

Thank you Matthew,

Your answer solved my problem.

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/Dojo-always-enabled-tp19762103p19779597.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Dojo always enabled

2008-10-01 Thread Guillaume Oriol

In some pages (where I put forms), I want to user Dojo forms. For this
reason, I put Zend_Dojo::enableView($this->view); in that controller's
actions.
And I extend my form from Zend_Dojo_Form.

In my layout, I've added :
dojo()->isEnabled()) {
  $this->dojo()->setLocalPath($this->staticUrl('js/dojo/dojo.js'))
   ->addStyleSheetModule('dijit.themes.tundra');
  echo $this->dojo();
}
?>

And in my bootstrap:
$view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');


Now, I get in every page (and not only where I activated Dojo in my action)
that HTML code:


<!--
@import "/fourgon.net/public/js/dijit/themes/tundra/tundra.css";
-->


...


I don't understand why Dojo seem to be enabled by default?

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/Dojo-always-enabled-tp19762103p19762103.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] encoding in HTTP headers

2008-09-25 Thread Guillaume Oriol

Thank you Matthew.

This issue was my misunderstanding of what the view.encoding was for.
I thougt it was the target encoding (ie related to page Content-Type).
But it is used only by escape() method as the source encoding of the text.
Therefore, when I was setting the view.encoding to "UTF-8", I was wrong
because my PHP sources are ISO-8859-1 encoded.


Matthew Weier O'Phinney-3 wrote:
> 
> -- Guillaume Oriol <[EMAIL PROTECTED]> wrote
> (on Wednesday, 24 September 2008, 04:05 AM -0700):
>> I wonder why my view sets an HTTP header of
>> "Content-Type: text/html; charset=iso-8859-1"
>> 
>> despite the configuration I do in the bootsrap.php with:
>> $view = new Zend_View($config->view->toArray());
>> 
>> referencing my config.ini with :
>> view.encoding="UTF-8"
>> view.escape=htmlentities
>> view.strictVars=1
>> 
>> which produces, as expected, in my rendered page:
>> 
>> 
>> Where is my error?
> 
> Zend_View's encoding is simply to ensure that the view scripts render
> with the appropriate encoding. Setting it does not create the
> appropriate  tag nor does setting it set the Content-Type header.
> 
> You can set the default content-type header in your apache and/or PHP
> configuration, or you can do it in your bootstrap code.
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect   | [EMAIL PROTECTED]
> Zend Framework   | http://framework.zend.com/
> 
> 


-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/encoding-in-HTTP-headers-tp19646506p19666366.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] encoding in HTTP headers

2008-09-24 Thread Guillaume Oriol

Hi,

I wonder why my view sets an HTTP header of
"Content-Type: text/html; charset=iso-8859-1"

despite the configuration I do in the bootsrap.php with:
$view = new Zend_View($config->view->toArray());

referencing my config.ini with :
view.encoding="UTF-8"
view.escape=htmlentities
view.strictVars=1

which produces, as expected, in my rendered page:


Where is my error?

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/encoding-in-HTTP-headers-tp19646506p19646506.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] error template not rendered when exception is raised

2008-09-22 Thread Guillaume ORIOL
Hi,

I am wondering why my error template is not rendered when an exception
is thrown in my authorization plugin.
Let me explain the context.
1) my bootstrap registers a plugin for authorization:
...
$frontController = Zend_Controller_Front::getInstance();
$frontController->setControllerDirectory(WEBAPP_CONTROLLER_DIR);

$view = new Zend_View($config->view->toArray());
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view)
 ->setViewBasePathSpec(WEBAPP_VIEW_DIR);

$auth = Zend_Auth::getInstance();
$acl = new Permission();
$frontController->registerPlugin(new
Technema_Plugin_Authorization($auth, $acl));

2) my plugin throws an exception when user is not allowed to

public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if ($this->_auth->hasIdentity()) {
$role = $this->_auth->getIdentity()->role;
} else {
$role = $this->_config->acl->guest;
}

$module = $request->module;
$controller = $request->controller;
$action = $request->action;

$resource = $controller;
if (!$this->_acl->has($resource)) {
$resource = null;
}

if (!$this->_acl->isAllowed($role, $resource, $action)) {
if ($this->_auth->hasIdentity()) {
throw new Zend_Acl_Exception($resource . '/' . $action);
   ...

3) by default, the front controller registers an error handler that
triggers the ErrorController

class ErrorController extends Zend_Controller_Action
{
public function errorAction()
{
$this->getResponse()->clearBody();

$error = $this->_getParam('error_handler');
switch ($error->type) {
case
Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
// 404 error: controller or action not found
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
break;

default:
switch (get_class($error->exception)) {
case 'Zend_Acl_Exception' :
$this->getResponse()->setHttpResponseCode(200);
$this->view->message = 'Access denied to page '
. $error->exception->getMessage();
Zend_Registry::get(REG_LOG)->debug('Access
denied to ' . $error->exception->getMessage());
break;
...

When I try to access a resource I am not allowed to, I am sure the
ErrorController is triggered because I find an "Access denied..." in my
log. But I get a plain text error message instead of my custom error
page (views/scripts/error/error.phtml)

Where am I wrong?
-- 

Guillaume ORIOL
[EMAIL PROTECTED]



[fw-general] what is the best practice for handling errors in application and in a plugin?

2008-09-22 Thread Guillaume Oriol

I've read a few posts from the archive regarding the way to handle exceptions
occurring in a plugin. In one of them, Matthew W. answers:

What the statement "It is not intended to catch exceptions raised in
other plugins or routing" means is that the ErrorHandler plugin can only
catch exceptions raised within your action controllers, not exceptions
raised in plugins or other areas of responsibility during the dispatch
cycle.  You can always do your own try/catch blocks and forward as noted
above. 



Is it intentional to not catch in ErrorController the exceptions raised in
plugins or is there a hidden technical problem?

And, as the way to handle errors is different depending on the place they
occur, what is the best practice for application errors? To use in every
case a forward to a specific action in the error controller?

-
Guillaume ORIOL
Sofware architect
Technema
-- 
View this message in context: 
http://www.nabble.com/what-is-the-best-practice-for-handling-errors-in-application-and-in-a-plugin--tp19527791p19527791.html
Sent from the Zend Framework mailing list archive at Nabble.com.