1#! /usr/bin/perl 2 3# use diagnostics; 4 5 6# 7# define days in month 8# 9@days=(0,31,28,31,30,31,30,31,31,30,31,30,31 ); 10 11@month=("", "January", "February", "March", "April", "May", "June", 12 "July", "August", "September", "October", "November", "December" ); 13 14# 15# read html functions 16# 17require ("./cgi-lib.pl"); 18require ("./common.pl"); 19 20 21# Get Today's Date and remember it 22 23@timelist = localtime(time()); 24$Today_Month=$timelist[4]+1; 25$Today_Year =$timelist[5]+1900; 26$Today_Day =$timelist[3]; 27 28&ReadParse; 29 30if ( $in{month} eq "" ) { 31 $Month=$Today_Month; 32} else { 33 $Month=$in{month}; 34} 35if ( $in{years} eq "" ) { 36 $Year=$Today_Year; 37} else { 38 $Year=$in{years}; 39} 40 41if ( $in{group} eq "" ) { 42 $Group="none"; 43} else { 44 $Group=$in{group}; 45} 46 47if ( $in{jour} eq "" ) { 48 $Jour=0; 49} else { 50 $Jour=$in{jour}; 51} 52 53 if ( $in{show_private} eq "" ) { 54 $show_private="no"; 55 } 56 else { 57 $show_private=$in{show_private} 58 } 59 60 if ( $in{show_appt} eq "" ) { 61 $show_appt="no"; 62 } 63 else { 64 $show_appt=$in{show_appt}; 65 } 66 67 68# 69# read data from plan's output for the specified month and year 70# 71@PlanData=&get_plan_data($Jour,$Month,$Year,$Group); 72 73 74@PlanHoliday=&get_holiday($Year); 75 76# 77# we now have the data to display, we need to calculate the height of the calendar 78# in vertical, in order to have the same size in each days, and each 79# 80 81 82$height=0; 83$nbline=0; 84$date="1\.$Month\.$Year"; 85 86foreach $line (@PlanData) { 87 # split plan line in parts 88 @SplitLine=split(/\;/,$line); 89 90 # Filter on user Selected : none == ALL 91 # Can NOT ignore Entire Group entries == Team 92 if ( $SplitLine[4] ne Team ) { 93 # Filter Private Appointment 94 if ( $show_private eq "no" && substr($SplitLine[5],0,1) eq "." ) { 95 next; 96 } 97 98 # Filter Hourly Appointment 99 if ( $show_appt eq "no" && $SplitLine[2] ne "-" ) { 100 next; 101 } 102 } 103 104 # the date have day,date, format 105 @tmpdate=split(/,/,$SplitLine[1]); 106 107 $tmpdate[1]=~s/[ ]*//; 108 109 if ($tmpdate[1] == $date) { 110 $nbline++; 111 } else { 112 if ($nbline > $height) { 113 $height=$nbline; 114 } 115 $date=$tmpdate[1]; 116 $nbline=1; 117 } 118} 119 120 121print &PrintHeader; 122print &HtmlTop; 123 124if ( $Jour == 0 ) { 125 &month ($Month, $Year,"webmonth.cgi"); 126 &add_entry(0); 127} 128else { 129 &day ( $Jour, $Month, $Year ,"webmonth.cgi"); 130 &add_entry(1); 131} 132 133print &HtmlBot; 134