You are here: Foswiki>Tasks Web>Item1864 (20 Aug 2009, MichaelDaum)Edit Attach

Item1864: NatSkin "Create New Topic" does not work due to several Javascript bugs with JQueryPlugin

pencil
Priority: Normal
Current State: Closed
Released In:
Target Release: n/a
Applies To: Extension
Component: NatSkin
Branches:
Reported By: PascalSchuppli
Waiting For:
Last Change By: MichaelDaum
Hi

I installed a vanilla FosWiki 1.0.6 with the Natskin Extension (I downloaded all the required plugins and activated them as described in the NatSkin documentation). After activating NatSkin, the "Create New Topic" button did not work: It only gave me the first form filed (the Title Field) plus the two Buttons, but no "Show advanced options" to expand. Whenever I pressed OK after filling in a Title, I got an error page telling me that the topic WebHome existed already, although I did NOT enter anything like it in the Title field.

I got the Topic Creator to work after a few hours of debugging. Here's what I did to get it to work and what I think went wrong:

  1. The Firefox Firebug debugger (Firefox 3.0.11) told me that $(....) wasn't a function, so I went to the configure script and disabled the "No Conflict" Option under the JQueryPlugin Extensions. This got me a bit further, so I think there are still some $(...) calls which aren't wrapped in a function($) {....} (jQuery) wrapper.
  2. The next step was to add superfish, validate, wikiword, tooltips, each one in turn, to {JQueryPlugin}{DefaultPlugins} in the Extensions section of the configure script, because without them Firebug complained about missing attributes; the jquery plugin files didn't seem to get loaded (at least I didn't see any <script...></script> directives in the page source which would have indicated they'd been loaded) before I added them to the DefaultPlugins list, even though the configure script told me they were active.
  3. Finally I had to edit natskin.js on line 47 (changing the if(true) to if(false) to disable the tooltips block):
 /* tooltips */
  if (true) {
    /* tooltip img previews */
    $(".natAttachmentName a").each(function() {
      if ($(this).attr('href').match(/jpe?g|gif|png|bmp/i)) {
        $(this).tooltip({
The problem in this piece of code was the $(this).attr('href').match(...); the anchor element refered to by this when the debugger stopped execution had no href attribute. I couldn't check this from the source because I didn't find any natAttachmentName class, but I found a lot of other a tags reading <a name="xy">...<a>, so it's entirely possible the map function picked up an a tag without a href attribute.

After changing all this stuff, suddenly the Web Topic Creator started working flawlessly. I'm sure it works out of the box for other people, but I don't know what I could have done wrong; I've been installing TWiki and FosWiki several times in the last year and I just downloaded all the vanilla packages for 1.0.6 and the NatSkin plugins again, so I do think this is a bug that should be looked at.


Fixed in Item8250.

-- MichaelDaum - 20 Aug 2009

ItemTemplate edit

Summary NatSkin "Create New Topic" does not work due to several Javascript bugs with JQueryPlugin
ReportedBy PascalSchuppli
Codebase 1.0.6
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component NatSkin
Priority Normal
CurrentState Closed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn
Topic revision: r2 - 20 Aug 2009, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy