Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-ganttproject
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
0
Merge Requests
0
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-ganttproject
Commits
6e40933d
Commit
6e40933d
authored
Apr 03, 2006
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Implemented Resource storage
parent
c1f58ce1
Pipeline
#285
failed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
179 additions
and
74 deletions
+179
-74
intranet-ganttproject-create.sql
sql/postgresql/intranet-ganttproject-create.sql
+1
-1
intranet-ganttproject-procs.tcl
tcl/intranet-ganttproject-procs.tcl
+138
-44
gantt-upload-2.tcl
www/gantt-upload-2.tcl
+40
-29
No files found.
sql/postgresql/intranet-ganttproject-create.sql
View file @
6e40933d
...
...
@@ -35,6 +35,6 @@ SELECT im_component_plugin__new (
'/intranet/projects/view'
,
-- page_url
null
,
-- view_name
-
10
,
-- sort_order
'im_table_with_title [lang::message::lookup "" intranet-ganttproject.Scheduling "Scheduling
(Experimental)
"] [im_ganttproject_component -project_id $project_id -current_page_url $current_url -return_url $return_url -export_var_list [list project_id]]'
'im_table_with_title [lang::message::lookup "" intranet-ganttproject.Scheduling "Scheduling
<font color=red>(Beta Code. Please use with care)</font>
"] [im_ganttproject_component -project_id $project_id -current_page_url $current_url -return_url $return_url -export_var_list [list project_id]]'
);
tcl/intranet-ganttproject-procs.tcl
View file @
6e40933d
...
...
@@ -140,6 +140,16 @@ ad_proc -public im_ganttproject_component {
</table>
</form>
</td>
<tr><td colspan=2 class=small>
Warning: Don't modify the project structure
while the project is being executed. Changes
may lead to deleted timesheet hours, cost
items and others. Please read the manual and/or
request more information.<br>
You need to install <a href='http://prdownloads.sourceforge.net/ganttproject/ganttproject-2.0.exe?download'>GanttProject</a> on your computer.
</td></tr>
</table>
"
}
...
...
@@ -305,10 +315,7 @@ ad_proc -public im_gp_extract_xml_tree2 {
set cust_value
[
$taskchild
getAttribute value
""
]
switch
$cust
_key
{
tpc0
{
set task_nr
$cust
_value
}
tpc1
{
set task_id
$cust
_value
if
{[
info
exists task_hash
(
$task
_id
)]}
{
set task_id
$task
_hash
(
$task
_id
)
}
}
tpc1
{
set po_task_id
$cust
_value
}
}
}
task
{
...
...
@@ -318,6 +325,17 @@ ad_proc -public im_gp_extract_xml_tree2 {
}
}
# Which ID to choose?
# If there is a mapping from GP to PO ids
then
trust that mapping
# Otherwise take the PO id from the XML
#
if
{[
info
exists task_hash
(
$gantt
_id
)]}
{
set task_id
$task
_hash
(
$gantt
_id
)
}
else
{
set task_id
$po
_task_id
}
# Return single value or list.
if
{
0 ==
[
llength
$task
_children
]}
{
return
$task
_id
}
else
{
...
...
@@ -327,8 +345,6 @@ ad_proc -public im_gp_extract_xml_tree2 {
# ---------------------------------------------------------------
# Procedure: Dependency
# ---------------------------------------------------------------
...
...
@@ -356,7 +372,7 @@ ad_proc -public im_ganttproject_create_dependency { depend_node task_node task_h
if
{[
info
exists task_hash
(
$task
_id_one
)]}
{
set task_id_one
$task
_hash
(
$task
_id_one
)
}
if
{[
info
exists task_hash
(
$task
_id_two
)]}
{
set task_id_two
$task
_hash
(
$task
_id_two
)
}
ns_write
"<li>im_ganttproject_create_dependency(
$org
_task_id_one =>
$task
_id_one,
$org
_task_id_two =>
$task
_id_two,
$depend
_type,
$hardness
)
\n
"
#
ns_write "<li>im_ganttproject_create_dependency($org_task_id_one =>
;
$task
_id_one,
$org
_task_id_two =>
;
$task
_id_two,
$depend
_type,
$hardness
)
\n
"
# ----------------------------------------------------------
# Check if the two task_ids exist
...
...
@@ -452,7 +468,6 @@ ad_proc -public im_gp_save_tasks {
}
# Go through sub-tasks
ns_write
"<h2>Saving Tasks</h2><ul>
\n
"
foreach task_child
[
$child
childNodes
]
{
incr sort_order
if
{
"task"
==
[
$task
_child nodeName
]}
{
...
...
@@ -548,7 +563,7 @@ ad_proc -public im_gp_save_tasks2 {
set cost_center_id ""
set material_id
[
im_material_default_material_id
]
ns_write "
<li>
im_gp_save_tasks2: gp_id='$gantt_project_id', task_id='$task_id', task_nr='$task_nr', super_project_id:
$org
_super_project_id =>
;
$super
_project_id
"
ns_write "
<li>
GanttProject:
$task
_nr: '$gantt_project_id' =>
;
task_id='$task_id'
"
# Set some default variables for new project
...
...
@@ -617,38 +632,56 @@ ad_proc -public im_gp_save_tasks2 {
if {0 !=
$existing
_project_id} {
set task_hash(
$gantt
_project_id)
$existing
_project_id
ns_write "
<li>im_gp_save_tasks2: found project_id=$existing_project_id for project with project_nr=$task_nr
"
#
ns_write "
<li>im_gp_save_tasks2: found project_id=$existing_project_id for project with project_nr=$task_nr
"
set task_id
$existing
_project_id
set project_exists_p 1
}
# Check the cases that the "
task
" has changed its type
set cur_object_type
[
db_string cur_object_type
"select object_type from acs_objects where object_id = :task_id"
-default
""
]
# -----------------------------------------------------
# Now we have several cases:
# Inconsistency handling:
# Both a project and a task exist
- This is an
#
error, caused by giving a project and a task the
#
same task_nr
# Both a project and a task exist
.
#
This error occurs during "
demotion
"
#
if {
$task
_exists_p &&
$project
_exists_p} {
ad_return_complaint 1 "
Not implemented yet: Both a project and a task exist with task_nr=$task_nr.
"
#
ad_return_complaint 1 "
Not implemented yet: Both a project and a task exist with task_nr=$task_nr.
"
}
# Now the check the cases that the "
task
" has changed its type
set cur_object_type
[
db_string cur_object_type
"select object_type from acs_objects where object_id = :task_id"
-default
""
]
# -----------------------------------------------------
# Needs to be "
demoted
" from project to task
if {!
$has
_subobjects_p &&
[
string
equal
"im_project"
$cur
_object_type
]
} {
ns_write "
<li>im_gp_save_tasks2: <font color=red>Demote</font> project#
$task
_id to a task
"
# Nuke the old project
im_project_nuke
$task
_id
# Set the task_id to 0 to initiate project creation further below.
set task_id 0
}
# -----------------------------------------------------
# Needs to be "
promoted
" from task to project
if {
$has
_subobjects_p &&
[
string
equal
"im_timesheet_task"
$cur
_object_type
]
} {
ad_return_complaint 1 "
Promotion from Task to Project is not implemented yet:<br>
<li>Name =
$task
_name
<li>Nr =
$task
_nr
<li>ID =
$task
_id
"
return
[
array
get task_hash
]
ns_write "
<li>im_gp_save_tasks2: <font color=red>Promote</font> task#
$task
_id to a project
"
# Nuke the old task
im_timesheet_task_nuke
$task
_id
# Set the task_id to 0 to initiate project creation further below.
set task_id 0
}
# -----------------------------------------------------
# Needs to be "
demoted
" from project to task
#
# Does a project really needs to be "
demoted
" to a task?
...
...
@@ -672,26 +705,28 @@ ad_proc -public im_gp_save_tasks2 {
if {!
$has
_subobjects_p} {
if {0 ==
$task
_id || !
$task
_exists_p} {
ns_write "
<li>Creating new task nr=$task_nr
"
set task_id
[
db_string task_insert
"
select im_timesheet_task__new (
null, -- p_task_id
'im_timesheet_task', -- object_type
now(), -- creation_date
null, -- creation_user
null, -- creation_ip
null, -- context_id
:task_nr,
:task_name,
:super_project_id,
:material_id,
:cost_center_id,
:uom_id,
:task_type_id,
:task_status_id,
:description
)
"
]
ns_write "
<li>im_gp_save_tasks2: Creating new task: nr=$task_nr, name=$task_name, super_project=$super_project_id
"
set task_id
[
im_exec_dml task_insert
"
im_timesheet_task__new (
null, -- p_task_id
'im_timesheet_task', -- object_type
now(), -- creation_date
null, -- creation_user
null, -- creation_ip
null, -- context_id
:task_nr,
:task_name,
:super_project_id,
:material_id,
:cost_center_id,
:uom_id,
:task_type_id,
:task_status_id,
:description
)"
]
ns_write "
<li>im_gp_save_tasks2: Creating new task: gp_id=$gantt_project_id =>
;
$task
_id
"
set task_hash(
$gantt
_project_id)
$task
_id
}
}
...
...
@@ -815,15 +850,21 @@ ad_proc -public im_gp_save_tasks2 {
# ----------------------------------------------------------------------
# Allocations
#
# Assigns users with a percentage to a task.
# Also addes the user to sub-projects if they are assigned to
# sub-tasks of a sub-project.
# ----------------------------------------------------------------------
ad_proc -public im_gp_save_allocations
{
childNodes
allocations_node
task_hash_array
resource_hash_array
}
{
Saves allocation information from GanttProject
}
{
array set task_hash
$task
_hash_array
array set resource_hash
$resource
_hash_array
foreach child
[
$allocations
_node childNodes
]
{
switch
[
$child
nodeName
]
{
...
...
@@ -831,6 +872,8 @@ ad_proc -public im_gp_save_allocations {
set task_id
[
$child
getAttribute task-id
""
]
if
{[
info
exists task_hash
(
$task
_id
)]}
{
set task_id
$task
_hash
(
$task
_id
)
}
set resource_id
[
$child
getAttribute resource-id
""
]
if
{[
info
exists resource_hash
(
$resource
_id
)]}
{
set resource_id
$resource
_hash
(
$resource
_id
)
}
set function
[
$child
getAttribute function
""
]
set responsible
[
$child
getAttribute responsible
""
]
set percentage
[
$child
getAttribute load
"0"
]
...
...
@@ -858,7 +901,13 @@ ad_proc -public im_gp_save_allocations {
where task_id = :task_id
and user_id = :resource_id
"
ns_write
"<li>
[
ns_quotehtml
[
$child
asXML
]]
"
ns_write
"<li>Allocation: User#
$resource
_id allocated to task#
$task
_id with
$percentage
%
\n
"
ns_log Notice
"im_gp_save_allocations:
[
$child
asXML
]
"
set project_id
[
db_string project_id
"select project_id from im_timesheet_tasks where task_id = :task_id"
]
# Check if the resource is already member of the project
im_biz_object_add_role
$resource
_id
$project
_id
[
im_biz_object_role_full_member
]
}
default
{
}
}
...
...
@@ -866,3 +915,48 @@ ad_proc -public im_gp_save_allocations {
}
# ----------------------------------------------------------------------
# Resources
#
# <resource id="8869" name="Andrew Accounting" function="Default:0" contacts="aac@asdf.com... />
#
# ----------------------------------------------------------------------
ad_proc -public im_gp_save_resources
{
resources_node
}
{
Saves resource information from GanttProject
}
{
foreach child
[
$resources
_node childNodes
]
{
switch
[
$child
nodeName
]
{
"resource"
{
set resource_id
[
$child
getAttribute id
""
]
set name
[
$child
getAttribute name
""
]
set function
[
$child
getAttribute function
""
]
set person_id
[
db_string resource_id
"
select person_id
from persons
where lower(trim(:name)) = lower(trim(first_names || ' ' || last_name))
"
-default 0
]
if
{
0 !=
$person
_id
}
{
ns_write
"<li>Resource:
$name
(
$resource
_id) ->
$person
_id as
$function
\n
"
set resource_hash
(
$resource
_id
)
$person
_id
}
else
{
ns_write
"<li>Unknown Resource:
$name
(
$resource
_id)
\n
"
}
ns_log Notice
"im_gp_save_resources:
[
$child
asXML
]
"
}
default
{
}
}
}
return
[
array
get resource_hash
]
}
www/gantt-upload-2.tcl
View file @
6e40933d
...
...
@@ -72,64 +72,78 @@ set root_node [$doc documentElement]
# Save the new Tasks from GanttProject
# -------------------------------------------------------------------
ns_write
"<h2>Saving Tasks to the DB</h2>
\n
"
ns_write
"<ul>
\n
"
# Save the tasks.
# The task_hash contains a mapping table from gantt_project_ids
# to task_ids.
ns_write
"<h2>Pass 1: Saving Tasks</h2><ul>
\n
"
set
task_hash_array
[
list
]
set
task_hash_array
[
im_gp_save_tasks
\
-enable_save_dependencies 0
\
-task_hash_array
""
\
-task_hash_array
$task
_hash_array
\
$root
_node
\
$project
_id
\
]
array
set task_hash
$task
_hash_array
set
task_hash_array
[
im_gp_save_tasks
\
-enable_save_dependencies 1
\
-task_hash_array
$task
_hash_array
\
$root
_node
\
$project
_id
\
]
ns_write
"</ul>
\n
"
#ns_write "<h2>Pass 2: Saving Dependencies</h2><ul>\n"
#set task_hash_array [im_gp_save_tasks \
# -enable_save_dependencies 1 \
# -task_hash_array $task_hash_array \
# $root_node \
# $project_id \
#
]
# -------------------------------------------------------------------
# Process Resources
# <allocation task-id="12391" resource-id="7" function="Default:0" responsible="true" load="100.0"/>
# -------------------------------------------------------------------
ns_write
"<h2>Saving Resources</h2>
\n
"
ns_write
"<ul>
\n
"
set
resource_node
[
$root
_node selectNodes /project/resources
]
set
resource_hash_array
[
im_gp_save_resources
$resource
_node
]
ns_write
"</ul>
\n
"
# -------------------------------------------------------------------
# Process Allocations
# <allocation task-id="12391" resource-id="7" function="Default:0" responsible="true" load="100.0"/>
# -------------------------------------------------------------------
set
allocations_node
[
$root
_node selectNodes /project/allocations
]
ns_write
"<h2>Saving Allocations</h2>
\n
"
ns_write
"<ul>
\n
"
set
allocations_node
[
$root
_node selectNodes /project/allocations
]
im_gp_save_allocations
\
$child
Nodes
\
-task_hash_array
$task
_hash_array
$allocations
_node
\
$task
_hash_array
\
$resource
_hash_array
ns_write
"</ul>
\n
"
ns_write
"</ul>
\n
"
# -------------------------------------------------------------------
# Delete the tasks that have been deleted in GanttProject
# -------------------------------------------------------------------
ns_write
"<h2>Deleting Deleted Tasks</h2>
\n
"
# Extract a tree of tasks from the Database
set
xml_tree
[
im_gp_extract_xml_tree
$root
_node
$task
_hash_array
]
set
db_tree
[
im_gp_extract_db_tree
$project
_id
]
set
db_list
[
lsort
-integer -unique
[
im_gp_flatten
$db
_tree
]]
set
xml_list
[
lsort
-integer -unique
[
im_gp_flatten
$xml
_tree
]]
ns_write
"<h2>Extract DB Tree</h2>
\n
"
ns_write
"<ul>
\n
"
ns_write
"<li>DB Tree:
$db
_tree
\n
"
ns_write
"<li>XML Tree:
$xml
_tree
\n
"
ns_write
"<li>DB List:
$db
_list
\n
"
ns_write
"<li>XML List:
$xml
_list
\n
"
ns_write
"</ul>
\n
"
ns_log Notice
"task_hash_array:
$task
_hash_array"
ns_log Notice
"gantt-upload-2: DB Tree:
$db
_tree
\n
"
ns_log Notice
"gantt-upload-2: XML Tree:
$xml
_tree
\n
"
ns_log Notice
"gantt-upload-2: DB List:
$db
_list
\n
"
ns_log Notice
"gantt-upload-2: XML List:
$xml
_list
\n
"
# Now calculate the difference between the two lists
...
...
@@ -139,10 +153,7 @@ set diff_list [im_gp_difference $db_list [lappend xml_list $project_id]]
# Deal with the case of an empty diff_list
lappend
diff_list 0
ns_write
"<h2>Difference List</h2>
\n
"
ns_write
"<ul>
\n
"
ns_write
"<li>Diff List:
$diff
_list
\n
"
ns_write
"</ul>
\n
"
ns_log Notice
"gantt-upload-2: Diff List:
$diff
_list
\n
"
set
del_projects_sql
"
select p.project_id
...
...
@@ -150,8 +161,8 @@ set del_projects_sql "
where p.project_id in (
[
join
$diff
_list
","
]
)
"
db_foreach del_projects
$del
_projects_sql
{
ns_write
"<li>Nuking project
'
$project
_id'
\n
"
#
im_project_nuke $project_id
ns_write
"<li>Nuking project
#
$project
_id
\n
"
im_project_nuke
$project
_id
}
...
...
@@ -161,7 +172,7 @@ set del_tasks_sql "
where p.task_id in (
[
join
$diff
_list
","
]
)
"
db_foreach del_tasks
$del
_tasks_sql
{
ns_write
"<li>Nuking task
'
$task
_id'
\n
"
ns_write
"<li>Nuking task
#
$task
_id
\n
"
im_timesheet_task_nuke
$task
_id
}
...
...
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