Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-table-create.sql,v diff -u -r1.14 -r1.15 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 30 Sep 2003 12:10:01 -0000 1.14 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 3 Oct 2003 22:21:45 -0000 1.15 @@ -1,18 +1,19 @@ -- TODO: -- --- which items in this data model need to use the content repository? -- need to add in workflow (for status among other things) --- need to take into account acs-rels -- add categories to projects -- --- packages/test-project/sql/postgresql/test-project-table-create.sql +-- packages/project-manager/sql/postgresql/project-manager-table-create.sql -- --- @author jader@bread.com, ncarroll@ee.usyd.edu.au and everyone else involved in this thread: http://openacs.org/forums/message-view?message_id=90742 +-- @author jader@bread.com +-- @author ncarroll@ee.usyd.edu.au was involved in creating the initial CR version +-- @author everyone else involved in this thread: http://openacs.org/forums/message-view?message_id=90742 -- @creation-date 2003-05-15 -- --- Project repository datamodel. +-- PROJECTS + create table pm_projects ( project_id integer constraint project_manager_id_fk @@ -53,65 +54,82 @@ -create table pm_project_roles ( +-- ROLES + +create sequence pm_role_seq start 3; + +create table pm_roles ( role_id integer - constraint pm_project_role_id_pk + constraint pm_role_id_pk primary key, one_line varchar(100) - constraint pm_project_role_one_line_uq + constraint pm_role_one_line_uq unique, description varchar(2000), - sort_order integer + sort_order integer, + is_observer_p char(1) default 'f' + constraint pm_role_is_observer_ck + check (is_observer_p in ('t','f')) ); -comment on table pm_project_roles is ' - Roles represent the way in which a party participates in a project. For example, - they could be a manager, or client, or participant.. The sort order determines - what order it is displayed in. +comment on table pm_roles is ' + Roles represent the way in which a party participates in a project + or task. For example, they could be a manager, or client, or + participant.. The sort order determines what order it is displayed + in. The is_observer_p specifies whether they are directly + responsible for the task. People not directly responsible will not + get email notifications reminding them that tasks are overdue, for + example. '; -insert into pm_project_roles (role_id, one_line, description, sort_order) values ('1','Participant','Team members who are responsible for the completion of the project','10'); -insert into pm_project_roles (role_id, one_line, description, sort_order) values ('2','Manager','Manages the team to complete the project on time and on budget.','20'); +insert into pm_roles (role_id, one_line, description, sort_order) values ('1','Participant','Team members who are responsible for the completion of the project','10'); +insert into pm_roles (role_id, one_line, description, sort_order) values ('2','Manager','Manages the team to complete the project or task on time and on budget.','20'); -create sequence pm_project_role_seq start 3; +create table pm_default_roles ( + role_id integer + constraint pm_default_role_fk + references pm_roles + on delete cascade, + party_id integer + constraint pm_default_role_party_fk + references parties(party_id) + on delete cascade, + constraint pm_default_roles_uq + unique (role_id, party_id) +); +comment on table pm_default_roles is ' + Specifies what role a person is a part of by default +'; -create table pm_project_role_map ( +-- PROJECT ASSIGNMENT + +create table pm_project_assignment ( project_id integer constraint pm_project_role_map_project_fk references pm_projects on delete cascade, role_id integer constraint pm_project_role_map_role_fk - references pm_project_roles, + references pm_roles, party_id integer constraint pm_project_role_map_user_id_fk references parties(party_id) - on delete cascade + on delete cascade, + constraint pm_project_assignment_uq + unique (project_id, role_id, party_id) ); -comment on table pm_project_role_map is ' + +comment on table pm_project_assignment is ' Maps who is a part of what project, and in what capacity '; -create table pm_project_default_roles ( - role_id integer - constraint pm_proj_default_role_fk - references pm_project_roles - on delete cascade, - party_id integer - constraint pm_proj_default_role_party_fk - references parties(party_id) - on delete cascade -); +-- TASKS -comment on table pm_project_role_map is ' - Specifies what role a person is a part of by default, for projects -'; - -- we create two tables to store task information -- the information that we keep revisions on is in the -- pm_task_revisions table, the rest is in pm_task @@ -286,6 +304,8 @@ ); +-- DEPENDENCIES + -- dependency types -- such as: -- cannot start until Task X finishes @@ -322,78 +342,65 @@ on delete cascade, dependency_type varchar constraint pm_tasks_const_type - references pm_task_dependency_types + references pm_task_dependency_types, + constraint pm_task_dependency_uq + unique (task_id, parent_task_id) ); --- assignments +-- WORKGROUPS +create sequence pm_workgroup_seq; -create table pm_task_roles ( - role_id integer - constraint pm_task_role_id_pk +create table pm_workgroup ( + workgroup_id integer + constraint pm_workgroup_id_pk primary key, one_line varchar(100) - constraint pm_task_role_one_line_uq + constraint pm_workgroup_one_line_uq unique, description varchar(2000), - is_observer_p char(1) default 'f' - constraint pm_task_role_ck - check (is_observer_p in ('t','f')), sort_order integer ); -comment on table pm_task_roles is ' - Roles represent the way in which a role participates in a task. For example, - they could be an assignee, or a watcher. They can be divided up the same way - the organization is broken up, by sales and R and D for example. These terms - can be made up to fit the conditions of the local company. Defaults are set - up by another table, pm_task_default_role - The is_observer_p specifies - whether they are directly responsible for the task. People not directly - responsible will not get email notifications reminding them that tasks are - overdue, for example. -'; - -insert into pm_task_roles (role_id, one_line, description, is_observer_p, sort_order) values ('1','Manager','This person oversees someone responsible for completion of the task','t','10'); -insert into pm_task_roles (role_id, one_line, description, is_observer_p, sort_order) values ('2','Assignee','This person is directly responsible for completion of the task','f','20'); -insert into pm_task_roles (role_id, one_line, description, is_observer_p, sort_order) values ('3','Watcher','This person is interested in developments of a ticket, but not directly responsible for it.','t','30'); - - -create sequence pm_task_role_seq start 4; - - -create table pm_task_role_map ( - task_id integer - constraint pm_task_role_map_task_fk - references pm_tasks +create table pm_workgroup_parties ( + workgroup_id integer + constraint pm_workgroup_parties_wg_id_fk + references pm_workgroup(workgroup_id) on delete cascade, - role_id integer - constraint pm_task_roles_fk - references pm_task_roles, party_id integer - constraint pm_task_role_map_user_id_fk + constraint pm_workgroup_party_fk references parties(party_id) - on delete cascade + on delete cascade, + role_id integer + constraint pm_workgroup_role_id + references pm_roles, + constraint pm_workgroup_parties_uq + unique (workgroup_id, party_id, role_id) ); -comment on table pm_task_role_map is ' - Maps who is a part of what task, and in what capacity -'; -create table pm_task_default_roles ( - role_id integer - constraint pm_task_default_role_fk - references pm_task_roles +-- TASK ASSIGNMENTS + +create table pm_task_assignment ( + task_id integer + constraint pm_task_assignment_task_fk + references pm_tasks(task_id) on delete cascade, + role_id integer + constraint pm_task_assignment_role_fk + references pm_roles, party_id integer - constraint pm_task_default_role_party_fk + constraint pm_task_assignment_party_fk references parties(party_id) - on delete cascade + on delete cascade, + constraint pm_task_assignment_uq + unique (task_id, role_id, party_id) ); -comment on table pm_task_role_map is ' - Specifies what role a person is a part of by default, for tasks + +comment on table pm_project_assignment is ' + Maps who is a part of what project, and in what capacity '; @@ -443,7 +450,6 @@ description varchar(4000), -- dates are optional, because it may be computed in reference -- to all other items, or simply not have a deadline - end_date timestamptz, -- percent complete is always 0 estimated_hours_work numeric, -- PERT charts require minimum and maximum estimates Index: openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-dependency-add-edit-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit-postgresql.xql 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,51 @@ + + + + + select + t.process_task_id as task_id, + t.one_line as task_title, + t.description + FROM + pm_process_task t + WHERE + t.process_task_id in ([join $process_task_id ", "]) + + + + + + select + short_name, + description + FROM + pm_task_dependency_types + ORDER BY + short_name + + + + + + select + r.item_id, + r.title as task_title + FROM + pm_process_tasks + WHERE + process_id = :process_id + ORDER BY + upper(one_line) + + + + + + INSERT INTO pm_process_task_dependency + (dependency_id, task_id, parent_task_id, dependency_type) + VALUES + (:dependency_id, :tsk_id, :parent_tsk_id, :type_id) + + + + Index: openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-dependency-add-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.adp 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,21 @@ + +@context_bar@ +@title@ + + +You may now add dependencies to these +@task_term_lower@s. Dependencies describe the order in which items must +be completed. For example, "the boards must be delivered before +construction can begin". Entering dependencies is important because it +allows the system to automatically compute schedules. However, you can +skip adding dependencies. + +
+ + + + + +
+ + Index: openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-dependency-add-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,189 @@ +ad_page_contract { + + Form to add task dependencies + + @author jader@bread.com + @creation-date 2003-08-06 + @cvs-id $Id: process-dependency-add-edit.tcl,v 1.1 2003/10/03 22:21:45 jader Exp $ + + @return context_bar Context bar. + @return title Page title. + @return task_term_lower Terminology to use for Task + + @param dependency_id The new ID for dependencies we create + +} { + + process_id:integer + dependency_id:integer,optional + task_revisions:integer,multiple,optional + task_revisions_list:optional + dependency_type:array,optional + dependency_task_id:array,optional + {project_item_id:integer ""} + +} -properties { + + context_bar:onevalue + title:onevalue + task_term_lower:onevalue + project_item_id:onevalue + +} + +# --------------------------------------------------------------- # + +ns_log notice depedency page +set mypage [ns_getform] +if {[string equal "" $mypage]} { + ns_log notice no form was submitted on my page +} else { + ns_log notice the following form was submitted on my page + ns_set print $mypage +} + + +# HACK because there isn't a facility for exporting multiple hidden +# form variables in ad_form +#if {[info exists task_revisions_list]} { + # convert task_revisions_list to task_revisions +# set task_revisions_list_tmp [lindex $task_revisions_list 0] +# set task_revisions [split $task_revisions_list " "] +#} + +#if {[empty_string_p $project_item_id]} { + # get a parent project +# set project_item_id [db_string get_parent_project { }] +#} + +if {![exists_and_not_null task_revisions]} { + ad_returnredirect "process-one?[export_url_vars process_id]" +} + +# terminology +set task_term [parameter::get -parameter "TaskName" -default "Task"] +set task_term_lower [parameter::get -parameter "taskname" -default "task"] + +# the unique identifier for this package +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] + +# permissions + +set title "Add $task_term_lower dependencies" +set context_bar [ad_context_bar [list "process-task-add-edit?[export_vars -url {{process_id process_task_id:multiple}}" "Assignments"] "New $task_term dependency"] + +permission::require_permission -party_id $user_id -object_id $package_id -privilege create + + +ad_form -name add_edit -form { + dependency_id:key(pm_process_task_dependency_seq) + + {process_task_id:text(hidden) + {value $process_task_id} + } + + +} -export { + +} -on_submit { + + set user_id [ad_conn user_id] + set peeraddr [ad_conn peeraddr] + +} -new_data { + + foreach tr $task_revisions { + + set type_id $dependency_type($tr) + set parent_tsk_id $dependency_task_id($tr) + set dependency_id [db_nextval pm_task_dependency_seq] + set tsk_revision_id $tr + set tsk_id [db_string get_task_id { }] + + db_dml new_dependency { *SQL* } + } + + project_manager::project::compute_parent_status $project_item_id + +} -edit_data { + +} -after_submit { + + ad_returnredirect "one?project_item_id=$project_item_id" + ad_script_abort +} + +# get dependency types + +set options [list] +db_foreach get_dependency_types { } -column_array dependencies { + lappend options "{\"$dependencies(description)\" $dependencies(short_name)}" +} + +# set up list of tasks that this task can be depend on + +set dependency_keys [list] + +db_foreach get_dependency_tasks { } -column_array dependency_tasks { + + set dependency_options($dependency_tasks(task_title)) $dependency_tasks(item_id) + + lappend dependency_keys $dependency_tasks(task_title) +} + +set dependency_keys [lsort $dependency_keys] + + + + + + +# get the information on tasks from their revision_numbers + +db_foreach get_task_info { } -column_array tasks { + + # set up the tasks that can be viewed. Takes out the current task + set dependency_options_full "" + foreach key $dependency_keys { + if {![string equal $key $tasks(task_title)]} { + append dependency_options_full "{\"$key\" $dependency_options($key)} " + } + } + + append add_edit_definition " + {item_id.$tasks(revision_id):text(hidden) + {value {$tasks(item_id)}} + } + + {task_title.$tasks(revision_id):text(inform) + {label \"Subject\"} + {value {$tasks(task_title)}} + } + + {description.$tasks(revision_id):text(inform) + {label \"Description\"} + {value {$tasks(description)}} + } + + {end_date.$tasks(revision_id):text(inform) + {label \"Deadline\"} + {value {$tasks(end_date)}} + } + + {dependency_type.$tasks(revision_id):text(select) + {label \"Dependency type\"} + {options {[join $options " "]}} + {value {finish_before_start}} + } + + {dependency_task_id.$tasks(revision_id):text(select) + {label \"Dependency\"} + {options {$dependency_options_full}} + {help_text {$task_term the dependency is based on}} + } + " +} + + +ad_form -extend -name add_edit -form $add_edit_definition Index: openacs-4/contrib/packages/project-manager/www/process-one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-one-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-one-postgresql.xql 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,21 @@ + + + + + + SELECT + process_task_id, + one_line, + description, + end_date, + estimated_hours_work, + estimated_hours_work_min, + estimated_hours_work_max + FROM + pm_process_task + WHERE + process_id = :process_id + + + + Index: openacs-4/contrib/packages/project-manager/www/process-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-one.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-one.adp 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,24 @@ + + + + +One process +@context_bar@ + +Process tasks: + + + + + + Index: openacs-4/contrib/packages/project-manager/www/process-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-one.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-one.tcl 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,99 @@ +ad_page_contract { + Main view page for one process + + @author jader@bread.com + @creation-date 2003-09-25 + @cvs-id $Id: process-one.tcl,v 1.1 2003/10/03 22:21:45 jader Exp $ + + @return context_bar Context bar. + +} { + + process_id:integer + +} -properties { + process_id:onevalue + context_bar:onevalue +} -validate { +} + +# --------------------------------------------------------------- # + +# the unique identifier for this package +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] + +# permissions +permission::require_permission -party_id $user_id -object_id $package_id -privilege read + +set write_p [permission::permission_p -object_id $package_id -privilege write] +set create_p [permission::permission_p -object_id $package_id -privilege create] + +# set up context bar, needs parent_id + + +set context_bar [ad_context_bar [list "processes?process_id=$process_id" "Processes"] "One"] + + +# Process tasks, using list-builder --------------------------------- + +template::list::create \ + -name tasks \ + -multirow tasks \ + -key process_task_id \ + -elements { + one_line { + label "Subject" + display_template {@tasks.one_line@} + } + description { + label "Description" + } + estimated_hours_work { + label "Work estimate" + } + estimated_hours_work_min { + label "Work estimate min" + } + estimated_hours_work_min { + label "Work estimate max" + } + end_date { + label "Deadline" + } + } \ + -orderby { + one_line {orderby one_line} + description {orderby description} + estimated_hours_work {orderby estimated_hours_work} + estimated_hours_work_min {orderby estimated_hours_work_min} + estimated_hours_work_max {orderby estimated_hours_work_max} + default_value one_line,desc + } \ + -orderby_name orderby_tasks \ + -bulk_actions { + "Edit" "process-task-add-edit" "Edit tasks" + } \ + -bulk_action_export_vars { + process_id + project_id + {my_key 1} + } \ + -main_class { + narrow + } \ + -filters { + } \ + -html { + width 100% + } + + +db_multirow -extend { item_url } tasks task_query { +} { +} + + +ad_return_template + +# ------------------------- END OF FILE ------------------------- # Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit-2-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2-postgresql.xql 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,25 @@ + + + + + insert into + pm_process_task + (process_task_id, + process_id, + one_line, + description, + estimated_hours_work, + estimated_hours_work_min, + estimated_hours_work_max) + values + (:process_task_id, + :process_id, + :one_line, + :desc, + :work, + :work_min, + :work_max) + + + + Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,145 @@ +ns_log notice process-task-add-edit-2 +set mypage [ns_getform] +if {[string equal "" $mypage]} { + ns_log notice no form was submitted on my page +} else { + ns_log notice the following form was submitted on my page + ns_set print $mypage +} + +ad_page_contract { + + Add/edit form for process tasks, page 2 + + @author jader@bread.com + @creation-date 2003-09-29 + @cvs-id $Id: process-task-add-edit-2.tcl,v 1.1 2003/10/03 22:21:45 jader Exp $ + + @param process_id The process that we're adding or editing items for. + @param task_title The titles of the tasks + @param estimated_hours_work Estimated hours worked + @param estimated_hours_work Estimated hours worked (min) + @param estimated_hours_work Estimated hours worked (max) + @param process_task_id the ID for each process + +} { + + process_id:integer,notnull + {task_title:multiple ""} + {description:multiple ""} + {estimated_hours_work:multiple ""} + {estimated_hours_work_min:multiple ""} + {estimated_hours_work_max:multiple ""} + process_task_id:integer,multiple + +} -validate { + process_id_missing { + if {![exists_and_not_null process_id]} { + ad_complain + } + } + task_title_too_long { + foreach tt $task_title { + if {[string length $tt] > 198} { + ad_complain + } + } + } + description_too_long { + foreach d $description { + if {[string length $d] > 3998} { + ad_complain + } + } + } + bad_estimated_hours_work_range { + foreach wr $estimated_hours_work { + if {$wr > 500 || $wr < 0} { + ad_complain + } + } + } + process_task_id_missing { + foreach ptid $process_task_id { + if {![exists_and_not_null ptid]} { + ad_complain + } + } + } +} -errors { + process_id_missing {I don't know which process these tasks are for!} + task_title_too_long {A task subject is too long. It must be 198 characters or less} + description_too_long {A description subject is too long. It must be 3998 characters or less} + bad_estimated_hours_work_range {The estimated hours must be between 0 and 499 hours} + process_task_id_missing {I don't know which process task is being added or edited!} +} + + +set user_id [ad_maybe_redirect_for_registration] +set package_id [ad_conn package_id] + +permission::require_permission -party_id $user_id -object_id $package_id -privilege create + +set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] + + +set index 0 +foreach ptid $process_task_id { + + # set up the values + set task_id [lindex $process_task_id $index] + + set one_line [lindex $task_title $index] + set desc [lindex $description $index] + + if {[string equal $use_uncertain_completion_times_p "1"]} { + set work_min [lindex $estimated_hours_work_min $index] + set work_max [lindex $estimated_hours_work_max $index] + set work [expr .5 * [expr $work_max - $work_min] + $work_min] + } else { + set work [lindex $estimated_hours_work $index] + set work_min $work + set work_max $work + } + + db_dml new_task { *SQL* } +} + + +if {1 == 0} { + + set revision_has_dependencies [list] + set revision_no_dependencies [list] + + for {set i 1} {$i <= $number} {incr i} { + + if {![exists_and_not_null estimated_hours_work($i)]} { + set estimated_hours_work($i) [expr .5 * ($estimated_hours_work_max($i) - $estimated_hours_work_min($i)) + $estimated_hours_work_min($i)] + } + + if {![exists_and_not_null estimated_hours_work_min($i)]} { + set estimated_hours_work_min($i) $estimated_hours_work($i) + } + + if {![exists_and_not_null estimated_hours_work_max($i)]} { + set estimated_hours_work_max($i) $estimated_hours_work($i) + } + + # do the actual edit + db_dml edit_task { } + + ns_log Notice "edited process task" + + if {[info exists use_dependency_p($i)] && [string equal $use_dependency_p($i) "t"]} { + lappend revision_has_dependencies $this_revision_id + } else { + lappend revision_no_dependencies $this_revision_id + } + + } + +} + + +ad_returnredirect "process-task-assign-add-edit?[export_vars -url {use_dependency_p:multiple process_id process_task_id:multiple}]" +ad_script_abort Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql 15 Sep 2003 23:09:57 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql 3 Oct 2003 22:21:45 -0000 1.2 @@ -1,44 +1,55 @@ - + - select pm_task__new_task_item ( - null, - :project_item_id, - '$task_title($i)', - '$description($i)', - [project_manager::project::util::datenvl -value [set end_date_$i] -value_if_null "null," -value_if_not_null "to_timestamp('[set end_date_$i]','YYYY MM DD HH24 MI SS'),"] - '0', - '$estimated_hours_work($i)', - '$estimated_hours_work_min($i)', - '$estimated_hours_work_max($i)', - now(), - :user_id, - :peeraddr, - :package_id - ); + update + pm_process_task + set + process_task_id = :process_task_id, + process_id = :process_id, + one_line = :one_line, + description = :desc, + estimated_hours_work = :work, + estimated_hours_work_min = :work_min, + estimated_hours_work_max = :work_max select - t.task_revision_id, - t.title as task_title, - t.item_id, + current_timestamp + FROM + dual + + + + + + select + t.process_id, + t.one_line as task_title, t.description, - t.name, - t.parent_id, - to_char(t.end_date,'YYYY MM DD') as end_date, - t.percent_complete, t.estimated_hours_work, t.estimated_hours_work_min, t.estimated_hours_work_max - FROM - pm_tasks_revisionsx t, cr_items i + FROM + pm_process_task t LEFT JOIN pm_process_task_dependency d ON d.process_task_id = t.process_task_id WHERE - t.item_id = :task_id and - t.revision_id = i.live_revision + t.process_task_id in ([join $process_task_id ","]) + + + + SELECT + p.project_id + FROM + pm_projectsx p, cr_items i + WHERE + p.item_id = :project_item_id and + p.revision_id = i.live_revision + + + Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp 15 Sep 2003 23:09:57 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp 3 Oct 2003 22:21:45 -0000 1.2 @@ -6,9 +6,7 @@
- - - +
@@ -20,60 +18,50 @@
- + Description:
- + + - +
 @num.rownum@  Subject:*

+

Subject:*

- Description:

+ - - - + - + - - - - +
Work required:*
Min: hrs  schedule constrained by other @task_term_lower@ hrs
Max: hrs hrs
hrs depends on another @task_term_lower@
hrs
-

-
+ + depends on another @task_term_lower@ - Deadline: - +
-

- [i] - You may optionally enter a hard deadline, otherwise it is computed

- -
- - +

Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl 15 Sep 2003 23:09:57 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl 3 Oct 2003 22:21:45 -0000 1.2 @@ -1,27 +1,38 @@ +ns_log notice process-task-add-edit +set mypage [ns_getform] +if {[string equal "" $mypage]} { + ns_log notice no form was submitted on my page +} else { + ns_log notice the following form was submitted on my page + ns_set print $mypage +} + ad_page_contract { - Add/edit form for tasks + Add/edit form for process tasks @author jader@bread.com - @creation-date 2003-07-28 + @creation-date 2003-09-25 @cvs-id $Id$ @return context_bar Context bar. @return title Page title. - @return num num is used as a multirow datasource to iterate over the ad_form elements + @return process_id The process we're adding/editing tasks for - @param process_id Specifies which process this task is associated with + @return num used as a multirow datasource to iterate over the form elements + + @param process_id The process that we're adding or editing items for. @param number The number of Tasks to create } { - process_item_id:integer,optional - process_id:integer,optional + process_id:integer,notnull {number:integer "1"} } -properties { context_bar:onevalue title:onevalue + process_id:onevalue num:multirow use_uncertain_completion_times_p:onevalue @@ -32,64 +43,23 @@ ad_complain } } - percent_is_in_range -requires {percent_complete:integer} { - if {$percent_complete < 0 || $percent_complete > 100} { - ad_complain - } - } } -errors { number_is_in_range {Number must be between 1 and 100} - percent_is_in_range {Percent completed must be between 0 and 100} } # --------------------------------------------------------------- # -# create a multirow we can use to iterate -template::multirow create num number -for {set i 1} {$i <= $number} {incr i} { - template::multirow append num $i -} +template::multirow create num process_task_id -# The evilest hack of all time. -# ------------------------------------------------------- -# This is a workaround the fact that using multiple dates -# with ad_form is extremely difficult. Dates are formatted -# like arrays, with values like end_date.day, end_date.month, -# end_date.year, and end_date.format . The problem is we want -# to have multiple end_dates. Using the multiple method, we -# then get entries like this: end_date.1.year, end_date.2.year, -# end_date.2.day, etc.. -# -# What this loop does is go through the array, and rename the -# values into other variables. We then feed these variables into -# the SQL function that creates the new tasks. This works. I'm -# sure there must be a better way to do it, but my posting on -# the forums didn't result in any other suggestions. +for {set i 1} {$i <= $number} {incr i} { -if {[info exists end_date]} { - - set searchToken [array startsearch end_date] - - while {[array anymore end_date $searchToken]} { - - set keyname [array nextelement end_date $searchToken] - set keyvalu $end_date($keyname) - - # element_num is 1...n, element_type is year, format, day, month - regexp {(.*)\.(.*)} $keyname match element_num element_type - - set end_date_[set element_type]($element_num) $keyvalu - - } - - for {set i 1} {$i <= $number} {incr i} { - # set up date variable names - set end_date_$i [list $end_date_year($i) $end_date_month($i) $end_date_day($i) {} {} {}] - } + set process_task_id_tmp [db_nextval pm_process_task_seq] + template::multirow append num $process_task_id_tmp } + # terminology set task_term [parameter::get -parameter "TaskName" -default "Task"] set task_term_lower [parameter::get -parameter "taskname" -default "task"] @@ -100,139 +70,15 @@ set package_id [ad_conn package_id] set user_id [ad_maybe_redirect_for_registration] -# permissions -set title "Process" -set context_bar [ad_context_bar Process] +# permissions and more -if {[exists_and_not_null task_id]} { -# set title "Edit a $task_term_lower" -# set context_bar [ad_context_bar [list "one?item_id=$process_item_id&process_id=$process_id" "One $process_term"] "Edit $task_term"] -# permission::require_permission -party_id $user_id -object_id $package_id -privilege write -} else { -# set title "Add a $task_term_lower" -# set context_bar [ad_context_bar [list "one?item_id=$process_item_id&process_id=$process_id" "One $process_term"] "New $task_term"] -# permission::require_permission -party_id $user_id -object_id $package_id -privilege create -} +set title "Add a process $task_term_lower" +set context_bar [ad_context_bar [list "processes?process_id=$process_id" "Processes"] "Add"] +permission::require_permission -party_id $user_id -object_id $package_id -privilege create -ad_form -name add_edit -form { - task_id:key +set user_id [ad_conn user_id] +set peeraddr [ad_conn peeraddr] - {process_id:text(hidden) - {value $process_id} - } - {number:text(hidden) - {value $number} - } - -} -on_submit { - - set user_id [ad_conn user_id] - set peeraddr [ad_conn peeraddr] - -} -new_data { - - # each task we add in returns a task_revision_id - # we set up two lists, one for tasks that will need dependencies - # another for tasks that don't - - set revision_has_dependencies [list] - set revision_no_dependencies [list] - - for {set i 1} {$i <= $number} {incr i} { - - if {![exists_and_not_null estimated_hours_work($i)]} { - set estimated_hours_work($i) [expr .5 * ($estimated_hours_work_max($i) - $estimated_hours_work_min($i)) + $estimated_hours_work_min($i)] - } - - if {![exists_and_not_null estimated_hours_work_min($i)]} { - set estimated_hours_work_min($i) $estimated_hours_work($i) - } - - if {![exists_and_not_null estimated_hours_work_max($i)]} { - set estimated_hours_work_max($i) $estimated_hours_work($i) - } - - set this_revision_id [db_exec_plsql new_task_item { *SQL* }] - - if {[info exists use_dependency_p($i)] && [string equal $use_dependency_p($i) "t"]} { - lappend revision_has_dependencies $this_revision_id - } else { - lappend revision_no_dependencies $this_revision_id - } - } - -} -edit_data { - -} -select_query_name task_query -after_submit { - - # now go through the use_dependency_p items. For each that is checked, - # we add that to a list of ids that we pass to the dependency-add-edit - # page. - - ad_returnredirect "task-assign-add-edit?[export_vars -url {revision_has_dependencies:multiple revision_no_dependencies:multiple process_item_id}]" - ad_script_abort - -} - -for {set i 1} {$i <= $number} {incr i} { - - # reading this code, you may wonder why we put the .$i at the end. - # DaveB showed me this trick. It lets you make a multiple out of - # the items by stuffing them in an array. Long live DaveB. - - ad_form -extend -name add_edit -form \ - [list \ - [list \ - task_title.$i:text \ - {label "Subject \#$i"} \ - {html {size 39}} \ - ] \ - [list \ - description.$i:text(textarea),optional \ - {label "Description"} \ - {html {rows 7 cols 40}} \ - ] \ - [list \ - use_dependency_p.$i:text(checkbox) \ - {label "Use dependency"} \ - {value "t"} \ - ] \ - [list \ - parent_id.$i:text(hidden) \ - ] \ - [list \ - end_date.$i:date,to_sql(linear_date),optional \ - {label "Deadline"} \ - {format "MONTH DD YYYY"} \ - {help} \ - ] \ - ] - - if {$use_uncertain_completion_times_p} { - ad_form -extend -name add_edit -form \ - [list \ - [list \ - estimated_hours_work_min.$i:integer \ - {label "Hours estimate - min"} \ - {html {size 3}} \ - ] \ - [list \ - estimated_hours_work_max.$i:integer \ - {label "Hours estimate - max"} \ - {html {size 3}} \ - ] \ - ] - } else { - ad_form -extend -name add_edit -form \ - [list \ - [list \ - estimated_hours_work.$i:integer \ - {label "Hours estimate"} \ - {html {size 3}} \ - ] \ - ] - } -} Index: openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-assign-add-edit-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit-postgresql.xql 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,84 @@ + + + + + select + one_line, + description, + process_task_id + FROM + pm_process_task + WHERE + process_task_id in ([join $process_task_id ","]) + ORDER BY + process_task_id + + + + + + select + first_names || ' ' || last_name || ' (' || email || ')' as who, + person_id + FROM + cc_users + ORDER BY + first_names, last_name + + + + + + select + one_line, + role_id + FROM + pm_roles + ORDER BY + sort_order + + + + + + delete from pm_process_task_assignment + where process_task_id in ([join $process_task_id ","]) + + + + + + insert into pm_process_task_assignment + (process_task_id, + role_id, + party_id) + values + (:t_id, + :r_id, + :p_id) + + + + + + select + party_id + FROM + pm_process_task_assignment + WHERE + process_task_id = :tiid + + + + + + select + role_id + FROM + pm_process_task_assignment a + WHERE + process_task_id = :tiid + + + + Index: openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-assign-add-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.adp 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,40 @@ + +@context_bar@ +@title@ + + +
+ + + + + + + + + + + + + + + + +
@tasks.one_line@
@tasks.description@ + + +
+
+
+ +
+ +

+ + + + + +

+ + Index: openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-assign-add-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/process-task-assign-add-edit.tcl 3 Oct 2003 22:21:45 -0000 1.1 @@ -0,0 +1,340 @@ +ns_log notice process-task-add-edit +set mypage [ns_getform] +if {[string equal "" $mypage]} { + ns_log notice no form was submitted on my page +} else { + ns_log notice the following form was submitted on my page + ns_set print $mypage +} + +ad_page_contract { + + Form to add in assignments to process tasks + + @author jader@bread.com + @creation-date 2003-09-25 + @cvs-id $Id: process-task-assign-add-edit.tcl,v 1.1 2003/10/03 22:21:45 jader Exp $ + + @return context_bar Context bar. + @return title Page title. + @return process_id The process we're adding/editing tasks for + + @return num used as a multirow datasource to iterate over the form elements + + @param process_id The process that we're adding or editing items for. + @param process_task_id The tasks we're creating and adding assignments for + @param use_dependency_p Although it says _p, it actually a list of items that will need dependencies. Needs to be passed to the depedency page. +} { + + my_key:integer,optional + process_id:integer,notnull + process_task_id:notnull,multiple + use_dependency_p:integer,multiple,optional + role_id:array,optional + party_id:array,optional + +} -properties { + + context_bar:onevalue + title:onevalue + process_id:onevalue + tasks:multirow + num:multirow + task_term_lower:onevalue + +} -validate { +} -errors { +} + +# --------------------------------------------------------------- # + + +# hack to get around lack of multiple hidden support with ad_form + +set process_task_id_pass $process_task_id +set process_task_id_pass [string map {"-" " "} $process_task_id] +set process_task_id $process_task_id_pass + +#set task_revision_nodep_pass $revision_no_dependencies +#set task_revision_nodep_pass [string map {"-" " "} $task_revision_nodep_pass] +#set revision_no_dependencies $task_revision_nodep_pass + + + +# terminology +set task_term [parameter::get -parameter "TaskName" -default "Task"] +set task_term_lower [parameter::get -parameter "taskname" -default "task"] + + +# the unique identifier for this package +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] + + +# permissions and more + +set title "Add a process $task_term_lower (assignment)" +set context_bar [ad_context_bar [list "processes?process_id=$process_id" "Processes"] "Add assignment"] +permission::require_permission -party_id $user_id -object_id $package_id -privilege create + + +set user_id [ad_conn user_id] +set peeraddr [ad_conn peeraddr] + +db_multirow tasks get_tasks { + set description [ad_text_to_html $description] +} + + + +# create a multirow we can use to iterate +template::multirow create num number + +# currently hardcoded the number of assignments + +for {set i 0} {$i <= 10} {incr i} { + template::multirow append num $i +} + + + +set users_lofl "{{--Select Person--} {}} " +append users_lofl [db_list_of_lists get_users { }] + + +set roles_lofl "{{--Select Role--} {}} " +append roles_lofl [db_list_of_lists get_roles { }] + + +set process_task_id_pass $process_task_id +set process_task_id_pass [string map {" " "-"} $process_task_id] + +#set task_revision_nodep_pass $revision_no_dependencies +#set task_revision_nodep_pass [string map {" " "-"} $task_revision_nodep_pass] + +ad_form -name add_edit -form { + + my_key:key(acs_object_id_seq) + + {process_id:text(hidden) + {value $process_id}} + + {process_task_id:text(hidden) + {value $process_task_id_pass}} + + +} -on_submit { + + set user_id [ad_conn user_id] + set peeraddr [ad_conn peeraddr] + +} -new_data { + + #role_id + #party_id + + if {[info exists role_id]} { + + set searchToken [array startsearch role_id] + + while {[array anymore role_id $searchToken]} { + + set keyname [array nextelement role_id $searchToken] + set keyvalu $role_id($keyname) + + # keyname looks like 2308.1 - 2308.10 + # first element is task_id, second is 1-10 + # if keyvalu is not empty, then we pay attention to it. + + if {[exists_and_not_null keyvalu]} { + + regexp {(.*)\.(.*)} $keyname match task_id_val num_value + + set assignment_role($task_id_val,$num_value) $keyvalu + + } + } + + } + + set party_list [list] + + if {[info exists party_id]} { + + set searchToken [array startsearch party_id] + + while {[array anymore party_id $searchToken]} { + + set keyname [array nextelement party_id $searchToken] + set keyvalu $party_id($keyname) + + # keyname looks like 2308.1 - 2308.10 + # first element is task_id, second is 1-10 + # if keyvalu is not empty, then we pay attention to it. + + if {[exists_and_not_null keyvalu]} { + + regexp {(.*)\.(.*)} $keyname match task_id_val num_value + + set assignment_party($task_id_val,$num_value) $keyvalu + + lappend party_list "$task_id_val,$num_value" + + } + } + + } + + db_dml delete_assignments { } + + foreach pl $party_list { + + regexp {(.*),(.*)} $pl match task_id_v num_value + + set t_id $task_id_v + set r_id $assignment_role($pl) + set p_id $assignment_party($pl) + + ns_log Notice "tid: $t_id rid: $r_id pid: $p_id" + + db_dml add_assignment { } + + } + +} -edit_data { + + # do something + #role_id + #party_id + + if {[info exists role_id]} { + + set searchToken [array startsearch role_id] + + while {[array anymore role_id $searchToken]} { + + set keyname [array nextelement role_id $searchToken] + set keyvalu $role_id($keyname) + + # keyname looks like 2308.1 - 2308.10 + # first element is task_id, second is 1-10 + # if keyvalu is not empty, then we pay attention to it. + + if {[exists_and_not_null keyvalu]} { + + regexp {(.*)\.(.*)} $keyname match task_id_val num_value + + set assignment_role($task_id_val,$num_value) $keyvalu + + } + } + + } + + set party_list [list] + + if {[info exists party_id]} { + + set searchToken [array startsearch party_id] + + while {[array anymore party_id $searchToken]} { + + set keyname [array nextelement party_id $searchToken] + set keyvalu $party_id($keyname) + + # keyname looks like 2308.1 - 2308.10 + # first element is task_id, second is 1-10 + # if keyvalu is not empty, then we pay attention to it. + + if {[exists_and_not_null keyvalu]} { + + regexp {(.*)\.(.*)} $keyname match task_id_val num_value + + set assignment_party($task_id_val,$num_value) $keyvalu + + lappend party_list "$task_id_val,$num_value" + + } + } + + } + + db_dml delete_assignments { } + + foreach pl $party_list { + + regexp {(.*),(.*)} $pl match task_id_v num_value + + set t_id $task_id_v + set r_id $assignment_role($pl) + set p_id $assignment_party($pl) + + ns_log Notice "tid: $t_id rid: $r_id pid: $p_id" + + db_dml add_assignment { } + + } + +} -after_submit { + + # for some reason this hack is necessary here + + #set task_revision_dep_pass $revision_has_dependencies + #set task_revision_dep_pass [string map {"-" " "} $task_revision_dep_pass] + #set revision_has_dependencies $task_revision_dep_pass + + #set task_revisions $revision_has_dependencies + + ad_returnredirect "process-dependency-add-edit?[export_vars -url {process_task_id:multiple process_id}]" + ad_script_abort +} + + +# we create a terrible monster array + +foreach tiid $process_task_id { + + set roles_values [db_list_of_lists get_current_roles { }] + set users_values [db_list_of_lists get_current_users { }] + + set users_length [string length $users_values] + set roles_length [string length $roles_values] + + for {set i 0} {$i <= 10} {incr i} { + + if {$i < $users_length && $i < $roles_length} { + set uv [lindex $users_values $i] + set rv [lindex $roles_values $i] + } else { + set uv "" + set rv "" + } + + ad_form -extend -name add_edit -form \ + [list \ + [list \ + party_id.$tiid.$i:text(select) \ + {label "Assignments \#$i $tiid"} \ + {options {[set users_lofl]}} \ + {values $uv} \ + ] \ + [list \ + role_id.$tiid.$i:text(select) \ + {label "Role \#$i $tiid"} \ + {options {[set roles_lofl]}} \ + {values $rv} \ + ] \ + ] + + } +} + + +ns_log notice it's my page, but later! +set mypage [ns_getform] +if {[string equal "" $mypage]} { + ns_log notice no form was submitted on my page +} else { + ns_log notice the following form was submitted on my page + ns_set print $mypage +} Index: openacs-4/contrib/packages/project-manager/www/processes.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/processes.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/project-manager/www/processes.adp 15 Sep 2003 23:09:57 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/www/processes.adp 3 Oct 2003 22:21:45 -0000 1.2 @@ -22,9 +22,6 @@ - - Add Process - Index: openacs-4/contrib/packages/project-manager/www/processes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/processes.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/project-manager/www/processes.tcl 15 Sep 2003 23:09:57 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/www/processes.tcl 3 Oct 2003 22:21:45 -0000 1.2 @@ -61,8 +61,9 @@ -elements { one_line { label "Subject" - link_url_col item_url - link_html { title "Use this process" } + display_template { + @processes.one_line@ + } } description { label "Description" @@ -74,6 +75,9 @@ -main_class { narrow } \ + -actions { + "Add process" "process-add-edit" "Add a process" + } \ -filters { orderby_process {} } \ @@ -89,7 +93,7 @@ db_multirow -extend { item_url } processes process_query { } { - set item_url [export_vars -base "process-add-edit" {process_id}] + } Index: openacs-4/contrib/packages/project-manager/www/task-assign-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-assign-add-edit-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/task-assign-add-edit-postgresql.xql 12 Sep 2003 19:01:10 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/task-assign-add-edit-postgresql.xql 3 Oct 2003 22:21:45 -0000 1.3 @@ -77,7 +77,7 @@ FROM pm_task_assignment WHERE - task_id in ([join $task_id ","]) + task_id = :tiid @@ -88,7 +88,7 @@ FROM pm_task_assignment a WHERE - task_id in ([join $task_id ","]) + task_id = :tiid Index: openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-assign-add-edit.adp,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.adp 12 Sep 2003 19:01:10 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.adp 3 Oct 2003 22:21:45 -0000 1.3 @@ -9,20 +9,21 @@ - +
- + +
@tasks.one_line@
@tasks.description@ @tasks.item_id@@tasks.description@
Index: openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-assign-add-edit.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl 18 Sep 2003 23:33:54 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl 3 Oct 2003 22:21:45 -0000 1.4 @@ -110,12 +110,10 @@ set users_lofl "{{--Select Person--} {}} " append users_lofl [db_list_of_lists get_users { }] -set users_values [db_list_of_lists get_current_users { }] set roles_lofl "{{--Select Role--} {}} " append roles_lofl [db_list_of_lists get_roles { }] -set roles_values [db_list_of_lists get_current_roles { }] set task_revision_dep_pass $revision_has_dependencies set task_revision_dep_pass [string map {" " "-"} $task_revision_dep_pass] @@ -218,7 +216,77 @@ } -edit_data { # do something + #role_id + #party_id + if {[info exists role_id]} { + + set searchToken [array startsearch role_id] + + while {[array anymore role_id $searchToken]} { + + set keyname [array nextelement role_id $searchToken] + set keyvalu $role_id($keyname) + + # keyname looks like 2308.1 - 2308.10 + # first element is task_id, second is 1-10 + # if keyvalu is not empty, then we pay attention to it. + + if {[exists_and_not_null keyvalu]} { + + regexp {(.*)\.(.*)} $keyname match task_id_val num_value + + set assignment_role($task_id_val,$num_value) $keyvalu + + } + } + + } + + set party_list [list] + + if {[info exists party_id]} { + + set searchToken [array startsearch party_id] + + while {[array anymore party_id $searchToken]} { + + set keyname [array nextelement party_id $searchToken] + set keyvalu $party_id($keyname) + + # keyname looks like 2308.1 - 2308.10 + # first element is task_id, second is 1-10 + # if keyvalu is not empty, then we pay attention to it. + + if {[exists_and_not_null keyvalu]} { + + regexp {(.*)\.(.*)} $keyname match task_id_val num_value + + set assignment_party($task_id_val,$num_value) $keyvalu + + lappend party_list "$task_id_val,$num_value" + + } + } + + } + + db_dml delete_assignments { } + + foreach pl $party_list { + + regexp {(.*),(.*)} $pl match task_id_v num_value + + set t_id $task_id_v + set r_id $assignment_role($pl) + set p_id $assignment_party($pl) + + ns_log Notice "tid: $t_id rid: $r_id pid: $p_id" + + db_dml add_assignment { } + + } + } -after_submit { # for some reason this hack is necessary here @@ -238,6 +306,9 @@ foreach tiid $task_id { + set roles_values [db_list_of_lists get_current_roles { }] + set users_values [db_list_of_lists get_current_users { }] + set users_length [string length $users_values] set roles_length [string length $roles_values] Index: openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-one-postgresql.xql,v diff -u -r1.15 -r1.16 --- openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 12 Sep 2003 21:36:32 -0000 1.15 +++ openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 3 Oct 2003 22:21:45 -0000 1.16 @@ -128,7 +128,8 @@ select r.one_line, - u.first_names || ' ' || u.last_name || ' (' || u.email || ')' as user_info + u.first_names || ' ' || u.last_name || ' (' || u.email || ')' as user_info, + r.role_id from pm_task_assignment a, cc_users u, Index: openacs-4/contrib/packages/project-manager/www/task-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-one.adp,v diff -u -r1.15 -r1.16 --- openacs-4/contrib/packages/project-manager/www/task-one.adp 17 Sep 2003 22:20:59 -0000 1.15 +++ openacs-4/contrib/packages/project-manager/www/task-one.adp 3 Oct 2003 22:21:45 -0000 1.16 @@ -12,7 +12,7 @@ - + Index: openacs-4/contrib/packages/project-manager/www/task-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-one.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/contrib/packages/project-manager/www/task-one.tcl 12 Sep 2003 21:36:32 -0000 1.17 +++ openacs-4/contrib/packages/project-manager/www/task-one.tcl 3 Oct 2003 22:21:45 -0000 1.18 @@ -82,6 +82,7 @@ # Task info ---------------------------------------------------------- db_1row task_query { } -column_array task_info +set task_info(description) [ad_text_to_html $task_info(description)] # Task Revisions, using list-builder --------------------------------- @@ -289,6 +290,7 @@ } \ -filters { party_id {} + task_id {} orderby_subproject {} orderby_versions {} orderby_tasks {} @@ -306,7 +308,7 @@ db_multirow -extend { item_url } subproject task_people_query { } { - set item_url [export_vars -base "one" -override {{project_item_id $item_id}} {project_item_id}] + }
EditEdit @task_term@ #@item_id@: @task_info.task_title@