Item8248: AutoViewTemplatePlugin does not work on foswiki/trunk (patch available)

pencil
Priority: Enhancement
Current State: Closed
Released In:
Target Release:
Applies To: Extension
Component: AutoViewTemplatePlugin
Branches:
Reported By: Foswiki:Main.MichaelDaum
Waiting For:
Last Change By: MichaelDaum
... as it makes use of unpublished API's and those have been changed. In addition the below patch fixes the Config.spec to fit nicely into the new configure interface. Oliver, can you please check?

Index: lib/Foswiki/Plugins/AutoViewTemplatePlugin.pm
===================================================================
--- lib/Foswiki/Plugins/AutoViewTemplatePlugin.pm       (revision 4669)
+++ lib/Foswiki/Plugins/AutoViewTemplatePlugin.pm       (working copy)
@@ -99,7 +99,11 @@
         Foswiki::Func::writeDebug("- ${pluginName}: $templateVar set to: $templateName");
       }
     }
-    $Foswiki::Plugins::SESSION->{prefs}->pushPreferenceValues( 'SESSION', { $templateVar => $templateName } );
+    if ($Foswiki::Plugins::VERSION >= 2.1 ) {
+      Foswiki::Func::setPreferencesValue($templateVar, $templateName);
+    } else {
+      $Foswiki::Plugins::SESSION->{prefs}->pushPreferenceValues( 'SESSION', { $templateVar => $templateName } );
+    }

     # Plugin correctly initialized
     return 1;
Index: lib/Foswiki/Plugins/AutoViewTemplatePlugin/Config.spec
===================================================================
--- lib/Foswiki/Plugins/AutoViewTemplatePlugin/Config.spec      (revision 4669)
+++ lib/Foswiki/Plugins/AutoViewTemplatePlugin/Config.spec      (working copy)
@@ -1,14 +1,15 @@
-# ---+ AutoViewTemplate settings
-# This is the configuration used by the <b>AutoViewTemplatePlugin</b>.
-
-# **BOOLEAN**
-# Turn on/off debugging in debug.txt
-$Foswiki::cfg{Plugins}{AutoViewTemplatePlugin}{Debug} = 0;
-
-# **BOOLEAN**
-# Override existing VIEW_TEMPLATE settings in doubt.
-$Foswiki::cfg{Plugins}{AutoViewTemplatePlugin}{Override} = 0;
-
-# **SELECT exist,section**
-# Where to find the template to be used.
-$Foswiki::cfg{Plugins}{AutoViewTemplatePlugin}{Mode} = 'exist';
\ No newline at end of file
+# ---+ Extensions
+# ---++ AutoViewTemplate settings
+# This is the configuration used by the <b>AutoViewTemplatePlugin</b>.
+
+# **BOOLEAN**
+# Turn on/off debugging in debug.txt
+$Foswiki::cfg{Plugins}{AutoViewTemplatePlugin}{Debug} = 0;
+
+# **BOOLEAN**
+# Override existing VIEW_TEMPLATE settings in doubt.
+$Foswiki::cfg{Plugins}{AutoViewTemplatePlugin}{Override} = 0;
+
+# **SELECT exist,section**
+# Where to find the template to be used.
+$Foswiki::cfg{Plugins}{AutoViewTemplatePlugin}{Mode} = 'exist';

-- MichaelDaum - 20 Aug 2009

Michael, please go ahead and just check it in. Thanks for the patch.

-- OliverKrueger - 20 Aug 2009
 

ItemTemplate edit

Summary AutoViewTemplatePlugin does not work on foswiki/trunk (patch available)
ReportedBy Foswiki:Main.MichaelDaum
Codebase
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component AutoViewTemplatePlugin
Priority Enhancement
CurrentState Closed
WaitingFor
Checkins distro:1301a9ba0c2e
ReleasedIn
Topic revision: r4 - 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