File: menu.cgi

package info (click to toggle)
plan 1.8.4-9
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,964 kB
  • ctags: 1,986
  • sloc: ansic: 24,493; perl: 1,361; makefile: 531; sh: 516; yacc: 119; sed: 17
file content (161 lines) | stat: -rwxr-xr-x 4,135 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/bin/perl
#--------------------------------------------------------------------------

#--------------------------------------------------------------------------
require ("./cgi-lib.pl") || die "can\'t require cgi-lib.pl: $!";;
require ("./common.pl") || die "can\'t require common.pl: $!";;




#--------------------------------------------------------------------------
# User-definable variables
#--------------------------------------------------------------------------
$myurl="http:webmonth.cgi";

@month=( "", "January ", "February", "March", "April", "May", "June", 
         "July", "August", "September", "October", "November", "December" );

&main(@ARGV);

#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
sub header {
   local($mo,$yr)=@_;

   print "Content-type: text/html


<HTML>
<HEAD>
<TITLE>January 1999</TITLE>
</HEAD>
<BODY>
";
} # header

#--------------------------------------------------------------------------
# Print the content of the FORM
#--------------------------------------------------------------------------
sub form {
   
   print "<FORM method=post action=$myurl TARGET=\"calendar\">\n";


   @group_list=&get_group;
   
   print "<FONT size=2>";
   print "<CENTER>";
  
   print "<SELECT NAME=\"group\">\n";
   print "<OPTION ";
   print "SELECTED " if ( $group eq "none" ) ;
   print "VALUE=\"none\"> (All Users) \n"; 
   foreach (@group_list) {
       $group_elem=$_; 
       print "<OPTION ";
       chop $group_elem;
       print "SELECTED " if ( $group eq "$group_elem" ) ;
       print "VALUE=\"$group_elem\">", $group_elem, "\n";
   }
   print "</SELECT>\n";

   print "<SELECT NAME=\"years\">\n";
   for ($i=1998;$i<=2034;$i++) {
       print "<OPTION ";
       print "SELECTED " if ($i == $cur_year );
       print "VALUE=\"$i\">", $i, "\n";
   }
   print "</SELECT>\n";

   print "<SELECT NAME=\"month\">\n";
   for ($i=1;$i<=12;$i++) {
       print "<OPTION ";
       print "SELECTED " if ($i == $cur_month );
       print "VALUE=\"$i\">", $month[$i], "\n";
   }
   print "</SELECT>\n";

   print "<SELECT NAME=\"jour\">\n";
   print "<OPTION VALUE=0>(All Days)\n";
   for ($i=1;$i<=31;$i++) {
       print "<OPTION ";
       print "SELECTED " if ( $i == $cur_jour );
       print "VALUE=\"$i\">", $i, "\n";
   }
   print "</SELECT>\n";

   print "<SELECT NAME=\"show_private\">\n";
   print "<OPTION ";
   print "SELECTED " if ( $show_private eq "no" );
   print "VALUE=\"no\">Private: no\n";
   print "<OPTION ";
   print "SELECTED " if ( $show_private eq "yes" );
   print "VALUE=\"yes\">Private: yes\n";
   print "</SELECT>\n";

   print "<SELECT NAME=\"show_appt\">\n";
   print "<OPTION ";
   print "SELECTED " if ( $show_appt eq "no" );
   print "VALUE=\"no\">Appointment: no\n";
   print "<OPTION ";
   print "SELECTED " if ( $show_appt eq "yes" );
   print "VALUE=\"yes\">Appointment: yes\n";
   print "</SELECT>\n";


   print "<INPUT TYPE=SUBMIT VALUE=\"Get Calendar\"> \n" ;
   print "<A HREF=\"help.html\" target=\"calendar\"><I><U><B>Help?</I></U></B></A>";
   print "</FONT>";
   print "</CENTER>";
   print "</form>\n" ;

} # form

#--------------------------------------------------------------------------
# Print the Footer
#--------------------------------------------------------------------------
sub footer {
   print <<"END";
END
   print "</HTML>";
} # footer

#--------------------------------------------------------------------------
# Main Function 
#--------------------------------------------------------------------------
sub main {

   ($sec,$min,$hour,$mday,$cur_month,$cur_year)=localtime(time);
   $cur_jour=$mday;
   $cur_month++;
   $cur_year+=1900;

   &ReadParse;

   if( $in{group} eq "" ) {
	$group="none";
   }
   else {
	$group=$in{group};
   }

   if ( $in{show_private} eq "" ) {
        $show_private="no";
   }
   else {
        $show_private=$in{show_private}
   }

   if ( $in{show_appt} eq "" ) {
        $show_appt="no";
   }
   else {
        $show_appt=$in{show_appt};
   }

   &header;
   &form;
   &footer;

} # main