Foswiki on GitHub is open for business! Next release meeting: Monday Nov. 17, 1300Z

Item1462: WYSIWYG-attaches to wrong topic when creating new autonumbered topic

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Urgent Closed Extension TinyMCEPlugin Main.PaulHarvey, Main.MichaelTempest
If I attach a file to an autonumbered topic that does not yet exist, via the WYSIWYG interface, then the attach appears to succeed. However, the file is not attached to the correct topic. After I save the topic, the attachment has apparently disappeared. From the user's perspective, the file was attached to the wrong topic.

Steps to reproduce:
  1. Create a new topic in Sandbox by clicking the "Create TestTopic###" button -> opens TinyMCE editor
  2. Click on paperclip -> opens the attachment dialog
  3. Select upload attachment and fill in the attachment details
  4. Click Upload. Gives a message that the file was attached to TestTopicAUTOINC0.
  5. Close the dialog and save the topic -> saved as, for example, TestTopic5.

The first time I tried this, I was attaching a perl script. And so the message indicated that the filename had .txt appended to it. I saw that part of the message and ignored the message, since I know about the renaming. I know I should read the whole message, but it is entirely human not to smile This is a mistake that a user could make.

I also found that attach creates a topic if it does not yet exist. Thus, if I create a topic (which opens the TinyMCE editor), attach a file, and then cancel the edit, the topic is created.

I suggest that the attach button should be disabled unless the topic being edited actually exists.

-- MichaelTempest - 18 Apr 2009

Agree.

-- PaulHarvey - 30 Nov 2009

Yes. We have people falling into this trap here in Foswiki.org almost once a month. Same on the old project. We have to constantly remove AUTOINC0 topics and we have long periods where people cannot post anything.

I am elevating this to urgent. Can we have a 1.0.9 type fix for this one? Ie is it possible to fix in a not too distant future?

The analysis and suggested fix sounds like the only right solution to me.

-- KennethLavrsen - 30 Nov 2009

I will try to find time to get a fix in tonight (Canberra time), but if that doesn't happen I won't be able to touch it until Friday.

-- PaulHarvey - 01 Dec 2009

The main reason I had not done anything about this was that Crawford did not the fix I suggested. I still think disabling the upload button is a good idea, at least in the short term, but I thought I should mention that Crawford had objected. Unfortunately, I do not remember the details. frown

-- MichaelTempest - 01 Dec 2009

In case people are wondering why I created a new .htm dialogue, it's for a internationalisation of the error message. Couldn't figure out a lighter way to do it from TinyMCE docs.

Needs testing in non-FF 3.0 browsers:
  • Look out for JS errors.
  • Ensure edit of TestTopicAUTOINC0 topic shows error version of attach dialogue.
  • Save and continue.
  • Ensure attach dialogue works properly. Wouldn't hurt to attach a real file.
  • Repeat for TestTopicXXXXXXXXXX

Todo:
  • Error message is an a div of class error. There is probably a better CSS class defined.
  • Merge on trunk

-- PaulHarvey - 01 Dec 2009

The attachment feature is totally broken in both IE and FF 3.5.

There is a JS error.

Ie says:

Webpage error details
Message: 'foswiki.topic' is null or not an object
Line: 3
Char: 397
Code: 0
URI: http://merlin.lavrsen.dk/foswiki10/pub/System/TinyMCEPlugin/tinymce/jscripts/tiny_mce/plugins/foswikibuttons/editor_plugin.js?v=%24Rev:%205629%20%24

Firefox says:

Error: foswiki.topic is undefined
Source File: http://merlin.lavrsen.dk/foswiki10/pub/System/TinyMCEPlugin/tinymce/jscripts/tiny_mce/plugins/foswikibuttons/editor_plugin.js?v=%24Rev:%205629%20%24
Line: 3

-- KennethLavrsen - 01 Dec 2009

Damn, those vars must be a jquery thing. Have a couple of hours free today. Wiping out my release installation to start again.

-- PaulHarvey - 01 Dec 2009

I added a missing field to the form in the autoinc html, to eliminate one last JS error. It now runs cleanly on FF 3.5 and IE8.

Opera 10 reports JS errors when opening the attachment dialog. However, the same error is reported regardless of whether the current topic is an unsaved autonumber topic or not, and the dialog works in spite of the error.

More testing is most welcome, but I think Paul has nailed this problem smile

-- MichaelTempest - 02 Dec 2009

Set up:
  • Deleted my branch/Release01x00/core directory
  • svn update branch/Release01x00/core
  • svn status
  • ./pseudo-install default, ./pseudo-install developer
  • minimal configure, register user

Procedure:
  • /bin/edit/Sandbox/TestTopicAUTOINC0
  • Attach: confirm error dialogue
  • Save & Continue
  • Attach: confirm normal dialogue
  • Upload new attachment
  • Attach: insert link from drop-down list
  • Save

Repeat again for /bin/edit/Sandbox/TestTopicXXXXXXXXXX

Applied this procedure successfully on:
  • Iceweasel (Firefox) 3.0.12 on Linux amd64
  • Firefox 3.5.5 on 32-bit WinXP
  • Opera 10.10 on Linux amd64 (error console shows errors but don't seem to affect operation, see Item2449)
  • Google Chrome 3.0.195.33 on 32-bit WinXP
  • Safari 4.0.4 on 32-bit WinXP
  • MS IE 6.0.2900 on 32-bit WinXP
  • MS IE 7.00.5730 on 32-bit WinXP
  • MS IE 8.0.6001 on 32-bit WinXP

-- PaulHarvey - 03 Dec 2009

Merged to trunk.

-- PaulHarvey - 03 Dec 2009

For the record, I don't recall discussing this, much less objecting; probably my bad memory. But I can't think of a reason not to disable the attach in this scenario.

-- CrawfordCurrie - 04 Dec 2009

ItemTemplate edit

Summary WYSIWYG-attaches to wrong topic when creating new autonumbered topic
ReportedBy MichaelTempest
Codebase 1.0.8, 1.0.7, 1.0.6, 1.0.5, 1.0.4
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component TinyMCEPlugin
Priority Urgent
CurrentState Closed
WaitingFor PaulHarvey, MichaelTempest
Checkins distro:b55c821342f6 distro:89506d933936 distro:67b0ffabd21b distro:a430db0e0f22 distro:d2db758631f6 distro:52372f00498f distro:6b6ce439d330
TargetRelease patch
ReleasedIn 1.0.9, 1.1.0
Topic revision: r21 - 17 Jan 2010, PaulHarvey
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License