"Fossies" - the Fresh Open Source Software Archive

Member "absence-v2.1/cgi-bin/findres" (10 Jul 2008, 1253 Bytes) of package /linux/www/web-absence-2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 
    3 use lib '/home/httpd/urban/www.unix-wissen.de/cgi-bin';
    4 
    5 use AbsenceImage;
    6 use AbsenceDB;
    7 
    8 ($month, $year, $x, $y) = @ARGV;
    9 
   10 # 1/2003?415,16
   11 print "month [$month], year [$year], x [$x], y [$y] hehe <BR>\n";
   12 
   13 @result = AbsenceImage::findAbsence($month, $year, $x, $y);
   14 
   15 
   16 #-----------------------------------------
   17 $key = $result[0];
   18 if ($key eq 'none') {
   19     print "can't do anything.<BR>\n";
   20     print "You must click on a person row.<BR>\n";
   21 } elsif ($key eq 'absence') {
   22     $id = $result[1];
   23     $res = AbsenceDB::getReservation($id);
   24     if (!defined($res)) {
   25         print "shit.  reservation id [$id] not found.<BR>\n";
   26     } else {
   27         $pid = $res->{person_id};
   28         # getPerson retuns name in scalar context
   29         $person = AbsenceDB::getPerson($pid);
   30         $type = $res->{type};
   31         print "Absence for [$person]. Type=[$type]<BR>\n";
   32     }
   33 } elsif ($key eq 'holiday') {
   34     $href = $result[1];
   35     $hol = $href->[3];
   36     print "holiday: $hol<BR>\n";
   37 } elsif ($key eq 'start') {
   38     $sref = $result[1];
   39     $pid = $sref->[0];
   40     $person = AbsenceDB::getPerson($pid);
   41     $start = "$sref->[1]/$sref->[2]/$sref->[3]";
   42     print "Add an absence for [$person] starting on $start.<BR>\n";
   43 } else {
   44     print "findAbsence error. returned: [@result]<BR>\n";
   45 }
   46 #-----------------------------------------