Tags:
create new tag
, view all tags
This started in TWikiPluginAPI

-- PeterThoeny - 06 Feb 2001

Proposal we probably need a way to ADD values to a variable, so that you can fix a minimal set of site-wide ACTIVEPLUGINS, each web can add other plugins, the user can add even more plugins. Would you like a syntax like:

   * Add ACTIVEPLUGINS = AnotherPlugin, EvenMorePlugin

-- AndreaSterbini - 01 Feb 2001

This is a useful idea to have control if to replace an existing preference variable, or if to add to an exiting one. (I.e. to modify an existing TWikiPreferences variable in WebPreferences)

  • To replace: (existing feature)
    • Set VARIABLE_NAME = new value
  • To add to the end of the existing value: (proposed feature)
    • Add VARIABLE_NAME = added stuff

-- PeterThoeny - 06 Feb 2001

Since you are going down that path, I would rather have an append / prepend as keywords, that way future things like search paths could be specified easily without having to think of a non-related pair of words like add and something_else (not to mention that at some point having the possibility of really adding two variables together could be thought as useful by someone).

So I suggest:

  • To add at the end
    • Append VARIABLE_NAME = appended stuff
  • To add at the begining
    • Prepend VARIABLE_NAME = pre-appended stuff

Or even as a more general solution (I'm not really proposing the very long 'Concatenate' itself as a keyword, but at least as an idea):

  • To add somewhere
    • Concatenate VARIABLE_NAME = VARIABLE_NAME, appended stuff
    • Concatenate VARIABLE_NAME = pre-appended stuff, VARIABLE_NAME
    • Concatenate VARIABLE_NAME = ( pre-stuff; VARIABLE_NAME; post-stuff )

The later is much more wordy, but almost unambiguous, not to mention that it allows the specification of field separators and delimiters.

-- EdgarBrown - 06 Feb 2001

Another way could be to use a predefined tag to indicate the same variable in previous level (where TWikiPreferences comes before WebPreferences and personal preferences).

Would you like a syntax like this?

  • Set VARIABLE_NAME = pre-stuff %SUPER% post-stuff

NB: this is probably very easy to implement and fits nicely with the FIXEDPREFERENCES mechanism.

-- AndreaSterbini - 06 Feb 2001

Or this:

   * Set VARIABLE_NAME = pre-stuff %VARIABLE_NAME% post-stuff

E.g. allow to reuse the value of any previously set variable. This is how Windows NT system/user variables work.

-- PeterThoeny - 10 Feb 2001

I was going to make the same suggestion ... I like it more then %SUPER%.

Small idea for implementation: just add a call to the variable replacement routine on the text of the (Web/User) preference topic before parsing the variables ... you get the previous level values replaced inside the next one.

-- AndreaSterbini - 11 Feb 2001

Even though it's been a long time since this discussion has been going on, I still think it's a good idea. And since it's quite easy to implement, I tried it.

I implemented the functionality according to Peter's suggestion:

   * Set VARIABLE_NAME = pre-stuff %VARIABLE_NAME% post-stuff

Here is the patch: AddValuesToPreferenceVariable.patch

-- JohannesMartin - 09 Apr 2003

I don't think my patch actually solved the problem. It worked for preference values obtained through %VAR{}% or internally through getPreferencesValue() but not for %PREF%. My new patch should do a much better job, it's shorter and even more efficient since the evaluation is only done once.

-- JohannesMartin - 23 Apr 2003

The current method of dealing with preferences involves slurping up the various preferences files and stepping through them line by line. No, not reading them in line by line.

Compared to this, keeping prefences in a DBM hash file would be an enourmous boost to an execution path that is critical to all operations within Twiki.

-- AntonAylward - 01 May 2003

My patch of April 23 is still flawed. For example, it does not replace any internal tags (such as %TOPIC%), and it does not do repeated replacements (such as %%SOMEVARIABLE%_SUFFIX%). My new patch should handle these cases correctly as well.

-- JohannesMartin - 13 May 2003

Updated progress fields with values from old manual "Nice to Have" table. Don't know how accurate they are.

-- SamHasler - 08 Sep 2004

Edit | Attach | Watch | Print version | History: r15 < r14 < r13 < r12 < r11 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r15 - 2008-09-02 - TWikiJanitor
 
  • 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.