> So when calling we can have something like this:
>
> $fw = &JHTMLFramework::getInstance();
> $fw->tooltip();
That's the way, I like it! How and by whom will the JS framework be
chosen? Like the database (mysql/mysqli) on installation level/global
configuration (sounds most reasonable to me)?
BTW: correct naming would be JHtmlFramework; the & is not needed in
PHP5, but that's an other story.
> The JHTMLFramework class can also add further optimizations to the
> javascript handling in the whole framework, so maybe there is a better
> name for the class... although JJS looks weird and like a typo =P
I'd call it JScript.
Regards,
Niels
--
| http://www.kolleg.de · Das Portal der Kollegs in Deutschland |
| http://www.bsds.de · BSDS Braczek Software- und DatenSysteme |
| Webdesign · Webhosting · e-Commerce · Joomla! Content Management |
------------------------------------------------------------------
dukeofgaming asked me to post some suggestions I sent him, in here. So
here goes:
I suggest a dot notation syntax for the classes when you call the
framework. Instead of JMootools, I would use
JHTML::_('framework.jquery'); to initiate the framework class and set
a static with the framework you prefer.
Doing that will allow us to write code more independently from what
the exact methods and other apis the framework calls.
And if we are to convince the core devs to add this in, we need it to
work as simple as JHTML::_('behavior.mootools') does today.
So by moving all the logic into the class, we can make it possible
with a simple call like that.
I suggest then that we overload the behavior class like this:
The mootools behavior will be reduced to a simple
JHTML::_('framework.mootools') call so the new API get full control.
All the other methods in the behavior class will have Mootools as
their default codebase. If something call an behavior, and got another
framework than mootools called the framework class would then check if
the extension provide an alternate script running on the current
framework. If not then all behavior apis will fall back to mootools,
as a "plan B" or "safe mode" function to ensure nothing breaks.
I then recommend all scripts written for something other than mootools
are coded in a way that wont break Moo scripts if both are loaded. So
that will make it possible to load just one framework in optimal
situations, and still ensure compatiblity and that everything still
"just works" even if more than one framework are loaded.
Best regards,
Stian Didriksen
Developer and Designer at NinjaForge.com
> I suggest a dot notation syntax for the classes when you call the
> framework. Instead of JMootools, I would use
> JHTML::_('framework.jquery'); to initiate the framework class and set
> a static with the framework you prefer.
I prefer
$script = JFactory::getScript();
All components, modules and plugins should use only methods defined by
the JScript interface. Thus, the template(s) can define, which framework
is needed, and the admin is responsible to provide the proper
configuration. The template(s) may then contain JS code specific to one
framework.
At least for the frontend, a non-JS variant (eg. JScriptNoscript) should
be provided (may be 3rd party), that provides functionality as close to
the JS solution as possible. That way, CMPs can make use of all the
pretty effects, but the admin can decide to turn them off without
breaking the site.
> It's too late for 1.6 because as you can see, our Core Devs are very very
> comfortable already with how things are.
If it is too late, it is not because of the reason, you see. It is
because the desired solution is a bigger mouthfull, and most likely can
not be brought to reasonable stable reality within the given timeline.
> $jsf =& JFactory::getJSFramework('mootools');
> $jsf->loadPlugin( 'calendar', array('option1'=>'value'));
The calendar is an example of stuff, that should be in the interface
definition, so that *any* ClientScript framework *must* implement it.
Thus there is no need to specify a framework here.
So your example would read
$jsf = JFactory::getScript();
$calendar = $jsf->calendar( 'value' );
$calendar->init();
...
<... onclick="<?php echo $calendar->open(...); ?>" ... />
Amy, I'd like to think this could be more than just a plugin but a somewhat "formal" proposal to the Joomla! framework since this could be a way of making Joomla! javascript framework agnostic... or more like polytheist =P.
----- Original Message -----From: Israel Dacanay CanasaSent: Thursday, June 11, 2009 8:37 AMSubject: Re: Universal JS Framework integration
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.339 / Virus Database: 270.12.62/2168 - Release Date: 06/10/09 18:30:00