[Seaside] Accessing configuration values from the configuration
cdshaffer at acm.org
Fri Jul 22 01:42:04 CEST 2005
> William E Harford wrote:
>> If there any way to access a site's user inputted configuration
>> values from a subclass of WASystemConfiguration ?
>> What I am trying to do is present the site administrator with a
>> series of questions in the config biased on answers that were given
>> in the config.
>> For example
>> In this application there might be 3 components. The administrator
>> would put the number 3 for a config value than save the config.
>> The config might than ask for the 3 component classes and there names.
>> I have only been able to retrieve the default values for a
>> SystemConfiguration using.
>> self localConfiguration valueAt: #numberOfContainers.
>> I have to admit even though I have read a couple notes on seasides
>> config component I still don't fully understand how it works.
One way you could accomplish your goal (probably not the only one but
the one that I'd try first) is by introducing a new configuration
parameter "type" and then building an editor for it. A simple example
can be found in:
Look at the implementation of SCColorAttribute (actually, the examples
of attributes in the image are simpler). Note that it requires you to
_add_ a method to WAConfigurationEditor. That class has an i-var
"configuration" which is the "local configuration" object. You can get
the value of a configuration parameter via "configuration valueAt:
#numberOfContainers" and render your editor appropriately. I have to
admit that adding a method to a Seaside system class seems awkward. The
alternative is either to build the rendering method into your attribute
class or build a separate class to render the editor for the attribute
(this second option would be difficult since the lifetime of the
attribute editor should be tied to the WAEditConfigurationDialog but
there is really no clear way to do that). Hopefully the document above
will clarify things slightly.
More information about the Seaside