> from what i can see, it's meant to create
<optgroup>s based on input
that resembles a MediaWiki list. there doesn't
seem to be anything
specific to 'reason'-fields though, so i think a more appropriate
name might be something like optGroupSelect. <<
Well, this thing is going to replace the dropdown code used on Deletion and
Protection forms. Those dropdowns were all based on the same coding idea,
but with lots of variables defined etc. The idea behind creating
reasonDropDown (which can be renamed, of course) is to provide a "single"
funciton, which will generate the dropdown lists used on these forms.
What it does is just what the dropdowns on Deletion and Protection forms do
at the moment; almost nothing more (except for a better support of
pre-selecting an item in the list). It doesn't necessarily create optgroups.
Whether optgroups are created or only <options> are created depends on the
contents of $list variable, which in practice, comes from a MediaWiki
message (like 'filedelete-reason-dropdown', etc).
Anyways, I'm open to ideas about how to update it. At the moment, it works
just as good as the hard-coded dropdowns work. If there is anywhere to go
from here to make it better, I'm ready to go.
By the way, about the naming, we currently have "dateSelector" and
"namespaceSelector" functions. What do you think of reasonSelector?
> also, a more code-friendly input format than
\n-separated lines might
be nice for calling it when your options don't come
from a wiki page. <<
At the moment, the only places where it can be used are those were the list
comes from a MediaWiki message. I can't imagine how options can't come from
a wiki page, so can you give an example?
Huji