#!/usr/bin/perl use strict; use Exporter; my @ISA = ('Exporter'); my @EXPORT = qw(date_time_pop); # + + + + + + + + + + + + + + + + + + + + + + + + + + # # + + + + + + + + + + + + + + + + + + + + + + + + + + # sub date_time_pop{ # This module's purpose is to expidite the creation of HTML drop down menus. The calling code # passes some info to determine what type of drop down is required and the actual HTML code for # the drop down is returned. It is often used to create dynamic script created HTML pages that need # drop downs that aren't always the same. We can use this routine to create drop downs that we can # control the default selected item. A good example is the creation of an HTML form that we want # to control date input by forcing the use of a drop down menu to keep the user from typing in # incorrectly formatted data, but we want the form to always have today's date chosen by default. # # $month=date_time_pop('MONTH',$var,'var2'); # $day=date_time_pop('DAY',$var,'var2'); # $year=date_time_pop('YEAR',$var,'var2','5','5'); # $hour=date_time_pop('HOUR',$var,'var2'); # $minute=date_time_pop('MINUTES',$var,var2'); # # $month: This var will contain the HTML code. # MONTH or DAY or YEAR or HOUR or MINUTES: This tells the code which type of dropdown to return. # $var: This var contains the item to be selected by default. It must match an item in the list. # $var2: This is the name of the HTML select statement. # 5,5: For the year routine only: These are the number of years before var2 and the number of # years after var2 to show in the drop down. # # # Initial date 6/12/00, by Devlin Technical Consulting # Revision 1 6/15/00, D3 Converted to module format. Now is Datimenu.pm # Revision 2 6/14/00 fixed hour loop w/ sprintf and int # Revision 3 9/11/00 D3 Adding comments. my @input=@_;# get the passed parameters #initialize some variables my $start= my $total = my $format= ""; #do process for month type pop-up if ($input[0] =~ m/MONTH/i){ my $default = $input[1];# get the default value my $select_name = $input[2];# name for the select statement my @month=("JAN","FEB","MAR","APR","MAY","JUN", "JUL","AUG","SEP","OCT","NOV","DEC"); $format='%02d'; my $return_this .= qq[]; return $return_this; }#end if month type pop_up #do process for number type pop-up my $default=$input[1];# default selected value in popup list my $select_name = $input[2];# name for the select statement my $return_this .= qq[\n]; return $return_this; }#end number type 1;