Path

ez projects / ezjscore / forum / general / ideas of enhancement


Ideas of enhancement

You need to be logged in to post messages in the forums. New users may register here.

Jérôme Vieilledent

Member since:
09 January 2008

Posts: 98

Thursday 29 October 2009 1:50:44 pm

Hi !

Thanks for this great extension (which I use in Noven Image Cropper). I'd like to submit some enhancement ideas :

1. Add possibility to choose a "media host" for JS/CSS. Useful to serve media files through a specific CDN and/or a server lighter (such as LightHTTPD)
2. Add a solution for Crossdomain issues (such as flXHR (http://flxhr.flensed.com)
3. When using tpl operators such as ezscript_require, it seems that JS files are not put in <head> but directly in the body. Is this an issue ?

Thanks !
Up

Gaetano Giunta

Member since:
09 January 2008

Posts: 241

Thursday 29 October 2009 2:05:50 pm

2 - I think you can already do it:

a - using Yui 3 support for x-domain requests

b - with the next version of ggwebservices (soon to be released), you will be able to both:

- use a provided js function to make ajax calls using on the wire the jsonrpc protocol instead of the ezjscore one (while still accessing your ezjscore-defined methods in php/tpl)

- call a server-side webservice proxy that can connect to external-domain services via soap, post, jsonrpc or xmlrpc and forward the response to the browser in jsonrpc format

Principal Consultant International Business
Member of the Community Project Board

Up

Jérôme Vieilledent

Member since:
09 January 2008

Posts: 98

Thursday 29 October 2009 2:25:11 pm

Thanks Gaetano

Yahoo UI supports x-domain via SWF indeed, but this is not the case of jQuery (by default). So I wanted to suggest a generic way to do that (flXRH provides a plugin for number of JS frameworks)

Here's another feature request : A simple server function which provides the ezroot. Indeed, although $.ez() or Y.ez() functions can be used in most cases, sometimes you just cannot use them. That was my case for Noven Image Cropper, and I simply added a very simple server function : http://svn.projects.ez.no/novenim...lasses/novimgcropserverfunctions.php (method getURLPrefix())
Up

André R.

Member since:
14 January 2008

Posts: 170

Friday 30 October 2009 1:12:17 am

1. for the packaged js / css files?

3. This only happens if you use it in pagelayout, as in after ezscript_load has been called.
Just thought of a way to solve that, not very 'clean' though: make ez*_load write a unique html comment in source code and if ez*_require is called after that, make it string replace the output buffer instead of outputing it to template.

4. (root url), almost what you want: jQuery.ez.url / Y.io.ez.url (just add .replace( 'ezjscore/', '' ), and your there). I can easily add root parameter for next version.

Lead Engineer eZ Publish
@: http://twitter.com/andrerom

Up

Gaetano Giunta

Member since:
09 January 2008

Posts: 241

Friday 30 October 2009 10:17:48 am

4. (root url), almost what you want: jQuery.ez.url / Y.io.ez.url (just add .replace( 'ezjscore/', '' ), and your there). I can easily add root parameter for next version.

mmm, yummi!
So I can get it from there and not need anymore to make my own js function generated dynamically

Principal Consultant International Business
Member of the Community Project Board

Up

Jérôme Vieilledent

Member since:
09 January 2008

Posts: 98

Friday 30 October 2009 10:25:45 am

1. for the packaged js / css files?

Yes. At the moment, I have to hack your operator to add the media host (needed in my current project)

3. This only happens if you use it in pagelayout, as in after ezscript_load has been called.


Just thought of a way to solve that, not very 'clean' though: make ez*_load write a unique html comment in source code and if ez*_require is called after that, make it string replace the output buffer instead of outputing it to template.

OK Got it. But ezscript_require is in a view template embedded via node_view_gui in the pagelayout. I'm not sure I understand your solution :-/

4. (root url), almost what you want: jQuery.ez.url / Y.io.ez.url (just add .replace( 'ezjscore/', '' ), and your there). I can easily add root parameter for next version.

Thanks, gotta test it :-)
Up

André R.

Member since:
14 January 2008

Posts: 170

Saturday 31 October 2009 9:24:04 am


OK Got it. But ezscript_require is in a view template embedded via node_view_gui in the pagelayout. I'm not sure I understand your solution :-/


It still means it is executed after <head> in your pagelayout template aka after ezscript_load() has being called. In these cases it outputs the script directly.
So my experimental idea of fixing it is make ezscript_load also output a html comment like <!-- #ezscript_load#replace#mark# --> and replace that with script tag when ezscript_require is called afterwards. using some vodoo on ob_get_contents or something.

EDIT: Thinking a bit more about it, and this is not cache safe. Ack..

Lead Engineer eZ Publish
@: http://twitter.com/andrerom

Up

You need to be logged in to post messages in the forums. New users may register here.