Re: [fw-general] Current Module in Application Resource

2009-12-03 Thread takeshin

W dniu 2009-12-04 01:59, Ben Scholzen 'DASPRiD' [via Zend Framework 
Community] pisze:
> finished. You may want to do you logic in a controller plugin:
> $front->getRequest()->getModuleName();
>
>

Thank you.
That's the way I do it for now.

-- 
regards
takeshin

-- 
View this message in context: 
http://n4.nabble.com/Current-Module-in-Application-Resource-tp947682p948312.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Current Module in Application Resource

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

You mean you want to access the current module in you bootstrap? The
module is only known after the dispatcher was started and the routing
finished. You may want to do you logic in a controller plugin:

$front->getRequest()->getModuleName();

takeshin wrote on 03.12.2009 16:00:
> How to get current module name in application resource?
> 
> It is stored in Dispatchers $_curModule member variable,
> but it is protected.
> 
> Request object is null.
> 
> Do I have to dispatch first? How?
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksYXuAACgkQ0HfT5Ws789DvLgCffiTW9a59kfyfqjQV9PAefrPK
VBUAoIAp9RmfPVQGiCdR4wu8+DFn1zG3
=s64v
-END PGP SIGNATURE-


[fw-general] Help with Zend Rest Route

2009-12-03 Thread AJ McKee
hi All,

I seem to be running into a PEBKAC issue with Zend_Rest_Route

I've initialized the rest route with the following (See
http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.basic
)

$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
// Rest enabled module only
$restRoute = new Zend_Rest_Route($front, array(), array('articles'));
$router->addRoute('rest', $restRoute);


Now I want to be able to have URLS such as

http://foo.com/articles/1/json

(For the json, I'm using context switch helper)

So, I've added the following route;

$route = new Zend_Controller_Router_Route('articles/:articleid',
array('module' => 'articles', 'controller' => 'index', 'format' => ''));
$router->addRoute('articleRoute', $route);

However when I request via curl I keep getting Invalid controller; And my
request appears to have been directed to the index action no matter if i do
a DELETE

array (
  'module' => 'articles',

  'controller' => '1234',
  'action' => 'index',
  'format' => 'xml',
)

I'm obvisouly missing out something here so if anyone could be so kind and
advise me of my errors would be most helpful. Think I managed to get myself
into a rut here and can't see the wood for the trees.

TIA
AJ


[fw-general] Zend_Amazon_Service_DevPay

2009-12-03 Thread Wil Sinclair
The Zend_Amazon_Service_DevPay proposal is ready for review at
http://framework.zend.com/wiki/display/ZFPROP/Zend_Service_Amazon_DevPay
+-+Wil+Sinclair.

This proposal should be interesting to any developer that is looking to
make a buck on the cloud. The DevPay service takes care of all billing,
fulfillment, payments, etc. The only thing you have to do is write the
next best thing. :)

Please drop me a note if you're using this service or plan to use it;
I'd like to hear how things go.

,Wil


Re: [fw-general] Doctrine - default directory structure

2009-12-03 Thread takeshin


And what about structure like this:

+ application
 |+ configs
  | application.ini
  | schema.yml (one for all models, or each model in separate file?
Maybe in /data/ ?)
 |+ models
  |+ Db
 |+ generated
 |+ controllers
 |+ modules
  |+ other
   |+ controllers
   |+ models
   |+ views
 |Bootstrap.php
+ data
 |+ cache
 |+ log
 |+ fixtures
 |+ migrations
 |+ sql
+ library
+ scripts
  | doctrine-cli.php

-- 
regards
takeshin
-- 
View this message in context: 
http://n4.nabble.com/Doctrine-default-directory-structure-tp947943p948053.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Doctrine - default directory structure

2009-12-03 Thread Matthew Weier O'Phinney
-- Jon Lebensold  wrote
(on Thursday, 03 December 2009, 04:39 PM -0500):
> I think that in the architecture you're suggesting, it makes a lot of sense,
> however I wonder how many apps need per-module models since you're essentially
> creating two resource layers: one "system-wide" one and one for that 
> particular
> portion of the application. If you're manipulation of a subset of data (in 
> your
> case, scrum logs) with module-specific business rules, then its a no-brainer.
> 
> When I did the zendcast, I was heavily inspired by your blog post about zend /
> doctrine model autoloading, however I didn't find a working example with 
> models
> being generated on a per module basis using the CLI. 

I actually don't generate my models -- I define the entities explicitly,
and go the other route: generating my DB schema from the models. I've
done that from the CLI, but I think I can find better ways to do it.

> On Thu, Dec 3, 2009 at 4:02 PM, Matthew Weier O'Phinney 
> wrote:
> 
> -- Jon Lebensold  wrote
> (on Thursday, 03 December 2009, 03:34 PM -0500):
> > not true... I put the Doctrine CLI script in a /scripts folder. All the
> other
> > folders (migrations / sql / yaml / data) I believe belong in configs/
> since
> > they are part of setting up an app or migrating releases.
> >
> > the models belong in /model
> >
> > I haven't found a good solution to autoloading /modules/{modname}/models
> yet
> 
> I've found that having ZF do the autoloading for your models works
> flawlessly, and can thus simply use the autoloading rules defined in
> Zend_Application_Module_Autoloader (which module bootstraps instantiate
> and configure by default).
> 
> > Also, I wonder how many module-specific models most app's have (and
> > I'm eager to see how D2 / ZF2 integration will standardize these
> > things).
> 
> In the scrum app I've been working on, I had an "application" module
> (the default module, basically) that had models related to users and
> teams; these were considered "system-wide" models. I then had models
> specific to the "scrum" module (which has functionality for manipulating
> backlogs, sprints, and scrum logs). I'm also planning a pastebin and
> wiki module for this application -- and each module thus has its own
> models.
> 
> 
> > On Thu, Dec 3, 2009 at 2:57 PM, takeshin  wrote:
> >
> >
> > Where do you store models, migrations, sql, yaml,
> > cli scripts etc. when using Doctrine (1.2) with ZF.
> >
> > I noticed on zendcasts.com,
> > that Jon puts a lot to /application/configs/
> >
> > It makes me wonder
> >
> > --
> > regards
> > takeshin
> > --
> > View this message in context: http://n4.nabble.com/
> > Doctrine-default-directory-structure-tp947943p947943.html
> > Sent from the Zend Framework mailing list archive at Nabble.com.
> >
> >
> 
> --
> Matthew Weier O'Phinney
> Project Lead| matt...@zend.com
> Zend Framework  | http://framework.zend.com/
> 
> 

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


Re: [fw-general] Doctrine - default directory structure

2009-12-03 Thread Juozas
Hi.

I just recently uploaded my demo-code here:
http://github.com/juokaz/php-examples/tree/master/doctrine-application-resource/,
you might want to check it out.

Usually I have fixtures, migrations and stuff like that in config, but you
can easily move it to /data folder as well.

The biggest problem: how to generate modular models. From what I've seen,
proposal for Zf is addressing this, but for now I just do it by hand -
faster and easier than in other ways. However, by doing this you loose some
functions as it seems that Doctrine is more for one-directory structure.

--
Juozas Kaziukėnas (juo...@juokaz.com)
Aš internete - JuoKaz (http://www.juokaz.com)


On Thu, Dec 3, 2009 at 9:54 PM, takeshin  wrote:

>
>
>
> Jon Lebensold wrote:
> >
> > takeshin, I believe the sql/ folder is supposed to house SQL that would
> > run
> > via the Doctrine CLI and this is exactly the same approach that you would
> > use with the YAML files.
> >
>
> I'd rather not put anything that requires write access to the /configs/
> I would store yaml, sql, migration files in /data/ directory.
>
> Anyone here using doctrine-cli?
>
> I hope I'll post working example of doctrine application resource,
> but I just have to make sure about the recommended/approved by community
> app
> structure.
>
> --
> regards
> takeshin
>
> --
> View this message in context:
> http://n4.nabble.com/Doctrine-default-directory-structure-tp947943p948031.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>


Re: [fw-general] Doctrine - default directory structure

2009-12-03 Thread takeshin



Jon Lebensold wrote:
> 
> takeshin, I believe the sql/ folder is supposed to house SQL that would
> run
> via the Doctrine CLI and this is exactly the same approach that you would
> use with the YAML files.
> 

I'd rather not put anything that requires write access to the /configs/
I would store yaml, sql, migration files in /data/ directory.

Anyone here using doctrine-cli?

I hope I'll post working example of doctrine application resource,
but I just have to make sure about the recommended/approved by community app
structure.

-- 
regards
takeshin

-- 
View this message in context: 
http://n4.nabble.com/Doctrine-default-directory-structure-tp947943p948031.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Doctrine - default directory structure

2009-12-03 Thread Jon Lebensold
takeshin, I believe the sql/ folder is supposed to house SQL that would run
via the Doctrine CLI and this is exactly the same approach that you would
use with the YAML files.

my 2 cents,

j

On Thu, Dec 3, 2009 at 4:38 PM, takeshin  wrote:

>
> Happily, Doctrine 1.2 has new additions which allows for easy integrating
> with ZF models autoloader.
> But that's not the point of this post.
>
> I'm just curious of standard directory tree when working with Doctrine
> (as proposed for ZF application once).
>
> My previous setup was more or less like this:
> /application/
> /application/models/
> /application/models/generated/
> /doctrine/
> /doctrine/migrations/
> /doctrine/schema/
> /doctrine/schema/sql
> /bin/
> /bin/doctrine-cli.sh
>
> Now I use:
> /application/
> /application/models/
> /application/models/Db/
> /data/cache/
> /data/log/
>
> and I wonder where to put the other stuff.
>
> I agree that yml may go to /configs/
> but is this right place for sql's too?
> Should't it be near to /scritps or /models ?
>
> --
> regards
> takeshin
> --
> View this message in context:
> http://n4.nabble.com/Doctrine-default-directory-structure-tp947943p948015.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>


Re: [fw-general] Doctrine - default directory structure

2009-12-03 Thread Jon Lebensold
I think that in the architecture you're suggesting, it makes a lot of sense,
however I wonder how many apps need per-module models since you're
essentially creating two resource layers: one "system-wide" one and one for
that particular portion of the application. If you're manipulation of a
subset of data (in your case, scrum logs) with module-specific business
rules, then its a no-brainer.

When I did the zendcast, I was heavily inspired by your blog post about zend
/ doctrine model autoloading, however I didn't find a working example with
models being generated on a per module basis using the CLI.


On Thu, Dec 3, 2009 at 4:02 PM, Matthew Weier O'Phinney wrote:

> -- Jon Lebensold  wrote
> (on Thursday, 03 December 2009, 03:34 PM -0500):
> > not true... I put the Doctrine CLI script in a /scripts folder. All the
> other
> > folders (migrations / sql / yaml / data) I believe belong in configs/
> since
> > they are part of setting up an app or migrating releases.
> >
> > the models belong in /model
> >
> > I haven't found a good solution to autoloading /modules/{modname}/models
> yet
>
> I've found that having ZF do the autoloading for your models works
> flawlessly, and can thus simply use the autoloading rules defined in
> Zend_Application_Module_Autoloader (which module bootstraps instantiate
> and configure by default).
>
> > Also, I wonder how many module-specific models most app's have (and
> > I'm eager to see how D2 / ZF2 integration will standardize these
> > things).
>
> In the scrum app I've been working on, I had an "application" module
> (the default module, basically) that had models related to users and
> teams; these were considered "system-wide" models. I then had models
> specific to the "scrum" module (which has functionality for manipulating
> backlogs, sprints, and scrum logs). I'm also planning a pastebin and
> wiki module for this application -- and each module thus has its own
> models.
>
>
> > On Thu, Dec 3, 2009 at 2:57 PM, takeshin  wrote:
> >
> >
> > Where do you store models, migrations, sql, yaml,
> > cli scripts etc. when using Doctrine (1.2) with ZF.
> >
> > I noticed on zendcasts.com,
> > that Jon puts a lot to /application/configs/
> >
> > It makes me wonder
> >
> > --
> > regards
> > takeshin
> > --
> > View this message in context: http://n4.nabble.com/
> > Doctrine-default-directory-structure-tp947943p947943.html
> > Sent from the Zend Framework mailing list archive at Nabble.com.
> >
> >
>
> --
> Matthew Weier O'Phinney
> Project Lead| matt...@zend.com
> Zend Framework  | http://framework.zend.com/
>


Re: [fw-general] Doctrine - default directory structure

2009-12-03 Thread takeshin

Happily, Doctrine 1.2 has new additions which allows for easy integrating
with ZF models autoloader.
But that's not the point of this post.

I'm just curious of standard directory tree when working with Doctrine
(as proposed for ZF application once).

My previous setup was more or less like this:
/application/
/application/models/
/application/models/generated/
/doctrine/
/doctrine/migrations/
/doctrine/schema/
/doctrine/schema/sql
/bin/
/bin/doctrine-cli.sh

Now I use:
/application/
/application/models/
/application/models/Db/
/data/cache/
/data/log/

and I wonder where to put the other stuff.

I agree that yml may go to /configs/
but is this right place for sql's too?
Should't it be near to /scritps or /models ?

-- 
regards
takeshin
-- 
View this message in context: 
http://n4.nabble.com/Doctrine-default-directory-structure-tp947943p948015.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Doctrine - default directory structure

2009-12-03 Thread Matthew Weier O'Phinney
-- Jon Lebensold  wrote
(on Thursday, 03 December 2009, 03:34 PM -0500):
> not true... I put the Doctrine CLI script in a /scripts folder. All the other
> folders (migrations / sql / yaml / data) I believe belong in configs/ since
> they are part of setting up an app or migrating releases.
> 
> the models belong in /model
> 
> I haven't found a good solution to autoloading /modules/{modname}/models yet

I've found that having ZF do the autoloading for your models works
flawlessly, and can thus simply use the autoloading rules defined in
Zend_Application_Module_Autoloader (which module bootstraps instantiate
and configure by default).

> Also, I wonder how many module-specific models most app's have (and
> I'm eager to see how D2 / ZF2 integration will standardize these
> things).

In the scrum app I've been working on, I had an "application" module
(the default module, basically) that had models related to users and
teams; these were considered "system-wide" models. I then had models
specific to the "scrum" module (which has functionality for manipulating
backlogs, sprints, and scrum logs). I'm also planning a pastebin and
wiki module for this application -- and each module thus has its own
models.


> On Thu, Dec 3, 2009 at 2:57 PM, takeshin  wrote:
> 
> 
> Where do you store models, migrations, sql, yaml,
> cli scripts etc. when using Doctrine (1.2) with ZF.
> 
> I noticed on zendcasts.com,
> that Jon puts a lot to /application/configs/
> 
> It makes me wonder 
> 
> --
> regards
> takeshin
> --
> View this message in context: http://n4.nabble.com/
> Doctrine-default-directory-structure-tp947943p947943.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> 

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


Re: [fw-general] Doctrine - default directory structure

2009-12-03 Thread Jon Lebensold
not true... I put the Doctrine CLI script in a /scripts folder. All the
other folders (migrations / sql / yaml / data) I believe belong in configs/
since they are part of setting up an app or migrating releases.

the models belong in /model

I haven't found a good solution to autoloading /modules/{modname}/models yet

Also, I wonder how many module-specific models most app's have (and I'm
eager to see how D2 / ZF2 integration will standardize these things).

Best,
-
Jon

On Thu, Dec 3, 2009 at 2:57 PM, takeshin  wrote:

>
> Where do you store models, migrations, sql, yaml,
> cli scripts etc. when using Doctrine (1.2) with ZF.
>
> I noticed on zendcasts.com,
> that Jon puts a lot to /application/configs/
>
> It makes me wonder…
>
> --
> regards
> takeshin
> --
> View this message in context:
> http://n4.nabble.com/Doctrine-default-directory-structure-tp947943p947943.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>


[fw-general] Doctrine - default directory structure

2009-12-03 Thread takeshin

Where do you store models, migrations, sql, yaml,
cli scripts etc. when using Doctrine (1.2) with ZF.

I noticed on zendcasts.com,
that Jon puts a lot to /application/configs/

It makes me wonder…

-- 
regards
takeshin
-- 
View this message in context: 
http://n4.nabble.com/Doctrine-default-directory-structure-tp947943p947943.html
Sent from the Zend Framework mailing list archive at Nabble.com.


RE: [fw-general] ZF Open Source Project: Example of Best Practices?

2009-12-03 Thread swilhelm

Thanks Wil.

You mentioned Digitalus, http://digitaluscms.com. It seems like it might be
the best example open source project running on ZF.  They mention version
2.0 is under development and will take advantage of more core ZF components,
but I can not find a public source repository containing version 2.0.

- Steve W.




wllm wrote:
> 
> Simplecloud.org currently runs on EC2 and the next generation of
> Digitalus. It's even using components of Zend_Service_Amazon and the
> Simple Cloud API- it's 'cloud native', so to speak. J I may be able to
> open-source the code, but I'd have to talk with Forrest
> (creator/maintainer of DigitalusCMS) first.
> 
> I'm also working on an app called the Simple Cloud Explorer that is
> designed to demo SCAPI in action. This will definitely be open-sourced
> and liberally commented/documented, but I can't make any promises on the
> release date.
> 
> ,Wil
> 
> 

-- 
View this message in context: 
http://n4.nabble.com/ZF-Open-Source-Project-Example-of-Best-Practices-tp787830p947922.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] ZendX_JQuery_Form discussion

2009-12-03 Thread Jigal sanders
Hello everyone,

Since I want to use some JQuery in my form I installed ZendX_JQuery. But can
anyone give example's or tutorials to learn how to use Zend_JQuery_Form? How
does it go together wit zend_form?
Thanks

On Thu, Dec 3, 2009 at 11:32 AM, Саша Стаменковић wrote:

> I'm trying now to make tabs, but with display groups, not subforms like in
> docs example
>
> In my form which extends ZendX_JQuery_Form
>
> $this->setDisableLoadDefaultDecorators(true);
>  $this->setDecorators(array(
> 'FormElements',
> array('TabContainer', array(
> 'id'  => 'tabContainer',
> 'style'   => 'width: 600px;',
> )),
> 'Form',
> ));
>
> $decorators = array(
> 'FormElements',
> array(
>  'TabPane', array(
>  'jQueryParams' => array(
>  'containerId' => 'tabContainer',
>  'title' => 'DatePicker and Slider'
>  )
>  )
> )
> );
> )->addElement(
> ...
> )->addElement(
> ...
> )->addDisplayGroup(
> array(
>  'el1',
>  'el3'
> ),
> 'group2',
> array (
>  'decorators' => $decorators
> )
> ...
>
> But it looks like ZendX_JQuery_View_Helper_TabContainer does not renders
> anything, just
>
>  
>
> Any idea? Where did I go wrong?
>
> Regards,
> Saša Stamenković
>
>
>
> On Thu, Dec 3, 2009 at 10:35 AM, Саша Стаменковић wrote:
>
>> Is there a way to achieve that in one shot?
>>
>> My form is extends ZendX_JQuery_Form and I want
>> to $this->setElementDecorators() but which one to set UiWidgetElement
>> or ViewHelper? I don't want to set decorators for each element separately.
>>
>> Regards,
>> Saša Stamenković
>>
>>
>> On Thu, Dec 3, 2009 at 10:21 AM, Benjamin Eberlei 
>>  wrote:
>>
>>>
>>> The UiWidgetElement decorator is supposed to be used only with jQuery
>>> elements,
>>> wheras the "normal" decorator is for "normal" elements.
>>>
>>> On Wed, 2 Dec 2009 23:15:38 -0800 (PST), umpirsky 
>>>
>>> wrote:
>>> > Hi.
>>> >
>>> > I started using ZendX_JQuery_Form, and noted few things:
>>> >
>>> > 1. Replacing ViewHelper with UiWidgetElement produces
>>> Zend_Form_Element*
>>> > not
>>> > to render correctly. Then I added ugly patch in
>>> > ZendX_JQuery_Form_Decorator_UiWidgetElement in render method
>>> > (http://pastie.org/725073 line #13).
>>> > I don't see why ZendX_JQuery_Form_Decorator_UiWidgetElement calls
>>> > $elementContent = $view->$helper($name, $value, $jQueryParams,
>>> $attribs);
>>>
>>> > instead
>>> > $elementContent = $view->$helper($name, $value, $attribs,
>>> > $element->options);
>>> > in this case it can have jQuery options in attribs use it and then just
>>> > unset it - and we have a compatibility with Zend_Form_Element_*. Which
>>> is
>>> a
>>> > must, since jQuery UI don't have all element replacements(input,
>>> checkbox,
>>> > radio...)
>>> >
>>> > 2. Is there a support for factory methods -
>>> ZendX_Jquery_Form::addElement()
>>> > ? How do we add elements to ZendX_Jquery_Form?
>>> >
>>> > 3. I use
>>> >
>>>
>>> http://www.filamentgroup.com/lab/jquery_ui_selectmenu_an_aria_accessible_plugin_for_styling_a_html_select/
>>> > and
>>> >
>>>
>>> http://www.filamentgroup.com/lab/update_jquery_ui_slider_from_a_select_element_now_with_aria_support/
>>> > on my site, have already implemented selectmenu
>>> (http://pastie.org/725079)
>>> > it would be nice if someone can review.
>>> >
>>> > 4. I have sent my signed CLA a week ago via email, still no response.
>>> Maybe
>>> > I can contribute if there is someone from ZendX_JQuery authors to
>>> discuss.
>>> >
>>> > Regards,
>>> > Saša Stamenković.
>>>
>>>
>


Re: [fw-general] Current Module in Application Resource

2009-12-03 Thread takeshin


weierophinney wrote:
> 
>> How to get current module name in application resource?
> 
> You can't. The module is not known until after routing.
> 

Thank you.

-- 
regards
takeshin



-- 
View this message in context: 
http://n4.nabble.com/Current-Module-in-Application-Resource-tp947682p947763.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Current Module in Application Resource

2009-12-03 Thread Matthew Weier O'Phinney
-- takeshin  wrote
(on Thursday, 03 December 2009, 07:00 AM -0800):
> How to get current module name in application resource?

You can't. The module is not known until after routing.

> It is stored in Dispatchers $_curModule member variable,
> but it is protected.
> 
> Request object is null.
> 
> Do I have to dispatch first? How?

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


Re: [fw-general] getFrontController() returns null?

2009-12-03 Thread Ralph Schindler

I would check to see if your environment is the same:

* PHP Version
* ZF Version

Then, if you don't see any issues there, try turning error_reporting and 
display_errors on, just to see if there are some warnings being raised 
on the production machine.


Generally, the code should work exactly the same in testing as in 
production.


-ralph

Eugene Morgan wrote:

   $bootstrap = $this->getInvokeArg('bootstrap');


For some reason that works beautifully on my development machine but
not on the production server (shared hosting).

Fortunately this is a very small application so I'm able to work
around it easily by putting my config object in Zend_Registry. But I'm
clueless as to why the server doesn't want to play along ...

On Mon, Nov 30, 2009 at 8:03 PM, Matthew Weier O'Phinney
 wrote:

-- Eugene Morgan  wrote
(on Monday, 30 November 2009, 06:35 PM -0600):

I am working on a contact form in ZF 1.9. In one of my actions, I am
trying to access the bootstrap by
$this->getFrontController()->getParam('bootstrap')

Not sure why it's not working, but there's an easier way:

   $bootstrap = $this->getInvokeArg('bootstrap');


I made some changes to the application.ini file that shouldn't affect
anything ... but now the code above is not returning the bootstrap. In
fact, $this->getFrontController() returns NULL -- I am not sure why?
It was working fine before ...

Here is my application.ini file
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "America/Chicago"

includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layout = "layout"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"

contactMail.fromAddress = cont...@xyz.com
contactMail.fromName = Contact form
contactMail.toAddress = a...@abc.com
contactMail.toName = Some Name
contactMail.subject = "Contact Form Message on xyz.com"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

Here is the code in the action method:


public function createAction()
{
if (!$this->_request->isPost()) {
return $this->_forward('new');
}

$form = new Form_Contact();
$formData = $this->_request->getPost();
if (!$form->isValid($formData)) {
return $this->_forward('new');
}

// Check for honeypot to avoid spam
if ($form->getValue('altEmail')) {
return $this->_forward('spam');
}

$view = new Zend_View();
$path = APPLICATION_PATH . '/views/scripts';
$view->setScriptPath($path);
$view->name = $form->getValue('contactName');
$view->phone = $form->getValue('phone');
$view->email = $form->getValue('email');
$view->comments = $form->getValue('comments');

$bootstrap = $this->getFrontController()->getParam('bootstrap');
if ($bootstrap->getEnvironment() == 'production') {
$config = new Zend_Config($bootstrap->getOption('smtp'));
$mail = new Zend_Mail('utf-8');
$mail->setFrom($config->fromAddress, $config->fromName);
$mail->addTo($config->toAddress, $config->toName);
$mail->setSubject($config->subject);
$mail->setBodyHtml($view->render('mail/contact.phtml'));
$mail->send();
}

$this->_redirector->gotoSimple('show');
}


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





Re: [fw-general] XMheL

2009-12-03 Thread Daniel Latter
Thanks, I'll have a look at Zend_Dom, I was looking for Zend_Xml so
missed that one.




2009/12/3 prodigitalson :
>
>
>
> Daniel Latter wrote:
>>
>> Can anyone recommend any XML libs they use with thier ZF app? I need to
>> create, parse, request/respond etc..
>>
>
> I normally use SimpleXML or DOMDocument. Ive also used XMLReader in the past
> for huge files, but never in conjunction with ZF. There is also Zend_Dom
> http://framework.zend.com/manual/en/zend.dom.html which is based on
> DOMDocument.
> --
> View this message in context: http://n4.nabble.com/XMheL-tp947685p947687.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>


Re: [fw-general] XMheL

2009-12-03 Thread prodigitalson



Daniel Latter wrote:
> 
> Can anyone recommend any XML libs they use with thier ZF app? I need to
> create, parse, request/respond etc..
> 

I normally use SimpleXML or DOMDocument. Ive also used XMLReader in the past
for huge files, but never in conjunction with ZF. There is also Zend_Dom
http://framework.zend.com/manual/en/zend.dom.html which is based on
DOMDocument.
-- 
View this message in context: http://n4.nabble.com/XMheL-tp947685p947687.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Current Module in Application Resource

2009-12-03 Thread takeshin

How to get current module name in application resource?

It is stored in Dispatchers $_curModule member variable,
but it is protected.

Request object is null.

Do I have to dispatch first? How?

-- 
regards
takeshin
-- 
View this message in context: 
http://n4.nabble.com/Current-Module-in-Application-Resource-tp947682p947682.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] XMheL

2009-12-03 Thread Daniel Latter
Hi All,

Can anyone recommend any XML libs they use with thier ZF app? I need to
create, parse, request/respond etc..

Thanks.


Re: [fw-general] "observe" controller action

2009-12-03 Thread Thorsten Suckow-Homberg

>I've written a fairly robust system, Phly_PubSub:
>
>PHP 5.3 version:
>http://github.com/weierophinney/phly/tree/mvcfsm/Phly_PubSub/
>
>PHP 5.2+ version:
>http://github.com/weierophinney/phly/tree/master/Phly_PubSub/


...which would follow the traditional MessageBus-approach. +1 for bringing 
something like this into the ZF trunk. 

-- 
Sent with conjoon. Visit http://www.conjoon.org

You should follow me on Twitter: http://twitter.com/ThorstenSuckow



Re: [fw-general] "observe" controller action

2009-12-03 Thread Matthew Weier O'Phinney
-- Cameron  wrote
(on Thursday, 03 December 2009, 10:03 AM +0800):
> I've done a similar thing by using an Events and Subscribe system, my
> controller abstract has a number of event broadcasts throughout, and it's very
> simple to build a subscriber that latches on to whatever it needs to in order
> to satisfy the business rules. I based mine upon some code I found through the
> googles, I've just now quickly tried to find it again with no success, I
> suppose though I could be convinced to package up what I've done and post it
> somewhere.

I've written a fairly robust system, Phly_PubSub:

PHP 5.3 version:
http://github.com/weierophinney/phly/tree/mvcfsm/Phly_PubSub/

PHP 5.2+ version:
http://github.com/weierophinney/phly/tree/master/Phly_PubSub/

> On Wed, Dec 2, 2009 at 8:41 PM, Diego Potapczuk  wrote:
> 
> Exactly.
> 
> 
> ::: Diego Potapczuk
> 
>Analista de sistemas
>Tel: (71) 3287-8343 / (71) 9144-3062
>http://www.diegoliveira.com.br
> 
> 
> 
> On Wed, Dec 2, 2009 at 9:22 AM, Vincent de Lau  wrote:
> 
> Consume basically means 'one object using another object'.
> 
> Basically what it boils down to, is that you should move the code from
> the
> controller to an object in the Model layer (a Service is suggested).
> Both
> controllers can than consume/use this service to get their work done.
> 
> Controllers should be thin and use Models to do the work. I can 
> suggest
> reading http://www.survivethedeepend.com/ for more information on the
> subject.
> 
> Vincent de Lau
>  vinc...@delau.nl
> 
> > -Original Message-
> > From: tonystamp [mailto:tonyst...@hotmail.co.uk]
> > Sent: Wednesday, December 02, 2009 12:34 PM
> > To: fw-general@lists.zend.com
> > Subject: Re: [fw-general] "observe" controller action
> >
> >
> > Thanks for the reply, but could you elaborate a bit more- what do 
> you
> > mean by consume?
> 
> 
> 
> 
> 

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


Re: [fw-general] File Upload Progress

2009-12-03 Thread Thomas Weidner

Look into the demos directory.
There are 2 demos shipped with ZF which show how file progress works.

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

- Original Message - 
From: "Andrei Iarus" 

To: "Zend Framework" 
Sent: Thursday, December 03, 2009 9:08 AM
Subject: [fw-general] File Upload Progress


Hello,

How is PHP/the extension ZF aware of the UPLOAD_ID in the code from the 
documentation:


$adapter = new Zend_ProgressBar_Adapter_Console();
$upload = Zend_File_Transfer_Adapter_Http::getProgress($adapter);

$upload = null;
while (!$upload['done']) {
$upload = Zend_File_Transfer_Adapter_Http:getProgress($upload);
}

This documentation is tooken from 
http://zendframework.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress


How should that parameter be passed, in case of an Ajax request?

Thanks.





Re: [fw-general] ZendX_JQuery_Form discussion

2009-12-03 Thread Саша Стаменковић
I'm trying now to make tabs, but with display groups, not subforms like in
docs example

In my form which extends ZendX_JQuery_Form

$this->setDisableLoadDefaultDecorators(true);
$this->setDecorators(array(
'FormElements',
array('TabContainer', array(
'id'  => 'tabContainer',
'style'   => 'width: 600px;',
)),
'Form',
));

$decorators = array(
'FormElements',
array(
 'TabPane', array(
 'jQueryParams' => array(
 'containerId' => 'tabContainer',
'title' => 'DatePicker and Slider'
 )
 )
)
);
)->addElement(
...
)->addElement(
...
)->addDisplayGroup(
array(
 'el1',
 'el3'
),
'group2',
array (
 'decorators' => $decorators
)
...

But it looks like ZendX_JQuery_View_Helper_TabContainer does not renders
anything, just

 

Any idea? Where did I go wrong?

Regards,
Saša Stamenković


On Thu, Dec 3, 2009 at 10:35 AM, Саша Стаменковић wrote:

> Is there a way to achieve that in one shot?
>
> My form is extends ZendX_JQuery_Form and I want
> to $this->setElementDecorators() but which one to set UiWidgetElement
> or ViewHelper? I don't want to set decorators for each element separately.
>
> Regards,
> Saša Stamenković
>
>
> On Thu, Dec 3, 2009 at 10:21 AM, Benjamin Eberlei 
>  wrote:
>
>>
>> The UiWidgetElement decorator is supposed to be used only with jQuery
>> elements,
>> wheras the "normal" decorator is for "normal" elements.
>>
>> On Wed, 2 Dec 2009 23:15:38 -0800 (PST), umpirsky 
>>
>> wrote:
>> > Hi.
>> >
>> > I started using ZendX_JQuery_Form, and noted few things:
>> >
>> > 1. Replacing ViewHelper with UiWidgetElement produces Zend_Form_Element*
>> > not
>> > to render correctly. Then I added ugly patch in
>> > ZendX_JQuery_Form_Decorator_UiWidgetElement in render method
>> > (http://pastie.org/725073 line #13).
>> > I don't see why ZendX_JQuery_Form_Decorator_UiWidgetElement calls
>> > $elementContent = $view->$helper($name, $value, $jQueryParams,
>> $attribs);
>>
>> > instead
>> > $elementContent = $view->$helper($name, $value, $attribs,
>> > $element->options);
>> > in this case it can have jQuery options in attribs use it and then just
>> > unset it - and we have a compatibility with Zend_Form_Element_*. Which
>> is
>> a
>> > must, since jQuery UI don't have all element replacements(input,
>> checkbox,
>> > radio...)
>> >
>> > 2. Is there a support for factory methods -
>> ZendX_Jquery_Form::addElement()
>> > ? How do we add elements to ZendX_Jquery_Form?
>> >
>> > 3. I use
>> >
>>
>> http://www.filamentgroup.com/lab/jquery_ui_selectmenu_an_aria_accessible_plugin_for_styling_a_html_select/
>> > and
>> >
>>
>> http://www.filamentgroup.com/lab/update_jquery_ui_slider_from_a_select_element_now_with_aria_support/
>> > on my site, have already implemented selectmenu
>> (http://pastie.org/725079)
>> > it would be nice if someone can review.
>> >
>> > 4. I have sent my signed CLA a week ago via email, still no response.
>> Maybe
>> > I can contribute if there is someone from ZendX_JQuery authors to
>> discuss.
>> >
>> > Regards,
>> > Saša Stamenković.
>>
>>


Re: [fw-general] ZendX_JQuery_Form discussion

2009-12-03 Thread Саша Стаменковић
Is there a way to achieve that in one shot?

My form is extends ZendX_JQuery_Form and I want
to $this->setElementDecorators() but which one to set UiWidgetElement
or ViewHelper? I don't want to set decorators for each element separately.

Regards,
Saša Stamenković


On Thu, Dec 3, 2009 at 10:21 AM, Benjamin Eberlei 
 wrote:

>
> The UiWidgetElement decorator is supposed to be used only with jQuery
> elements,
> wheras the "normal" decorator is for "normal" elements.
>
> On Wed, 2 Dec 2009 23:15:38 -0800 (PST), umpirsky 
> wrote:
> > Hi.
> >
> > I started using ZendX_JQuery_Form, and noted few things:
> >
> > 1. Replacing ViewHelper with UiWidgetElement produces Zend_Form_Element*
> > not
> > to render correctly. Then I added ugly patch in
> > ZendX_JQuery_Form_Decorator_UiWidgetElement in render method
> > (http://pastie.org/725073 line #13).
> > I don't see why ZendX_JQuery_Form_Decorator_UiWidgetElement calls
> > $elementContent = $view->$helper($name, $value, $jQueryParams, $attribs);
>
> > instead
> > $elementContent = $view->$helper($name, $value, $attribs,
> > $element->options);
> > in this case it can have jQuery options in attribs use it and then just
> > unset it - and we have a compatibility with Zend_Form_Element_*. Which is
> a
> > must, since jQuery UI don't have all element replacements(input,
> checkbox,
> > radio...)
> >
> > 2. Is there a support for factory methods -
> ZendX_Jquery_Form::addElement()
> > ? How do we add elements to ZendX_Jquery_Form?
> >
> > 3. I use
> >
>
> http://www.filamentgroup.com/lab/jquery_ui_selectmenu_an_aria_accessible_plugin_for_styling_a_html_select/
> > and
> >
>
> http://www.filamentgroup.com/lab/update_jquery_ui_slider_from_a_select_element_now_with_aria_support/
> > on my site, have already implemented selectmenu
> (http://pastie.org/725079)
> > it would be nice if someone can review.
> >
> > 4. I have sent my signed CLA a week ago via email, still no response.
> Maybe
> > I can contribute if there is someone from ZendX_JQuery authors to
> discuss.
> >
> > Regards,
> > Saša Stamenković.
>
>


Re: [fw-general] Return value from controller action

2009-12-03 Thread Jurian Sluiman
Thanks for the answer :)

Actually I simplified the example. The real case, the admin module builds an
Admin_Form_Page. Based on the request, the blog module can return a form
instance, but it's not allways the case. The form is a Blog_Form_Admin (for
example, but the admin module doesn't know this for sure).
The Blog_Form_Admin might get filled with data A or data B, based on the
request (or even remains empty).
All the logic (wheter or not to return a form and if so, which data is used
to fill the form) is imho a piece of logic for the Blog module.

But eventually the Blog_Form_Admin needs to be placed as a subform in the
Admin_Form_Page, which causes all the troubles.

Regards, Jurian

2009/12/3 Diego Potapczuk 

> I didn´t understand it very well, but here are some tips that maybe help
> you.
>
> Dont´t build Forms inside controllers, make a separated class extending
> Zend_Form to define it, then use it in the controllers. If you need to
> construct it with some data, you can make a method in the Form class to do
> it.
>
> Example to ilustrate:
>
> Form
>
> >
>> class Blog_Form_Post extends Zend_Form {
>> public function init()
>> {
>> $this->setMethod('post');
>>
>> $id = $this->createElement('hidden','idPost');
>> $this->addelement($id);
>>
>> $texto = $this->createElement('textarea','text');
>> $texto->setLabel('Text:')
>>   ->setAttrib('size',50);
>> $this->addelement($texto);
>>
>> $salvar = $this->createElement('submit','salvar');
>> $salvar->setLabel("Salvar")
>>->setIgnore(true);
>> $this->addelement($salvar);
>> }
>>
>> public function setIdPost($id)
>> {
>> $this->getElement('idPost')->setValue($id);
>> }
>> }
>>
>
> Controler
>
> public function editFormAction()
>> {
>> $post = $this->getRequest()->getPost();
>> $form = new Blog_Form_Post();
>> $form->setIdPostValue($post['idPost']);
>>
>> $this->view->form = $form;
>> }
>>
>
>
> Now you can use it anywhere, even outside Blog module
>
>
>
> ::: Diego Potapczuk
>
> »» Analista de sistemas
> »» Tel: (71) 3287-8343 / (71) 9144-3062
> »» http://www.diegoliveira.com.br
>
>
>
> On Wed, Dec 2, 2009 at 7:08 PM, Jurian Sluiman  wrote:
>
>> Hi all,
>> Is it possible to fetch the return value from a certain function inside
>> an
>> action controller?
>>
>> This is the use case: I have ad admin module and a specific controller.
>> This
>> controller builds a form to edit some data. The data might come from
>> another
>> modules, so I call the admin-controller from that module.
>> I want to have something like this (pseudo code):
>>
>> admin-module/controller-action:
>>
>>> $form = new Zend_Form;
>>
>> $subform = someMagicFunction('blog', 'admin', 'getForm');
>>
>> $form->addSubform($subform);
>>
>>
>> Is this possible to achieve? Currently I fetch the results with a custom
>> dispatcher, but that's imho an ugly hack...
>>
>> Regards, Jurian
>>
>
>


[fw-general] File Upload Progress

2009-12-03 Thread Andrei Iarus
Hello,
 
How is PHP/the extension ZF aware of the UPLOAD_ID in the code from the 
documentation:
 
$adapter = new Zend_ProgressBar_Adapter_Console();
$upload  = Zend_File_Transfer_Adapter_Http::getProgress($adapter);

$upload = null;
while (!$upload['done']) {
$upload = Zend_File_Transfer_Adapter_Http:getProgress($upload);
}
 
This documentation is tooken from 
http://zendframework.com/manual/en/zend.file.html#zend.file.transfer.introduction.uploadprogress
 
How should that parameter be passed, in case of an Ajax request?
 
Thanks.