#-*- perl -*-
#
# Copyright (C) 2003,2004,2006 Ken'ichi Fukamachi
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
# $FML: Wizard.pm,v 1.2 2006/01/09 14:00:53 fukachan Exp $
#
package FML::CGI::Skin::Wizard;
use strict;
use Carp;
use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD);
use CGI qw/:standard/; # load standard CGI routines
use FML::CGI::Skin::Base;
@ISA = qw(FML::CGI::Skin::Base);
my $debug = 0;
=head1 NAME
FML::CGI::Skin::Wizard - provides CGI control function for the specific domain.
=head1 SYNOPSIS
$obj = new FML::CGI::Menu;
$obj->prepare();
$obj->verify_request();
$obj->run();
$obj->finish();
=cut
# Descriptions: dummy.
# Arguments: OBJ($curproc)
# Side Effects: none
# Return Value: none
sub run_cgi_navigator
{
my ($curproc) = @_;
if ($curproc->is_valid_input()) {
return $curproc->SUPER::run_cgi_navigator();
}
else {
$curproc->cgi_var_navigator_title();
# 1.1 menu description.
my $desc = $curproc->message_nl("cgi.wizard_navigation",
"1) select ml_name, 2) command\n");
print $desc, "\n";
print "\n
\n";
}
}
# Descriptions: show menu (old style, list based menu).
# Arguments: OBJ($curproc)
# Side Effects: none
# Return Value: none
sub run_cgi_menu
{
my ($curproc) = @_;
my $target = $curproc->cgi_var_frame_target();
my $action = $curproc->cgi_var_action();
# natural language-ed name
my $name_ml_name = $curproc->message_nl('term.ml_name', 'ml_name');
my $name_command = $curproc->message_nl('term.command', 'command');
my $name_switch = $curproc->message_nl('term.switch', 'switch to');
my $name_reset = $curproc->message_nl('term.reset', 'reset');
# 0. call command specific menu if both ml_name and command specified.
if ($curproc->is_valid_input()) {
return $curproc->cgi_execute_cgi_menu();
}
# 1. ML
my $ml_name = $curproc->cgi_var_ml_name();
my $ml_list = $curproc->cgi_var_ml_name_list();
my $title = $curproc->cgi_var_navigator_title();
print $title, "\n";
# 1.1 ML selection.
print "
\n";
if ($ml_name) {
print "1. O.K. ml_name = $ml_name selected.
\n";
}
else {
my $size = $#$ml_list + 1;
my $_desc = "1. select ml_name.\n";
my $desc = $curproc->message_nl("cgi.select_ml_name", $_desc);
print $desc;
print "
\n";
print start_form(-action=>$action, -target=>$target);
print $name_ml_name, ":\n";
print scrolling_list(-name => 'ml_name',
-values => $ml_list,
-default => [ $ml_name ],
-size => $size > 5 ? 5 : $size);
print "
\n";
print submit(-name => $name_switch);
print reset(-name => $name_reset);
print end_form;
return;
}
# 2. list up command.
my $next_button = $curproc->message_nl("cgi.button_next", "next");
print "
\n";
print $curproc->message_nl("cgi.select_command",
"2. select command.");
print "\n
\n";
print "\n