jQuery 1.6 UI is out with a bunch of bug fixes so you may want to consider using that.
Right…I was just copy/pasting real quick from the google AJAX API page - looks like the latest they have is 1.5.2. I’m not even using UI - I have it disabled in the extension settings.
Can’t wait to see what Derek suggests Travis incorporate into this so I can install a more-or-less “official” version of this extension.
Good stuff!
Though I can’t imagine anyone activating this extension and then unchecking jQuery, Victor points out correctly that it’s of course possible. I don’t like the idea of checking for specific versions, it seems like overkill, but since this feature was added primarily for the people in this thread, here’s your chance to lay out a case for how this should be modified to let you easily check to ensure it’s installed, and that jQuery and/or jQuery UI is active.
My personal feeling is to remove the options of disabling either, which was something I did internally first, but decided against it to be friendly for people upgrading from version 1.0. It seems the simplest and most sane option in my book, though.
I know if I go to the trouble of enabling an extension whose sole purpose is to add jQuery to the CP, I want it on - so, no need for a checkbox to disable. I can see where I might not want UI on, but why not just accept that fact that if I’m loading this extension, they’re both on, and available for use.
In my extensions, then, should I just somehow state, if CP jQuery isn’t enabled, “This extension requires that CP jQuery be enabled.” I’m not a huge fan of having a dependency like that, but simple is good.
I’ll let more experienced developers (Leevi, Victor…) chime in with specifics about how the extensions should check for the presence of jQuery. I think I agree that version checking is a little bit overkill.
If we just remove those checkboxes, then you’d check via:
if ( ! isset($EXT->version_numbers['Cp_jquery']))or comparing the version number of the extension if you need to.
Either way, you could display an error telling the user that it is needed, or you could install it for them by loading the file and calling activate_extension(). Of course, if the file does not exist, then you’d have to settle for an error. That decision would really be up to you.
So for people following this: This is the new code then 😊if (isset($EXT->version_numbers['Cp_jquery']) === FALSE && empty($SESS->cache['scripts']['jquery']) === TRUE) { /* include jquery */ $SESS->cache['scripts']['jquery']['1.2.6'] = TRUE; }
Hey Victor,
Are you suggesting that developers put this in their own extension code?
Cheers
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.