[MAGNOLIA-766] Dynamic Options for Select Control Created: 14/Mar/06  Updated: 23/Jan/13  Resolved: 13/Jun/06

Status: Closed
Project: Magnolia
Component/s: admininterface
Affects Version/s: 2.1.5
Fix Version/s: 3.0 RC1

Type: Improvement Priority: Minor
Reporter: Bert Schulzki Assignee: Philipp Bärfuss
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File dynamicOptions_magnolia2.1.5.zip    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

If you use selections in magnolia dialogs, the options must be static defined in the dialog properties. Though this is straight forward, it has serious limitations:

  • when using the same options in multiple dialogs, you must copy and paste, and if one option changes, you have to start over
  • you cant provide "dynamic" options, for instance:
    o select a user from the repository
    o select a page with a specific template below a certain content tree
    o retrieve options from elsewhere (filesystem, jdbc, ...)

I could not solve this without changing magnolia. If someone knows a better way, please tell me. Otherwise i would suggest to build my (or a similiar solution) into the product. The source is attached to this page and in the wiki.

The solution works like this:

  • if a "options" contentnode in a select field is found, its static options will be used
  • if "options" contentnode is missing, it will look for a nodedata called "optionClass"
  • if this nodedata is found, it will instantiate this class
  • this class must implement the interface OptionHook and provides a single method "getOptions(...)"

Using this pattern, you are fully backward compatible to existing dialog definitions, with the ability to create dynamic options.

The code is ready and can be found ready here:
http://www.magnolia.info/wiki/Wiki.jsp?page=DynamicOptions

If there are some supporters for this issue, i would like to see it integrated into the magnolia source tree.



 Comments   
Comment by Philipp Bracher [ 15/Mar/06 ]

You have my support

I will check it in. But be aware that the controls will change complete in the future since we move to JSF. But the dialog definition will survive the changes.

Comment by Philipp Bracher [ 13/Jun/06 ]

I followed a simple approach:

  • the control type can be a classname (for controls used only in one dialog)
  • I have to update the documentation to show how such a control is done
  • use info.magnolia.module.admininterface.dialogs.LanguageSelect as an example
Generated at Mon Feb 12 03:20:28 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.