power-media / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

ratings.js script always included on pages with postback controls #399

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a page which has one or more controls requiring the 'prado' package, 
but no TRatingList control on it (for ex. like a page with a single TButton or 
any other postback control)
2. Run the page
3. Check which scripts are included on the page

What is the expected output? What do you see instead?
Upon checking the script files included in/by the HTML markup you can notice 
that ratings.js is always included and thus loaded by the browser. This, 
however, is totally unneccessary and useless, unless there's a TRatingList or 
TActiveRatingList control on the page, as ratings.js only includes the 
client-side support code for these two controls.

What version of the product are you using? On what operating system?
Prado/trunk

Please provide any additional information below.
The unconditional inclusion happens because 'prado/ratings/ratings.js' is 
present in the script file list for the 'prado' script package in 
framework/Web/JavaScripts/packages.php . I have no clue why it's there, but I 
guess it shouldn't be there, and should be registered only on-demand by the 
TRatingList control. Which btw registers and publishes the rating images 
anyway, so I totally don't understand why it doesn't register the script file 
too.

Original issue reported on code.google.com by google...@pcforum.hu on 8 May 2012 at 7:09

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Btw. there's a similar issue with inlineeditor.js which is part of the standard 
'ajax' Prado script package required by all active controls - but is actually 
used by only one control, by TInPlaceTextBox.

Both ratings.js and inlineeditor.js should be moved to a separate Prado package 
- like is the case the slider, tabpanel, and accordion scripts and controls.

Removing 'effects.js' from the standard 'prado' package might be also worth a 
try, as obviously that script file is also not actually needed by most 
controls, and is included only for convenience there. This change, however, 
would require a more thorough check of all controls, as some of them might rely 
on 'effects.js' always being included, even though they don't specify that 
requirement exactly by a call to 
TClientScriptManager::registerPradoScript('effects'). Which should be the 
proper way to signal the requirement of inclusion said file in the page. 

So controls needing the effects library (like the TAccordion control) should 
either have the latter call added to their onPreRender/registerAssets methods, 
or 'effects' should be added as a dependency to their appropriate script 
package list in packages.php. 

Original comment by google...@pcforum.hu on 8 May 2012 at 8:02

GoogleCodeExporter commented 8 years ago
ratings.js and inlineeditor.js have been fixed in r3137; i'll keep this ticket 
open to investigate the removal of effects.js from the base scripts

Original comment by ctrlal...@gmail.com on 10 May 2012 at 9:13

GoogleCodeExporter commented 8 years ago

Original comment by ctrlal...@gmail.com on 25 Jun 2012 at 1:56

GoogleCodeExporter commented 8 years ago
It seems like in scriptaculous-adapter.js there's a backward compatibility 
Prado.Effect class that relies on scriptaculous' effects class in order to 
provide an highlight() function. I'll be glad to trash this entire class and 
the dependency at once, but this would be an incompatible change that's not so 
good for a 3.2.1 release.

Currently we work on trunk/ for every change, so the better idea would be to 
branch off 3.2 and making such changes to trunk/. Anyway, i'm unsure if this 
would be a good idea, since we're just a bunch of devs and work on multiple 
branches would lead to some overhead work.

So i'm closing this for now, since i'm quite sure that any future work will 
need a lot of restructuring and documentation of the javascripts anyway.

Of course if you'd like to join and give an hand..

Original comment by ctrlal...@gmail.com on 6 Aug 2012 at 5:00