Update of /cvsroot/wtf-tracker/wtf/lib/WTF/Pages
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv25900/lib/WTF/Pages
Modified Files:
Admin.pm Input.pm
Log Message:
Patch to implement feature request 1618514: Colored Dates in Timesheet Dropdown
Index: Admin.pm
===================================================================
RCS file: /cvsroot/wtf-tracker/wtf/lib/WTF/Pages/Admin.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Admin.pm 6 Dec 2006 16:09:34 -0000 1.7
--- Admin.pm 21 Dec 2006 19:33:54 -0000 1.8
***************
*** 349,353 ****
$table ||= DATA_TABLES->[0];
! # for the table name, execute the prepare_cached query for table data and
# return all its data into $table_data
my $sql_sth = 'table_data_' . $table->{'table'};
--- 349,353 ----
$table ||= DATA_TABLES->[0];
! # for the table name, execute the prepared query for table data and
# return all its data into $table_data
my $sql_sth = 'table_data_' . $table->{'table'};
Index: Input.pm
===================================================================
RCS file: /cvsroot/wtf-tracker/wtf/lib/WTF/Pages/Input.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Input.pm 21 Dec 2006 16:36:04 -0000 1.11
--- Input.pm 21 Dec 2006 19:33:54 -0000 1.12
***************
*** 99,102 ****
--- 99,104 ----
my ( $time, $weeks, $req, @dates ) = ( time, 0, WTF::Utils::get_req($r) );
+ # setup @dates to contain data that will populate the date select
+ # drop-down control on the tracking form
while ( ( not @dates ) or ( $weeks < 2 ) ) {
my @date = ( localtime($time) )[3 .. 6];
***************
*** 121,124 ****
--- 123,146 ----
}
+ # for the days within the range of days that the date select drop-down
+ # list will display, make a list of the days for which the current user
+ # has entered some kind of data
+ $sth->{'work_days_in_range'}->execute(
+ $r->pnotes('user_id'), $dates[-1]->{'value'}, $dates[0]->{'value'},
+ $r->pnotes('user_id'), $dates[-1]->{'value'}, $dates[0]->{'value'},
+ $r->pnotes('user_id'), $dates[-1]->{'value'}, $dates[0]->{'value'},
+ ) or die $dbh->errstr();
+ my @work_days = map { $_->[0] } @{ $sth->{'work_days_in_range'}->fetchall_arrayref() };
+ $sth->{'work_days_in_range'}->finish();
+
+ # for each day that will be listed in the date select drop-down list,
+ # include a "has_data" attribute indicating whether the current user has
+ # already entered data for that day
+ for my $date (@dates) {
+ $date->{'has_data'} = (
+ scalar( grep { $_ eq $date->{'value'} } @work_days ) > 0
+ ) ? 1 : 0;
+ }
+
# set $display_date to be what the user selected in the date select
# drop-down field; set $data_date to be the same thing, but we might
***************
*** 134,138 ****
$r->pnotes('user_id'), $display_date,
$r->pnotes('user_id'), $display_date,
! );
$data_date = $sth->{'max_work_day'}->fetchrow_array() || $display_date;
$sth->{'max_work_day'}->finish();
--- 156,160 ----
$r->pnotes('user_id'), $display_date,
$r->pnotes('user_id'), $display_date,
! ) or die $dbh->errstr();
$data_date = $sth->{'max_work_day'}->fetchrow_array() || $display_date;
$sth->{'max_work_day'}->finish();
|