"Mangano, Aron" <[EMAIL PROTECTED]> writes:

> What is the best way to set up menus ie in the standard setup you
> have base, sales and develop etc.
> 
> I work for an engineering firm and to make things are lot easier on
> myself I could use some sort of cascading menu.
> 
> Ie for example we have departments
> 
> Admin
> Civil
> Mechanical
> Rail
> Transport
> Structural
> Mining and Minerals
> Environmental etc
> Information Technology
> Accounts
> 
> Within each department we have:
> 
> Engineers
> Secretaries
> Draftsman
> Support Staff etc

Is the set of roles within each department the same?  If so, it sounds
like you want two menus (department + role), not a cascading menu.

> Depending on which engineer works in which department etc, they will
> have different software. All secretaries have basically the same
> software but this can sometimes be different as well.
> 
> I'd like to have say top level menu, being the department, then sub
> menu's with engineer, draftsman, secretary etc.
> 
> What would be the best way to achieve this.
> 
> I presume I need to edit config.pl??

Yes.  Getting these questions asked is trivial; you can just add your
own section ("_maunsell", say) with some values:

======================================================================
$u->{'_maunsell}->{'department'} =
    sub {
        return menu_choice ('Choose department: ',
                            map { $_ => $_ }
                            ('Admin', 'Civil', 'Mechanical',
                             [etc.]
                            ));
    };

$u->{'_maunsell}->{'role'} =
    sub {
        return menu_choice ('Choose role: ',
                            map { $_ => $_ }
                            ('Secretary', 'Engineer', 'Draftsman',
                             [etc.]
                            ));
    };
======================================================================

The funny "map { $_ => $_ } ('Admin', 'Civil, 'Mechanical')" construct
is equivalent to "'Admin' => 'Admin', 'Civil' => 'Civil', 'Mechanical'
=> 'Mechanical'".  This is needed because our menu_choice() function
takes pairs of values; the first element of the pair being what the
user sees and the second element being what the function returns.
This just makes the return value the same as the display value.
(Which, come to think of it, is what the function should have returned
to begin with.  Oh, well.)

This will ask the questions, and put the answers in
[_maunsell]/department and [_maunsell]/role.  Next, you have to
arrange to use those values to select the installation scripts...  And
there are many ways you might do this.

The most brute-force approach is to have one .bat file for each
combination of department and role:

======================================================================
$u->{'_meta'}->{'top'} =
    sub {
        my $department = $u->{'_maunsell'}->{'department'};
        my role = $u->{'_maunsell'}->{'role'};

        return "$department-$role.bat";
    };

# Assuming you want to skip the offer of optional scripts
$u->{'_meta'}->{'middle'} = undef;
======================================================================

This would select a top-level script named "Admin-Secretary.bat" or
"Civil-Engineer.bat" or whatever based on the department and role.
(Whitespace in the names might not work right...)  You would probably
want to write these scripts to invoke common sub-scripts to avoid
things getting completely out of hand.

The other approach is to write code to compute [_meta]/top and
[_meta]/middle based on the department and role.  The best way to do
that depends on how you want to express things.

The first step is probably to figure out how you would want to write
this configuration in your ideal world.  Then implement it :-).

I can help more if you can be more precise about how you would want to
write this if you were choosing the syntax.

 - Pat


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
unattended-info mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unattended-info

Reply via email to