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.2 -r1.3 --- openacs-4/contrib/packages/project-manager/project-manager.info 15 Jun 2003 12:59:06 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/project-manager.info 30 Jul 2003 20:42:05 -0000 1.3 @@ -6,15 +6,16 @@ Project Managers f f - - + /project-manager + + Jade Rubick Nick Carroll Project management for OpenACS - OpenACS - http://openacs.org/projects/dotwrk/project_management + 2003-07-18 + http://openacs.org/projects/dotwrk/project_management/ - + 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.2 -r1.3 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql 15 Jun 2003 13:01:52 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql 30 Jul 2003 20:42:05 -0000 1.3 @@ -26,17 +26,12 @@ from cr_items where parent_id = v_folder_id LOOP - PERFORM pm_project__delete_project_item(v_item_cursor.item_id); + PERFORM pm_projects__delete_project_item(v_item_cursor.item_id); END LOOP; -- unregister_content_types PERFORM content_folder__unregister_content_type ( v_folder_id, -- folder_id - ''content_revision'', -- content_type - ''t'' -- include_subtypes - ); - PERFORM content_folder__unregister_content_type ( - v_folder_id, -- folder_id ''pm_project'', -- content_type ''t'' -- include_subtypes ); @@ -54,27 +49,76 @@ select inline_0(); drop function inline_0(); --- drop package project-manager ---drop package, which drops all functions created with define_function_args ---select drop_package('pm_projects'); -drop function pm_project__name (integer); -drop function pm_project__new_root_folder (integer); -drop function pm_project__get_root_folder (integer); -drop function pm_project__new_project_folder (varchar, varchar, integer, - integer, varchar, integer); -drop function pm_project__new_project_item (integer, varchar, varchar, - integer, varchar, varchar, char(1), timestamptz, timestamptz, - timestamptz, timestamptz, char(1), timestamptz, integer, - varchar, integer); -drop function pm_project__delete_project_item (integer); -drop function pm_project__new_unique_name (integer); +----------- +-- PACKAGES +----------- -- delete content_type 'pm_project' -select acs_object_type__drop_type( - 'pm_project', -- object_type - 't' -- cascade_p - ); +create function inline_0 () +returns integer as ' +declare + v_pm_item cr_items%ROWTYPE; +begin + FOR v_pm_item in select + item_id + from + cr_items + where + content_type = ''pm_project'' + LOOP + PERFORM pm_project__delete_project_item(v_pm_item.item_id); + END LOOP; + + return 0; +end; +' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + +-- drop package, which drops all functions created with define_function_args +select drop_package('pm_project'); + --drop table -drop table pm_projects; -drop table pm_root_folders; \ No newline at end of file +drop table pm_projects cascade; + +select content_type__drop_type('pm_project', 't', 'f'); + +-------- +-- TASKS +-------- + + +create function inline_0 () +returns integer as ' +declare + v_item RECORD; + +begin + for v_item in select + item_id + from + cr_items + where + content_type = ''pm_task'' + LOOP + + PERFORM pm_task__delete_task_item(v_item); + end loop; + + return 0; +end; +' language 'plpgsql'; + +-- select inline_0(); +drop function inline_0(); + +select drop_package('pm_task'); + +select content_type__drop_type('pm_task', 't', 'f'); + +drop table pm_tasks cascade; +drop table pm_tasks_revisions cascade; + +-- 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.2 -r1.3 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql 15 Jun 2003 13:01:52 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql 30 Jul 2003 20:42:05 -0000 1.3 @@ -12,7 +12,9 @@ -- name of the object. This is a convention ensuring that all objects -- can be identified. Now we have to build that function. In this case, -- we'll return a field called title as the name. + select define_function_args('pm_project__name', 'project_id'); + create or replace function pm_project__name (integer) returns varchar as ' declare @@ -28,43 +30,44 @@ -- Create a new root folder + select define_function_args('pm_project__new_root_folder', 'package_id'); + create function pm_project__new_root_folder (integer) returns integer as ' declare p_package_id alias for $1; - v_folder_id pm_root_folders.folder_id%TYPE; + v_folder_id cr_folders.folder_id%TYPE; v_folder_name cr_items.name%TYPE; begin + + -- raise notice ''in new root folder''; + -- Set the folder name v_folder_name := pm_project__new_unique_name (p_package_id); v_folder_id := content_folder__new ( v_folder_name, -- name ''Projects'', -- label ''Project Repository'', -- description - null -- parent_id + null -- parent_id ); - insert into pm_root_folders - (package_id, folder_id) - values - (p_package_id, v_folder_id); - -- Register the standard content types - PERFORM content_folder__register_content_type ( - v_folder_id, -- folder_id - ''pm_project'', -- content_type - ''f'' -- include_subtypes + PERFORM content_folder__register_content_type ( + v_folder_id, -- folder_id + ''pm_project'', -- content_type + ''f'' -- include_subtypes ); - PERFORM content_folder__register_content_type( - v_folder_id, -- folder_id - ''content_folder'', -- content_type - ''f'' -- include_subtypes (default) - ); + -- there is no facility in the API for adding in the package_id, + -- so we have to do it ourselves + update cr_folders + set package_id = p_package_id + where folder_id = v_folder_id; + -- TODO: Handle Permissions here for this folder. return v_folder_id; @@ -74,111 +77,83 @@ -- Returns the root folder corresponding to a particular package instance. -- Creates a new root folder if one does not exist for the specified package -- instance. -select define_function_args('pm_project__get_root_folder', 'package_id'); -create function pm_project__get_root_folder (integer) + +select define_function_args('pm_project__get_root_folder', 'package_id,create_if_not_present_p'); + +create function pm_project__get_root_folder (integer, boolean) returns integer as ' declare p_package_id alias for $1; - v_folder_id pm_root_folders.folder_id%TYPE; + p_create_if_not_present_p alias for $2; + + v_folder_id cr_folders.folder_id%TYPE; v_count integer; begin - select count(*) into v_count - from pm_root_folders - where package_id = p_package_id; - if v_count > 0 then - select folder_id into v_folder_id - from pm_root_folders - where package_id = p_package_id; - else - -- Must be a new instance. Create a new root folder. - v_folder_id := pm_project__new_root_folder(p_package_id); - end if; + -- this function is not complete yet. It makes duplicates - return v_folder_id; -end; ' language 'plpgsql'; + -- raise notice ''in get root folder p_create_if_not_present_p = %'',p_create_if_not_present_p; + select count(*) into v_count + from cr_folders + where package_id = p_package_id; --- Create a new project folder. --- Top level project folders should be created under the PROJECTS --- container folder. --- Refer to file-storage-package-create.sql -select define_function_args('pm_project__new_project_folder', 'folder_name, description, parent_id, creation_user, creation_ip, package_id'); -create function pm_project__new_project_folder (varchar, varchar, integer, - integer, varchar, integer) -returns integer as ' -declare - p_folder_name alias for $1; - p_description alias for $2; - p_parent_id alias for $3; - p_creation_user alias for $4; - p_creation_ip alias for $5; - p_package_id alias for $6; + -- raise notice ''count is % for package_id %'', v_count, p_package_id; - v_folder_id cr_folders.folder_id%TYPE; - v_parent_id cr_items.parent_id%TYPE; - v_name cr_items.name%TYPE; -begin - -- If p_parent_id is null then treat the new folder as - -- a new root project folder. Therefore set parent_id to - -- the PROJECTS folder where all root project folders should - -- reside. - if p_parent_id is null - then - v_parent_id := pm_project__get_root_folder(p_package_id); + if v_count > 1 then + raise exception ''More than one project repository for this application instance''; + elsif v_count = 1 then + select folder_id into v_folder_id + from cr_folders + where package_id = p_package_id; else - v_parent_id := p_parent_id; - end if; + if p_create_if_not_present_p = true then + -- Must be a new instance. Create a new root folder. + raise notice ''creating a new root repository folder''; + v_folder_id := pm_project__new_root_folder(p_package_id); + else + -- raise notice ''setting to null''; + v_folder_id := null; + end if; + end if; - -- Set the folder name - v_name := pm_project__new_unique_name (p_package_id); + -- raise notice ''v_folder_id is %'', v_folder_id; - -- Create a new folder - v_folder_id := content_folder__new ( - v_name, -- name - p_folder_name, -- label - p_description, -- description - v_parent_id, -- parent_id - null, -- context_id - null, -- folder_id - now(), -- creation_date - p_creation_user, -- creation_user - p_creation_ip -- creation_ip - ); - - -- Register the standard content types - PERFORM content_folder__register_content_type ( - v_folder_id, -- folder_id - ''pm_project'', -- content_type - ''t'' -- include_subtypes - ); - - PERFORM content_folder__register_content_type( - v_folder_id, -- folder_id - ''content_folder'', -- content_type - ''t'' -- include_subtypes (default) - ); - - -- TODO: Handle Permissions here for this folder. - return v_folder_id; -end;' language 'plpgsql'; +end; ' language 'plpgsql'; -- Create a project item. + -- A project item should be placed within a folder. Therefore a new project -- item is associated with creating a new project folder that will contain -- the project item. A new root project folder will be created if parent_id -- 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, deadline_scheduling, planned_start_date, planned_end_date, actual_start_date, actual_end_date, ongoing_p, creation_date, creation_user, creation_ip, package_id'); -create function pm_project__new_project_item (integer, varchar, varchar, - integer, varchar, varchar, char(1), timestamptz, timestamptz, - timestamptz, timestamptz, char(1), timestamptz, integer, - varchar, integer) -returns integer as ' + +create function pm_project__new_project_item ( + integer, -- project_id + varchar, -- project_name + varchar, -- project_code + integer, -- parent_id + varchar, -- goal + varchar, -- description + char(1), -- deadline_scheduling + timestamptz, -- planned_start_date + timestamptz, -- planned_end_date + timestamptz, -- actual_start_date + timestamptz, -- actual_end_date + char(1), -- ongoing_p + 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; @@ -204,19 +179,17 @@ begin select acs_object_id_seq.nextval into v_id from dual; - -- Need to create a new project folder for the project item. - -- If p_parent_id is null then a new root project folder will - -- be created. Otherwise a new folder will be created under - -- the folder with the folder_id equal to p_parent_id. - v_parent_id := pm_project__new_project_folder ( - p_project_name, -- folder_name - p_description, -- description - p_parent_id, -- parent_id - p_creation_user, -- creation_user - p_creation_ip, -- creation_ip - p_package_id -- package_id - ); + v_parent_id := pm_project__get_root_folder (p_package_id, ''t''); + -- raise notice ''v_parent_id (%) p_parent_id (%)'', v_parent_id, p_parent_id; + + if p_parent_id is not null + then + v_parent_id = p_parent_id; + end if; + + -- raise notice ''v_parent_id (%) p_parent_id (%)'', v_parent_id, p_parent_id; + v_item_id := content_item__new ( p_project_name, -- name v_parent_id, -- parent_id @@ -252,12 +225,12 @@ PERFORM content_item__set_live_revision (v_revision_id); insert into pm_projects ( - project_id, project_folder_id, project_name, project_code, + project_id, project_name, project_code, goal, deadline_scheduling, planned_start_date, planned_end_date, actual_start_date, actual_end_date, ongoing_p) values ( - v_revision_id, v_parent_id, p_project_name, p_project_code, + v_revision_id, p_project_name, p_project_code, p_goal, p_deadline_scheduling, p_planned_start_date, p_planned_end_date, p_actual_start_date, p_actual_end_date, p_ongoing_p); @@ -273,27 +246,125 @@ -- The delete function deletes a record and all related overhead. -select define_function_args('pm_project___delete_project_item', 'project_id'); + +select define_function_args('pm_project__delete_project_item', 'project_id'); + create or replace function pm_project__delete_project_item (integer) returns integer as ' declare p_project_id alias for $1; + v_child cr_items%ROWTYPE; begin + raise NOTICE ''Deleting pm_project...''; + delete from acs_permissions where object_id = p_project_id; + for v_child in select + item_id + from + cr_items + where + parent_id = p_project_id and + content_type = ''pm_project'' + LOOP + PERFORM pm_project__delete_project_item(v_child.item_id); + end loop; + delete from pm_projects where project_id = p_project_id; - raise NOTICE ''Deleting pm_project...''; - 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, deadline_scheduling, planned_start_date, planned_end_date, actual_start_date, actual_end_date, ongoing_p, creation_date, creation_user, creation_ip, package_id'); + +create function pm_project__new_project_revision ( + integer, -- item_id + varchar, -- project_name + varchar, -- project_code + integer, -- parent_id + varchar, -- goal + varchar, -- description + char(1), -- deadline_scheduling + timestamptz, -- planned_start_date + timestamptz, -- planned_end_date + timestamptz, -- actual_start_date + timestamptz, -- actual_end_date + char(1), -- ongoing_p + timestamptz, -- creation_date + integer, -- creation_user + varchar, -- creation_ip + integer -- package_id +) returns integer +as ' +declare + p_item_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_deadline_scheduling alias for $7; + p_planned_start_date alias for $8; + p_planned_end_date alias for $9; + p_actual_start_date alias for $10; + p_actual_end_date alias for $11; + p_ongoing_p 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; + + v_revision_id cr_revisions.revision_id%TYPE; +begin + + -- the item_id is the project_id + + v_revision_id := content_revision__new ( + p_project_name, -- title + p_description, -- description + now(), -- publish_date + ''text/plain'', -- mime_type + NULL, -- nls_language + NULL, -- data + p_item_id, -- item_id + NULL, -- revision_id + now(), -- creation_date + p_creation_user, -- creation_user + p_creation_ip -- creation_ip + ); + + PERFORM content_item__set_live_revision (v_revision_id); + + insert into pm_projects ( + project_id, project_name, project_code, + goal, deadline_scheduling, planned_start_date, + planned_end_date, actual_start_date, actual_end_date, + ongoing_p) + values ( + v_revision_id, p_project_name, p_project_code, + p_goal, p_deadline_scheduling, p_planned_start_date, + p_planned_end_date, p_actual_start_date, + p_actual_end_date, p_ongoing_p); + + PERFORM acs_permission__grant_permission( + v_revision_id, + p_creation_user, + ''admin'' + ); + + return v_revision_id; +end;' language 'plpgsql'; + + + -- Creates and returns a unique name. + select define_function_args('pm_project__new_unique_name', 'package_id'); + create function pm_project__new_unique_name (integer) returns text as ' declare @@ -315,3 +386,225 @@ return v_name; end;' language 'plpgsql'; + +---------------------------------- +-- Tasks +---------------------------------- + +-- When we created the acs object type above, we specified a +-- 'name_method'. This is the name of a function that will return the +-- name of the object. This is a convention ensuring that all objects +-- can be identified. Now we have to build that function. In this case, +-- we'll return a field called title as the name. + +select define_function_args('pm_task__name', 'task_id'); + +create or replace function pm_task__name (integer) +returns varchar as ' +declare + p_pm_task_id alias for $1; + v_pm_task_name pm_task.title%TYPE; +begin + select title into v_pm_project_name + from pm_tasks_revisionsx + where item_id = p_pm_task_id limit 1; + return v_pm_task_name; +end; +' language 'plpgsql'; + + +-- Create a task item. + +-- A task should be placed within a project or another task. +-- 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, start_date, end_date, percent_complete, 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 + timestamptz, -- start_date + timestamptz, -- end_date + numeric, -- percent_complete + timestamptz, -- creation_date + integer, -- creation_user + varchar, -- creation_ip + integer -- package_id +) 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_start_date alias for $5; + p_end_date alias for $6; + p_percent_complete alias for $7; + p_creation_date alias for $8; + p_creation_user alias for $9; + p_creation_ip alias for $10; + p_package_id alias for $11; + + v_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_id cr_items.item_id%TYPE; + v_task_number integer; +begin + select acs_object_id_seq.nextval into v_id from dual; + + -- We want to put the task under the project item + + -- create the task_number + + v_item_id := content_item__new ( + p_title, -- name + p_project_id, -- parent_id + v_id, -- item_id + null, -- locale + now(), -- creation_date + p_creation_user, -- creation_user + p_package_id, -- context_id + p_creation_ip, -- creation_ip + ''content_item'', -- item_subtype + ''pm_task'', -- content_type + p_title, -- title + p_description, -- description + ''text/plain'', -- mime_type + null, -- nls_language + null -- data + ); + + v_revision_id := content_revision__new ( + p_title, -- title + p_description, -- description + now(), -- publish_date + ''text/plain'', -- mime_type + NULL, -- nls_language + NULL, -- data + v_item_id, -- item_id + NULL, -- revision_id + now(), -- creation_date + p_creation_user, -- creation_user + p_creation_ip -- creation_ip + ); + + PERFORM content_item__set_live_revision (v_revision_id); + + insert into pm_tasks ( + task_id, task_number) + values ( + v_item_id, v_task_number); + + insert into pm_tasks_revisions ( + task_revision_id, start_date, end_date, percent_complete) + values ( + v_revision_id, p_start_date, p_end_date, p_percent_complete); + + PERFORM acs_permission__grant_permission( + v_revision_id, + p_creation_user, + ''admin'' + ); + + return v_revision_id; +end;' language 'plpgsql'; + + +select define_function_args('pm_task__new_task_revision', 'task_id, project_id, title, description, start_date, end_date, percent_complete, creation_date, creation_user, creation_ip, package_id'); + +create function pm_task__new_task_revision ( + integer, -- task_id + integer, -- project_id + varchar, -- title + varchar, -- description + timestamptz, -- start_date + timestamptz, -- end_date + numeric, -- percent_complete + timestamptz, -- creation_date + integer, -- creation_user + varchar, -- creation_ip + integer -- package_id +) 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_start_date alias for $5; + p_end_date alias for $6; + p_percent_complete alias for $7; + p_creation_date alias for $8; + p_creation_user alias for $9; + p_creation_ip alias for $10; + p_package_id alias for $11; + + v_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_id cr_items.item_id%TYPE; +begin + select acs_object_id_seq.nextval into v_id from dual; + + -- We want to put the task under the project item + + v_revision_id := content_revision__new ( + p_title, -- title + p_description, -- description + now(), -- publish_date + ''text/plain'', -- mime_type + NULL, -- nls_language + NULL, -- data + v_item_id, -- item_id + NULL, -- revision_id + now(), -- creation_date + p_creation_user, -- creation_user + p_creation_ip -- creation_ip + ); + + PERFORM content_item__set_live_revision (v_revision_id); + + insert into pm_tasks_revisions ( + task_revision_id, start_date, end_date, percent_complete) + values ( + v_revision_id, p_start_date, p_end_date, p_percent_complete); + + PERFORM acs_permission__grant_permission( + v_revision_id, + p_creation_user, + ''admin'' + ); + + return v_revision_id; +end;' language 'plpgsql'; + + +-- The delete function deletes a record and all related overhead. + +select define_function_args('pm_task__delete_task_item', 'task_id'); + +create or replace function pm_task__delete_task_item (integer) +returns integer as ' +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); + + delete from pm_tasks + where task_id = p_task_id; + + raise NOTICE ''Deleting pm_task...''; + + PERFORM content_item__delete(p_task_id); + return 0; +end;' language 'plpgsql'; + + 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.2 -r1.3 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 15 Jun 2003 13:01:52 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 30 Jul 2003 20:42:05 -0000 1.3 @@ -19,9 +19,6 @@ references cr_revisions on delete cascade constraint pm_projects_id_pk primary key, - project_folder_id integer - constraint pm_project_folder_id_fk - references cr_folders, project_name varchar(255) constraint pm_projects_name_nn not null, @@ -56,17 +53,79 @@ ); -create table pm_root_folders ( - -- ID for this package instance - package_id integer - constraint pm_root_folder_package_id_fk - references apm_packages on delete cascade - constraint pm_root_folder_package_id_pk - primary key, - -- ID of the root folder - folder_id integer - constraint pm_root_folder_folder_id_fk - references cr_folders - constraint pm_root_folder_folder_id_un - unique +-- 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 + + +create table pm_tasks ( + task_id integer + constraint pm_tasks_task_id_fk + references cr_items + on delete cascade + constraint pm_task_task_id_pk + primary key, + task_number integer ); + + +create table pm_tasks_revisions ( + task_revision_id integer + constraint pm_task_revs_id_fk + references cr_revisions + on delete cascade + constraint pm_task_revs_id_pk + primary key, + -- dates are optional, because it may be computed in reference + -- to all other items, or simply not have a deadline + start_date timestamptz, + end_date timestamptz, + -- keep track of completion status + percent_complete numeric +); + +-- create the content type +select content_type__create_type ( + 'pm_task', -- content_type + 'content_revision', -- supertype + 'Task', -- pretty_name + 'Tasks', -- pretty_plural + 'pm_tasks_revisions', -- table_name (should this be pm_task?) + 'task_revision_id', -- id_column + 'pm_task__name' -- name_method +); + +-- add in attributes + +select content_type__create_attribute ( + 'pm_task', -- content_type + 'start_date', -- attribute_name + 'date', -- datatype (string, number, boolean, date, keyword, integer) + 'Start date', -- pretty_name + 'Start dates', -- pretty_plural + null, -- sort_order + null, -- default value + 'timestamptz' -- column_spec +); + +select content_type__create_attribute ( + 'pm_task', -- content_type + 'end_date', -- attribute_name + 'date', -- datatype + 'End date', -- pretty_name + 'End dates', -- pretty_plural + null, -- sort_order + null, -- default value + 'timestamptz' -- column_spec +); + +select content_type__create_attribute ( + 'pm_task', -- content_type + 'percent_complete', -- attribute_name + 'number', -- datatype + 'Percent complete', -- pretty_name + 'Percents complete', -- pretty_plural + null, -- sort_order + null, -- default value + 'numeric' -- column_spec +); 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.1 -r1.2 --- openacs-4/contrib/packages/project-manager/www/add-edit-postgresql.xql 15 Jun 2003 13:07:28 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/www/add-edit-postgresql.xql 30 Jul 2003 20:42:05 -0000 1.2 @@ -6,7 +6,7 @@ :project_id, :project_name, :project_code, - :parent_project_id, + :parent_id, :goal, :description, :deadline_scheduling, @@ -25,28 +25,33 @@ - UPDATE - pm_projects - SET - project_name = :project_name, - project_code = :project_code, - parent_project_id = :parent_project_id, - goal = :goal, - description = :description, - deadline_scheduling = :deadline_scheduling, - planned_start_date = to_timestamp(:planned_start_date,'YYYY MM DD HH24 MI SS'), - planned_end_date = to_timestamp(:planned_end_date,'YYYY MM DD HH24 MI SS'), - ongoing_p = :ongoing_p - WHERE - project_id = :project_id + select pm_project__new_project_revision ( + :item_id, + :project_name, + :project_code, + :parent_id, + :goal, + :description, + :deadline_scheduling, + 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, + now(), + :user_id, + :peeraddr, + :package_id + ); select + item_id, + parent_id, project_id, - project_folder_id, project_name, project_code, goal, @@ -60,4 +65,4 @@ where project_id = :project_id - \ No newline at end of file + Index: openacs-4/contrib/packages/project-manager/www/add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/add-edit.adp,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/add-edit.adp 15 Jun 2003 01:44:58 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/add-edit.adp 30 Jul 2003 20:42:05 -0000 1.3 @@ -3,5 +3,5 @@ @title@
- +
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.2 -r1.3 --- openacs-4/contrib/packages/project-manager/www/add-edit.tcl 15 Jun 2003 13:07:28 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/add-edit.tcl 30 Jul 2003 20:42:05 -0000 1.3 @@ -11,9 +11,14 @@ } { project_id:integer,optional + {item_id ""} + {project_name ""} + {project_code ""} + {parent_id ""} + {goal ""} + {description ""} {planned_start_date ""} {planned_end_date ""} - parent_project_id:integer,optional } -properties { @@ -38,31 +43,40 @@ ad_form -name add_edit -form { project_id:key + {parent_id:text(hidden) + {value $parent_id} + } + + {item_id:text(hidden) + {value $item_id} + } + {project_name:text {label "Project name"} + {value $project_name} } {project_code:text {label "Project code"} + {value $project_code} } - {parent_project_id:text(hidden) - {value $parent_project_id} - } - {goal:text(textarea) {label "Project goal"} {optional} + {value $goal} {html { rows 5 cols 40 wrap soft}}} {description:text(textarea) {label "Description"} {optional} + {value $description} {html { rows 5 cols 40 wrap soft}}} {deadline_scheduling:text(select) {label "Scheduling"} - {options {{"From today" "t"} {"From deadline" "e"}} {value $deadline_scheduling}} } + {options {{"From today" "t"} {"From deadline" "e"}} + {value $deadline_scheduling}} } {planned_start_date:date {value {[util::date acquire clock [clock scan $planned_start_date]]}} optional {label "Planned start date"} @@ -93,10 +107,10 @@ } -edit_data { - db_dml new_project_revision { *SQL* } + db_exec_plsql new_project_revision { *SQL* } } -after_submit { ad_returnredirect "index" ad_script_abort -} \ No newline at end of file +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 30 Jul 2003 20:42:05 -0000 1.1 @@ -0,0 +1,40 @@ + + + + + SELECT + p.item_id, + p.project_id, + p.project_name, + p.project_code, + p.goal, + p.description, + p.deadline_scheduling, + to_char(p.planned_start_date,'MM/DD/YYYY') as planned_start_date, + to_char(p.planned_end_date,'MM/DD/YYYY') as planned_end_date, + p.ongoing_p + FROM + pm_projectsx p + WHERE + p.item_id = :item_id and + p.project_id = :project_id + + + + + + SELECT + t.item_id, + t.title, + to_char(t.start_date,'MM/DD/YYYY') as start_date, + to_char(t.end_date,'MM/DD/YYYY') as end_date + FROM + pm_tasks_revisionsx t, cr_items i + WHERE + t.parent_id = :item_id and + t.revision_id = i.live_revision + ORDER BY + t.end_date,t.title + + + Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/one.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/one.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/project-manager/www/style.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/style.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/style.css 30 Jul 2003 20:42:05 -0000 1.1 @@ -0,0 +1,20 @@ + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 30 Jul 2003 20:42:05 -0000 1.1 @@ -0,0 +1,57 @@ + + + + + select pm_task__new_task_item ( + :task_revision_id, + :project_item_id, + :title, + :description, + to_timestamp(:start_date,'YYYY MM DD HH24 MI SS'), + to_timestamp(:end_date,'YYYY MM DD HH24 MI SS'), + :percent_complete, + now(), + :user_id, + :peeraddr, + :package_id + ); + + + + + + select pm_project__new_task_revision ( + :task_revision_id, + :project_item_id, + :title, + :description, + to_timestamp(:start_date,'YYYY MM DD HH24 MI SS'), + to_timestamp(:end_date,'YYYY MM DD HH24 MI SS'), + :percent_complete, + now(), + :user_id, + :peeraddr, + :package_id + ); + + + + + + select + task_revision_id, + title, + item_id, + description, + name, + parent_id, + to_char(start_date,'YYYY MM DD') as start_date, + to_char(end_date,'YYYY MM DD') as end_date, + percent_complete + FROM + pm_tasks_revisionsx + WHERE + task_revision_id = :task_revision_id + + + Index: openacs-4/contrib/packages/project-manager/www/task-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-add-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.adp 30 Jul 2003 20:42:05 -0000 1.1 @@ -0,0 +1,7 @@ + +@context_bar@ +@title@ + +
+ +
Index: openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-add-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 30 Jul 2003 20:42:05 -0000 1.1 @@ -0,0 +1,101 @@ +ad_page_contract { + + Simple add/edit form for tasks + + @author jader@bread.com + @creation-date 2003-07-28 + @cvs-id $Id: task-add-edit.tcl,v 1.1 2003/07/30 20:42:05 jader Exp $ + @return context_bar Context bar. + @return title Page title. + +} { + + project_item_id:integer,optional + + task_revision_id:integer,optional + {title ""} + {description ""} + {name ""} + {parent_id ""} + {start_date ""} + {end_date ""} + {percent_complete "0"} + +} -properties { + + context_bar:onevalue + title:onevalue + +} + +set user_id [ad_maybe_redirect_for_registration] + +set package_id [ad_conn package_id] + +if {[exists_and_not_null project_id]} { + set title "Edit a task" + set context_bar [ad_context_bar "Edit Task"] +} else { + set title "Add a task" + set context_bar [ad_context_bar "New Task"] +} + + +ad_form -name add_edit -form { + task_revision_id:key + + {project_item_id:text(hidden) + {value $project_item_id} + } + + {title:text + {label "Title"} + {value $title} + } + + {description:text + {label "Description"} + {value $description} + } + + {parent_id:text(hidden) + {value $parent_id} + } + + {start_date:date {value {[util::date acquire clock [clock scan $start_date]]}} optional + {label "Start date"} + {format "MONTH DD YYYY"} + {help} + } + + {end_date:date {value {[util::date acquire clock [clock scan $end_date]]}} optional + {label "End date"} + {format "MONTH DD YYYY"} + {help} + } + + {percent_complete:integer + {label "Percent complete"} + {value $percent_complete} + } + +} -select_query_name task_query -on_submit { + + set user_id [ad_conn user_id] + set peeraddr [ad_conn peeraddr] + +} -new_data { + db_exec_plsql new_task_item { *SQL* } + + ad_returnredirect "." + ad_script_abort + +} -edit_data { + + db_exec_plsql new_task_revision { *SQL* } + +} -after_submit { + + ad_returnredirect "one?item_id=$project_item_id" + ad_script_abort +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 30 Jul 2003 20:42:05 -0000 1.1 @@ -0,0 +1,17 @@ + + + + + SELECT + p.item_id, + p.title as task_title, + p.description, + to_char(p.start_date,'MM/DD/YYYY') as start_date, + to_char(p.end_date,'MM/DD/YYYY') as end_date + FROM + pm_tasks_revisionsx p + WHERE + p.item_id = :task_id + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/task-one.adp 30 Jul 2003 20:42:05 -0000 1.1 @@ -0,0 +1,49 @@ + + + + +One Task +@context_bar@ + +breakdown this task into subtasks. +edit + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Subject@task_title@
Description@description@ +
Start date@start_date@
End date@end_date@
Priority
+ +How this ticket relates to others: + +

+ +Assigned: + +

+ +Watchers: 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/project-manager/www/task-one.tcl 30 Jul 2003 20:42:05 -0000 1.1 @@ -0,0 +1,33 @@ +ad_page_contract { + Main view page for one task. + + @author jader@bread.com + @creation-date 2003-07-28 + @cvs-id $Id: task-one.tcl,v 1.1 2003/07/30 20:42:05 jader Exp $ + + @param task_id item_id for the task + @param project_item_id the item_id for the project. Used for navigational links + @param context_bar value for context bar creation + @property task_title Name for Task +} { + task_id:integer + project_item_id:integer + project_id:integer + +} -properties { + context_bar:onevalue + task_title:onevalue + description:onevalue + start_date:onevalue + end_date:onevalue +} + +# --------------------------------------------------------------- # + +set context_bar [ad_context_bar "one?item_id=$project_item_id&project_id=$project_id Project" "View"] + +db_1row task_query { } + +ad_return_template + +# ------------------------- END OF FILE ------------------------- # Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/view-project-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/view-project.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/project-manager/www/view-project.tcl'. Fisheye: No comparison available. Pass `N' to diff?