package MenuProject; =head1 NAME MenuProject -- A menu to select a project =head1 SYNOPSIS MenuProject -> run; =head1 DESCRIPTION This package creates a Project Menu for extropy. The user interacts with Project Menu in order to select a project or start a new project. The only method is run. =head1 VERSION 0.001 (last update: 6/30/04) =head1 AUTHOR Chet Langin, clangin@siu.edu SIU Plant Biotechnology and Genomics Core-facility =head1 BUGS None known. =head1 SEE ALSO extropy ExtropyConstants ExtropyUtils Extropy::Configuration Extropy::DBManager Extropy::Project Extropy::ProjectCreate Extropy::ProjectPick Extropy::MenuMain =head1 COPYRIGHT Copyright 2004, Chet Langin, All Rights Reserved. This program is free software. You may copy or redistribute it under the same terms as Perl itself. =head1 METHODS The remainder of this document describes the methods available to the programmer. =cut # load the pragmas use warnings; use strict; # load other modules use ExtropyConstants; use ExtropyUtils; use Extropy::Configuration; use Extropy::DBManager; # use Extropy::Help; # use Extropy::Menu; use Extropy::Project; use Extropy::ProjectCreate; use Extropy::ProjectPick; # package variables my $configuration; my $db_manager; my $project; my $command = NONE; my $help_message_number = 0; # ******************************** run ****************************** =head2 run MenuProject->run; Run the Project Menu, which allows the user to select an existing project or start a new one. =cut # --------------------------------------------------------------------- sub run { my $self = shift; $configuration = shift; $db_manager = shift; $project = shift; my $proceed = TRUE; while($proceed) { &print_menu; if($command == HELP) { Help->display($help_message_number); } # if elsif($command == QUIT) { $proceed = FALSE; } # elsif elsif($command == PROJECT_CREATE) { if(ProjectCreate->new($configuration, $db_manager, $project)) { message("Current project: $project->{current_project}"); $proceed = FALSE; } # if else { message("No project created"); } # else press_enter; } # elsif elsif($command == PROJECT_PICK) { if(ProjectPick->new($configuration, $db_manager, $project)) { message("Current project: $project->{current_project}"); $proceed = FALSE; } # if else { message("No project created"); } # else press_enter; } # elsif } # while $command = NONE if($command != QUIT); $command; } # run =head2 print_main() print_menu; Display the menu. =cut # ******************************* print_menu ************************ sub print_menu { $command = NONE; if(scalar(@{$configuration->{project_array}})) { # There are one or more projects to choose from $command = Menu->menu("(P)ick an existing project", PROJECT_PICK, "(S)tart a new project", PROJECT_CREATE, "(H)elp", HELP, "(Q)uit", QUIT); $help_message_number = 101 if($command == HELP); } # if else { # There are no projects to choose from $command = Menu->menu("(S)tart a new project", PROJECT_CREATE, "(H)elp", HELP, "(Q)uit", QUIT); $help_message_number = 102 if($command == HELP); } # else } # print_menu 1