File: webmonth.cgi

package info (click to toggle)
plan 1.10.1-2
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 2,228 kB
  • ctags: 1,995
  • sloc: ansic: 25,050; perl: 1,361; sh: 1,003; makefile: 528; yacc: 121; sed: 17
file content (133 lines) | stat: -rwxr-xr-x 2,368 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
#! /usr/bin/perl

# use diagnostics;


#
# define days in month
#
@days=(0,31,28,31,30,31,30,31,31,30,31,30,31 );

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

#
#  read html functions
#
require ("./cgi-lib.pl");
require ("./common.pl");


# Get Today's Date and remember it

@timelist = localtime(time());
$Today_Month=$timelist[4]+1;
$Today_Year =$timelist[5]+1900;
$Today_Day  =$timelist[3];

&ReadParse;

if ( $in{month} eq "" ) {
	$Month=$Today_Month;
} else {
	$Month=$in{month};
}
if ( $in{years} eq "" ) {
	$Year=$Today_Year;
} else {
	$Year=$in{years};
}

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

if ( $in{jour} eq "" ) {
	$Jour=0;
} else {
	$Jour=$in{jour};
}

   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};
   }


#
# read data from plan's output for the specified month and year
#
@PlanData=&get_plan_data($Jour,$Month,$Year,$Group);


@PlanHoliday=&get_holiday($Year);

#
# we now have the data to display, we need to calculate the height of the calendar
# in vertical, in order to have the same size in each days, and each
#


$height=0;
$nbline=0;
$date="1\.$Month\.$Year";

foreach $line (@PlanData) {
    # split plan line in parts
    @SplitLine=split(/\;/,$line);

    # Filter on user Selected : none == ALL
    # Can NOT ignore Entire Group entries == Team
    if ( $SplitLine[4] ne Team ) {
    	# Filter Private Appointment
    	if ( $show_private eq "no" && substr($SplitLine[5],0,1) eq "." ) { 
		next;
    	}
	
    	# Filter Hourly Appointment
    	if ( $show_appt eq "no" && $SplitLine[2] ne "-" ) { 
		next;
    	}
    }

    # the date have day,date, format
    @tmpdate=split(/,/,$SplitLine[1]);

    $tmpdate[1]=~s/[ ]*//;    

    if ($tmpdate[1] == $date) {
       $nbline++;
    } else {
       if ($nbline > $height) {
          $height=$nbline;
       }
       $date=$tmpdate[1];
       $nbline=1;
    }
}


print &PrintHeader;
print &HtmlTop;

if ( $Jour == 0 ) {
	&month ($Month, $Year,"webmonth.cgi");
	&add_entry(0);
}
else {
	&day ( $Jour, $Month, $Year ,"webmonth.cgi");
	&add_entry(1);
}

print &HtmlBot;