Index: openacs-4/contrib/packages/project-manager/project-manager.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/Attic/project-manager.info,v diff -u -r1.12.2.4 -r1.12.2.5 --- openacs-4/contrib/packages/project-manager/project-manager.info 15 Jan 2004 01:20:04 -0000 1.12.2.4 +++ openacs-4/contrib/packages/project-manager/project-manager.info 4 Feb 2004 20:17:19 -0000 1.12.2.5 @@ -6,23 +6,24 @@ Project Managers f f - - + project-manager + + Jade Rubick Project management tool for OpenACS - 2003-10-08 - Track tasks, estimates and actual progress for a project. See the <a href="http://openacs.org/projects/dotwrk/project_management/">project page</a> for more information. + 2004-02-04 + Track tasks, estimates and actual progress for a project. See the <a href="http://openacs.org/projects/dotwrk/project_management/">project page</a> for more information. - + - + Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-custom-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-custom-create.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-custom-create.sql 13 Dec 2003 01:19:54 -0000 1.1.2.1 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-custom-create.sql 4 Feb 2004 20:17:19 -0000 1.1.2.2 @@ -15,8 +15,10 @@ -- you should use the content_type__create_attribute procedure to add -- in columns so that the views are correctly recreated. +-- PROJECTS --- add in extra columns +-- example, using customer +-- this is actually done in the table-create script --select content_type__create_attribute( -- 'pm_project', Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-custom-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-custom-drop.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-custom-drop.sql 13 Dec 2003 01:19:54 -0000 1.1.2.1 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-custom-drop.sql 4 Feb 2004 20:17:19 -0000 1.1.2.2 @@ -6,8 +6,6 @@ -- @cvs-id $Id$ -- --- drop any custom tables here. +select content_type__drop_attribute ('pm_project', 'customer_id', 't'); --- select content_type__drop_attribute ('pm_project', 'customer_id', 't'); - - +-- drop any custom tables here. Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-drop.sql,v diff -u -r1.10.2.4 -r1.10.2.5 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql 10 Jan 2004 01:04:02 -0000 1.10.2.4 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql 4 Feb 2004 20:17:19 -0000 1.10.2.5 @@ -10,6 +10,9 @@ -- TASKS -------- +\i project-manager-custom-drop.sql +\i project-manager-notifications-drop.sql + -- task dependency types drop table pm_task_dependency_types cascade; drop table pm_task_dependency cascade; @@ -84,7 +87,7 @@ create function inline_0 () returns integer as ' declare - v_folder_id cr_folders.folder_id%TYPE; + v_folder_id cr_folders.folder_id%TYPE; v_item_id cr_items.item_id%TYPE; v_item_cursor RECORD; begin @@ -98,16 +101,16 @@ where content_type = ''pm_project'' LOOP - PERFORM pm_project__delete_project_item(v_item_cursor.item_id); + PERFORM pm_project__delete_project_item(v_item_cursor.item_id); END LOOP; select content_item__get_id(''projects'', null, ''f'') into v_folder_id from dual; -- unregister_content_types PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id - ''pm_project'', -- content_type - ''t'' -- include_subtypes + v_folder_id, -- folder_id + ''pm_project'', -- content_type + ''t'' -- include_subtypes ); -- this table must not hold reference to ''pm_project'' type @@ -124,7 +127,7 @@ where f.folder_id = i.item_id and description = ''Project Repository'' LOOP - PERFORM content_item__delete(v_item_cursor.folder_id); + PERFORM content_item__delete(v_item_cursor.folder_id); END LOOP; return 0; @@ -143,16 +146,56 @@ drop sequence pm_project_status_seq; drop table pm_project_status; -drop table pm_project_category_map; +-- unregister content_types from folder +create function inline_0 () +returns integer as ' +declare + v_folder_id cr_folders.folder_id%TYPE; + v_item_id cr_items.item_id%TYPE; + v_item_cursor RECORD; +begin -drop sequence pm_project_category_seq; -drop table pm_project_category; + -- delete all contents of projects folder + FOR v_item_cursor IN + select + item_id + from + cr_items + where + content_type = ''pm_task'' + LOOP + PERFORM pm_project__delete_task_item(v_item_cursor.item_id); + END LOOP; + --select content_item__get_id(''tasks'', null, ''f'') into v_folder_id from dual; + + -- unregister_content_types + --PERFORM content_folder__unregister_content_type ( + -- v_folder_id, -- folder_id + -- ''pm_tasks'', -- content_type + -- ''t'' -- include_subtypes + --); + + -- this table must not hold reference to ''pm_project'' type + delete from cr_folder_type_map where content_type = ''pm_tasks''; + + -- delete projects folder + --PERFORM content_folder__delete(v_folder_id); + + return 0; +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + + select content_type__drop_type('pm_task', 't', 'f'); drop table pm_tasks cascade; drop table pm_tasks_revisions cascade; + select content_type__drop_type('pm_project', 't', 'f'); -- note that the Project Repository folder is not deleted Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-functions-create.sql,v diff -u -r1.8.2.4 -r1.8.2.5 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql 10 Jan 2004 01:04:02 -0000 1.8.2.4 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql 4 Feb 2004 20:17:19 -0000 1.8.2.5 @@ -22,8 +22,8 @@ v_pm_project_name pm_projects.project_name%TYPE; begin select project_name || ''_'' || p_pm_project_id into v_pm_project_name - from pm_projects - where project_id = p_pm_project_id; + from pm_projectsx + where item_id = p_pm_project_id; return v_pm_project_name; end; ' language 'plpgsql'; @@ -130,10 +130,9 @@ -- is null. Otherwise a project folder will be created as a sub-folder -- of an existing project folder. -select define_function_args('pm_project__new_project_item', 'project_id, project_name, project_code, parent_id, goal, description, planned_start_date, planned_end_date, actual_start_date, actual_end_date, ongoing_p, status_id, creation_date, creation_user, creation_ip, package_id'); +select define_function_args('pm_project__new_project_item', 'project_name, project_code, parent_id, goal, description, planned_start_date, planned_end_date, actual_start_date, actual_end_date, ongoing_p, status_id, customer_id, creation_date, creation_user, creation_ip, package_id'); create function pm_project__new_project_item ( - integer, -- project_id varchar, -- project_name varchar, -- project_code integer, -- parent_id @@ -145,25 +144,26 @@ timestamptz, -- actual_end_date char(1), -- ongoing_p integer, -- status_id + integer, -- customer_id (organization_id) timestamptz, -- creation_date integer, -- creation_user varchar, -- creation_ip integer -- package_id ) returns integer as ' declare - p_project_id alias for $1; - p_project_name alias for $2; - p_project_code alias for $3; - p_parent_id alias for $4; - p_goal alias for $5; - p_description alias for $6; - p_planned_start_date alias for $7; - p_planned_end_date alias for $8; - p_actual_start_date alias for $9; - p_actual_end_date alias for $10; - p_ongoing_p alias for $11; - p_status_id alias for $12; + p_project_name alias for $1; + p_project_code alias for $2; + p_parent_id alias for $3; + p_goal alias for $4; + p_description alias for $5; + p_planned_start_date alias for $6; + p_planned_end_date alias for $7; + p_actual_start_date alias for $8; + p_actual_end_date alias for $9; + p_ongoing_p alias for $10; + p_status_id alias for $11; + p_customer_id alias for $12; p_creation_date alias for $13; p_creation_user alias for $14; p_creation_ip alias for $15; @@ -228,14 +228,14 @@ ongoing_p, estimated_finish_date, earliest_finish_date, latest_finish_date, actual_hours_completed, - estimated_hours_total, status_id) + estimated_hours_total, status_id, customer_id) values ( v_revision_id, p_project_code, p_goal, p_planned_start_date, p_planned_end_date, p_actual_start_date, p_actual_end_date, p_ongoing_p, p_planned_end_date, p_planned_end_date, p_planned_end_date, ''0'', - ''0'', p_status_id + ''0'', p_status_id, p_customer_id ); PERFORM acs_permission__grant_permission( @@ -260,9 +260,6 @@ begin raise NOTICE ''Deleting pm_project...''; - delete from acs_permissions - where object_id = p_project_id; - for v_child in select item_id from @@ -274,15 +271,14 @@ PERFORM pm_project__delete_project_item(v_child.item_id); end loop; - delete from pm_projects - where project_id = p_project_id; + delete from pm_projects where project_id in (select revision_id from pm_projectsx where item_id = p_project_id); PERFORM content_item__delete(p_project_id); return 0; end;' language 'plpgsql'; -select define_function_args('pm_project__new_project_revision', 'item_id, project_name, project_code, parent_id, goal, description, planned_start_date, planned_end_date, actual_start_date, actual_end_date, ongoing_p, status_id, creation_date, creation_user, creation_ip, package_id'); +select define_function_args('pm_project__new_project_revision', 'item_id, project_name, project_code, parent_id, goal, description, planned_start_date, planned_end_date, actual_start_date, actual_end_date, ongoing_p, status_id, organization_id, creation_date, creation_user, creation_ip, package_id'); create function pm_project__new_project_revision ( integer, -- item_id @@ -297,6 +293,7 @@ timestamptz, -- actual_end_date char(1), -- ongoing_p integer, -- status_id + integer, -- organization_id (customer) timestamptz, -- creation_date integer, -- creation_user varchar, -- creation_ip @@ -316,10 +313,11 @@ p_actual_end_date alias for $10; p_ongoing_p alias for $11; p_status_id alias for $12; - p_creation_date alias for $13; - p_creation_user alias for $14; - p_creation_ip alias for $15; - p_package_id alias for $16; + p_organizaion_id alias for $13; + p_creation_date alias for $14; + p_creation_user alias for $15; + p_creation_ip alias for $16; + p_package_id alias for $17; v_revision_id cr_revisions.revision_id%TYPE; begin @@ -346,13 +344,15 @@ project_id, project_code, goal, planned_start_date, planned_end_date, actual_start_date, actual_end_date, - ongoing_p, status_id) + ongoing_p, status_id, customer_id) values ( v_revision_id, p_project_code, p_goal, p_planned_start_date, p_planned_end_date, p_actual_start_date, - p_actual_end_date, p_ongoing_p, p_status_id); + p_actual_end_date, p_ongoing_p, p_status_id, p_organization_id); + -- make sure organizations are in as well + PERFORM acs_permission__grant_permission( v_revision_id, p_creation_user, @@ -422,10 +422,9 @@ -- If it is not associated with a project, then it is placed in the root -- project repository folder. -select define_function_args('pm_task__new_task_item', 'task_id, project_id, title, description, end_date, percent_complete, estimated_hours_work, estimated_hours_work_min, estimated_hours_work_max, creation_date, creation_user, creation_ip, package_id'); +select define_function_args('pm_task__new_task_item', 'project_id, title, description, end_date, percent_complete, estimated_hours_work, estimated_hours_work_min, estimated_hours_work_max, creation_date, creation_user, creation_ip, package_id'); create function pm_task__new_task_item ( - integer, -- task_id integer, -- project_id varchar, -- title varchar, -- description @@ -441,19 +440,18 @@ ) returns integer as ' declare - p_task_id alias for $1; - p_project_id alias for $2; - p_title alias for $3; - p_description alias for $4; - p_end_date alias for $5; - p_percent_complete alias for $6; - p_estimated_hours_work alias for $7; - p_estimated_hours_work_min alias for $8; - p_estimated_hours_work_max alias for $9; - p_creation_date alias for $10; - p_creation_user alias for $11; - p_creation_ip alias for $12; - p_package_id alias for $13; + p_project_id alias for $1; + p_title alias for $2; + p_description alias for $3; + p_end_date alias for $4; + p_percent_complete alias for $5; + p_estimated_hours_work alias for $6; + p_estimated_hours_work_min alias for $7; + p_estimated_hours_work_max alias for $8; + p_creation_date alias for $9; + p_creation_user alias for $10; + p_creation_ip alias for $11; + p_package_id alias for $12; v_item_id cr_items.item_id%TYPE; v_revision_id cr_revisions.revision_id%TYPE; @@ -602,11 +600,6 @@ declare p_task_id alias for $1; begin - -- will not work because permissions are on revision_id not - -- item_id - -- delete from acs_permissions - -- where object_id = p_task_id; - delete from pm_tasks_revisions where task_revision_id in (select revision_id from pm_tasks_revisionsx where item_id = p_task_id); 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.15.2.4 -r1.15.2.5 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 10 Jan 2004 01:04:02 -0000 1.15.2.4 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 4 Feb 2004 20:17:19 -0000 1.15.2.5 @@ -1,7 +1,6 @@ -- TODO: -- -- need to add in workflow (for status among other things) --- add categories to projects -- -- packages/project-manager/sql/postgresql/project-manager-table-create.sql @@ -23,8 +22,8 @@ description varchar(100), -- closed or open status_type char(1) default 'c' - constraint pm_projects_status_type_ck - check (status_type in ('c','o')) + constraint pm_projects_status_type_ck + check (status_type in ('c','o')) ); insert into pm_project_status (status_id, description, status_type) values @@ -33,27 +32,29 @@ (2, 'Closed', 'c'); +-- project revisions, items are kept in cr_items + create table pm_projects ( - project_id integer - constraint project_manager_id_fk - references cr_revisions on delete cascade - constraint pm_projects_id_pk - primary key, - -- a user-specified project code - project_code varchar(255), - goal varchar(4000), - planned_start_date timestamptz, - planned_end_date timestamptz, - actual_start_date timestamptz, - actual_end_date timestamptz, + project_id integer + constraint pm_proj_rev_fk + references cr_revisions on delete cascade + constraint pm_proj_rev_pk + primary key, + -- a user-specified project code + project_code varchar(255), + goal varchar(4000), + planned_start_date timestamptz, + planned_end_date timestamptz, + actual_start_date timestamptz, + actual_end_date timestamptz, status_id integer constraint pm_projects_status_id_nn not null constraint pm_projects_status_id_fk references pm_project_status, - ongoing_p char(1) default 'f' - constraint pm_projects_ongoing_p_ck - check (ongoing_p in ('t','f')), + ongoing_p char(1) default 'f' + constraint pm_projects_ongoing_p_ck + check (ongoing_p in ('t','f')), -- denormalized, computed values -- these are computed but stored in projects table for efficient -- access. @@ -67,16 +68,31 @@ -- create the content type select content_type__create_type ( - 'pm_project', -- content_type - 'content_revision', -- supertype - 'Project', -- pretty_name - 'Projects', -- pretty_plural - 'pm_projects', -- table_name - 'project_id', -- id_column - 'pm_project__name' -- name_method + 'pm_project', -- content_type + 'content_revision', -- supertype + 'Project', -- pretty_name + 'Projects', -- pretty_plural + 'pm_projects', -- table_name + 'project_id', -- id_column + 'pm_project__name' -- name_method ); +-- this adds in the customer column. This is an example of how +-- the custom columns are added in. I put this here as a reminder +-- that other columns can be added in as well. These custom items +-- are in the custom-create.sql script +select content_type__create_attribute( + 'pm_project', + 'customer_id', + 'integer', + 'Customer', + 'Customers', + null, + null, + 'integer constraint pm_project_customer_fk references organizations' +); + -- ROLES create sequence pm_role_seq start 4; @@ -106,7 +122,6 @@ insert into pm_roles (role_id, one_line, description, sort_order) values ('1','Lead','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','Player','A person on the team responsible for completion of the project','20'); - insert into pm_roles (role_id, one_line, description, sort_order, is_observer_p) values ('3','Watcher','A person interested in developments, possibly helping out on it.','30','t'); @@ -131,7 +146,7 @@ create table pm_project_assignment ( project_id integer - constraint pm_project_role_map_project_fk + constraint pm_proj_role_map_project_fk references pm_projects on delete cascade, role_id integer @@ -206,7 +221,7 @@ -- create the content type select content_type__create_type ( 'pm_task', -- content_type - 'content_revision', -- supertype + 'content_revision', -- supertype 'Task', -- pretty_name 'Tasks', -- pretty_plural 'pm_tasks_revisions', -- table_name (should this be pm_task?) Index: openacs-4/contrib/packages/project-manager/tcl/project-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-procs-postgresql.xql,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/project-manager/tcl/project-procs-postgresql.xql 4 Sep 2003 22:45:22 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs-postgresql.xql 4 Feb 2004 20:17:19 -0000 1.2.2.1 @@ -3,6 +3,29 @@ postgresql7.1 + + + select pm_project__new_project_item ( + :project_name, + :project_code, + :parent_id, + :goal, + :description, + to_timestamp(:planned_start_date,'YYYY MM DD HH24 MI SS'), + to_timestamp(:planned_end_date,'YYYY MM DD HH24 MI SS'), + null, + null, + :ongoing_p, + :status_id, + :organization_id, + current_timestamp, + :creation_user, + :creation_ip, + :package_id + ); + + + select Index: openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-procs.tcl,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 10 Jan 2004 01:04:02 -0000 1.3.2.1 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 4 Feb 2004 20:17:19 -0000 1.3.2.2 @@ -12,6 +12,30 @@ namespace eval project_manager::project {} +ad_proc -public project_manager::project::new { + -project_name:required + {-project_code ""} + {-parent_id ""} + {-goal ""} + {-description ""} + {-planned_start_date ""} + {-planned_end_date ""} + {-actual_start_date ""} + {-actual_end_date ""} + {-ongoing_p "f"} + -status_id:required + -organization_id:required + {-creation_date ""} + -creation_user:required + -creation_ip:required + -package_id:required +} { + + set return_val [db_exec_plsql new_project_item { *SQL }] + + return $return_val +} + ad_proc -public project_manager::project::latest_start { end_date_j hours_to_complete Index: openacs-4/contrib/packages/project-manager/www/add-edit-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/add-edit-2-postgresql.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/contrib/packages/project-manager/www/add-edit-2-postgresql.xql 13 Dec 2003 01:19:54 -0000 1.1.2.1 +++ openacs-4/contrib/packages/project-manager/www/add-edit-2-postgresql.xql 4 Feb 2004 20:17:19 -0000 1.1.2.2 @@ -6,8 +6,7 @@ p.item_id as project_item_id, p.project_id, p.title as project_name, - p.description, - p.customer_id + p.description FROM pm_projectsx p WHERE @@ -19,7 +18,7 @@ UPDATE pm_projects set - customer_id = :customer_id + WHERE project_id = :project_id Index: openacs-4/contrib/packages/project-manager/www/add-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/add-edit-2.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/contrib/packages/project-manager/www/add-edit-2.tcl 13 Dec 2003 01:19:54 -0000 1.1.2.1 +++ openacs-4/contrib/packages/project-manager/www/add-edit-2.tcl 4 Feb 2004 20:17:19 -0000 1.1.2.2 @@ -68,11 +68,6 @@ {value $description} } - {customer_id:text(select),optional - {label "Customer"} - {options {{"--- TBD ---" ""} [db_list_of_lists get_customer "select o.name, o.organization_id from organizations o order by o.name"]}} - } - } \ -select_query_name project_query \ -on_submit { Index: openacs-4/contrib/packages/project-manager/www/add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/add-edit-postgresql.xql,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/contrib/packages/project-manager/www/add-edit-postgresql.xql 4 Dec 2003 21:00:13 -0000 1.9.2.1 +++ openacs-4/contrib/packages/project-manager/www/add-edit-postgresql.xql 4 Feb 2004 20:17:19 -0000 1.9.2.2 @@ -2,23 +2,7 @@ - SELECT - p.item_id as project_item_id, - p.parent_id, - p.project_id, - p.title as project_name, - p.project_code, - p.goal, - p.description, - p.status_id, - to_char(p.planned_start_date,'YYYY MM DD') as planned_start_date, - to_char(p.planned_end_date,'YYYY MM DD') as planned_end_date, - p.ongoing_p - FROM - pm_projectsx p - WHERE - p.item_id = :project_item_id and - p.project_id = :project_id + select p.end_date from pm_tasks_revisions p @@ -34,7 +18,6 @@ select pm_project__new_project_item ( - :project_id, :project_name, :project_code, :parent_id, Index: openacs-4/contrib/packages/project-manager/www/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/add-edit.tcl,v diff -u -r1.12.2.5 -r1.12.2.6 --- openacs-4/contrib/packages/project-manager/www/add-edit.tcl 15 Jan 2004 01:20:04 -0000 1.12.2.5 +++ openacs-4/contrib/packages/project-manager/www/add-edit.tcl 4 Feb 2004 20:17:19 -0000 1.12.2.6 @@ -10,7 +10,6 @@ @return title Page title. } { - project_id:integer,optional {project_revision_id ""} {project_item_id ""} @@ -19,6 +18,7 @@ {parent_id ""} {goal ""} {description ""} + {customer_id ""} {planned_start_date ""} {planned_end_date ""} {deadline_scheduling ""} @@ -68,11 +68,11 @@ {parent_id:text(hidden) {value $parent_id} } - + {project_item_id:text(hidden) {value $project_item_id} } - + {project_name:text {label "[set project_term] name"} {value $project_name} @@ -84,6 +84,11 @@ {value $description} {html { rows 5 cols 40 wrap soft}}} + {customer_id:text(select),optional + {label "Customer"} + {options {{"--- TBD ---" ""} [db_list_of_lists get_customer "select o.name, o.organization_id from organizations o order by o.name"]}} + } + {planned_start_date:date,to_sql(linear_date) {label "Starts"} {format "MONTH DD YYYY"} @@ -154,18 +159,43 @@ } + + ad_form -extend -name add_edit \ -select_query_name project_query \ -on_submit { + set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] } -new_data { - set project_id [db_exec_plsql new_project_item { *SQL* }] + + + set project_id [project_manager::project::new \ + -project_name $project_name \ + -project_code $project_code \ + -parent_id $parent_id \ + -goal $goal \ + -description $description \ + -planned_start_date $planned_start_date \ + -planned_end_date $planned_end_date \ + -actual_start_date "" \ + -actual_end_date "" \ + -ongoing_p $ongoing_p \ + -status_id $status_id \ + -organization_id $customer_id \ + -creation_date "" \ + -creation_user $user_id \ + -creation_ip $peeraddr \ + -package_id $package_id + ] + set project_item_id [db_string get_item_id { }] - category::map_object -remove_old -object_id $project_item_id $category_ids + if {[exists_and_not_null category_ids]} { + category::map_object -remove_old -object_id $project_item_id $category_ids + } if {$use_project_customizations_p} { ad_returnredirect "add-edit-2?[export_url_vars project_item_id project_id]" @@ -177,18 +207,22 @@ } -edit_data { +ns_log Notice "edit" set project_id [db_exec_plsql new_project_revision { *SQL* }] project_manager::project::compute_parent_status $project_item_id category::map_object -remove_old -object_id $project_item_id $category_ids } -after_submit { - + +ns_log Notice "after_submit" if {$use_project_customizations_p} { ad_returnredirect "add-edit-2?[export_url_vars project_id]" ad_script_abort } else { ad_returnredirect "one?[export_url_vars project_id]" ad_script_abort } - } +} + +ns_log Notice "end of it all" Index: openacs-4/contrib/packages/project-manager/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/index-postgresql.xql,v diff -u -r1.8.2.4 -r1.8.2.5 --- openacs-4/contrib/packages/project-manager/www/index-postgresql.xql 15 Jan 2004 01:20:04 -0000 1.8.2.4 +++ openacs-4/contrib/packages/project-manager/www/index-postgresql.xql 4 Feb 2004 20:17:19 -0000 1.8.2.5 @@ -5,7 +5,7 @@ SELECT - p.item_id, + p.item_id as project_item_id, p.project_id, p.parent_id as folder_id, p.object_type as content_type, @@ -21,12 +21,29 @@ to_char(p.estimated_finish_date, 'MM/DD/YY') as estimated_finish_date, to_char(p.earliest_finish_date, 'MM/DD/YY') as earliest_finish_date, to_char(p.latest_finish_date, 'MM/DD/YY') as latest_finish_date, - o.name as customer_name - FROM pm_projectsx p LEFT JOIN organizations o ON p.customer_id = o.organization_id LEFT JOIN (select om.category_id, om.object_id, t.name as category_name from category_object_map om, category_translations t, categories ctg where om.category_id = t.category_id and ctg.category_id = t.category_id and ctg.deprecated_p = 'f') c ON p.item_id = c.object_id, + case when o.name is null then '--no customer--' else o.name end as customer_name, + o.organization_id + FROM pm_projectsx p + LEFT JOIN organizations o ON p.customer_id = o.organization_id + LEFT JOIN ( + select + om.category_id, + om.object_id, + t.name as category_name + from + category_object_map om, + category_translations t, + categories ctg + where + om.category_id = t.category_id and + ctg.category_id = t.category_id and + ctg.deprecated_p = 'f') + c ON p.item_id = c.object_id, cr_items i, pm_project_status s - WHERE p.project_id = i.live_revision and - s.status_id = p.status_id + WHERE + p.project_id = i.live_revision and + s.status_id = p.status_id [template::list::filter_where_clauses -and -name projects] [template::list::orderby_clause -orderby -name projects] Index: openacs-4/contrib/packages/project-manager/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/index.tcl,v diff -u -r1.9.2.5 -r1.9.2.6 --- openacs-4/contrib/packages/project-manager/www/index.tcl 15 Jan 2004 01:20:04 -0000 1.9.2.5 +++ openacs-4/contrib/packages/project-manager/www/index.tcl 4 Feb 2004 20:17:19 -0000 1.9.2.6 @@ -16,9 +16,8 @@ } { orderby_project:optional - status_id:optional + {status_id:integer,optional} category_id:multiple,optional - {subprojects_p ""} } -properties { context:onevalue @@ -57,29 +56,51 @@ # root CR folder set root_folder [db_string get_root "select pm_project__get_root_folder (:package_id, 'f')"] -# hack to make the subprojects filter work -#if {[string equal $subprojects_p "t"]} { -# set subprojects_p "" -#} - - # Projects, using list-builder --------------------------------- +# set default values +if {![exists_and_not_null status_id]} { + set status_id [db_string get_def_status "select status_id from pm_project_status where description = 'Open'"] +} # Categories are arranges into category trees. # Set up an array for each tree. The array contains the category for each tree -db_foreach get_choices "select t.name as cat_name, t.category_id as cat_id, tm.tree_id from category_tree_map tm, categories c, category_translations t where c.tree_id = tm.tree_id and c.category_id = t.category_id and tm.object_id = :package_id order by t.name" { +db_foreach get_choices " +select +t.name as cat_name, +t.category_id as cat_id, +tm.tree_id +from +category_tree_map tm, +categories c, +category_translations t +where +c.tree_id = tm.tree_id and +c.category_id = t.category_id and +tm.object_id = :package_id and +c.deprecated_p = 'f' +order +by t.name" { lappend category_choices($tree_id) [list $cat_name $cat_id] } # We want to set up a filter for each category tree. -set export_vars [export_vars -form {status_id subprojects_p orderby}] +set export_vars [export_vars -form {status_id orderby}] set category_select "" -foreach tree_list [db_list_of_lists get_category_trees "select tt.name as tree_name, tt.tree_id from category_tree_map tm, category_tree_translations tt where tm.object_id = :package_id and tm.tree_id = tt.tree_id"] { +foreach tree_list [db_list_of_lists get_category_trees " +select +tt.name as tree_name, +tt.tree_id +from +category_tree_map tm, +category_tree_translations tt +where +tm.object_id = :package_id and +tm.tree_id = tt.tree_id"] { set tree_name [lindex $tree_list 0] set tree_id [lindex $tree_list 1] @@ -112,16 +133,19 @@ template::list::create \ -name projects \ -multirow projects \ - -key item_id \ + -key project_item_id \ -elements { + customer_name { + label "Customer" + display_template " + @projects.customer_name@@projects.customer_name@ + " + } project_name { label "Project name" link_url_col item_url link_html { title "View this project version" } } - customer_name { - label "Customer" - } earliest_finish_date { label "Earliest finish" } @@ -134,7 +158,7 @@ } category_id { label "Categories" - display_template "
  • @projects.category_name@" + display_template "
  • @projects.category_name@" } } \ -actions { @@ -152,26 +176,25 @@ values {[db_list_of_lists get_status "select description, status_id from pm_project_status order by status_type desc, description"]} where_clause {s.status_id = :status_id} } - subprojects_p { - label Subprojects - values {{"No" "f"} {"Yes" ""}} - default_value {f} - has_default_p 0 - where_clause {p.parent_id = :root_folder} - } category_id { label Categories where_clause {c.category_id = [join [value_if_exists category_id] ","]} } } \ -orderby { - default_value project_name,asc + default_value customer_name,asc project_name { label "Project name" orderby_desc "upper(p.title) desc" orderby_asc "upper(p.title) asc" default_direction asc } + customer_name { + label "Customer Name" + orderby_desc "upper(o.name) desc, earliest_finish_date desc" + orderby_asc "upper(o.name) asc, earliest_finish_date asc" + default_direction asc + } category_id { label "Categories" orderby_desc "c.category_name desc" @@ -187,7 +210,7 @@ db_multirow -extend { item_url } projects project_folders { } { - set item_url [export_vars -base "one" -override {{project_item_id $item_id}} {project_item_id}] + set item_url [export_vars -base "one" {project_item_id}] } Index: openacs-4/contrib/packages/project-manager/www/one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one-postgresql.xql,v diff -u -r1.19.2.3 -r1.19.2.4 --- openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 10 Jan 2004 01:04:02 -0000 1.19.2.3 +++ openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 4 Feb 2004 20:17:19 -0000 1.19.2.4 @@ -102,7 +102,7 @@ t.estimated_hours_work_max, t.actual_hours_worked FROM - (select * from pm_tasks_revisionsx LEFT JOIN pm_task_assignment ON item_id = task_id) t LEFT JOIN all_users u ON t.party_id = u.party_id, cr_items i LEFT JOIN pm_task_dependency d ON i.item_id = d.task_id + (select * from pm_tasks_revisionsx LEFT JOIN pm_task_assignment ON item_id = task_id) t LEFT JOIN persons u ON t.party_id = u.person_id, cr_items i LEFT JOIN pm_task_dependency d ON i.item_id = d.task_id WHERE t.parent_id = :project_item_id and t.revision_id = i.live_revision @@ -150,6 +150,13 @@ + SELECT + p.customer_id, + FROM + pm_projectsx p + LEFT JOIN organizations c ON p.customer_id = c.organization_id + WHERE + p.project_id = :original_project_id Index: openacs-4/contrib/packages/project-manager/www/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one.adp,v diff -u -r1.27.2.4 -r1.27.2.5 --- openacs-4/contrib/packages/project-manager/www/one.adp 10 Jan 2004 01:04:02 -0000 1.27.2.4 +++ openacs-4/contrib/packages/project-manager/www/one.adp 4 Feb 2004 20:17:19 -0000 1.27.2.5 @@ -2,7 +2,7 @@ -@project_term@ #@project_item_id@: @project.project_name@ +@project_term@ #@project_item_id@: @project.project_name;noquote@ @context_bar;noquote@ @@ -76,17 +76,32 @@ Earliest finish - @project.earliest_finish_date@ + + @project.earliest_finish_date@ + + + Ongoing + Deadline - @project.planned_end_date@ + + @project.planned_end_date@ + + + Ongoing + Latest finish - @project.latest_finish_date@ + + @project.latest_finish_date@ + + + Ongoing + @@ -97,10 +112,32 @@ +

    + +

    + + + + +
    Project information
    + + + + + + +
    Customer@custom.customer_name@
    +
    + + +

    + + + @@ -123,26 +160,15 @@
    Categories
    -

    - - - - - -
    Project information
    - - - -

    Add subproject

    Subprojects: - People: - + Index: openacs-4/contrib/packages/project-manager/www/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one.tcl,v diff -u -r1.26.2.4 -r1.26.2.5 --- openacs-4/contrib/packages/project-manager/www/one.tcl 10 Jan 2004 01:04:02 -0000 1.26.2.4 +++ openacs-4/contrib/packages/project-manager/www/one.tcl 4 Feb 2004 20:17:19 -0000 1.26.2.5 @@ -360,6 +360,8 @@ db_1row custom_query { } -column_array custom +set custom(pretty_target_rollout) [lc_time_fmt $custom(target_rollout) "%x"] + # end of customizations Index: openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-add-edit-postgresql.xql,v diff -u -r1.11.2.2 -r1.11.2.3 --- openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 10 Jan 2004 01:04:02 -0000 1.11.2.2 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 4 Feb 2004 20:17:19 -0000 1.11.2.3 @@ -22,7 +22,6 @@ select pm_task__new_task_item ( - null, :project_item_id, :p_task_title, :p_description, 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.16.2.1 -r1.16.2.2 --- openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 10 Jan 2004 01:04:02 -0000 1.16.2.1 +++ openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 4 Feb 2004 20:17:19 -0000 1.16.2.2 @@ -53,13 +53,17 @@ t.estimated_hours_work_min, t.estimated_hours_work_max, t.percent_complete, - i.live_revision + i.live_revision, + p.first_names || ' ' || p.last_name as creation_user FROM - pm_tasks_revisionsx t, cr_items i + pm_tasks_revisionsx t, + cr_items i, + persons p WHERE t.item_id = :task_id and t.revision_id = :task_revision_id and - t.item_id = i.item_id + t.item_id = i.item_id and + t.creation_user = p.person_id @@ -70,17 +74,18 @@ t.revision_id, i.live_revision, t.title as task_title, - t.description, + t.description || ' -- ' || p.first_names || ' ' || p.last_name as description, to_char(t.end_date,'MM/DD/YYYY') as end_date, t.percent_complete, t.estimated_hours_work_min, t.estimated_hours_work_max, t.actual_hours_worked FROM - pm_tasks_revisionsx t, cr_items i + pm_tasks_revisionsx t, cr_items i, persons p WHERE t.item_id = :task_id and - t.item_id = i.item_id + t.item_id = i.item_id and + t.creation_user = p.person_id [template::list::orderby_clause -name revisions -orderby] 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.19.2.2 -r1.19.2.3 --- openacs-4/contrib/packages/project-manager/www/task-one.adp 10 Jan 2004 01:04:02 -0000 1.19.2.2 +++ openacs-4/contrib/packages/project-manager/www/task-one.adp 4 Feb 2004 20:17:19 -0000 1.19.2.3 @@ -28,6 +28,8 @@ Description @task_info.description;noquote@ + +-- @task_info.creation_user@ Index: openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/tasks-postgresql.xql,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql 15 Jan 2004 01:20:49 -0000 1.1.2.3 +++ openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql 4 Feb 2004 20:17:19 -0000 1.1.2.4 @@ -10,7 +10,11 @@ t.task_revision_id, t.title, t.description, - to_char(t.end_date,'YYYY-MM-DD HH24:MI') as end_date, + to_char(t.earliest_start,'J') as earliest_start_j, + to_char(current_timestamp,'J') as today_j, + to_char(t.latest_start,'J') as latest_start_j, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, t.percent_complete, t.estimated_hours_work, t.estimated_hours_work_min, Index: openacs-4/contrib/packages/project-manager/www/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/tasks.tcl,v diff -u -r1.1.2.4 -r1.1.2.5 --- openacs-4/contrib/packages/project-manager/www/tasks.tcl 10 Jan 2004 01:04:02 -0000 1.1.2.4 +++ openacs-4/contrib/packages/project-manager/www/tasks.tcl 4 Feb 2004 20:17:19 -0000 1.1.2.5 @@ -62,6 +62,7 @@ label "\#" link_url_col item_url link_html { title "View this project version" } + display_template {@tasks.task_id@} } title { label "Subject" @@ -73,9 +74,15 @@ description { label "Description" } - end_date { - label "Deadline" + slack_time { + label "Slack time" } + latest_start_pretty { + label "Latest Start" + } + latest_finish_pretty { + label "Latest Finish" + } actual_hours_worked { label "Hours completed" display_template "@tasks.actual_hours_worked@/@tasks.estimated_hours_work@" @@ -93,13 +100,10 @@ -filters { searchterm { label "Search" - where_clause { - t.title ilike '%:searchterm%' - } } party_id { label "People" - values {[db_list_of_lists get_people "select first_names || ' ' || last_name, u.party_id from all_users u, pm_task_assignment a where u.party_id = a.party_id order by upper(first_names), upper(last_name)"]} + values {[db_list_of_lists get_people "select distinct(first_names || ' ' || last_name) as fullname, u.person_id from persons u, pm_task_assignment a where u.person_id = a.party_id order by fullname"]} where_clause { t.party_id = :party_id } @@ -126,9 +130,24 @@ } -db_multirow -extend { item_url } tasks tasks { +db_multirow -extend { item_url latest_start_pretty latest_finish_pretty slack_time} tasks tasks { } { set item_url [export_vars -base "task-one" {task_id}] + + set latest_start_pretty [lc_time_fmt $latest_start "%x"] + set latest_finish_pretty [lc_time_fmt $latest_finish "%x"] + + if {[exists_and_not_null earliest_start_j]} { + if {$earliest_start_j < $today_j} { + set slack_time "[expr $latest_start_j - $today_j] days" + } else { + set slack_time "[expr $latest_start_j - $earliest_start_j] days" + } + } else { + set slack_time "n/a" + } + + }