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
ece00a8a
Commit
ece00a8a
authored
Apr 18, 2024
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Arrow buttons now wrap around weekends
parent
be8e7b0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
new.tcl
www/hours/new.tcl
+29
-5
No files found.
www/hours/new.tcl
View file @
ece00a8a
...
...
@@ -102,6 +102,7 @@ im_security_alert_check_integer -location "/intranet-timesheet2/www/hours/new" -
# Get the date. Accept a gregorian or julian format. Use today as default.
if
{
$gregorian
_date ne
""
}
{
set julian_date
[
db_string sysdate_as_julian
"select to_char(:gregorian_date::date, 'J')"
]
}
if
{
$julian
_date eq
""
}
{
set julian_date
[
db_string sysdate_as_julian
"select to_char(sysdate,'J') from dual"
]
}
# set iso_date [db_string iso_date "select to_date(:julian_date, 'J'
)
::date
"]
if {"" ==
$return
_url} { set return_url
[
export_vars -base
"/intranet-timesheet2/hours/index"
{
julian_date user_id_from_search
}]
}
...
...
@@ -235,6 +236,8 @@ where user_id = :user_id_from_search"
set pretty_date
[
lc_time_fmt
$datetime
"%Q"
]
# ---------------------------------------------------------
# Calculate the <- -> buttons at the top of the timesheet page.
# ---------------------------------------------------------
...
...
@@ -244,8 +247,8 @@ set right_gif [im_gif arrow_comp_right]
if {
$show
_week_p} {
# Showing an entire week - advance by 7 days
set page_title
[
lang::message::lookup
""
intranet-timesheet2.The_week_for_user
"The week for %user_name_from_search%"
]
set prev_week_julian_date
[
expr
{
$julian
_date - 7
}]
set prev_week_url
[
export_vars -base
"new"
{{
julian_date
$prev
_week_julian_date
}
user_id_from_search return_url project_id show_week_p
}]
set prev_week_link "
<a href=$prev_week_url>$left_gif</a>
"
...
...
@@ -264,14 +267,35 @@ if {$show_week_p} {
} else {
# Showing just a single day - advance by 1 day
set page_title "
[
lang::message::lookup
""
intranet-timesheet2.Date_for_user
"%pretty_date% for %user_name_from_search%"
]
"
set prev_day_julian_date
[
expr
{
$julian
_date - 1
}]
set prev_day_url
[
export_vars -base
"new"
{{
julian_date
$prev
_day_julian_date
}
user_id_from_search project_id show_week_p
}]
# Previous day arrow
set prev_day_julian
$julian
_date
set maxcount 7
ns_log Notice "
hours/new: julian_date=$julian_date
"
while {
$maxcount
> 0} {
incr maxcount -1
set prev_day_julian
[
expr
$prev
_day_julian - 1
]
set prev_day_dow
[
expr
[
db_string dow
"select to_char(to_date(:prev_day_julian, 'J'), 'D')"
]
- 1
]
; # 0=Sun, 1=Mon, 2=Tue, 3=Wed, 4=Thu, 5=Fri, 6=Sam
ns_log Notice "
hours/new: maxcount=$maxcount, prev_day_julian=$prev_day_julian, prev_day_dow=$prev_day_dow, weekly_logging_days=$weekly_logging_days
"
if {
[
string
first
$prev
_day_dow
$weekly
_logging_days
]
>= 0} { break }; # Break if day is supported
}
set prev_day_url
[
export_vars -base
"new"
{{
julian_date
$prev
_day_julian
}
user_id_from_search project_id show_week_p
}]
set prev_day_link "
<a href=$prev_day_url>$left_gif</a>
"
set next_day_julian_date
[
expr
{
$julian
_date + 1
}]
set next_day_url
[
export_vars -base
"new"
{{
julian_date
$next
_day_julian_date
}
user_id_from_search project_id show_week_p
}]
# Next day arrow
set next_day_julian
$julian
_date
set maxcount 7
ns_log Notice "
hours/new: julian_date=$julian_date
"
while {
$maxcount
> 0} {
incr maxcount -1
set next_day_julian
[
expr
$next
_day_julian + 1
]
set next_day_dow
[
expr
[
db_string dow
"select to_char(to_date(:next_day_julian, 'J'), 'D')"
]
- 1
]
; # 0=Sun, 1=Mon, 2=Tue, 3=Wed, 4=Thu, 5=Fri, 6=Sam
ns_log Notice "
hours/new: maxcount=$maxcount, next_day_julian=$next_day_julian, next_day_dow=$next_day_dow, weekly_logging_days=$weekly_logging_days
"
if {
[
string
first
$next
_day_dow
$weekly
_logging_days
]
>= 0} { break }; # Break if day is supported
}
set next_day_url
[
export_vars -base
"new"
{{
julian_date
$next
_day_julian
}
user_id_from_search project_id show_week_p
}]
set next_day_link "
<a href=$next_day_url>$right_gif</a>
"
set forward_backward_buttons "
...
...
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