#!/usr/bin/perl ############################################################################## # Nigel Hamilton # # Copyright Nigel Hamilton 2005 # All Rights Reserved # # Author: Nigel Hamilton # Filename: tasklist.pl # Description: Show a list of tasks # # Date Change # ----------------------------------------------------------------------------- # 24/10/2005 Version 1 # ############################################################################### use strict; use lib '/home/search/shared/bin'; use lib '/home/search/trexy/bin'; use CGIScript; use GooDatabase; use TabHeaderWidget; my $cgi = CGIScript->new(); my $company = $cgi->{company} || "trexy"; my $list = getList($company); print <
$list
HTML ############################################################################### # # getList - return the a list of each task # ############################################################################### sub getList { my ($company) = @_; $company = lc($company); my $query = GooDatabase::executeSQL(<new(); if ($cgi->{company} eq "trexy") { $thw->addTab("Trexy Tasks", "", "#3EAA54"); } else { $thw->addTab("Trexy Tasks", "window.location='./tasklist.pl?company=trexy'"); } if ($cgi->{company} eq "turbo10") { $thw->addTab("Turbo10 Tasks", "", "#330066"); } else { $thw->addTab("Turbo10 Tasks", "window.location='./tasklist.pl?company=turbo10'"); } $thw->addTab("Trexy Bugs", "window.location='./buglist.pl?company=trexy'"); $thw->addTab("Turbo10 Bugs", "window.location='./buglist.pl?company=turbo10'"); $thw->addTab("Add New Task", "window.location='edittask.pl?company=$company'"); my $tabs = $thw->getContents(); my $list = < Importance Status Task Requested by Date Requested Finished by Date Finished TaskID TABLE while (my $row = GooDatabase::getResultHash($query)) { my $date_requested = conv_date($row->{requestedon}); my $date_finished = conv_date($row->{finishedon}); my $style = style($row->{status}); my $link = style_link($row->{status}); $list .= < $row->{importance} $row->{status} $row->{title} $row->{requestedby} $date_requested $row->{finishedby} $date_finished $row->{taskid} ROW } return $list .= ""; } sub conv_date { my $date = shift; $date =~ s/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d:\d\d:\d\d)/$3-$2-$1/; return $date; } sub style { my $state = shift; my $color; if ($state eq "finished"){ $color = 'style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; color: #AFAFAF;"'; } else { $color = 'style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; color: #000000;"'; } return $color; } sub style_link { my $state = shift; my $color; if ($state eq "finished"){ $color = 'style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; color: #AAABFF;"'; } else { $color = 'style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: normal; color: #0002FB;"'; } return $color; } __END__ =head1 NAME tasklist.pl - Show a list of tasks =head1 SYNOPSIS tasklist.pl =head1 DESCRIPTION =head1 METHODS =over =item getList return the a list of each task =back =head1 AUTHOR Nigel Hamilton =head1 SEE ALSO