Having written a several applications using TWiki having preferences in only
TWikiPreferences and
WebPreferences (or topics if you use the topic plugin), and then trying to merge them in a single web for usage is currently very awkward. If the application changes, merging the preference settings from 4 different things becomes an admin overhead.
Being able to %INCLUDE% preferences into a topic - as mentioned in several places before (include
SeparateCustomPreferences) would allow this.
This requires a modification to
getPrefsFromTopic to handle includes. If the standard include handling was used that would need changing since it performs rendering tasks as well as structural tasks. (Separating the structural/subrequest elements of INCLUDEs from the rendering elements would simplify this)
Moving preferences to meta data, as has partially happened would help, but needs to introduce a pointer for inclusion.
Unlike the
SeparateTWikiSystemAndSitePreferences topic which deals, essentially, with class inheritance and overriding,
include preferences refers more to composition and aggregation.
I've been mulling over a "PREFSCLUDE" functionality for some months now, but a) hate that name b) have considered simply expanding %INCLUDE%s, c) adding in a flag %INCLUDE{norender="1"}%, %INCLUDE{expandprefs="1"}%, %INCLUDE{early="1"}%, etc. My current preference for "c" is "early" since that could give the biggest win - allowing use of includes inside
to be dealt with as people might expect, and allow preferences to realise that things need to done earlier. (Initial implementation wouldn't do that of course.)
A completely alternative approach d) is to allow %BEGIN{ }% blocks ala perl. The problem with that approach is that it's yet more syntax for people to learn, and support queries over the years show that people _expect_ the include approach (with no hinting of any kind) to _just work_.
My overall preference is to do b) and pass over a structural only parameter from Prefs.pm, leaving "early" for another feature, another day.
-- <!-- Main.MichaelSparks --> MS - 22 Dec 2003
In conjunction with http://twiki.org/cgi-bin/view/Codev/OverridePreferenceSettingsInTopics, http://twiki.org/cgi-bin/view/Codev/FormattedTWikiFormDataInTopicText, and so on this enables a large number of interesting possibilities.
* =%<nop>INCLUDE{"%<nop>TOPIC%Preferences" defaulttopic="%\<nop>FORMFIELDS\{'TopicClassification'}\%Config" expandprefs="1"}%=
Calculations/decisions based on the last edit time in the META data would also allow ShowPageAgeVisually to be dealt with in this sort of way.
Much of the stuff Raymond's been talking about fall out of this approach then. (And again treats topics as libraries)
-- <!-- Main.MichaelSparks --> MS - 16 Jan 2004
I've now implemented this for my wiki. If anyone's interested in this feature in TWiki I can backport the feature and post a diff. The implementation is this:
* Standard includes function as normal
* Includes that are of the form =%<nop>INCLUDE{<i>normalstuff</i> prefs="1" <i>normalstuff</i>}%= pull in the preferences defined in the include.
This functionality allows plugins and in-web twiki applications to define preferences for their application in a similar way to plugins and pull in the values as needed.
-- <!-- Main.MichaelSparks --> MS - 24 Jan 2004