Tags:
create new tag
, view all tags
I need a way to control the behaviour of an addon using addon-specific variables, similar to a plugin. So when my addon is unzipped, I want SOMEADDON_VARIABLE to be defined by virtue of the unzipping process. I then want to be able to override that value in WebPreferences and the user's personal topic, like a variable declared in TWikiPreferences.

I can obviously do it by asking the installer to manually edit TWikiPreferences as a post-install step, but I don't think that's very friendly. I could also do it by creating a Plugin with the same name, but that's nasty.

Anyone got any ideas?

If there's no way to do it today, how about some way to load a preferences object with a resolution chain? For example:

my $prefs = TWiki::Func::loadPreferences( "TWiki.SomeAddOn,TWiki.TWikiPreferences,%WEB%.WebPreferences,%MAINWEB%.$userName" );
my $var = $prefs->getPreferencesValue( "SOMEADDON_VARIABLE" );
This would of course necessitate publishing the Prefs class through Func; some would argue this is the way Func should be done anyway.

-- CrawfordCurrie - 26 Feb 2003

Topic revision: r1 - 2003-02-26 - CrawfordCurrie
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.