2008年12月31日星期三

[fw-core] Image upload and database insert, correct way

Hi,
 
Wishing everyone a very happy, prosperous and fun-filled 2009.
--
 
I have an image upload form, where on successful upload...
1. I copy the image from the temp location, to its final location (after renaming)
2. Delete the original image from the temp folder
3. Insert the image information into the database
 
All works fine, but what i'd like to know is, if I am doing the steps in the right order (1,2,3).
One drawback of the above order is that I do not have the insert id while renaming the image (which i'd really like to have). But at the same time I am not sure if db insert should be done first and the image renamed/cleaned later.
 
All guidance is appreciated.
 
-R
 
P.S. I am on shared host, where there are (not very often, but they do happen) db issues :)

Re: [fw-db] index by primary key?

One answer might be to return something like;
Mutli-Col1Val-Col2Val => array('keys' => array('col1' =>'val',

'col2' => 'val),
'row' =>
array(/*row goes here*/))

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com

Tobias Gies wrote:
> Hi Joachim,
>
> personally, I'd like to see this feature. I see at least one problem,
> however: It is possible that primary keys consist of more than one
> table column, and I see no way how we could generate a PK -> row array
> for these. Can one of our database gurus assist?
>
> Wishing you a happy new year,
> Tobias
>
> 2008/12/17 Joachim Lous <joachim@lous.org>:
>
>> The various fetch-modes and -functions provide many useful formats
>> for representing rowsets, but none of them display this desirable feature:
>> Return an associative array of rows (in whatever row format), where the
>> array key for each row is the row's primary key in string format.
>>
>> The thought seems pretty obvious; Is there any particular reason why this is
>> a bad idea?
>>
>>

Re: [fw-mvc] Relative urls that are not based on routes

Thanks, Rolando, that worked perfectly.

-Hector


On Wed, Dec 31, 2008 at 7:37 AM, Rolando Espinoza La Fuente <darkrho@gmail.com> wrote:
On Tue, Dec 30, 2008 at 6:08 PM, Hector Virgen <djvirgen@gmail.com> wrote:
[...]
> Is there a better way to easily create relative URLs that are not based on
> routes? I want to avoid using <base href="" /> if possible. Thanks!

You can use a view helper to construct the urls, see:

http://code.google.com/p/zym/source/browse/trunk/library/Zym/View/Helper/BaseUrl.php

Regards,


--
Rolando Espinoza La fuente
Pro Soft Resources  Inc.
www.prosoftpeople.com

Re: [fw-mvc] Relative urls that are not based on routes

On Tue, Dec 30, 2008 at 6:08 PM, Hector Virgen <djvirgen@gmail.com> wrote:
[...]
> Is there a better way to easily create relative URLs that are not based on
> routes? I want to avoid using <base href="" /> if possible. Thanks!

You can use a view helper to construct the urls, see:

http://code.google.com/p/zym/source/browse/trunk/library/Zym/View/Helper/BaseUrl.php

Regards,


--
Rolando Espinoza La fuente
Pro Soft Resources Inc.
www.prosoftpeople.com

Re: [fw-db] index by primary key?

Hi Joachim,

personally, I'd like to see this feature. I see at least one problem,
however: It is possible that primary keys consist of more than one
table column, and I see no way how we could generate a PK -> row array
for these. Can one of our database gurus assist?

Wishing you a happy new year,
Tobias

2008/12/17 Joachim Lous <joachim@lous.org>:
> The various fetch-modes and -functions provide many useful formats
> for representing rowsets, but none of them display this desirable feature:
> Return an associative array of rows (in whatever row format), where the
> array key for each row is the row's primary key in string format.
>
> The thought seems pretty obvious; Is there any particular reason why this is
> a bad idea?
>

2008年12月30日星期二

[fw-core] Problem with Dispatch using Zend_Test

Hi,

I'm just starting to use PHPUnit test and Zend_Test.

I've managed to get both running with my application but I'm facing a strange problem. The dispatching does not seem to be able to dispatch my requests to any other controller except IndexController and ErrorController.

I'll try to explain as clearly as possible as my application setup is rather convoluted.

I'm using a modular approach to developing my application. This is done with the following line in /application/bootstrap.php:

$frontController->addModuleDirectory(APPLICATION_PATH . '/modules');

Right now, there are no additional modules yet, only the default.

In my test, I created a MainControllerTest.php in /tests/
Aside from the normal setUp() and tearDown() methods, I have just one testRedirectionToDashboard() method in this class. This method is defined like this:

    public function testRedirectionToDashboard()
    {
        $this->dispatch('/');
        $this->assertController('index');
    }

The above runs fine. Even if I change
 $this->dispatch('/')
to
 $this->dispatch('/index/look');
it works fine.

The problem occurs when I change the location to any controller other than index. So

 $this->dispatch('/dashboard');
 $this->assertController('dashboard');

will fail.

I have no idea why this is the case and I've tried everything I can think of. I guess it probably is something fundamental that has to do with the front controller but I'm new to PHPUnit and Zend_Test, and can't figure this out by myself.

Any help is appreciated. Thanks.

I've deliberately kept this message small for easier reading. If more information is needed, I can place it in follow-up posts. Thanks.

Re: [fw-mvc] Can't manipulate the Dojo addOnLoad queue

-- Drew Bertola <drew@drewb.com> wrote
(on Tuesday, 30 December 2008, 04:54 PM -0800):
> Drew Bertola wrote:
> > I can work around this with:
> >

> > $view->dojo()->addJavascript("dojo.addOnLoad(function(){my.whatever.someFunc();});");
> >
> >
>
> I've now refined this to:
>
> ->addJavascript('dojo.addOnLoad(my.init);')
>
> Which is slightly better... but still feels clumsy.

I can't remember the rest of the thread... but why aren't you using
addOnLoad()?

$view->dojo()->addOnLoad('function(){my.whatever.someFunc()};');

or

$view->dojo()->addOnLoad('my.init');

?

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

Re: [fw-mvc] Can't manipulate the Dojo addOnLoad queue

Drew Bertola wrote:
> I can work around this with:
>
> $view->dojo()->addJavascript("dojo.addOnLoad(function(){my.whatever.someFunc();});");
>

I've now refined this to:

->addJavascript('dojo.addOnLoad(my.init);')

Which is slightly better... but still feels clumsy.

--
Drew Bertola

-------------------------------------------------
* PHP/LAMP Consultant, ZCE-1000 *
* *
* Tel: 408-966-6671 *
* *
* current resume: *
* http://drewb.com/blog/about/resume/ *
-------------------------------------------------

[fw-mvc] Can't manipulate the Dojo addOnLoad queue

Hi everyone,

I'm trying to manipulate the order of the addOnLoad queue for the
Zend_Dojo container. I need to be able to manipulate the DOM after
dojo.parser.parse() is called (so that my dijits are available).

Unfortunately, the only way I can do this is a bit clumsy. I've tried
using:

$view->dojo()->addOnLoad("my.whatever.someFunc()");

but this renders backwards (for my needs) as:

dojo.addOnLoad(my.whatever.someFunc());
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();

and since someFunc() is trying to manipulate dijits, and the dijits are not yet created by parse(), I get javascript errors.

I can work around this with:

$view->dojo()->addJavascript("dojo.addOnLoad(function(){my.whatever.someFunc();});");

but, at best, that's ... clumsy.

Any ideas?

--
Drew Bertola

-------------------------------------------------
* PHP/LAMP Consultant, ZCE-1000 *
* *
* Tel: 408-966-6671 *
* *
* current resume: *
* http://drewb.com/blog/about/resume/ *
-------------------------------------------------

[fw-mvc] Relative urls that are not based on routes

Hello ZF users,

I am currently building a new ZF site in a sandbox directory (example.com/sandbox/mysite) and I'm curious as to how many of you are creating URLs to non-ZF files like images, stylesheets, etc.

I understand that when I visit /sandbox/mysite/somecontroller/someaction, my browser "thinks" I'm actually in a directory called "someaction". Therefore, simple relative URLs do not work:

<img src="images/logo.png" alt="" />  <-- firebug says my browser requested "http://example.com/sandbox/mysite/somecontroller/someaction/images/logo.png" which does not exist.

In my view scripts, I am currently using a global constant DOC_ROOT that is dynamically defined based on dirname($_SERVER['PHP_SELF']), which resolves to "/sandbox/mysite":

<img src="<?= DOC_ROOT ?>/images/logo.png" alt="" />  <-- works

However, I feel that that looks a little clumsy, especially next to links that use the url() view helper (which automatically prepends the correct relative path prefix).

Is there a better way to easily create relative URLs that are not based on routes? I want to avoid using <base href="" /> if possible. Thanks!

-Hector

Re: [fw-mvc] Zend_Paginator identify last item of last page

There is no other way currently, but I encourage you to file an enhancement ticket with this e-mail exchange in it calling for the addition of a getItemByIndex() method to Zend_Paginator.

-Matt

On Tue, Dec 30, 2008 at 2:20 AM, Emanuele Deserti <emanuele.deserti@netwing.it> wrote:
Hi Matthew,

thanks that's work and I use it as final solution.

However it will be interesting if it's possible identify the last item directly in the view script, inside the foreach against the paginator himself :)

There's a way to do it? Or it's useless as we can use your code?

Il giorno 29/dic/08, alle ore 19:07, Matthew Ratzloff ha scritto:


Hi Emanuele,

You should be able to do something like this (after setting up the paginator):

$item = end($paginator->getItemsByPage(count($paginator)));

Untested, but that should at least put you on the right track.

Hope that helps,

-Matt

On Mon, Dec 29, 2008 at 4:01 AM, Emanuele Deserti <emanuele.deserti@netwing.it> wrote:
Hi to all,

how I can identify the last item in my paginator?
NOT the last in the current page, but the last item in the last page.

For example: I have 100 items paginated into 5 pages (20 items per page); I need to display custom content only for the 100th (the last of all).

I've tried with getTotalItemCount(), getCurrentItemCount() and so on but without success...
Also googled around and look into API core doc but nothing useful found...

Thanks in advance

---
Emanuele Deserti
Netwing S.r.l.
<emanuele.deserti@netwing.it>
Tel. 0532-1915183
http://www.netwing.it


---
Emanuele Deserti
Netwing S.r.l.
<emanuele.deserti@netwing.it>
Tel. 0532-1915183
http://www.netwing.it


Re: [fw-mvc] S3 and Zend framework : sleeping code in the incubator !

I disagree that the forgotten proposals are any fault of the Zend team whatsoever, other than, perhaps, their ability to review them in a timely manner, which is a result of being a small team that's really overworked.

However, I do think it should be highly encouraged that proposals have two or more people working on them once coding begins.  I know the only proposal I was ever able to bring to fruition (Zend_Paginator) happened solely because Jurrien and I worked together at the suggestion of Darby (formerly of Zend).  I have several proposals I haven't finished, in part, because it's just been me working on them.

Also keep in mind that not just anyone can "walk in off the street" and contribute in a meaningful way to a proposal or a component.

-Matt

On Tue, Dec 30, 2008 at 2:20 AM, Zladivliba Voskuy <nospampam@hotmail.fr> wrote:
> Again, the proposal process is clear: when the *AUTHOR* of a proposal
> feels it's ready for approval, it is the *AUTHOR*'s responsibility to
> mark it as ready for recommendation.
>
> Please be aware that the team at Zend is very small, and part of the
> reason that the proposal process exists, and exists in its current
> incarnation, is so that we can manage our time well. We simply cannot
> track all proposals adequately; many of the proposals languish in an
> incomplete state for months or years, and it would be a waste of our
> time to review them until the author has indicated that it's ready.

I understand this issue and I'm not blaming anyone for not having enough ressources to do more.
What I'm proposing is a solution that could help to go a little further : that would be simply to promote unfinished work so someone out there can take responsability for it and finish the job that was started by someone someday.

The fact that an *AUTHOR*, as you point it out, carries the responsability for the entire process, doesn't seems to me to be such a good thing after all, since, again as you point it out, you have projects that are lying for month or years in the incubator.
Now a better thing might be to put the responsability of a project more on the community then on one guy how might have time to carry on the first steps of a new piece of software but not the latest. That way, not the author only, but anyone could finish it.

Now for the S3 module, someone here is about to post a third version of if, with non of the previous version getting out in the framework. Now you can tell me whaterver you want, I'm just saying that this is a project management problem that would need to be taken care of.







Glissez - déplacez : c'est si simple de partager vos photos sur Windows Live™ Photos !

Re: [fw-mvc] S3 and Zend framework : sleeping code in the incubator !

-- Zladivliba Voskuy <nospampam@hotmail.fr> wrote
(on Tuesday, 30 December 2008, 11:20 AM +0100):
> > Again, the proposal process is clear: when the *AUTHOR* of a proposal
> > feels it's ready for approval, it is the *AUTHOR*'s responsibility to
> > mark it as ready for recommendation.
> >
> > Please be aware that the team at Zend is very small, and part of the
> > reason that the proposal process exists, and exists in its current
> > incarnation, is so that we can manage our time well. We simply cannot
> > track all proposals adequately; many of the proposals languish in an
> > incomplete state for months or years, and it would be a waste of our
> > time to review them until the author has indicated that it's ready.
>
> I understand this issue and I'm not blaming anyone for not having enough
> ressources to do more.
> What I'm proposing is a solution that could help to go a little further : that
> would be simply to promote unfinished work so someone out there can take
> responsability for it and finish the job that was started by someone someday.
>
> The fact that an *AUTHOR*, as you point it out, carries the responsability for
> the entire process, doesn't seems to me to be such a good thing after all,
> since, again as you point it out, you have projects that are lying for month or
> years in the incubator.
> Now a better thing might be to put the responsability of a project more on the
> community then on one guy how might have time to carry on the first steps of a
> new piece of software but not the latest. That way, not the author only, but
> anyone could finish it.
>
> Now for the S3 module, someone here is about to post a third version of if,
> with non of the previous version getting out in the framework. Now you can tell
> me whaterver you want, I'm just saying that this is a project management
> problem that would need to be taken care of.

I've encouraged, and continue to encourage, developers who see
languishing proposals or who have implemented (or wish to imlement)
similar functionality to reach out to the proposal author and offer to
assist. I myself have done so in the past, and have also had others do
so with me (e.g., Jon Whitcraft contacted me to take over the Twitter
proposal and see it to completion for 1.7).

So, if you want to see S3 support in ZF, work *with* one of the proposal
authors to see it to completion -- *that's* how community works. :)

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

Re: [fw-mvc] Adding * to label

Zladivliba Voskuy wrote:
> Hey, did you finally managed to find an answer to this problem ? It's
> an interesting question and I haven't found any answer to it.
Hi,

After researching for a while, I found no convincing reasons to _not_
use CSS for this. As Matthew and others have said, it really depends on
the project and developers to adapt a certain technique. It's nice to
see different ways of solving this problem down this thread.

I wrote http://techchorus.net/adding-required-zendform-field-using-css

I will try to summarize this discussion in another blog post.


--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net

Re: [fw-mvc] Zend_Paginator identify last item of last page

Hi Matthew,

thanks that's work and I use it as final solution.

However it will be interesting if it's possible identify the last item
directly in the view script, inside the foreach against the paginator
himself :)

There's a way to do it? Or it's useless as we can use your code?

Il giorno 29/dic/08, alle ore 19:07, Matthew Ratzloff ha scritto:

> Hi Emanuele,
>
> You should be able to do something like this (after setting up the
> paginator):
>
> $item = end($paginator->getItemsByPage(count($paginator)));
>
> Untested, but that should at least put you on the right track.
>
> Hope that helps,
>
> -Matt
>
> On Mon, Dec 29, 2008 at 4:01 AM, Emanuele Deserti <emanuele.deserti@netwing.it
> > wrote:
> Hi to all,
>
> how I can identify the last item in my paginator?
> NOT the last in the current page, but the last item in the last page.
>
> For example: I have 100 items paginated into 5 pages (20 items per
> page); I need to display custom content only for the 100th (the last
> of all).
>
> I've tried with getTotalItemCount(), getCurrentItemCount() and so on
> but without success...
> Also googled around and look into API core doc but nothing useful
> found...
>
> Thanks in advance
>
> ---
> Emanuele Deserti
> Netwing S.r.l.
> <emanuele.deserti@netwing.it>
> Tel. 0532-1915183
> http://www.netwing.it
>

---
Emanuele Deserti
Netwing S.r.l.
<emanuele.deserti@netwing.it>
Tel. 0532-1915183
http://www.netwing.it

RE: [fw-mvc] S3 and Zend framework : sleeping code in the incubator !

> Again, the proposal process is clear: when the *AUTHOR* of a proposal
> feels it's ready for approval, it is the *AUTHOR*'s responsibility to
> mark it as ready for recommendation.
>
> Please be aware that the team at Zend is very small, and part of the
> reason that the proposal process exists, and exists in its current
> incarnation, is so that we can manage our time well. We simply cannot
> track all proposals adequately; many of the proposals languish in an
> incomplete state for months or years, and it would be a waste of our
> time to review them until the author has indicated that it's ready.

I understand this issue and I'm not blaming anyone for not having enough ressources to do more.
What I'm proposing is a solution that could help to go a little further : that would be simply to promote unfinished work so someone out there can take responsability for it and finish the job that was started by someone someday.

The fact that an *AUTHOR*, as you point it out, carries the responsability for the entire process, doesn't seems to me to be such a good thing after all, since, again as you point it out, you have projects that are lying for month or years in the incubator.
Now a better thing might be to put the responsability of a project more on the community then on one guy how might have time to carry on the first steps of a new piece of software but not the latest. That way, not the author only, but anyone could finish it.

Now for the S3 module, someone here is about to post a third version of if, with non of the previous version getting out in the framework. Now you can tell me whaterver you want, I'm just saying that this is a project management problem that would need to be taken care of.







Glissez - déplacez : c'est si simple de partager vos photos sur Windows Live™ Photos !

2008年12月29日星期一

Re: [fw-mvc] Creating custom dojo builds...

Is this live anywhere? What is the list of files being requested? The
profile / command line / etc looks entirely sane, and should work. My
only guess is you are still loading the layer.js from the pre-build tree
(or a dojo.js) and despite running the build, Dojo is using the relative
location from the source tree.

Feel free to ping me off-list with a live url -- that would provide the
debugging info needed to give you a definitive answer.

Regards,
Peter Higgins


Drew Bertola wrote:
> Peter E Higgins wrote:
>> Drew Bertola wrote:
>>
>>> Thanks Peter and Matthew.
>>>
>>> I followed Peter's approach and still ended up with 32 file
>>> requests. Is there supposed to be that many?
>>>
>>> It's better than the 60+ requests I get without the layer, but still...
>>>
>>> Thanks again.
>>>
>>>
>> No. With the layer approach you will have two js resources loaded:
>> dojo.js and layer.js -- depending on what is in the layer, you may see
>> one request for i18n bundle for the locale. What are the url's for the
>> additional requests being made?
>>
>> One step I didn't mention in the last note is cssOptimize ... if you are
>> using Dijit, you'll need a theme obviously, but for maintainability the
>> themes are broken into many small files based on widget. tundra.css is
>> simply a list of @imports in a -src release. In the "release", we use a
>> command line option cssOptimize=comments.keepLines
>> cssImportExclude=../dijit.css
>>
>> This makes a tundra.css "layer" of all the @imports (you can do this too
>> in your my/ namespace, provided the css files all use relative locations
>> to images and such), and excludes the @import "../dijit.css"; You can
>> skip the exclusion of dijit.css, we do this step for backwards
>> compatibility.
>>
>> I suspect the majority of your requests are CSS, as cssOptimize is not
>> on by default, so running it against a clean checkout or -src release
>> will not build the theme rollups.
>>
>> So, dojo.js, layer.js, nls/layer-en.js, tundra.css, and however many
>> images are referenced in css and being used in the dom would be your
>> initial expected request count. I suppose it _could_ be 32 including
>> images, depending on how many widgets you are using. Some use sprites,
>> others cannot ...
>>
>
> They're all js files.
>
> Here's my profile:
> ------------------------- nt.profile.js -------------------
> /* ./build.sh profile="nt" action="release" loader="default"
> cssOptimize=comments.keepLines optimize="shrinksafe"
> layerOptimize="shrinksafe" copyTests="false" version="0.0.1-nt"
> releaseName="nt" */
>
> dependencies = {
>
> stripConsole: "normal",
>
> layers: [
> {
> name: "nt.js",
> resourceName: "nt.layer",
> dependencies: [
> "nt.layer"
> ]
> }
> ],
>
> prefixes: [
> [ "nt", "../nt" ],
> [ "dijit", "../dijit" ],
> [ "dojox", "../dojox" ]
> ]
>
> };
>
> ------------------------- nt.profile.js -------------------
>
> and my layer:
> ----------------------- layer.js ---------------------------
> dojo.provide("nt.layer");
>
> dojo.require("dojo.parser");
> dojo.require("dojo.fx");
> dojo.require("dijit.form.FilteringSelect");
> dojo.require("dijit.form.Button");
> dojo.require("dijit.form.Form");
> dojo.require("dijit.form.ValidationTextBox");
>
> dojo.require("nt.main");
> dojo.require("nt.forms");
> dojo.require("nt.postingAccordions");
>
> ----------------------- layer.js ---------------------------
>

Re: [fw-mvc] Creating custom dojo builds...

Peter E Higgins wrote:
> Drew Bertola wrote:
>
>> Thanks Peter and Matthew.
>>
>> I followed Peter's approach and still ended up with 32 file requests.
>> Is there supposed to be that many?
>>
>> It's better than the 60+ requests I get without the layer, but still...
>>
>> Thanks again.
>>
>>
> No. With the layer approach you will have two js resources loaded:
> dojo.js and layer.js -- depending on what is in the layer, you may see
> one request for i18n bundle for the locale. What are the url's for the
> additional requests being made?
>
> One step I didn't mention in the last note is cssOptimize ... if you are
> using Dijit, you'll need a theme obviously, but for maintainability the
> themes are broken into many small files based on widget. tundra.css is
> simply a list of @imports in a -src release. In the "release", we use a
> command line option cssOptimize=comments.keepLines
> cssImportExclude=../dijit.css
>
> This makes a tundra.css "layer" of all the @imports (you can do this too
> in your my/ namespace, provided the css files all use relative locations
> to images and such), and excludes the @import "../dijit.css"; You can
> skip the exclusion of dijit.css, we do this step for backwards
> compatibility.
>
> I suspect the majority of your requests are CSS, as cssOptimize is not
> on by default, so running it against a clean checkout or -src release
> will not build the theme rollups.
>
> So, dojo.js, layer.js, nls/layer-en.js, tundra.css, and however many
> images are referenced in css and being used in the dom would be your
> initial expected request count. I suppose it _could_ be 32 including
> images, depending on how many widgets you are using. Some use sprites,
> others cannot ...
>

They're all js files.

Here's my profile:
------------------------- nt.profile.js -------------------
/* ./build.sh profile="nt" action="release" loader="default"
cssOptimize=comments.keepLines optimize="shrinksafe"
layerOptimize="shrinksafe" copyTests="false" version="0.0.1-nt"
releaseName="nt" */

dependencies = {

stripConsole: "normal",

layers: [
{
name: "nt.js",
resourceName: "nt.layer",
dependencies: [
"nt.layer"
]
}
],

prefixes: [
[ "nt", "../nt" ],
[ "dijit", "../dijit" ],
[ "dojox", "../dojox" ]
]

};

------------------------- nt.profile.js -------------------

and my layer:
----------------------- layer.js ---------------------------
dojo.provide("nt.layer");

dojo.require("dojo.parser");
dojo.require("dojo.fx");
dojo.require("dijit.form.FilteringSelect");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.Form");
dojo.require("dijit.form.ValidationTextBox");

dojo.require("nt.main");
dojo.require("nt.forms");
dojo.require("nt.postingAccordions");

----------------------- layer.js ---------------------------

--
Drew Bertola

-------------------------------------------------
* PHP/LAMP Consultant, ZCE-1000 *
* *
* Tel: 408-966-6671 *
* *
* current resume: *
* http://drewb.com/blog/about/resume/ *
-------------------------------------------------

Re: [fw-mvc] Creating custom dojo builds...

Drew Bertola wrote:
> Thanks Peter and Matthew.
>
> I followed Peter's approach and still ended up with 32 file requests.
> Is there supposed to be that many?
>
> It's better than the 60+ requests I get without the layer, but still...
>
> Thanks again.
>
No. With the layer approach you will have two js resources loaded:
dojo.js and layer.js -- depending on what is in the layer, you may see
one request for i18n bundle for the locale. What are the url's for the
additional requests being made?

One step I didn't mention in the last note is cssOptimize ... if you are
using Dijit, you'll need a theme obviously, but for maintainability the
themes are broken into many small files based on widget. tundra.css is
simply a list of @imports in a -src release. In the "release", we use a
command line option cssOptimize=comments.keepLines
cssImportExclude=../dijit.css

This makes a tundra.css "layer" of all the @imports (you can do this too
in your my/ namespace, provided the css files all use relative locations
to images and such), and excludes the @import "../dijit.css"; You can
skip the exclusion of dijit.css, we do this step for backwards
compatibility.

I suspect the majority of your requests are CSS, as cssOptimize is not
on by default, so running it against a clean checkout or -src release
will not build the theme rollups.

So, dojo.js, layer.js, nls/layer-en.js, tundra.css, and however many
images are referenced in css and being used in the dom would be your
initial expected request count. I suppose it _could_ be 32 including
images, depending on how many widgets you are using. Some use sprites,
others cannot ...

Regards,
Peter Higgins

Re: [fw-mvc] Creating custom dojo builds...

Thanks Peter and Matthew.

I followed Peter's approach and still ended up with 32 file requests.
Is there supposed to be that many?

It's better than the 60+ requests I get without the layer, but still...

Thanks again.

--
Drew Bertola

-------------------------------------------------
* PHP/LAMP Consultant, ZCE-1000 *
* *
* Tel: 408-966-6671 *
* *
* current resume: *
* http://drewb.com/blog/about/resume/ *
-------------------------------------------------

Re: [fw-mvc] Zend_Paginator identify last item of last page

Hi Emanuele,

You should be able to do something like this (after setting up the paginator):

$item = end($paginator->getItemsByPage(count($paginator)));

Untested, but that should at least put you on the right track.

Hope that helps,

-Matt

On Mon, Dec 29, 2008 at 4:01 AM, Emanuele Deserti <emanuele.deserti@netwing.it> wrote:
Hi to all,

how I can identify the last item in my paginator?
NOT the last in the current page, but the last item in the last page.

For example: I have 100 items paginated into 5 pages (20 items per page); I need to display custom content only for the 100th (the last of all).

I've tried with getTotalItemCount(), getCurrentItemCount() and so on but without success...
Also googled around and look into API core doc but nothing useful found...

Thanks in advance

---
Emanuele Deserti
Netwing S.r.l.
<emanuele.deserti@netwing.it>
Tel. 0532-1915183
http://www.netwing.it

Re: [fw-mvc] S3 and Zend framework : sleeping code in the incubator !

-- Zladivliba Voskuy <nospampam@hotmail.fr> wrote
(on Monday, 29 December 2008, 04:03 PM +0100):
> Well this is a very bad exemple of efficiency. I'm not blaming anyone here, but
> there's 2 S3 proposals in the incubator sleeping for more then a year, dozens
> of messages on the lists asking for S3 classes that work, humm we can't be
> satisfied with that !

Again, the proposal process is clear: when the *AUTHOR* of a proposal
feels it's ready for approval, it is the *AUTHOR*'s responsibility to
mark it as ready for recommendation.

Please be aware that the team at Zend is very small, and part of the
reason that the proposal process exists, and exists in its current
incarnation, is so that we can manage our time well. We simply cannot
track all proposals adequately; many of the proposals languish in an
incomplete state for months or years, and it would be a waste of our
time to review them until the author has indicated that it's ready.


> How could the php community here do better than what we have here ? I see good
> work in an unfinished process, and this is probably happening to other
> projects, so, is there somehting we can do to avoid this kind of loss ?
> Is there a way we could prioritize this kind of projects on to completion, so
> we don't "loose" work that was done ?
>
> Well, hummm... One thing that could be done is making a little more publicity
> arround unfinished projhects Ex: zend could advertise on the front page of the
> zend framework project, on the "give back" column all the "nearly finished"
> projects, so php developers would know better what project they could work on,
> what work is expected.
> It's not a technical solution and does not do the work but might help a little,
> so we don't see good work staying in the incubator too long.
>
> Z.
>
> > Date: Mon, 29 Dec 2008 09:07:38 -0500
> > From: matthew@zend.com
> > To: fw-mvc@lists.zend.com
> > Subject: Re: [fw-mvc] S3 and Zend framework : sleeping code in the incubator
> !
> >
> > -- Zladivliba Voskuy <nospampam@hotmail.fr> wrote
> > (on Monday, 29 December 2008, 02:23 PM +0100):
> > > I just saw excelent work done by the community here with the amazon S3
> proposal
> > > here : http://framework.zend.com/wiki/display/ZFPROP/
> > > Zend_Service_Amazon_S3+-+Justin+Plock
> > >
> > > It's been lying there forever. Since S3 in itself is a very important piece
> for
> > > some of us, I would like to ask Zend guys to push this a little forward.
> This
> > > code has been lying donw for too long with no response from anyone it
> seems.
> > > It's good work and it servers no one, it's unfair for the guy who
> developped
> > > this (note that I don't know him, and I don't own him money either ;-)
> > >
> > > Seriously, what's missing to put this on the next version of the framework
> ?
> >
> > We approved it for laboratory development as the API needed more work.
> > It is the responsibility of the proposal author to re-parent the
> > proposal back to "Ready for Recommendation" once s/he feels it is once
> > again ready to review for inclusion in the standard library. If that has
> > not yet been done, likely the author has not completed the work they
> > wisted to complete.
> >
> > --
> > Matthew Weier O'Phinney
> > Software Architect | matthew@zend.com
> > Zend Framework | http://framework.zend.com/
>
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> T l chargez le nouveau Windows Live Messenger ! T l chargez Messenger, c'est
> gratuit !

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

Re: [fw-mvc] S3 and Zend framework : sleeping code in the incubator !

Hi,

> Well this is a very bad exemple of efficiency. I'm not blaming
> anyone here, but there's 2 S3 proposals in the incubator sleeping
> for more then a year, dozens of messages on the lists asking for S3
> classes that work, humm we can't be satisfied with that !

Just to increase the inefficiency, I'm working on a new implementation
of S3 and I'll publish a proposal next week. The main reason of my
work, is that the current proposal does not follow the same approch of
other services.

Marco Pracucci

RE: [fw-mvc] S3 and Zend framework : sleeping code in the incubator !

Well this is a very bad exemple of efficiency. I'm not blaming anyone here, but there's 2 S3 proposals in the incubator sleeping for more then a year, dozens of messages on the lists asking for S3 classes that work, humm we can't be satisfied with that !

How could the php community here do better than what we have here ? I see good work in an unfinished process, and this is probably happening to other projects, so, is there somehting we can do to avoid this kind of loss ?
Is there a way we could prioritize this kind of projects on to completion, so we don't "loose" work that was done ?

Well, hummm... One thing that could be done is making a little more publicity arround unfinished projhects  Ex: zend could advertise on the front page of the zend framework project, on the "give back" column all the "nearly finished" projects, so php developers would know better what project they could work on, what work is expected.
It's not a technical solution and does not do the work but might help a little, so we don't see good work staying in the incubator too long.

Z.

> Date: Mon, 29 Dec 2008 09:07:38 -0500
> From: matthew@zend.com
> To: fw-mvc@lists.zend.com
> Subject: Re: [fw-mvc] S3 and Zend framework : sleeping code in the incubator !
>
> -- Zladivliba Voskuy <nospampam@hotmail.fr> wrote
> (on Monday, 29 December 2008, 02:23 PM +0100):
> > I just saw excelent work done by the community here with the amazon S3 proposal
> > here : http://framework.zend.com/wiki/display/ZFPROP/
> > Zend_Service_Amazon_S3+-+Justin+Plock
> >
> > It's been lying there forever. Since S3 in itself is a very important piece for
> > some of us, I would like to ask Zend guys to push this a little forward. This
> > code has been lying donw for too long with no response from anyone it seems.
> > It's good work and it servers no one, it's unfair for the guy who developped
> > this (note that I don't know him, and I don't own him money either ;-)
> >
> > Seriously, what's missing to put this on the next version of the framework ?
>
> We approved it for laboratory development as the API needed more work.
> It is the responsibility of the proposal author to re-parent the
> proposal back to "Ready for Recommendation" once s/he feels it is once
> again ready to review for inclusion in the standard library. If that has
> not yet been done, likely the author has not completed the work they
> wisted to complete.
>
> --
> Matthew Weier O'Phinney
> Software Architect | matthew@zend.com
> Zend Framework | http://framework.zend.com/


Téléchargez le nouveau Windows Live Messenger ! Téléchargez Messenger, c'est gratuit !

Re: [fw-mvc] Adding * to label

-- John Antony Riga <ja.riga@yahoo.com> wrote
(on Monday, 29 December 2008, 05:28 AM -0800):
> Is there a way we could integrate this to the framework ? I'm pretty sure
> everyone would benefit from a nice little patch that would add * to all
> required fields.

There are other ways to denote required fields, and the approaches
differ from developer to developer and site to site. Right now, the
label is marked with a class of "required" when the element is required,
allowing CSS styling. You can change that behavior, as well as prefix or
suffix either optional or required elements; it's all configurable.

You can configure the label decorators at any time by pulling them from
the individual elements, or simply configure them at element
instantiation (which, unfortunately, requires that you configure all
decorators).

Also, as noted, if you have a default behavior you want for *your*
forms, you can extend the default label decorator to specify your
desired behavior:

class My_Decorator_Label extends Zend_Form_Decorator_Label
{
public function __construct($options = null)
{
$this->setOption('escape', true)
->setOption('requiredSuffix', ' <span>*</span>');
parent::__construct($options);
}
}

Then, simply ensure your form specifies an appropriate element prefix
path:

$form->setElementPrefixPath('My_Decorator', 'My/Decorator', 'decorator');

(This must be done prior to creating any elements.)

> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> From: Luiz Vitor <prowler666@gmail.com>
> To: fw-mvc@lists.zend.com
> Sent: Monday, December 29, 2008 1:25:40 PM
> Subject: Re: [fw-mvc] Adding * to label
>
> Hi there
>
> I managed to get this done subclassing Zend_Form and overriding the render()
> method:
>
> public function render(Zend_View_Interface $view = null)
> {
> foreach ($this->getElements() as $element) {
> $label = $element->getDecorator('Label');
> if ($label instanceof Zend_Form_Decorator_Label) {
> $label->setOption('requiredSuffix', ' <span>*</span>')
> ->setOption('escape', false);
> }
> }
>
> return parent::render($view);
> }
>
> On Mon, Dec 29, 2008 at 9:11 AM, Zladivliba Voskuy <nospampam@hotmail.fr>
> wrote:
>
> Hey, did you finally managed to find an answer to this problem ? It's an
> interesting question and I haven't found any answer to it..
>
> --
> My zend framework experience... the good, the bad
> http://myzendframeworkexperience.blogspot.com/
>
>
>
> > Hi,
> >
> > Currently I am using
> >
> > $element->getDecorator('label')->setOption('requiredSuffix', ' * ');
> >
> > to add * to required fields.
> >
> > I want to manage the markup from a centrally accessible place. Perhaps,
> > a custom label decorator. If I wish to change the markup to
> > <em>*</em> or to
> > <div class="redAsterisk">*</div>
> > it would be convenient to change it in one place.
> >
> > I just want to add this functionality to the label decorator and leave
> > all else as is.
> >
> > What is the best method to accomplish this? I have seen some people
> > adding * using CSS. I prefer to print the text character * and style it
> > using CSS.
> >
> > It would be much more convenient if the custom decorator can check
> > whether the element isRequired() and then add * to the label. But I
> > can't figure out how to do it.
> >
> > Code examples would be highly appreciated.
> >
> > --
> >
> > With warm regards,
> > Sudheer. S
> > Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net,
> Personal: http://sudheer.net
> >
> >
>
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> Organisez une f te en un tour de main : invitation, photos, blog
>
>
>

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

Re: [fw-mvc] S3 and Zend framework : sleeping code in the incubator !

-- Zladivliba Voskuy <nospampam@hotmail.fr> wrote
(on Monday, 29 December 2008, 02:23 PM +0100):
> I just saw excelent work done by the community here with the amazon S3 proposal
> here : http://framework.zend.com/wiki/display/ZFPROP/
> Zend_Service_Amazon_S3+-+Justin+Plock
>
> It's been lying there forever. Since S3 in itself is a very important piece for
> some of us, I would like to ask Zend guys to push this a little forward. This
> code has been lying donw for too long with no response from anyone it seems.
> It's good work and it servers no one, it's unfair for the guy who developped
> this (note that I don't know him, and I don't own him money either ;-)
>
> Seriously, what's missing to put this on the next version of the framework ?

We approved it for laboratory development as the API needed more work.
It is the responsibility of the proposal author to re-parent the
proposal back to "Ready for Recommendation" once s/he feels it is once
again ready to review for inclusion in the standard library. If that has
not yet been done, likely the author has not completed the work they
wisted to complete.

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

RE: [fw-mvc] Adding * to label

Hi,

 

It's got „required" class, isn't it?

 

Then simply use CSS:

 

.required:after

{

  color: red;

  content: " *";

}

 

It works for me very well.

 

Jiří

 

From: John Antony Riga [mailto:ja.riga@yahoo.com]
Sent: Monday, December 29, 2008 2:28 PM
To: Luiz Vitor; fw-mvc@lists.zend.com
Subject: Re: [fw-mvc] Adding * to label

 

Is there a way we could integrate this to the framework ? I'm pretty sure everyone would benefit from a nice little patch that would add * to all required fields.

 


From: Luiz Vitor <prowler666@gmail.com>
To: fw-mvc@lists.zend.com
Sent: Monday, December 29, 2008 1:25:40 PM
Subject: Re: [fw-mvc] Adding * to label

Hi there

I managed to get this done subclassing Zend_Form and overriding the render() method:

public function render(Zend_View_Interface $view = null)
{
    foreach ($this->getElements() as $element) {
        $label = $element->getDecorator('Label');
        if ($label instanceof Zend_Form_Decorator_Label) {
            $label->setOption('requiredSuffix', ' <span>*</span>')
                  ->setOption('escape', false);
        }
    }

    return parent::render($view);
}

On Mon, Dec 29, 2008 at 9:11 AM, Zladivliba Voskuy <nospampam@hotmail.fr> wrote:

Hey, did you finally managed to find an answer to this problem ? It's an interesting question and I haven't found any answer to it..

--
My zend framework experience... the good, the bad
http://myzendframeworkexperience.blogspot.com/




> Hi,
>
> Currently I am using
>
> $element->getDecorator('label')->setOption('requiredSuffix', ' * ');
>
> to add * to required fields.
>
> I want to manage the markup from a centrally accessible place. Perhaps,
> a custom label decorator. If I wish to change the markup to
> <em>*</em> or to
> <div class="redAsterisk">*</div>
> it would be convenient to change it in one place.
>
> I just want to add this functionality to the label decorator and leave
> all else as is.
>
> What is the best method to accomplish this? I have seen some people
> adding * using CSS. I prefer to print the text character * and style it
> using CSS.
>
> It would be much more convenient if the custom decorator can check
> whether the element isRequired() and then add * to the label. But I
> can't figure out how to do it.
>
> Code examples would be highly appreciated.
>
> --
>
> With warm regards,
> Sudheer. S
> Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
>
>


Organisez une fête en un tour de main : invitation, photos, blog…

 

 

Re: [fw-mvc] Adding * to label

-- Luiz Vitor <prowler666@gmail.com> wrote
(on Monday, 29 December 2008, 09:25 AM -0300):
> Hi there
>
> I managed to get this done subclassing Zend_Form and overriding the render()
> method:

It would be better to override the Label decorator by writing your own
as a drop-in replacement. :)


> public function render(Zend_View_Interface $view = null)
> {
> foreach ($this->getElements() as $element) {
> $label = $element->getDecorator('Label');
> if ($label instanceof Zend_Form_Decorator_Label) {
> $label->setOption('requiredSuffix', ' <span>*</span>')
> ->setOption('escape', false);
> }
> }
>
> return parent::render($view);
> }
>
> On Mon, Dec 29, 2008 at 9:11 AM, Zladivliba Voskuy <nospampam@hotmail.fr>
> wrote:
>
> Hey, did you finally managed to find an answer to this problem ? It's an
> interesting question and I haven't found any answer to it.
>
> --
> My zend framework experience... the good, the bad
> http://myzendframeworkexperience.blogspot.com/
>
>
>
> > Hi,
> >
> > Currently I am using
> >
> > $element->getDecorator('label')->setOption('requiredSuffix', ' * ');
> >
> > to add * to required fields.
> >
> > I want to manage the markup from a centrally accessible place. Perhaps,
> > a custom label decorator. If I wish to change the markup to
> > <em>*</em> or to
> > <div class="redAsterisk">*</div>
> > it would be convenient to change it in one place.
> >
> > I just want to add this functionality to the label decorator and leave
> > all else as is.
> >
> > What is the best method to accomplish this? I have seen some people
> > adding * using CSS. I prefer to print the text character * and style it
> > using CSS.
> >
> > It would be much more convenient if the custom decorator can check
> > whether the element isRequired() and then add * to the label. But I
> > can't figure out how to do it.
> >
> > Code examples would be highly appreciated.
> >
> > --
> >
> > With warm regards,
> > Sudheer. S
> > Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net,
> Personal: http://sudheer.net
> >
> >
>
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> Organisez une f te en un tour de main : invitation, photos, blog
>
>

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

Re: [fw-mvc] Adding * to label

Is there a way we could integrate this to the framework ? I'm pretty sure everyone would benefit from a nice little patch that would add * to all required fields.



From: Luiz Vitor <prowler666@gmail.com>
To: fw-mvc@lists.zend.com
Sent: Monday, December 29, 2008 1:25:40 PM
Subject: Re: [fw-mvc] Adding * to label

Hi there

I managed to get this done subclassing Zend_Form and overriding the render() method:

public function render(Zend_View_Interface $view = null)
{
    foreach ($this->getElements() as $element) {
        $label = $element->getDecorator('Label');
        if ($label instanceof Zend_Form_Decorator_Label) {
            $label->setOption('requiredSuffix', ' <span>*</span>')
                  ->setOption('escape', false);
        }
    }

    return parent::render($view);
}

On Mon, Dec 29, 2008 at 9:11 AM, Zladivliba Voskuy <nospampam@hotmail.fr> wrote:
Hey, did you finally managed to find an answer to this problem ? It's an interesting question and I haven't found any answer to it..

--
My zend framework experience... the good, the bad
http://myzendframeworkexperience.blogspot.com/



> Hi,
>
> Currently I am using
>
> $element->getDecorator('label')->setOption('requiredSuffix', ' * ');
>
> to add * to required fields.
>
> I want to manage the markup from a centrally accessible place. Perhaps,
> a custom label decorator. If I wish to change the markup to
> <em>*</em> or to
> <div class="redAsterisk">*</div>
> it would be convenient to change it in one place.
>
> I just want to add this functionality to the label decorator and leave
> all else as is.
>
> What is the best method to accomplish this? I have seen some people
> adding * using CSS. I prefer to print the text character * and style it
> using CSS.
>
> It would be much more convenient if the custom decorator can check
> whether the element isRequired() and then add * to the label. But I
> can't figure out how to do it.
>
> Code examples would be highly appreciated.
>
> --
>
> With warm regards,
> Sudheer. S
> Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
>
>


Organisez une fête en un tour de main : invitation, photos, blog…


Re: [fw-mvc] File uploads question (how to avoid file on discs)

Ok, well I didn't plan this actually ;-)

Thanks for you reply, and all the guys who took time to write about this issue.
JA.


From: Matthew Weier O'Phinney <matthew@zend.com>
To: fw-mvc@lists.zend.com
Sent: Monday, December 29, 2008 2:21:02 PM
Subject: Re: [fw-mvc] File uploads question (how to avoid file on discs)

-- John Antony Riga <ja.riga@yahoo.com> wrote
(on Monday, 29 December 2008, 12:31 AM -0800):
> I'm discovering the file upload feature provided by the framework. I'm
> wondering is there a way not to put the uploaded file on disc but to keep it in
> memory until it's transfered to the databases ?
> I'd rather use that solution then to transfert the elements on discs.

Actually, no; PHP's file upload mechanism writes a temporary file during
upload. The only way you would be able to do differently is to write
your own C extension for PHP.

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

[fw-mvc] S3 and Zend framework : sleeping code in the incubator !

I just saw excelent work done by the community here with the amazon S3 proposal here : http://framework.zend.com/wiki/display/ZFPROP/Zend_Service_Amazon_S3+-+Justin+Plock

It's been lying there forever. Since S3 in itself is a very important piece for some of us, I would like to ask Zend guys to push this a little forward. This code has been lying donw for too long with no response from anyone it seems.
It's good work and it servers no one, it's unfair for the guy who developped this (note that I don't know him, and I don't own him money either ;-)

Seriously, what's missing to put this on the next version of the framework ?

Z.
--
http://myzendframeworkexperience.blogspot.com/



Découvrez tout ce que Windows Live a à vous apporter !

Re: [fw-mvc] File uploads question (how to avoid file on discs)

-- John Antony Riga <ja.riga@yahoo.com> wrote
(on Monday, 29 December 2008, 12:31 AM -0800):
> I'm discovering the file upload feature provided by the framework. I'm
> wondering is there a way not to put the uploaded file on disc but to keep it in
> memory until it's transfered to the databases ?
> I'd rather use that solution then to transfert the elements on discs.

Actually, no; PHP's file upload mechanism writes a temporary file during
upload. The only way you would be able to do differently is to write
your own C extension for PHP.

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

Re: [fw-mvc] File uploads question (how to avoid file on discs)

This was not the question of John.
The way he asked and what he replied to you showed that he has not the
priviledges to do this.

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

----- Original Message -----
From: "Marco Pracucci" <pracucci@gmail.com>
To: "Thomas Weidner" <thomas.weidner@gmx.at>
Cc: <fw-mvc@lists.zend.com>
Sent: Monday, December 29, 2008 1:33 PM
Subject: Re: [fw-mvc] File uploads question (how to avoid file on discs)


> Hi,
>
>> PHP itself stores the uploaded file on disk in the temporary upload path
>> as defined in PHP.ini.
>> So it is stored to disk anyway, regardless of what you do after it has
>> been uploaded.
>
> You could mount the directory (that PHP uses to store temporary file) in
> memory, but you need admin privileges to do it.
>
> Marco Pracucci

Re: [fw-mvc] File uploads question (how to avoid file on discs)

Hi,

> PHP itself stores the uploaded file on disk in the temporary upload
> path as defined in PHP.ini.
> So it is stored to disk anyway, regardless of what you do after it
> has been uploaded.

You could mount the directory (that PHP uses to store temporary file)
in memory, but you need admin privileges to do it.

Marco Pracucci

Re: [fw-mvc] Adding * to label

Hi there

I managed to get this done subclassing Zend_Form and overriding the render() method:

public function render(Zend_View_Interface $view = null)
{
    foreach ($this->getElements() as $element) {
        $label = $element->getDecorator('Label');
        if ($label instanceof Zend_Form_Decorator_Label) {
            $label->setOption('requiredSuffix', ' <span>*</span>')
                  ->setOption('escape', false);
        }
    }

    return parent::render($view);
}

On Mon, Dec 29, 2008 at 9:11 AM, Zladivliba Voskuy <nospampam@hotmail.fr> wrote:
Hey, did you finally managed to find an answer to this problem ? It's an interesting question and I haven't found any answer to it.

--
My zend framework experience... the good, the bad
http://myzendframeworkexperience.blogspot.com/



> Hi,
>
> Currently I am using
>
> $element->getDecorator('label')->setOption('requiredSuffix', ' * ');
>
> to add * to required fields.
>
> I want to manage the markup from a centrally accessible place. Perhaps,
> a custom label decorator. If I wish to change the markup to
> <em>*</em> or to
> <div class="redAsterisk">*</div>
> it would be convenient to change it in one place.
>
> I just want to add this functionality to the label decorator and leave
> all else as is.
>
> What is the best method to accomplish this? I have seen some people
> adding * using CSS. I prefer to print the text character * and style it
> using CSS.
>
> It would be much more convenient if the custom decorator can check
> whether the element isRequired() and then add * to the label. But I
> can't figure out how to do it.
>
> Code examples would be highly appreciated.
>
> --
>
> With warm regards,
> Sudheer. S
> Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
>
>


Organisez une fête en un tour de main : invitation, photos, blog…

Re: [fw-mvc] File uploads question (how to avoid file on discs)

John,

there is no way.
The reason is quite simple...

PHP itself stores the uploaded file on disk in the temporary upload path as
defined in PHP.ini.
So it is stored to disk anyway, regardless of what you do after it has been
uploaded.

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

----- Original Message -----
From: "John Antony Riga" <ja.riga@yahoo.com>
To: <fw-mvc@lists.zend.com>
Sent: Monday, December 29, 2008 9:31 AM
Subject: [fw-mvc] File uploads question (how to avoid file on discs)


> Hello,
>
> I'm discovering the file upload feature provided by the framework. I'm
> wondering is there a way not to put the uploaded file on disc but to keep
> it in memory until it's transfered to the databases ?
> I'd rather use that solution then to transfert the elements on discs.
>
> Thanks
> JA.
>
>
>

Re: [fw-mvc] File uploads question (how to avoid file on discs)

Hi,

> I'm dealing with picture profile here so the files wouln't be very
> large ; a few k's
> Is this possible ?

I suggest you to use the disk if it's possibile. It's not a good idea
to put images to database, because you could have a huge performance
downgrade. If you have a lot of images you can use a multi-level
structure or a distributed storage service.

Marco Pracucci

RE: [fw-mvc] Adding * to label

Hey, did you finally managed to find an answer to this problem ? It's an interesting question and I haven't found any answer to it.

--
My zend framework experience... the good, the bad
http://myzendframeworkexperience.blogspot.com/


> Hi,
>
> Currently I am using
>
> $element->getDecorator('label')->setOption('requiredSuffix', ' * ');
>
> to add * to required fields.
>
> I want to manage the markup from a centrally accessible place. Perhaps,
> a custom label decorator. If I wish to change the markup to
> <em>*</em> or to
> <div class="redAsterisk">*</div>
> it would be convenient to change it in one place.
>
> I just want to add this functionality to the label decorator and leave
> all else as is.
>
> What is the best method to accomplish this? I have seen some people
> adding * using CSS. I prefer to print the text character * and style it
> using CSS.
>
> It would be much more convenient if the custom decorator can check
> whether the element isRequired() and then add * to the label. But I
> can't figure out how to do it.
>
> Code examples would be highly appreciated.
>
> --
>
> With warm regards,
> Sudheer. S
> Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net
>
>


Organisez une fête en un tour de main : invitation, photos, blog…

Re: [fw-mvc] File uploads question (how to avoid file on discs)

I'm dealing with picture profile here so the files wouln't be very large ; a few k's
Is this possible ?

I don't have other choice then putting this data in db avoiding putting on discs.
Besides, I'm just the guy that manages the how, not the why !

JA.



From: Marco Pracucci <pracucci@gmail.com>
To: John Antony Riga <ja.riga@yahoo.com>
Cc: fw-mvc@lists.zend.com
Sent: Monday, December 29, 2008 9:32:59 AM
Subject: Re: [fw-mvc] File uploads question (how to avoid file on discs)

Hi,

> I'm discovering the file upload feature provided by the framework. I'm wondering is there a way not to put the uploaded file on disc but to keep it in memory until it's transfered to the databases ?


how large are your files?
why do you want to put your files to db?

Marco Pracucci


[fw-mvc] Zend_Paginator identify last item of last page

Hi to all,

how I can identify the last item in my paginator?
NOT the last in the current page, but the last item in the last page.

For example: I have 100 items paginated into 5 pages (20 items per
page); I need to display custom content only for the 100th (the last
of all).

I've tried with getTotalItemCount(), getCurrentItemCount() and so on
but without success...
Also googled around and look into API core doc but nothing useful
found...

Thanks in advance

---
Emanuele Deserti
Netwing S.r.l.
<emanuele.deserti@netwing.it>
Tel. 0532-1915183
http://www.netwing.it

Re: [fw-mvc] File uploads question (how to avoid file on discs)

Hi,

> I'm discovering the file upload feature provided by the framework.
> I'm wondering is there a way not to put the uploaded file on disc
> but to keep it in memory until it's transfered to the databases ?


how large are your files?
why do you want to put your files to db?

Marco Pracucci

[fw-mvc] File uploads question (how to avoid file on discs)

Hello,

I'm discovering the file upload feature provided by the framework. I'm wondering is there a way not to put the uploaded file on disc but to keep it in memory until it's transfered to the databases ?
I'd rather use that solution then to transfert the elements on discs.

Thanks
JA.


2008年12月28日星期日

Re: [fw-mvc] Creating custom dojo builds...

Yes, what Matthew said [faster than I could] :)

Interesting to see all the command line params mixed as part of the
dependency objects ... I've only used that for kwArgs buildExclude
stuff. Would definitely cleanup some command lines of mine if I started
doing it this way :)

Matthew Weier O'Phinney wrote:
> -- Drew Bertola <drew@drewb.com> wrote
> (on Saturday, 27 December 2008, 10:55 PM -0800):
>
> * Create a layer file that contains all your dojo.require() statements:
> In public/js/<your custom module>/main.js (I'll call it "custom"):
>
> dojo.provide("custom.main");
>
> (function(){
> dojo.require("dijit.form.Form");
> dojo.require("dijit.form.Button");
> /* etc. */
> })();
>
>
Just as a note, put the dojo.require calls above the closure, and use
the anon function to scope stuff locally for that module. When the build
runs, executing the code from form.FOrm and form.Button within the
(function(){ })() is unnecessary overhead (though trivial). It also
seems "cleaner" to me:

dojo.provide("my.thinger");
dojo.require("my.otherthinger");

(function(){
// do stuff
var d = dojo; d.addOnLoad(function(){ ... });
})();

The way the build works (in the x-domain case) may be affected if the
require calls are not "outside" of the closure there, as special
consideration in the loader is taken to ensure all the modules are
tracked synchronously and whatnot.
> * In your bootstrap, make sure you reference this layer file:
>
> $view->dojo()->requireModule("custom.main");
>
> * Create a profile: public/js/util/buildscripts/profiles/custom.profile.js
>
> /* ./build.sh profile="custom" */
> dependencies = {
> action: "release",
> version: "1.2.2-custom", /* this can be arbitrary */
> releaseName: "custom",
> loader: "default",
> cssOptimize: "comments.keepLines",
> optimize: "shrinksafe",
> layerOptimize: "shrinksafe",
> copyTests: false,
> layers: [
> {
> name: "../custom/main.js",
> layerDependencies: [],
> dependencies: [
> "custom.main",
> ]
> }
> ],
> prefixes: [
> [ "dijit", "../dijit" ],
> [ "dojox", "../dojox" ],
> [ "custom", "../custom" ]
> ]
> }
>
> * From within public/js/util/buildscripts, execute:
>
> $ ./build.sh profile="custom"
>
> * The build will be created in public/js/release/custom
>
> * Now replace public/js with public/js/release/custom, and you'll be
> set.
>
> You'll need to clear your browser cache to notice the changes.
>
>

Regards,
Peter Higgins

Re: [fw-mvc] Creating custom dojo builds...

Drew Bertola wrote:
> Hi everyone,
>
> I'm trying to reduce the number of file requests per page load for my
> dojo enhanced ZF app. I created a profile and generated a release,
> but I still have 32 or so file requests. Some of them look like
> duplicates, as well.
>
> I'm kinda stuck between the documentation on the dojo site (started
> with the documentation for an early version, but that was a total
> waste of time). I've looked at Matthew's pastebiin demo app (both the
> download tarball, and the most recent stuff on github), and also read
> a bunch of posts here. Seems like all of this is a fast moving
> target. None of the examples match the docs or posts.
>
> Is there recent documentation on the best way to go about this?
>
The work-in-progress wiki docs are available at:
http://docs.dojocampus.org/quickstart/custom-builds

They will replace the "old book" as soon as they are completed. the
campus wiki exports to about a 650 page PDF now, but still lacks some
explanation. We're working to finalize this before 1.3 ships. Nothing
new has gone into Dojo without full documentation between 1.2 and 1.3,
and we're retroactively trying to fill in any missing blanks.

The build isn't much of a moving target -- it really seldom changes --
it just does a lot and is somewhat complicated when you want to start
doing advanced things. At some point you just "get it", and it is rather
intuitive, but difficult to explain. I'm working on extended text for
all the todocs: at the bottom of the build page.

the jist, and easiest way i've found is to assume you will be doing a
build from the start (you should, no one should use that many files
outside of dev work), and create a physical "layer" in a namespace.
(sibling folder of dojo/ or a registerModulePath'd folder).

dojo/
my/
dijit/
dojox/
util/

and my/layer.js is:

dojo.provide("my.layer");
dojo.require("my.things");
dojo.require("dijit.things");
dojo.require("dojo.dnd.Mover"); // etc etc

then your profile just says "my.layer is dependent on my.layer" -- thus
making an automatic rollup transparent between dev and production. While
you are working, layer.js is just a list of requires sending off
additional requests (no requests will be duplicated, as you mentioned,
they should all be unique, and no-op when a module is requests
previously) ... After you build, layer.js will be the culmination of all
the inline require() calls and their dependencies.

a profile for that (save in util/buildscripts/profiles/my.profile.js):

dependencies = {

stripConsole: "normal",

layers: [
{
name: "../my/layer.js",
resourceName: "my.layer"
dependencies: [
"my.layer"
]
}
],

prefixes: [
[ "my", "../my" ],
[ "dijit", "../dijit" ],
[ "dojox", "../dojox" ]
]
}

Then run a build (util/buildscripts/) You'll need js.jar (Rhino 1.7+)
and shrinksafe.jar, both come shipped with the -src archives available
on http://download.dojotoolkit.org/current-stable/

# basic build:
./build.sh action=release profile=my version=1.2.3
# shrinksafe build:
./build.sh action=release profile=my version=1.2.3 optimize=shrinksafe
# css concatenation?
./build.sh action=release profile=my version=1.2.3 optimize=shrinksafe
cssOptimize=comments.keepLines
# i like keepLines in my css as I sometimes use line-specific hacks that
would be destroyed otherwise

(profile=my assumes profiles/value.profile.js. you can do profileFile
and pass an absolute path if you like instead)

There are a lot of options to work with, and even more goodies within
the build to do very specific things (like omit a whole block of code
for production based on specially crafted comment tags, lazy-requiring
of modules, etc). run ./build.sh without options to see the CLI docs
there about supported command line params.

a folder "release/dojo/" will be made as a sibling of dojo/ ... all
dojo.require()'ing is done relative to dojo.js, so if you point your
page at the 'release' dojo.js, the rest of your modules will be from the
release tree too (layer included)

<!-- simply comment out or use some server-side goodness to determine
dev or production -->
<script src="/js/lib/dojotoolkit/dojo/dojo.js"></script>
<script src="/js/lib/dojotoolkit/release/dojo/dojo/dojo.js"></script>

<!-- this stays the same, regardless -->
<script>dojo.require("my.layer")</script>

Hope this helps. If you have more specific questions, or spot anything
wildly inaccurate in the wiki docs, please don't hesitate to let me
know. Improving Dojo's documentation availability and IA has been my #1
priority since taking this position, and we've made great strides
towards it's completion ... but review is always helpful and necessary.

Regards,
Peter Higgins

Re: [fw-mvc] Creating custom dojo builds...

-- Drew Bertola <drew@drewb.com> wrote
(on Saturday, 27 December 2008, 10:55 PM -0800):
> I'm trying to reduce the number of file requests per page load for my
> dojo enhanced ZF app. I created a profile and generated a release, but
> I still have 32 or so file requests. Some of them look like duplicates,
> as well.
>
> I'm kinda stuck between the documentation on the dojo site (started with
> the documentation for an early version, but that was a total waste of
> time). I've looked at Matthew's pastebiin demo app (both the download
> tarball, and the most recent stuff on github), and also read a bunch of
> posts here. Seems like all of this is a fast moving target. None of
> the examples match the docs or posts.
>
> Is there recent documentation on the best way to go about this?

Here's the easiest way:

* Create a layer file that contains all your dojo.require() statements:
In public/js/<your custom module>/main.js (I'll call it "custom"):

dojo.provide("custom.main");

(function(){
dojo.require("dijit.form.Form");
dojo.require("dijit.form.Button");
/* etc. */
})();

* In your bootstrap, make sure you reference this layer file:

$view->dojo()->requireModule("custom.main");

* Create a profile: public/js/util/buildscripts/profiles/custom.profile.js

/* ./build.sh profile="custom" */
dependencies = {
action: "release",
version: "1.2.2-custom", /* this can be arbitrary */
releaseName: "custom",
loader: "default",
cssOptimize: "comments.keepLines",
optimize: "shrinksafe",
layerOptimize: "shrinksafe",
copyTests: false,
layers: [
{
name: "../custom/main.js",
layerDependencies: [],
dependencies: [
"custom.main",
]
}
],
prefixes: [
[ "dijit", "../dijit" ],
[ "dojox", "../dojox" ],
[ "custom", "../custom" ]
]
}

* From within public/js/util/buildscripts, execute:

$ ./build.sh profile="custom"

* The build will be created in public/js/release/custom

* Now replace public/js with public/js/release/custom, and you'll be
set.

You'll need to clear your browser cache to notice the changes.

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

2008年12月27日星期六

[fw-mvc] Creating custom dojo builds...

Hi everyone,

I'm trying to reduce the number of file requests per page load for my
dojo enhanced ZF app. I created a profile and generated a release, but
I still have 32 or so file requests. Some of them look like duplicates,
as well.

I'm kinda stuck between the documentation on the dojo site (started with
the documentation for an early version, but that was a total waste of
time). I've looked at Matthew's pastebiin demo app (both the download
tarball, and the most recent stuff on github), and also read a bunch of
posts here. Seems like all of this is a fast moving target. None of
the examples match the docs or posts.

Is there recent documentation on the best way to go about this?

--
Drew Bertola

-------------------------------------------------
* PHP/LAMP Consultant, ZCE-1000 *
* *
* Tel: 408-966-6671 *
* *
* current resume: *
* http://drewb.com/blog/about/resume/ *
-------------------------------------------------

RE: [fw-mvc] Another Zend_Form checkboxes bug ?

A miss the element name in the validation section in addError() method call, here is the good one:

 

Class SomeForm extends Zend_Form

{

 

public function __construct($options = null)

{

                Your code here

                …

}

 

//override isValid method

public function isValid($data)

{

                $valid = true;

 

                //validate your checkbox according your code below,  if checkbox is checked, value is set to 1

                If ($this->contract->getValue() != 1)

                {

                               $this->contract->addError(‘you must agree our conditions!’);

                               $valid = false;

                }

               

                return parent::isValid($data) && $valid;

}

}

 

Regards,

Jaime.

 

 

De: Jaime Garcia [mailto:jgarcia@vali.com.mx]
Enviado el: Sábado, 27 de Diciembre de 2008 01:43 p.m.
Para: 'Zend Framework MVC'
Asunto: RE: [fw-mvc] Another Zend_Form checkboxes bug ?

 

Hello John,

I think this behavior is expected in checkboxes due the nature of the element (what is defined as empty o required if you can change checked or unchecked value?). however there is a workaround to do this validation without affect your  code outside of your form definition as follows:

 

Class SomeForm extends Zend_Form

{

 

public function __construct($options = null)

{

                Your code here

                …

}

 

//override isValid method

public function isValid($data)

{

                $valid = true;

 

                //validate your checkbox according your code below,  if checkbox is checked, value is set to 1

                If ($this->contract->getValue() != 1)

                {

                               $this->addError(‘you must agree our conditions!’);

                               $valid = false;

                }

               

                return parent::isValid($data) && $valid;

}

}

 

I hope this works for your case.

Best Regards,

Jaime Garcia.

 

De: John Antony Riga [mailto:ja.riga@yahoo.com]
Enviado el: Sábado, 27 de Diciembre de 2008 07:53 a.m.
Para: Zend Framework MVC
Asunto: [fw-mvc] Another Zend_Form checkboxes bug ?

 

Hello everyone !

I'm having a little problem with checkboxes, I'm using this element :
  
    // ACCEPT CONDITIONS
         $this->addElement(
                    'CheckBox',
                    'contract',
                    array(
                        'label'        => 'I accept the terms of service',
                        'style'            =>'margin-left:100px;',
                        'required'   => true,
                        'checkedValue' => '1',
                        'validators'     =>  array(array('NotEmpty', true)),
                    )
                );
       
I need my users to check the checkbox before the can submit the form, but actually it's not the case. Checking the checkbox is not required to validate the form despite what I wrote (require => true) and the form subimts

Is this a bug ? I saw there was a lot of bugs in the checkbox form elements so this might be a new one. Or is this me doing somehting wrong ?
JA.