I have noticed, that parent-child dependency in otrs services and queues is made based only on parent prefix in the name of child service. I understand that PERL is perfect for working with text, but...
Wouldn't it be more convenient to set one more column with the ID of the parent to the child and don't look for full text matches, while building tree views...
Yeah that was offtopic,
THE QUESTION:
I am trying to realise dependent selectboxes functionality into OTRS (Feature add-on lookalike) and I have no idea how to make selectboxes based on these prefixes...
So I want to share some ideas how to implement it and maybe some more experienced programmer could point to week spots of an algorithm
IDEA A - firstly fill selectboxes with everything and then limit what is shown
1) Look for service without "::"
2) Add it as an option to selectboxLVL1
3) Recursively look for service which parent is the service from (1) and which have only 1 "::" into the string
4) add it to selectboxLVL2
5) recursively look for children services, until none are found
6) go to point (1) until all services without "::" are drawn into the selectbox
7) Show only NOTEMPTY selectboxes

Of course I would like to implement this on server side and send to client, but maybe will try to implement it via JavaScript on client side.
IDEA B - fill selectboxes only with required data
1) fill selectboxLVL1 with services without "::"
2) wait till user selects the value in LVL1
3) Search for services with the prefix (before "::") equal to selectboxLVL1 value
4) Remove the prefix add those services to selectbox LVL2
5) Recursively continue doing it untill no descendands are found
Don' t know, these are just my thoughts that might be useful for me or maybe someone else, and if I get any comments on this this will be even better
Bye!