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
4afdcf86
Commit
4afdcf86
authored
Jan 31, 2006
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- some changes on forums (don't know anymore)
- Added parameters to timesheet2 to force logging of hours
parent
991b02dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
9 deletions
+71
-9
intranet-timesheet2-procs.tcl
tcl/intranet-timesheet2-procs.tcl
+65
-9
index.adp
www/hours/index.adp
+6
-0
No files found.
tcl/intranet-timesheet2-procs.tcl
View file @
4afdcf86
...
...
@@ -20,6 +20,26 @@ ad_library {
@author frank.bergmann@project-open.com
}
# ---------------------------------------------------------------------
#
# ---------------------------------------------------------------------
ad_proc -public im_package_timesheet2_id
{}
{
Returns the package id of the intranet-timesheet2 package
}
{
return
[
util_memoize
"im_package_timesheet2_id_helper"
]
}
ad_proc -private im_package_timesheet2_id_helper
{}
{
return
[
db_string im_package_core_id
{
select package_id from apm_packages
where package_key = 'intranet-timesheet2'
}
-default 0
]
}
# ---------------------------------------------------------------------
# Analyze logged hours
# ---------------------------------------------------------------------
...
...
@@ -28,26 +48,43 @@ ad_proc -public im_timesheet_home_component {user_id} {
Creates a HTML table showing a box with basic statistics about
the current project and a link to log the users hours.
}
{
set add_hours
[
im_permission
$user
_id
"add_hours"
]
# skip the entire component if the user doesn't have
# the permission to log hours
set add_hours
[
im_permission
$user
_id
"add_hours"
]
if
{
!$add_hours
}
{
return
""
}
set add_absences
[
im_permission
$user
_id
"add_absences"
]
set view_hours_all
[
im_permission
$user
_id view_hours_all
]
if
{
!$add_hours && !$add_absences && !$view_hours_all
}
{
return
""
}
# Get the number of hours in the number of days, and whether
# we should redirect if the user didn't log them...
#
set redirect_p
[
parameter::get -package_id
[
im_package_timesheet2_id
]
-parameter
"TimesheetRedirectHomeIfEmptyHoursP"
-default 0
]
set num_days
[
parameter::get -package_id
[
im_package_timesheet2_id
]
-parameter
"TimesheetRedirectNumDays"
-default 7
]
set expected_hours
[
parameter::get -package_id
[
im_package_timesheet2_id
]
-parameter
"TimesheetRedirectNumHoursInDays"
-default 32
]
set hours_html
""
if
{
[
catch
{
set num_hours
[
hours_sum_for_user
$user
_id
""
7
]
set num_hours
[
hours_sum_for_user
$user
_id
""
$num
_days
]
}
err_msg
]
}
{
set num_hours 0
}
if
{
$num
_hours == 0 &&
$add
_hours
}
{
if
{
$num
_hours <
$expected
_hours &&
$add
_hours
}
{
if
{
$redirect
_p
}
{
set default_message
"
You have logged %num_hours% hours in the last %num_days% days.
However, you are expected to log atleast %expected_hours% hours
or an equivalent amount of absences.
Please log your hours now or consult with your supervisor."
set header
[
lang::message::lookup
""
intranet-timesheet2.Please_Log_Your_Hours
"Please Log Your Hours"
]
set message
[
lang::message::lookup
""
intranet-timesheet2.You_need_to_log_hours
$default
_message
]
ad_returnredirect
[
export_vars -base
"/intranet-timesheet2/hours/index"
{
header message
}]
}
set log_them_now_link
"<a href=/intranet-timesheet2/hours/index>"
append hours_html
"<b>
[
_ intranet-timesheet2.lt_You_havent_logged_you
]
</a></b>
\n
"
}
else
{
...
...
@@ -100,11 +137,12 @@ ad_proc -public im_timesheet_project_component {user_id project_id} {
the current project and a link to log the users hours.
}
{
im_project_permissions
$user
_id
$project
_id view read write admin
if
{
!
[
info
exists return_url
]
}
{
set return_url
"
[
ad_conn url
]
?
[
ad_conn query
]
"
}
set add_hours
[
im_permission
$user
_id
"add_hours"
]
set hours_logged
"<ul>"
set info_html
""
...
...
@@ -119,10 +157,7 @@ ad_proc -public im_timesheet_project_component {user_id project_id} {
[
_ intranet-timesheet2.lt_See_the_breakdown_by_
]
</a>
\n
"
}
append hours_logged
"<li><a href=
\"
/intranet-timesheet2/weekly_report?project_id=
$project
_id
\"
>
[
_ intranet-timesheet2.lt_View_hours_logged_by_
]
</a>"
}
...
...
@@ -130,6 +165,27 @@ ad_proc -public im_timesheet_project_component {user_id project_id} {
set total_hours_str
"
[
hours_sum_for_user
$user
_id
$project
_id
]
"
append info_html
"<br>
[
_ intranet-timesheet2.lt_You_have_loged_total_
]
.
\n
"
set hours_today
[
hours_sum_for_user
$user
_id
""
1
]
# Get the number of hours in the number of days, and whether
# we should redirect if the user didn't log them...
#
set redirect_p
[
parameter::get -package_id
[
im_package_timesheet2_id
]
-parameter
"TimesheetRedirectProjectIfEmptyHoursP"
-default 0
]
set num_days
[
parameter::get -package_id
[
im_package_timesheet2_id
]
-parameter
"TimesheetRedirectNumDays"
-default 7
]
set expected_hours
[
parameter::get -package_id
[
im_package_timesheet2_id
]
-parameter
"TimesheetRedirectNumHoursInDays"
-default 32
]
set num_hours
[
hours_sum_for_user
$user
_id
""
$num
_days
]
if
{
$redirect
_p &&
$num
_hours <
$expected
_hours &&
$add
_hours
}
{
set default_message
"
You have logged %num_hours% hours in the last %num_days% days.
However, you are expected to log atleast %expected_hours% hours
or an equivalent amount of absences.
Please log your hours now or consult with your supervisor."
set header
[
lang::message::lookup
""
intranet-timesheet2.Please_Log_Your_Hours
"Please Log Your Hours"
]
set message
[
lang::message::lookup
""
intranet-timesheet2.You_need_to_log_hours
$default
_message
]
ad_returnredirect
[
export_vars -base
"/intranet-timesheet2/hours/index"
{
header message
}]
}
if
{
$hours
_today == 0
}
{
set log_hours_link
"<a href=/intranet-timesheet2/hours/new?project_id=
$project
_id&
[
export_url_vars return_url
]
>"
append hours_logged
"<li><font color=
\"\#
FF0000
\"
>
[
_ intranet-timesheet2.lt_Today_you_didnt_log_y
]
</font>
[
_ intranet-timesheet2.lt_Log_your_log_hours_li
]
</a>
\n
"
...
...
www/hours/index.adp
View file @
4afdcf86
...
...
@@ -5,9 +5,15 @@
<if "" ne @message@>
<h1>@header@</h1>
<table width="70%">
<tr><td>
<div class="form-error">
@message@
</div>
</tr></td>
</table>
<p>
</if>
...
...
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