[TYPO3] Re: Prototype and Mootools (accordion vs ratings)
Christopher Schnell
christopher.schnell at mda.ch
Wed Feb 27 11:24:23 CET 2008
Hello,
has anybody jet had the possibility to look into this one?
The changing of the header was no problem, but I don't know how to
rewrite the JS function tx_ratings_submit. If I simply launch it with
mootools, I get the following error:
"Ajax.Updater is not a constructor"
And the script stops. Any idea on how to invoke the script with the
correct mootools syntax? Unfortunately the whole mootools page
(http://www.mootools.net) with the documentation seems to be down.
Best regards,
Christopher.
> Hi!
>
> Georg Ringer wrote:
> > IMO ratings just uses ajax to send 1 ajax request and nothing
> more. so
> > this could be made with mootools too
> >
> > Dmitry, could you tell me where to look closer?
>
> Sure! JavaScript is in typo3conf/ratings/res/ratings.js. Here is
> the code:
>
> ==========================
> function tx_ratings_submit(id, rating, ajaxData, check) {
> $('tx-ratings-display-' + id).style.visibility = 'hidden';
> $('tx-ratings-wait-' + id).style.visibility = 'visible';
> new Ajax.Updater('tx-ratings-' + id, 'index.php?
> eID=tx_ratings_ajax', {
> asynchronous: true,
> method: 'post',
> parameters: 'ref=' + id + '&rating=' + rating + '&data=' +
> ajaxData + '&check=' + check
> });
> }
>
> ==========================
>
> But I guess you need to know where prototype is included, right?
> Take a look to typo3conf/ratings/res/ratings.html:
>
> ==========================
> <!-- ###HEADER_PARTS### -->
> <link rel="stylesheet" href="###SITE_REL_PATH###res/styles.css" />
> <script type="text/javascript" src="###SITE_REL_PATH###res/
> rating.js"></script>
> <script type="text/javascript" src="typo3/contrib/prototype/
> prototype.js"></script>
> <!-- ###ADDITIONAL_CSS### begin -->
> <link rel="stylesheet" href="###CSS_FILE###" />
> <!-- ###ADDITIONAL_CSS### end -->
> <!-- ###HEADER_PARTS### -->
> ==========================
>
> I know that many people like mootools but I used prototype because
> it comes with TYPO3 as official ajax library. I have no preference
> to prototype over mootools because I do not know any of them well
> (I am a big fun of ExtJS but it is too fat for having single ajax
> request).
>
> Next paragraph assumes that mootools is compatible with prototype
> in Ajax.Updater definition.
>
> I think a new TS configuration key is needed (say,
> "ajaxLibraryPath"), which will point by default to prototype inside
> TYPO3 but may point as well to EXT:mootools/whatever. Template file
> should have a marker instead of hard-coded path, which will be
> replaced by configuration value. The only requirement is that
> libraries should be compatible in syntax.
>
> If mootools and prototype are not ompatible, it should be easy to
> make a custom template to use with mootools. I am willing to add
> such template to ratings extension and mention author in docs ;)
>
> --
> Dmitry Dulepov
> TYPO3 core team
> Web: http://typo3bloke.net/
> Skype: callto:liels_bugs
> "Nothing is impossible. There are only limits to our knowledge"
--------------------------------
christopher.schnell at mda.ch
Christopher Schnell
MdA Business Communications AG
Unterer Rheinweg 86
4057 Basel
Schweiz
Phone: +41 61 273 44 69
More information about the TYPO3-english
mailing list