#-*- perl -*- # # Copyright (C) 2002 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: Menu.pm,v 1.6 2002/03/20 07:31:54 fukachan Exp $ # package FML::CGI::Admin::Menu; use strict; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; use CGI qw/:standard/; # load standard CGI routines use FML::Process::CGI; @ISA = qw(FML::Process::CGI); =head1 NAME FML::CGI::Admin::Menu - provides functions for makefml CGI interface =head1 SYNOPSIS $obj = new FML::CGI::Admin::Menu; $obj->prepare(); $obj->verify_request(); $obj->run(); $obj->finish(); run() executes html_start(), run_cgi() and html_end() described below. See L for flow details. =head1 DESCRIPTION =head2 CLASS HIERARCHY C is a subclass of C. FML::Process::Kernel | A FML::Process::CGI | A ----------------------- | | A A FML::CGI::Admin::Menu =head1 METHODS Almost methods common for CGI or HTML are forwarded to C base class. This module has routines needed for CGI. =cut # Descriptions: print out HTML header + body former part # Arguments: OBJ($curproc) HASH_REF($args) # Side Effects: none # Return Value: none sub html_start { my ($curproc, $args) = @_; my $config = $curproc->{ config }; my $myname = $curproc->myname(); my $domain = $curproc->ml_domain(); my $ml_name = $curproc->safe_param_ml_name(); my $title = "${ml_name}\@${domain} configuration interface"; my $color = $config->{ cgi_main_menu_color } || '#FFFFFF'; my $charset = $config->{ cgi_charset } || 'euc-jp'; # o.k start html print start_html(-title => $title, -lang => $charset, -BGCOLOR => $color); print "\n"; } # Descriptions: print out body latter part # Arguments: OBJ($curproc) HASH_REF($args) # Side Effects: none # Return Value: none sub html_end { my ($curproc, $args) = @_; # o.k. end of html print end_html; print "\n"; } # Descriptions: main routine for makefml.cgi. # kick off suitable FML::Command finally # via cgi_execulte_command(). # Arguments: OBJ($curproc) HASH_REF($args) # Side Effects: none # Return Value: none sub run_cgi_main { my ($curproc, $args) = @_; my $command = $curproc->safe_param_command() || ''; my $address = $curproc->cgi_try_get_address($args); if ($command && $address) { my $ml_name = $curproc->safe_param_ml_name(); my $command_args = { command_mode => 'admin', comname => $command, command => $command, ml_name => $ml_name, options => [ $address ], argv => undef, args => undef, }; $curproc->cgi_execute_command($args, $command_args); print hr; $curproc->run_cgi_menu($args, $command); } elsif ($command) { $curproc->run_cgi_menu($args, $command); } else { my $ml_name = $curproc->safe_param_ml_name(); if ($ml_name) { $curproc->run_cgi_help($args); } else { $curproc->run_cgi_help($args); } } } # Descriptions: show menu # Arguments: OBJ($curproc) HASH_REF($args) # Side Effects: none # Return Value: none sub run_cgi_navigator { my ($curproc, $args) = @_; my $action = $curproc->myname(); my $target = '_top'; my $ml_list = $curproc->get_ml_list($args); my $address = $curproc->safe_param_address() || ''; my $config = $curproc->{ config }; my $command_list = $config->get_as_array_ref('available_commands_for_admin_cgi'); # main menu my $ml_name = $curproc->safe_param_ml_name() || '?'; my $fml_url = 'fml'; print "$fml_url admin menu\n
\n"; print start_form(-action=>$action, -target=>$target); print "mailing list:\n"; print scrolling_list(-name => 'ml_name', -values => $ml_list, -default => $ml_name, -size => 5); print "\n
\n"; print " command:\n"; print scrolling_list(-name => 'command', -values => $command_list, -size => 5); print "\n
\n"; print submit(-name => 'submit'); print reset(-name => 'reset'); print end_form; } =head1 SEE ALSO L, L and L =head1 AUTHOR Ken'ichi Fukamachi =head1 COPYRIGHT Copyright (C) 2002 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. =head1 HISTORY FML::CGI::Admin::Menu appeared in fml5 mailing list driver package. See C for more details. =cut 1;