SID-01023: Installing EditRowPlugin on TWiki 5.0
| Status: |
Answered |
TWiki version: |
5.0.0 |
Perl version: |
perl 5.8.8 x86_64 |
| Category: |
CategoryPlugins |
Server OS: |
cent0S 5.3 Linux 2.6.18 64bit |
Last update: |
15 years ago |
I would like to use Edit Row Plugin on TWiki 5.0 but the plugin is not certified for 5.0.
I installed anyway to try and got this error. Before I dive in, does anyone have some input on this error or library?
Can't locate object method "Vars" via package "TWiki::Request" at /var/www/html/twiki/lib/TWiki/Plugins/EditRowPlugin.pm line 120.
Thanks
--
ScottGutman - 2010-11-13
Discussion and Answer
We tested over 150 TWiki extensions for TWiki-5.0 compatibility. This plugin is pending. Your help is appreciated: If you are a developer you could fix the plugin and attach a patch to the
EditRowPluginDev topic.
--
PeterThoeny - 2010-11-13
I found that the following change to lib/TWiki/Plugins/EditRowPlugin.pm made it work again for me.
# diff ./lib/TWiki/Plugins/EditRowPlugin.pm{.bak,}
120c120
< my $vars = $query->Vars();
---
> my $vars = $query->{param};
273c273
< my $urps = $query->Vars();
---
> my $urps = $query->{param};
--
ErikJohansen - 2011-01-20
Thanks you Erik, I'll update the plugin.
--
PeterThoeny - 2011-01-21
This bug is tracked at
TWikibug:Item6641
.
--
PeterThoeny - 2011-01-21
Erik, you got me on the right track. I am fixing it so that this plugin can run properly on releases older than TWiki-5.0 and TWiki-5.0 and up:
--- lib/TWiki/Plugins/EditRowPlugin.pm (revision 20025)
+++ lib/TWiki/Plugins/EditRowPlugin.pm (working copy)
@@ -1,7 +1,9 @@
+# Plugin for TWiki Enterprise Collaboration Platform, http://TWiki.org/
+#
# Author: Crawford Currie http://c-dot.co.uk
#
# Copyright (C) 2007 WindRiver Inc.
-# Copyright (C) 2008-2010 TWiki Contributor. All Rights Reserved.
+# Copyright (C) 2008-2011 TWiki Contributor. All Rights Reserved.
# TWiki Contributors are listed in the AUTHORS file in the root of
# this distribution.
# NOTE: Please extend that file, not this notice.
@@ -32,7 +34,7 @@
use Assert;
$VERSION = '$Rev$';
-$RELEASE = '$Date$';
+$RELEASE = '2011-01-20';
$SHORTDESCRIPTION = 'Inline edit for tables';
$NO_PREFS_IN_TOPIC = 1;
@@ -117,10 +119,20 @@
require TWiki::Plugins::EditRowPlugin::Table;
return 0 if $@;
- my $vars = $query->Vars();
my $urps = {};
- while (my ($key, $value) = each %{$vars}) {
- $urps->{$key} = $value if $key =~ /^erp_/;
+
+ if( $TWiki::Plugins::VERSION < 1.3 ) {
+ # TWiki-4.3 and older
+ my $vars = $query->Vars();
+ while (my ($key, $value) = each %{$vars}) {
+ $urps->{$key} = $value if $key =~ /^erp_/;
+ }
+ } else {
+ # TWiki-5.0 and up
+ my @varnames = $query->param();
+ foreach my $key (@varnames) {
+ $urps->{$key} = $query->param($key) if $key =~ /^erp_/;
+ }
}
my $endsWithNewline = ($text =~ /\n$/) ? 1 : 0;
@@ -270,7 +282,21 @@
$text =~ s/\\\n//gs;
require TWiki::Plugins::EditRowPlugin::Table;
die $@ if $@;
- my $urps = $query->Vars();
+
+ my $urps = {};
+ if( $TWiki::Plugins::VERSION < 1.3 ) {
+ # TWiki-4.3 and older
+ $urps = $query->Vars();
+ } else {
+ # TWiki-5.0 and up
+ my @params = $query->param();
+ foreach my $p ( @params ) {
+ my @vals = $query->param( $p );
+ # Turn checkboxes, select+multi into comma-separated list
+ $urps->{$p} = join(',', @vals);
+ }
+ }
+
my $content = TWiki::Plugins::EditRowPlugin::Table::parseTables(
$text, $topic, $web, $meta, $urps);
--
PeterThoeny - 2011-01-21
The plugin is now updated in SVN and at
Plugins.EditRowPlugin.
--
PeterThoeny - 2011-01-21
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.