Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-timesheet2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-timesheet2
Commits
0712e068
Commit
0712e068
authored
Apr 19, 2024
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TS calendar: Bank holidays now grey
parent
c440331b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
30 deletions
+42
-30
intranet-calendar-procs.tcl
tcl/intranet-calendar-procs.tcl
+13
-29
index.tcl
www/hours/index.tcl
+29
-1
No files found.
tcl/intranet-calendar-procs.tcl
View file @
0712e068
...
...
@@ -142,7 +142,9 @@ ad_proc calendar_basic_month {
-next_month_template
""
-prev_month_template
""
-prev_next_links_in_title 0
-fill_all_days 0
}
-fill_all_days 0
-grey_cell_list
{}
}
}
"
Returns a calendar for a specific month, with details supplied
by Julian date. Defaults to this month.
...
...
@@ -151,7 +153,6 @@ ad_proc calendar_basic_month {
the day, and the value is a string (possibly with HTML formatting) that
represents the details.
"
{
set start_day
[
parameter::get -package_id
[
apm_package_id_from_key intranet-timesheet2
]
-parameter
"WeekStartDay"
-default 0
]
calendar_get_info_from_db
$date
...
...
@@ -162,8 +163,6 @@ ad_proc calendar_basic_month {
}
set day_of_week
$first
_day_of_month
set julian_date
$first
_julian_date
set month_heading
[
format
"%s %s"
[
_ intranet-timesheet2.$month
]
$year
]
...
...
@@ -208,20 +207,11 @@ ad_proc calendar_basic_month {
}
append output
"</tr>"
# KH: Following code would produce an unnecessary, ugly row
# Tested various configurations, in none of them this snippet produces valuable output
# if
{
$fill
_all_days == 0
}
{
# for
{
set n 1
}
{
$n
<
$first
_day_of_month
}
{
incr n
}
{
# append output
"<td id='empty_bg' bgcolor=
$empty
_bgcolor align=right valign=top></td>"
#
}
#
}
set day_of_week 1
set julian_date
$first
_julian_date
set day_number
$first
_day
while
{
1
}
{
if
{
$julian
_date <
$first
_julian_date_of_month
}
{
set before_month_p 1
set after_month_p 0
...
...
@@ -237,7 +227,7 @@ ad_proc calendar_basic_month {
set day_number 1
}
else
if
{
$julian
_date >
$last
_julian_date
}
{
break
}
else
if
{
$julian
_date ==
[
expr
{
$last
_julian_date_in_month +1
}
]}
{
}
else
if
{
$julian
_date ==
[
expr
$last
_julian_date_in_month + 1
]}
{
set day_number 1
}
...
...
@@ -254,21 +244,23 @@ ad_proc calendar_basic_month {
append output
"
[
subst
$day
_number_template
]
"
}
}
else
{
# We are within the normal day of the month.
set day_ansi
[
calendar_convert_julian_to_ansi
$julian
_date
]
# ns_log Notice
"calendar_basic_month: '
$todays
_date', '
$day
_ansi'"
# Set BG color for weekend
set weekend
""
if
{
"1"
==
$start
_day
}
{
if
{
"6"
==
$day
_of_week ||
"7"
==
$day
_of_week
}
{
set weekend
"_weekend"
}
}
else
{
if
{
"1"
==
$day
_of_week ||
"7"
==
$day
_of_week
}
{
set weekend
"_weekend"
}
}
# Should we show the day in grey for weekend? That's for bank holidays
if
{
$julian
_date in
$grey
_cell_list
}
{
set weekend
"_weekend"
}
if
{
$todays
_date eq
$day
_ansi
}
{
append output
"<td class='todays_date
$weekend
' bgcolor=#6699CC align=right valign=top>
[
subst
$day
_number_template
]
"
}
else
{
...
...
@@ -276,22 +268,15 @@ ad_proc calendar_basic_month {
}
}
if
{
(
!
$skip
_day
)
&&
$large
_calendar_p == 1
}
{
if
{
(
!$skip_day
)
&&
$large
_calendar_p == 1
}
{
append output
"<div class='link_log_hours' align=left>"
set calendar_day_index
[
ns_set find
$calendar
_details
$julian
_date
]
while
{
$calendar
_day_index >= 0
}
{
set calendar_day
[
ns_set value
$calendar
_details
$calendar
_day_index
]
ns_set delete
$calendar
_details
$calendar
_day_index
ns_set delete
$calendar
_details
$calendar
_day_index
append output
"
$calendar
_day"
set calendar_day_index
[
ns_set find
$calendar
_details
$julian
_date
]
}
set calendar_day_index
[
ns_set find
$calendar
_details
$julian
_date
]
}
append output
"</div>"
}
...
...
@@ -318,7 +303,6 @@ ad_proc calendar_basic_month {
append output
"</table>"
return
$output
}
ad_proc calendar_small_month
{
{
...
...
www/hours/index.tcl
View file @
0712e068
...
...
@@ -567,6 +567,32 @@ for {set current_date $first_julian_date} {$current_date <= $last_julian_date} {
set timesheet_entry_blocked_p 0
}
# ---------------------------------------------------------------
# Check bank holidays for the month
# ---------------------------------------------------------------
set bank_holiday_sql "
select ua.*,
to_char
(
ua.start_date, 'J'
)
as start_date_julian,
to_char
(
ua.end_date, 'J'
)
as end_date_julian
from im_user_absences ua
where ua.absence_type_id in
([
join
[
im_sub_categories -include_disabled_p 1
[
im_user_absence_type_bank_holiday
]]
","
])
and
ua.start_date::date <= :last_day_of_month_ansi::date and
ua.end_date::date >= :first_day_of_month_ansi::date
"
# ad_return_complaint 1
[
im_ad_hoc_query -format html
$bank
_holiday_sql
]
set grey_cell_list
[
list
]
db_foreach bank_holidays
$bank
_holiday_sql {
for {set j
$start
_date_julian} {
$j
<=
$end
_date_julian} {incr j} {
lappend grey_cell_list
$j
}
}
# ---------------------------------------------------------------
# Render the calendar
# ---------------------------------------------------------------
set prev_month_template "
<font color=white><
;
</font>
<a href=
\"
[
export_vars -base index
{
user_id_from_search
}]
&date=
\$
ansi_date
\"
>
...
...
@@ -590,7 +616,9 @@ set page_body [calendar_basic_month \
-date
$date
\
-prev_next_links_in_title 1
\
-fill_all_days
$fill
_up_first_last_row_p
\
-empty_bgcolor
"
\#
cccccc"
]
-empty_bgcolor
"
\#
cccccc"
\
-grey_cell_list
$grey
_cell_list
\
]
# ---------------------------------------------------------------
# Render the Calendar widget
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment