Item10392: Switch to JEditableAddOn causes several issues

pencil
Priority: Urgent
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: JEditableContrib, JQueryPlugin
Branches:
Reported By: PhilippLeufke
Waiting For:
Last Change By: PhilippLeufke
With the recent modification of EditRowPlugin to utilize JEditableAddOn, we experience several bugs/issues:

  1. When JEditableAddOn is not activated in LocalSite.cfg, the "Delete this row / last row" function doesn't work. After submitting, the row is still present.
  2. In any case, if enabled or not, in "edit full table" mode, there are no "add new row" or "delete last row" buttons any more. Is this a bug or a feature?
  3. With JEditableAddOn enabled and manually forcing java-script by using require_js = "on", the whole table isn't editable any more (not a browser issue!). This is probably caused by the following issue:
  4. It seems, JEditableAddOn is incomplete yet, as we get the following warning message: Plugins: could not fully register JEditableAddOnPlugin, no plugin topic on each page load. I found, that the missing topic is also mentioned in Extensions.JEditableAddOn, but there is no associated topic, too. Also confusing to me: It seems, this topic or plugin is needed for all JQueryPlugin versions < 4.02, but the most recent version anyway is 4.00, as far as I can see.

We are using the most recent debian foswiki packages from fosiki.org.

I didn't file a separate bug for these four issues, as I don't know, to what extent they are connected to each other. If you want me to file them separately, just tell me.

Setting priority to "urgent", as the new features are just not working (here) and some old features are gone now.

-- PhilippLeufke - 22 Feb 2011

I don't fully understand the report.

JEditableAddOn is never activated in LocalSite.cfg - it's an AddOn. Even so, it has nothing to do with the add/delete row functionality. I have tested this (both with and without JEditable enabled) and it's working fine AFAICT.

The add/delete row buttons are indeed lost - my mistake.

Yes, I made a mistake in the DEPENDENCIES - it should be "JQueryOPlugin >=4.00" - that is already fixed (and released). 4.02 is in subversion, and has not yet been released.The JEditableContribPlugin must be enabled in configure for the plugin to work (until JQueryPlugin catches up).

A plugin topic should not be required to register a plugin, and that topic should not be linked from the JEditableContrib topic either :-/

I would recommend updating to JEditableContrib (it has been renamed), updating EditRowPlugin, and ensuring the JQueryPlugin is up-to-date before testing again.

-- CrawfordCurrie - 22 Feb 2011

I haven't yet upgraded to JEditableContrib, as the debian packages aren't yet available, but I still want to comment on this, as it could help to understand my first posting:

  • My mistake as I got really confused by the names: Please replace "JEditableAddOn" by "JEditableAddOnPlugIn" in item 1., 2. and 3. and then the statements become valid again.
  • I did some more testing regarding item 1. and noticed, that in this case (if the plugin isn't enabled in configure), any editing of the table seems to be entirely ignored.

I'll keep you posted, if things change with JEditableContrib.

-- PhilippLeufke - 23 Feb 2011

Just to clarify AddOn vs. Contrib.

The term AddOn was deprecated with Foswiki. There really should not be any new AddOn extensions. Any that exists were brought forward from history.

There are 3 types of extensions.
  • A Plugin generally adds macros and uses handlers to impact the rendering of topics. Plugins are activated in the configuration.
  • A Contrib is more passive - templates, topics, css, javascript libraries, etc. It's "just there" and does not need activating.
  • Skins are the 3rd type.

And one more wrinkle, it is possible for a Contrib to include a Plugin module in the package, typically this is done when the primary purpose of the Contrib is passive, but an optional "helper" plugin is useful in some situations.

As CDot mentioned, he has renamed the extension to be a Contrib instead of an AddOn.

-- GeorgeClark - 23 Feb 2011

Thanks, George...

I just stumbled upon an apache2 log entry on this:

[Wed Feb 23 16:20:06 2011] [error] [client ...] ERROR: can't load jQuery plugin JEditable:
Can't locate Foswiki/Plugins/JQueryPlugin/JEDITABLE.pm in @INC
(@INC contains: /var/lib/foswiki/lib /etc/foswiki . /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 
/usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl)
at (eval 418) line 1., referer: http://.../Main/CreatecSputterLog2011Feb22?erp_active_topic=Main.CreatecSputterLog2011Feb22;erp_active_table=EDITTABLE_1;erp_active_row=5

-- PhilippLeufke - 23 Feb 2011

I would guess, from that, that you have a JQREQUIRE{"JEditable"} but have not enabled the JEditableContribPlugin

-- CrawfordCurrie - 23 Feb 2011

Now that I have the most recent debian packages installed (EditRowPlugin 10810 (2011-02-25), JEditableContrib 10771 (2011-02-22)), I continued the tests...

Ajax is working now, i.e. I can edit cells by double-clicking and entering values, but again I encounter troubles here:
  • entering a "0" into a field results in an empty field (I don't know if this is fixed already; posted it in Item2016
  • the order of drop-down "select" lists is messed up (I can't see any systematic behind the new sort order)
    UPDATED filed a separate bug for this issue: Item10583
  • saving any content to a cell results in the following apache error message:
[Thu Mar 24 20:39:18 2011] [error] [client ] readdir() attempted on invalid dirhandle $DIR at, referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ] \t/var/lib/foswiki/lib/Foswiki/Store/RcsFile.pm line 257 (#1), referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ]     (W io) The dirhandle you're reading from is either closed or not really, referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ]     a dirhandle.  Check your control flow., referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ]     , referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ] [Thu Mar 24 20:39:18 2011] rest: readdir() attempted on invalid dirhandle $DIR at /var/lib/foswiki/lib/Foswiki/Store/RcsFile.pm line 257., referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ] closedir() attempted on invalid dirhandle $DIR at, referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ] \t/var/lib/foswiki/lib/Foswiki/Store/RcsFile.pm line 266 (#2), referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ]     (W io) The dirhandle you tried to close is either closed or not really, referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ]     a dirhandle.  Check your control flow., referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ]     , referer: http://XXX/Main/CreatecSputterLog2011Feb18
[Thu Mar 24 20:39:18 2011] [error] [client ] [Thu Mar 24 20:39:18 2011] rest: closedir() attempted on invalid dirhandle $DIR at /var/lib/foswiki/lib/Foswiki/Store/RcsFile.pm line 266., referer: http://XXX/Main/CreatecSputterLog2011Feb18

The non-Ajax interface stopped working: Although I can enter the edit-table and edit-row modes, no changes get saved. Trying to add a row will also result in an unmodified table. Apache says:
ERROR: can't load jQuery plugin JEditable:
Can't locate Foswiki/Plugins/JQueryPlugin/JEDITABLE.pm in @INC
(@INC contains: /var/lib/foswiki/lib /etc/foswiki . /etc/perl
/usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10
/usr/local/lib/site_perl) at (eval 420) line 1., referer:
http://XXX/Main/CreatecSputterLog2011Feb18?erp_active_topic=Main.CreatecSputterLog2011Feb18;erp_active_table=EDITTABLE_1;erp_active_row=2
And he is damn right: Foswiki/Plugins/JQueryPlugin/JEDITABLE.pm doesn't exist. Why?

Crawford, I know these are in principle several separate bugs. But as I don't know which of them are connected, I didn't file them separately. Just tell me which ones you wand to have listed separately and I will file them...

-- PhilippLeufke - 24 Mar 2011

Well, the error in RcsFile is just that, an error in RcsFile. As far as I can tell it is nothing to do with the plugin, which just uses the standard Foswiki::Func interface to perform its saves. So please report that as a bug against RcsFile.

I have no idea why JEDITABLE doesn't exist; it's in the MANIFEST and exists in the zip and the tgz most recently uploaded. I don't work with the debian packages, so can't comment on their structure. However I do maintain the version numbers, so if you check those and compare to the package most recently uploaded to Foswiki:Extensions.EditRowPlugin, that might reveal something.

-- CrawfordCurrie - 25 Mar 2011

Later - I checked the packages on Foswiki.org, and the EditRowPlugin is out of date compared to subversion. If the debian packages are built from the uploads, then that might have propagated the lack of fixes. However the JEditableContrib is up to date and contains JEDITABLE.pm, so maybe not. Anyway, I have re-uploaded both packages just to be sure. I have no idea how or when the debian packages are built, so can't suggest how long you might have to wait for new ones.

-- CrawfordCurrie - 25 Mar 2011

Updated to the latest debian packages; the versions are now:
Component Release Version
EditRowPlugin 14 Mar 2011 11065 (2011-03-14)
JEditableContrib 1.7.1 10771 (2011-02-22)
JQueryPlugin 4.00 10288 (2010-12-13)

My config is as follows:
# cat /etc/foswiki/LocalSite.cfg | grep -i editable | sort | uniq
$Foswiki::cfg{JQueryPlugin}{Plugins}{JEditable}{Enabled} = 1;
$Foswiki::cfg{JQueryPlugin}{Plugins}{JEditable}{Module} = 'Foswiki::Contrib::JEditableAddOn::JEDITABLE';
$Foswiki::cfg{Plugins}{JEditableContribPlugin}{Enabled} = 1;
$Foswiki::cfg{Plugins}{JEditableContribPlugin}{Module} = 'Foswiki::Plugins::JEditableContribPlugin';

# cat /etc/foswiki/LocalSite.cfg | grep -i editrow | sort | uniq
$Foswiki::cfg{Plugins}{EditRowPlugin}{Enabled} = 1;
$Foswiki::cfg{Plugins}{EditRowPlugin}{Macro} = 'EDITTABLE';
$Foswiki::cfg{Plugins}{EditRowPlugin}{Module} = 'Foswiki::Plugins::EditRowPlugin';

[the "uniq" was necessary as my old 1.0.10 core suffers from repeating config entries, but this is a different issue (solved in 1.1, I suppose)]

I still encounter the same problems from above: editing rows or the full table doesn't work, as the changes don't get saved. It's still caused by the same issue: ERROR: can't load jQuery plugin JEditable: Can't locate Foswiki/Plugins/JQueryPlugin/JEDITABLE.pm

I compared the contents of the .deb package and the zip attached to EditRowPlugin; there is no difference. After installation, JEDITABLE.pm is located at /var/lib/foswiki/lib/Foswiki/Contrib/JEditableContrib/ where it belongs, I guess. From the error message I understood, that Foswiki is looking for the module at /var/lib/foswiki/lib/Foswiki/Plugins/JQueryPlugin/JEDITABLE.pm. I created a symlink to this location and get the following error in the browser when rendering a page which uses the EDITTABLE macro:
Can't locate object method "new" via package "Foswiki::Plugins::JQueryPlugin::JEDITABLE" (perhaps you forgot to load "Foswiki::Plugins::JQueryPlugin::JEDITABLE"?)
And the apache log says:
Subroutine new redefined at, referer: http://intwiki.fzk.de/foswiki/bin/edit/Main/CreatecSputterLog2011Mar31?t=1301571870
[...]
Can't locate object method "new" via package "Foswiki::Plugins::JQueryPlugin::JEDITABLE" (perhaps you forgot to load "Foswiki::Plugins::JQueryPlugin::JEDITABLE"?) at /var/lib/foswiki/lib/Foswiki/Plugins/JQueryPlugin/Plugins.pm line 187.
[I picked the entries which I felt are most informative.]

Questions:
  • Why can't Foswiki find JEDITABLE.pm? Or better asked: why does it look at the wrong place?
  • Is my problem related to the early JQueryPlugin version 4.00?
  • And of course: How do we solve the issues?

-- PhilippLeufke - 31 Mar 2011

Anything I can do for debugging, Crawford?

-- PhilippLeufke - 04 Apr 2011

Your problems are more than likely to do with JQueryPlugin; all i can say is I have the plugin working in both latest code and 1.1.2, but haven't tried it on any earlier release. Since I can't reproduce the problem, I'm not much use for debugging.

-- CrawfordCurrie - 06 Apr 2011

Confirmed that this bug exists also on Foswiki 1.1.2 and 1.1.3

-- StefanosKouzof - 09 May 2011

Now that the 1.1.3 packages for debian are available, I upgraded everything. Interestingly, everything seems to work fine, but my apache2 error log gets cluttered with tons on error messages upon invocation of row- or full-table editing (single-cell edit is silent):

ERROR: can't load jQuery plugin JEditable: Can't locate Foswiki/Plugins/JQueryPlugin/JEDITABLE.pm in @INC
(@INC contains: /etc/foswiki /var/lib/foswiki/lib . /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 
/usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl) at (eval 326) line 1., referer: http://XXX

[followed by 46 more lines...]

So we are back to my above questions:

Questions:
  • Why can't Foswiki find JEDITABLE.pm? Or better asked: why does it look at the wrong place?
  • Is my problem related to the early JQueryPlugin version 4.00? I'm now on version 4.03
  • And of course: How do we solve the issues?

FYI: Currently used versions:
Package Release Version
EditRowPlugin 2.1.4 11717 (2011-05-18)
JQueryPlugin 4.03 11373 (2011-04-10)
JQueryCompatibilityModePlugin ?? 15 FMar 2009 (V1.5)
JEditableContrib 1.7.1 10771 (2011-02-22)
JEditablePlugin 1.7.1 10754 (2011-02-21)
JSCalendarContrib 11 Apr 2011 11391 (2011-04-10)

And then there is still a lot of confusion with JEditableAddOnPlugin and JEditableContribPlugin, as they eare still listed in configure and there is no proper documentation on which of them needs to be activated. I activated both of them for now.
Then there is another module which is called JEditablePlugin but although the name suggests it is -- well ehm, a plugin -- it gets listed in the "All Contrib Modules" in the InstalledPlugins topic. Consequently, I can't en- or disable it in configure. And what is the JQueryCompatibilityModePlugin all about?

Excuse my french, but this is a total mess. Please bring some clarity into this: Which modules do we really need? What do we need to activate in configure? And if possible, please remove all unnecessary modules so they aren't available and won't confuse people.

-- PhilippLeufke - 25 May 2011

The reasons for all this are quite complex, but I'll try to explain.

<geeky>
Until version 4.02 of JQueryPlugin, it made the assumption that any jquery-plugins (plugins to jquery, not plugins to Foswiki) had to have a .pm file in lib/Foswiki/Plugins/JQueryPlugin.

This meant that other Foswiki extensions had to include files that would be placed into another modules' code space, something which is dangerous and caused many failures when used with pseudo-install. To avoid this, other modules could alternatively register a jquery-plugin was with an API call - Foswiki::Plugins::JQueryPlugin::registerPlugin.

Unfortunately the only type of extension that is automatically called on Foswiki startup is a Foswiki-plugin. That meant that any module that wanted to register a jquery-plugin had to be a Foswiki-plugin.

Since every Foswiki-plugin carries a performance hit, this is not something we wanted. So we changed the code in JQueryPlugin to support the registration of jquery-plugins through an entry in configure. This allows us to add jquery-plugins in Foswiki-contribs, rather than always requiring extensions to be Foswiki-plugins.

Unfortunately this code is only in JQueryPlugin 4.02+, so to support versions prior to 4.02 we still needed a way to get that API called, but without imposing the overhead of a Foswiki-plugin for more recent JQueryPlugins.

The solution for JEditable was to embed a plugin into the JEditableContrib. This embedded plugin (JEditableContribPlugin) can be enabled when used with older JQueryPlugin versions, or simply ignored with 4.02+.
</geeky>

The bottom line of all this is that you need to enable the JEditableContribPlugin when you are running with JQueryPlugin versions prior to 4.02, otherwise it should be disabled.

JEditableAddOnPlugin does not exist. Ditto for JEditablePlugin - never heard of it. I have no idea what JQueryCompatibilityModePlugin is.

JEditableContribPlugin is the plugin described above that is used to enable the jquery plugin.

For simplicities sake, with JQueryPlugin 4.02 and later, these are the only lines you should need in LocalSite.cfg that include the string "JEditable":
$Foswiki::cfg{JQueryPlugin}{Plugins}{JEditable}{Module} = 'Foswiki::Contrib::JEditableContrib::JEDITABLE';
$Foswiki::cfg{JQueryPlugin}{Plugins}{JEditable}{Enabled} = 1;
This should suffice to register the jquery-plugin for JEditableContrib.

If you are using an older version of JQueryPlugin, you will need to have the lines:
$Foswiki::cfg{Plugins}{JEditableContribPlugin}{Module} = 'Foswiki::Plugins::JEditableContribPlugin';
$Foswiki::cfg{Plugins}{JEditableContribPlugin}{Enabled} = 1;
to enable the Foswiki-plugin that registers the jquery-plugin.

If you have used configure to install and manage these modules it ought to have left LocalSite.cfg in a consistent state, but since you have experienced problems I would recommend a manual edit to the what I just described.

Feel free to use the above in a FAQ if other people are having the same problems.

-- CrawfordCurrie - 26 May 2011

Thanks, Crawford, for this comprehensive explanation!

I tried the settings you suggested, but I still get the error message: Can't locate Foswiki/Plugins/JQueryPlugin/JEDITABLE.pm

If I symlink ln -s /var/lib/foswiki/lib/Foswiki/Contrib/JEditableContrib/JEDITABLE.pm /var/lib/foswiki/lib/Foswiki/Plugins/JQueryPlugin/JEDITABLE.pm, I get the browser error message:

Can't locate object method "new" via package "Foswiki::Plugins::JQueryPlugin::JEDITABLE" (perhaps you forgot to load "Foswiki::Plugins::JQueryPlugin::JEDITABLE"?)

Having JEditableContribPlugin enabled (although not necessary), doesn't change anything.

-- PhilippLeufke - 27 May 2011

Now I'm confused. Are you using pseudo-install? If so, why don't you just pseudo-install -u JEditableContrib EditRowPlugin and then pseudo-install JEditableContrib EditRowPlugin to clean and re-install? if you are not using pseudo-install=, why are you symlinking?

The file /var/lib/foswiki/lib/Foswiki/Plugins/JQueryPlugin/JEDITABLE.pm does not exist. The JQuery plugin doesn't exist in that namespace.

-- CrawfordCurrie - 03 Jun 2011

I think all this confusion is originated by the buggy debian packages. I tried the symlink, since the apache error log complained about this very path, where JEDITABLE.pm could not be found.

I'm currently preparing to entirely move away from the debian packages towards the vanilla foswiki installation. In my new test environment, the bug described here does not exist any longer.

I'm closing this bug for that reason...

-- PhilippLeufke - 03 Jun 2011

 

ItemTemplate edit

Summary Switch to JEditableAddOn causes several issues
ReportedBy PhilippLeufke
Codebase 1.1.3, 1.1.2, 1.0.10
SVN Range
AppliesTo Extension
Component JEditableContrib, JQueryPlugin
Priority Urgent
CurrentState No Action Required
WaitingFor
Checkins distro:b57581302cc5 distro:9f7963ad7b1a
TargetRelease n/a
ReleasedIn n/a
Topic revision: r20 - 03 Jun 2011, PhilippLeufke
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