Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# itamar82 12/5/2008 8:01 AM
I have an idea for improving the ability to configure the settings of a section.

Currently, Cuyahoga checks if the type is a string, int, boolean, or enum and creates a webcontrol accordingly. This limits the configuration capabilities of a given section.

Take the following example: (I will use the Polls Module as the basis of this example.)

I would like to show the same poll in multiple sections across the site. As of now, the way to do this would be to attach the section directly into a template that is used on all the pages. For me this doesn't seem like a scalable solution. If some of the pages use different templates then this is becomes a point of friction and basically a pain in the butt.

I propose the following solution:

In Cuyahoga.Core there is a class called SettingControlHelper which renders the controls. As mentioned above, this class renders simple types... which do not satisfy my requirements. I would add a new interface definition to Cuyahoga.Core called ISectionCustomSettings. This interface would look like the following.

interface ISectionCustomSettings
{
IDictionary CustomSettings { get; }
}

The SettingControlHelper would then check if the type implements this interface, if it does, it will instantiate the type, call the CustomSettings property and populate a drop down list with the name value pairs in the Dictionary.

Every module could them implement such a interface and allow dynamic setting population.

In the Polls example, I would send a dictionary with PollId, PollName pairs.

Furthermore, if the type implements INhibernateModule, then Cuyahoga would inject the appropriate dao into the class.

I believe this feature would be very practical and would help many Cuyahoga developers.

Do you agree?

# martijnb 12/5/2008 10:57 AM
Interesting idea.

I like it and I probably would like to have the option for multiple custom setting type (not limiting to a single dictionary).

Another thing that relates to the issue that causes your request: shouldn't we perhaps add the possibility that a section can also belong to multiple pages? It probably has quite some impact, but I think it's worth discussing.
# itamar82 12/5/2008 4:34 PM
I think having a section associated with multiple pages is a good idea when talking about the content it will display... because the database will be looking up the same section in essence. In addition, do you think that having the option of different section settings per page should also be available?

I was thinking about what you said of not limiting setting types to IDictionary, so what would you suggest? Another way I guess would be to pass back a WebControl, or pass a reference of a Control and add to its Controls property. However the latter could be dangerous as it leaves a hole for accidently calling Controls.Clear() and losing other settings.
# martijnb 12/6/2008 12:42 PM
itamar82In addition, do you think that having the option of different section settings per page should also be available?

Maybe yes, but that also makes things more complicated.
I was thinking about what you said of not limiting setting types to IDictionary, so what would you suggest?

I was thinking about returning multiple setting types instead of a single IDictionary.
Another way I guess would be to pass back a WebControl, or pass a reference of a Control and add to its Controls property. However the latter could be dangerous as it leaves a hole for accidently calling Controls.Clear() and losing other settings.

No, ISectionCustomSettings belongs to the core and should have no relation with any UI control whatsoever IMHO.