Index: openacs-4/packages/project-manager/templates/project-ae-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/project-ae-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/project-ae-oracle.xql 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,41 @@ + + + + + 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.customer_id, + 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 + p.dform + FROM pm_projectsx p + WHERE p.item_id = :project_item_id and + p.project_id = :project_id + + + + + + SELECT sysdate + from dual + + + + + + SELECT description, + status_id + FROM pm_project_status + ORDER BY status_type desc, + description asc + + + + Index: openacs-4/packages/project-manager/templates/project-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/project-ae-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/project-ae-postgresql.xql 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,53 @@ + + + + + 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.customer_id, + 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 HH24:MI:SS') as planned_end_date, + p.ongoing_p, + p.dform + FROM + pm_projectsx p + WHERE + p.item_id = :project_item_id and + p.project_id = :project_id + + + + + + SELECT + current_timestamp + + + + + + select customer_id + from pm_projects + where project_id = :project_id + + + + + + SELECT + description, status_id + FROM + pm_project_status + ORDER BY + status_type desc, description asc + + + + Index: openacs-4/packages/project-manager/templates/project-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/project-ae.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/project-ae.tcl 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,315 @@ +# --------------------------------------------------------------- # +# the unique identifier for this package +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] +set include_url [parameter::get -parameter "ProjectAdd"] + +# permissions. Check that user has write permission on the package. +permission::require_permission -party_id $user_id -object_id $package_id -privilege write + +# terminology +set project_term [_ project-manager.Project] +set project_term_lower [_ project-manager.project] +set use_goal_p [parameter::get -parameter "UseGoalP" -default "1"] +set use_project_code_p [parameter::get -parameter "UseUserProjectCodesP" -default "1"] +set ongoing_by_default_p [parameter::get -parameter "OngoingByDefaultP" -default "f"] + +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] + +if {[exists_and_not_null project_item_id] && ![exists_and_not_null project_id]} { + set project_id [pm::project::get_project_id -project_item_id $project_item_id] +} + + +if {[exists_and_not_null project_id]} { + set title "[_ project-manager.lt_Edit_a_project_term_l]" + set context_bar [ad_context_bar "[_ project-manager.Edit_project_term]"] + + # permissions + permission::require_permission -party_id $user_id -object_id $package_id -privilege write + +} else { + set title "[_ project-manager.lt_Add_a_project_term_lo]" + set context_bar [ad_context_bar "[_ project-manager.New_project_term]"] + + # permissions + permission::require_permission -party_id $user_id -object_id $package_id -privilege create +} + + +if {[ad_form_new_p -key project_item_id]} { + set logger_project "" + set logger_values "" +} else { + + set logger_project [lindex [application_data_link::get_linked -from_object_id $project_item_id -to_object_type logger_project] 0] + set logger_values [logger::project::get_variables -project_id $logger_project] + +} + +ad_form -name add_edit \ + -form { + project_id:key + + {parent_id:text(hidden) + {value $parent_id} + } + + {project_item_id:text(hidden) + {value $project_item_id} + } + + {dform:text(hidden)} + {extra_data:text(hidden),optional} + + {project_name:text + {label "[_ project-manager.lt_set_project_term_name]"} + {value $project_name} + {html {size 50}} + } + {ongoing_p:text(hidden) + {value "f"} + } + } + + +if {$use_project_code_p} { + ad_form -extend -name add_edit \ + -form { + {project_code:text,optional + {label "[_ project-manager.lt_set_project_term_code]"} + {value $project_code} + } + } +} + +ad_form -extend -name add_edit \ + -form { + {description:text(textarea),optional + {label "[_ project-manager.Description]"} + {value $description} + {html { rows 5 cols 40 wrap soft}}} + + } + + +if {[exists_and_not_null customer_id]} { + set customer_name [organizations::name -organization_id $customer_id] + ad_form -extend -name add_edit \ + -form { + {customer_id:text(hidden) + {value $customer_id} + } + {customer_name:text(inform) + {label "[_ project-manager.Customer]"} + {values "$customer_name"} + } + } +} else { + ad_form -extend -name add_edit \ + -form { + {customer_id:text(select),optional + {label "[_ project-manager.Customer]"} + {options {{"[_ project-manager.---_TBD_---]" ""} [lang::util::localize_list_of_lists -list [db_list_of_lists get_customer "select o.name, o.organization_id from organizations o order by o.name"]]}} + } + } +} + +ad_form -extend -name add_edit \ + -form { + {planned_start_date:text(text) + {label "[_ project-manager.Starts]"} + {html {id sel1}} + {after_html { \[d.m.y \] + }} + } + + + {planned_end_date:text(text) + {label "[_ project-manager.Deadline_1]"} + {html {id sel2}} + {after_html { \[d.m.y \] + }} + } + } + +#------------------------ +# Check if the project will be handled on daily basis or will request hours and minutes +#------------------------ + +if { $daily_p == "t"} { + ad_form -extend -name add_edit -form { + {planned_end_time:text(hidden) + {value ""} + } + } +} else { + ad_form -extend -name add_edit -form { + {planned_end_time:date + {label "[_ project-manager.Deadline_Time]"} + {value {[template::util::date::now]}} + {format {[lc_get formbuilder_time_format]}} + } + } +} + + +if {[exists_and_not_null project_id]} { + if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { + ad_form -extend -name add_edit -form { + {category_ids:integer(category),multiple {label "[_ project-manager.Categories]"} + {html {size 7}} {value {$project_id $package_id}} + } + } + } +} else { + if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { + ad_form -extend -name add_edit -form { + {category_ids:integer(category),multiple,optional {label "[_ project-manager.Categories]"} + {html {size 7}} {value {}} + } + } + } +} + +if {[exists_and_not_null customer_id]} { + set dynamic_params(customer_id) $customer_id +} elseif {[exists_and_not_null project_item_id]} { + set dynamic_params(customer_id) [db_string get_customer_id {}] +} else { + set dynamic_params(customer_id) "" +} + +dtype::form::add_elements -dform $dform -prefix pm -object_type pm_project -object_id [value_if_exists project_id] -form add_edit -exclude_static -cr_widget none -variables [array get dynamic_params] + +ad_form -extend -name add_edit \ + -new_request { + + if {[string equal $ongoing_by_default_p t]} { + set ongoing_p t + } + + set planned_end_date [dt_sysdate] + set planned_start_date [dt_sysdate] + + } -edit_request { + + db_1row project_query {} + set planned_end_time [template::util::date::from_ansi $planned_end_date [lc_get frombuilder_time_format]] + set planned_end_date [lindex $planned_end_date 0] + + } -on_submit { + + set user_id [ad_conn user_id] + set peeraddr [ad_conn peeraddr] + set folder_id [pm::util::get_root_folder -package_id $package_id] + set callback_data(organization_id) $customer_id + if {[exists_and_not_null variables]} { + set callback_data(variables) $variables + } + foreach {key value} $extra_data { + set callback_data($key) $value + } + + set customer_name [organizations::name -organization_id $customer_id] + if {![empty_string_p $customer_name]} { + append customer_name " - " + } + if {[empty_string_p $parent_id]} { + set parent_id $folder_id + } + set planned_end_date_list [split $planned_end_date "-"] + append planned_end_date_list " [lrange $planned_end_time 3 5]" + + set planned_start_date_sql "to_timestamp('$planned_start_date','YYYY MM DD HH24 MI SS')" + set planned_end_date_sql "to_timestamp('$planned_end_date_list','YYYY MM DD HH24 MI SS')" + + } -new_data { + + db_transaction { + # if the project is ongoing, there is no end date + # we set it to null to signify that. Technically, this + # is bad data model design -- we should just get rid of + # ongoing_p + if {[string equal $ongoing_p t]} { + set actual_end_date "" + set planned_end_date "" + } + + # create a project manager project + set project_id [dtype::form::process \ + -dform $dform \ + -prefix pm \ + -object_type pm_project \ + -object_id $project_id \ + -form add_edit \ + -cr_widget none \ + -defaults [list title $project_name description $description mime_type "text/plain" context_id $parent_id parent_id $parent_id object_type pm_project] \ + -default_fields {project_code goal {planned_start_date $planned_start_date_sql} {planned_end_date $planned_end_date_sql} actual_start_date actual_end_date ongoing_p status_id customer_id dform} \ + -exclude_static] + + set project_item_id [pm::project::get_project_item_id -project_id $project_id] + set project_role [pm::role::default] + + pm::project::assign \ + -project_item_id $project_item_id \ + -role_id $project_role \ + -party_id $user_id \ + -send_email_p "f" + + if {[exists_and_not_null category_ids]} { + category::map_object -object_id $project_id $category_ids + } + + # We need to check if the group exists before trying to + # give the group privileges + set employees_group_id [group::get_id -group_name "Employees"] + if { ![empty_string_p $employees_group_id] } { + permission::grant -object_id $project_item_id -party_id $employees_group_id -privilege admin + } + + callback pm::project_new -package_id $package_id -project_id $project_item_id -data [array get callback_data] + } + + } -edit_data { + + db_transaction { + # we need to pass the old_project_id to add-edit-2.tcl because + # the new revision will not have any of the custom values in + # it until it is edited. So we need to pull in these values + set old_project_id $project_id + + set project_id [dtype::form::process \ + -dform $dform \ + -prefix pm \ + -object_type pm_project \ + -object_id $project_id \ + -form add_edit \ + -cr_widget none \ + -defaults [list title $project_name description $description mime_type "text/plain" context_id $parent_id parent_id $parent_id object_type pm_project] \ + -default_fields {project_code goal {planned_start_date $planned_start_date_sql} {planned_end_date $planned_end_date_sql} actual_start_date actual_end_date ongoing_p status_id customer_id dform} \ + -exclude_static] + + set project_item_id [pm::project::get_project_item_id -project_id $project_id] + + if {[exists_and_not_null category_ids]} { + category::map_object -object_id $project_id $category_ids + } + callback pm::project_edit -package_id $package_id -project_id $project_item_id -data [array get callback_data] + } + + } -after_submit { + + ad_returnredirect -message "[_ project-manager.lt_Changes_to_project_sa]" "one?[export_url_vars project_id]" + # to add back in subproject support, should use + # compute_parent_status + if { [parameter::get -parameter UseDayInsteadOfHour -default f]} { + pm::project::compute_status $project_item_id + } else { + pm::project::compute_status_mins $project_item_id + } + ad_script_abort +} + +ad_return_template "../templates/project-ae" \ No newline at end of file Index: openacs-4/packages/project-manager/templates/project-one-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/project-one-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/project-one-oracle.xql 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,134 @@ + + + + + + SELECT p.item_id, + p.project_id, + p.title as project_name, + p.project_code, + p.goal, + p.description, + p.mime_type, + to_char(p.planned_start_date,'YYYY-MM-DD HH24:MI') as planned_start_date, + to_char(p.planned_end_date,'YYYY-MM-DD HH24:MI') as planned_end_date, + p.ongoing_p, + i.live_revision, + to_char(p.estimated_finish_date,'YYYY-MM-DD HH24:MI') as estimated_finish_date, + to_char(p.earliest_finish_date,'YYYY-MM-DD HH24:MI') as earliest_finish_date, + to_char(p.latest_finish_date,'YYYY-MM-DD HH24:MI') as latest_finish_date, + p.actual_hours_completed, + p.estimated_hours_total, + p.parent_id + FROM pm_projectsx p, cr_items i + WHERE p.item_id = :project_item_id and + p.project_id = :project_id and + p.item_id = i.item_id + + + + + + SELECT t.item_id as task_id, + t.title, + to_char(t.end_date,'YYYY-MM-DD HH24:MI') as end_date, + to_char(t.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, + t.earliest_start - sysdate as days_to_earliest_start, + to_char(t.earliest_start,'J') as earliest_start_j, + to_char(t.earliest_finish,'YYYY-MM-DD HH24:MI') as earliest_finish, + t.earliest_finish - sysdate as days_to_earliest_finish, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, + t.latest_start - sysdate as days_to_latest_start, + to_char(t.latest_start,'J') as latest_start_j, + to_char(sysdate,'J') as today_j, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, + t.latest_finish - sysdate as days_to_latest_finish, + u.first_names, + u.last_name, + t.percent_complete, + d.parent_task_id, + d.dependency_type, + t.estimated_hours_work, + t.estimated_hours_work_min, + t.estimated_hours_work_max, + t.actual_hours_worked, + s.status_type, + s.description as status_description + FROM (SELECT * + FROM pm_tasks_revisionsx tk, + pm_task_assignment asg + WHERE tk.item_id = asg.task_id (+) + ) t , + persons u, + cr_items i, + pm_tasks_active ti, + pm_task_status s , + pm_task_dependency d + WHERE i.item_id = d.task_id (+) and + t.party_id = u.person_id (+) and + t.parent_id = :project_item_id and + t.revision_id = i.live_revision and + t.item_id = ti.task_id and + ti.status = s.status_id + [template::list::orderby_clause -name tasks -orderby] + + + + + + begin + :1 := pm_project.get_root_folder (:package_id, 'f'); + end; + + + + + + SELECT p.item_id, + p.project_id, + p.parent_id as folder_id, + p.object_type as content_type, + p.title as project_name, + p.project_code, + to_char(p.planned_start_date, 'Mon DD') as planned_start_date, + to_char(p.planned_end_date, 'Mon DD') as planned_end_date, + p.ongoing_p, + p.actual_hours_completed, + p.estimated_hours_total + FROM pm_projectsx p, + cr_items i + WHERE p.project_id = i.live_revision and + p.parent_id = :project_item_id + ORDER BY p.title + + + + + + SELECT a.project_id, + r.one_line as role_name, + p.first_names || ' ' || p.last_name as user_name + FROM pm_project_assignment a, + pm_roles r, + persons p + WHERE a.role_id = r.role_id and + a.party_id = p.person_id and + project_id = :project_item_id + ORDER BY r.role_id, + p.first_names, + p.last_name + + + + + + SELECT p.customer_id, + c.name as customer_name + FROM pm_projectsx p , + organizations c + WHERE p.customer_id = c.organization_id (+) and + p.project_id = :original_project_id + + + + Index: openacs-4/packages/project-manager/templates/project-one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/project-one-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/project-one-postgresql.xql 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,174 @@ + + + + + + SELECT + p.item_id, + p.project_id, + p.title as project_name, + p.goal, + p.description, + p.mime_type, + to_char(p.planned_start_date,'YYYY-MM-DD HH24:MI') as planned_start_date, + to_char(p.planned_end_date,'YYYY-MM-DD HH24:MI') as planned_end_date, + p.ongoing_p, + i.live_revision, + to_char(p.estimated_finish_date,'YYYY-MM-DD HH24:MI') as estimated_finish_date, + to_char(p.earliest_finish_date,'YYYY-MM-DD HH24:MI') as earliest_finish_date, + to_char(p.latest_finish_date,'YYYY-MM-DD HH24:MI') as latest_finish_date, + p.actual_hours_completed, + p.estimated_hours_total, + p.parent_id, + s.status_type + FROM + pm_projectsx p, + cr_items i, + pm_project_status s + WHERE + p.item_id = :project_item_id and + p.project_id = :project_id and + p.item_id = i.item_id and + p.status_id = s.status_id + + + + + + SELECT + t.item_id as task_item_id, + t.parent_id as project_item_id, + t.title, + to_char(t.end_date,'YYYY-MM-DD HH24:MI') as end_date, + to_char(t.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, + t.earliest_start - current_date as days_to_earliest_start, + to_char(t.earliest_start,'J') as earliest_start_j, + to_char(t.earliest_finish,'YYYY-MM-DD HH24:MI') as earliest_finish, + t.earliest_finish - current_date as days_to_earliest_finish, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, + t.latest_start - current_date as days_to_latest_start, + to_char(t.latest_start,'J') as latest_start_j, + to_char(current_date,'J') as today_j, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, + t.latest_finish - current_date as days_to_latest_finish, + u.person_id, + u.first_names, + u.last_name, + t.percent_complete, + d.parent_task_id, + d.dependency_type, + t.estimated_hours_work, + t.estimated_hours_work_min, + t.estimated_hours_work_max, + t.actual_hours_worked, + s.status_type, + s.description as status_description, + r.is_lead_p, + t.priority + FROM + (select tr.item_id, + ta.party_id, + ta.role_id, + tr.title, + tr.end_date, + tr.earliest_start, + tr.earliest_finish, + tr.latest_start, + tr.latest_finish, + tr.percent_complete, + tr.estimated_hours_work, + tr.estimated_hours_work_min, + tr.estimated_hours_work_max, + tr.actual_hours_worked, + tr.parent_id, + tr.revision_id, + tr.priority + from pm_tasks_revisionsx tr + LEFT JOIN + pm_task_assignment ta ON tr.item_id = ta.task_id) t + LEFT JOIN + persons u + ON + t.party_id = u.person_id + LEFT JOIN + pm_roles r + ON t.role_id = r.role_id, + cr_items i + LEFT JOIN + pm_task_dependency d + ON + i.item_id = d.task_id, + pm_tasks_active ti, + pm_task_status s + WHERE + t.parent_id = :project_item_id and + t.revision_id = i.live_revision and + t.item_id = ti.task_id and + ti.status = s.status_id + $done_clause + [template::list::filter_where_clauses -and -name tasks] + [template::list::orderby_clause -name tasks -orderby] + + + + + + select pm_project__get_root_folder (:package_id, 'f') + + + + + + SELECT + p.item_id, + p.project_id, + p.parent_id as folder_id, + p.object_type as content_type, + p.title as project_name, + p.project_code, + to_char(p.planned_start_date, 'Mon DD') as planned_start_date, + to_char(p.planned_end_date, 'Mon DD') as planned_end_date, + p.ongoing_p, + p.actual_hours_completed, + p.estimated_hours_total + FROM pm_projectsx p, cr_items i + WHERE p.project_id = i.live_revision and + p.parent_id = :project_item_id + ORDER BY p.title + + + + + + SELECT + a.project_id, + r.one_line as role_name, + p.first_names || ' ' || p.last_name as user_name, + r.is_lead_p + FROM + pm_project_assignment a, + pm_roles r, + persons p + WHERE + a.role_id = r.role_id and + a.party_id = p.person_id and + project_id = :project_item_id + ORDER BY + r.role_id, p.first_names, p.last_name + + + + + + SELECT + p.customer_id, + c.name as customer_name + 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/packages/project-manager/templates/project-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/project-one.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/project-manager/templates/project-one.adp 10 Aug 2005 22:11:41 -0000 1.3 +++ openacs-4/packages/project-manager/templates/project-one.adp 11 Aug 2005 21:08:35 -0000 1.4 @@ -1,4 +1,5 @@ + @my_title;noquote@ -- #project-manager.Closed# Index: openacs-4/packages/project-manager/templates/project-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/project-one.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/project-one.tcl 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,55 @@ +set original_project_id $project_id + +# for edits of tasks. We want to come back to here. +set return_url [ad_return_url -qualified] + +# --------------------------------------------------------------- # + +# the unique identifier for this package +set package_id [ad_conn package_id] +set package_url [ad_conn package_url] +set user_id [auth::require_login] + + +# terminology and other parameters +set project_term [_ project-manager.Project] +set use_project_customizations_p [parameter::get -parameter "UseProjectCustomizationsP" -default "0"] +set use_subprojects_p [parameter::get -parameter "UseSubprojectsP" -default "0"] + +# permissions +permission::require_permission -party_id $user_id -object_id $package_id -privilege read + +# Get Project Information +db_1row project_query { } -column_array project + +set project(logger_project) [lindex [application_data_link::get_linked -from_object_id $project_item_id -to_object_type logger_project] 0] + +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] + +#------------------------ +# Check if the project will be handled on daily basis or will show hours and minutes +#------------------------ + +set fmt "%x %r" +if { $daily_p } { + set fmt "%x" +} + + +# Context Bar and Title information +set portlet_master "/packages/project-manager/lib/portlet" +set project_root [pm::util::get_root_folder -package_id $package_id] +set my_title "$project_term \#$project_item_id: $project(project_name)" + +set forum_id [application_data_link::get_linked -from_object_id $project(item_id) -to_object_type "forums_forum"] +set folder_id [lindex [application_data_link::get_linked -from_object_id $project(item_id) -to_object_type "content_folder"] 0] + + +# set up context bar, needs project(parent_id) +if {[string equal $project(parent_id) $project_root]} { + set context [list "$project(project_name)"] +} else { + set parent_name [pm::util::get_project_name -project_item_id $project(parent_id)] + set context [list [list "one?project_item_id=$project(parent_id)" "$parent_name"] "$project(project_name)"] +} Index: openacs-4/packages/project-manager/templates/project-one.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/project-one.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/project-one.xql 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,47 @@ + + + + + + + + + + + + SELECT + p.item_id, + p.project_id, + p.title as project_name, + p.project_code, + p.goal, + p.description, + p.mime_type, + to_char(p.planned_start_date,'YYYY-MM-DD HH24:MI:SS') as planned_start_date, + to_char(p.planned_end_date,'YYYY-MM-DD HH24:MI:SS') as planned_end_date, + p.ongoing_p, + i.live_revision, + to_char(p.estimated_finish_date,'YYYY-MM-DD HH24:MI:SS') as estimated_finish_date, + to_char(p.earliest_finish_date,'YYYY-MM-DD HH24:MI:SS') as earliest_finish_date, + to_char(p.latest_finish_date,'YYYY-MM-DD HH24:MI:SS') as latest_finish_date, + p.actual_hours_completed, + p.estimated_hours_total, + p.parent_id, + s.status_type + FROM + pm_projectsx p, + cr_items i, + pm_project_status s + WHERE + p.item_id = :project_item_id and + p.project_id = :project_id and + p.item_id = i.item_id and + p.status_id = s.status_id + and exists (select 1 from acs_object_party_privilege_map ppm + where ppm.object_id = :project_id + and ppm.privilege = 'read' + and ppm.party_id = :user_id) + + + + \ No newline at end of file Index: openacs-4/packages/project-manager/templates/task-ae-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/task-ae-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/task-ae-oracle.xql 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,11 @@ + + + oracle8.0 + + + + select to_char(sysdate,'YYYY-MM-DD') from dual + + + + Index: openacs-4/packages/project-manager/templates/task-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/task-ae-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/task-ae-postgresql.xql 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,11 @@ + + + postgresql7.3 + + + + select to_char(now(),'YYYY-MM-DD') from dual + + + + Index: openacs-4/packages/project-manager/templates/task-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/task-ae.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/task-ae.adp 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,7 @@ + + @title;noquote@ + @context@ + + + + Index: openacs-4/packages/project-manager/templates/task-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/task-ae.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/task-ae.tcl 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,682 @@ +# --------------------------------------------------------------- +# Set up +# --------------------------------------------------------------- +set user_id [ad_maybe_redirect_for_registration] +set package_id [ad_conn package_id] + +# use hour units or day units +set use_day_p [parameter::get -parameter "UseDayInsteadOfHour" -default "t"] +set hours_day [pm::util::hours_day] +set root_folder_id [content::folder::get_folder_from_package -package_id $package_id] + +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] + + +if {[string is true $use_day_p]} { + set work_units "[_ project-manager.days]" +} else { + set work_units "[_ project-manager.hrs]" +} + +# --------------------------------------------------------------- +# terminology +# --------------------------------------------------------------- +set project_term [_ project-manager.Project] +set task_term [_ project-manager.Task] +set task_term_lower [_ project-manager.task] +set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] + +# ------------------------- +# Set up flags to use later +# ------------------------- + +if {[exists_and_not_null task_item_id] || ![ad_form_new_p -key task_id]} { + set edit_p t + db_1row task_data {} + set logger_project [lindex [application_data_link::get_linked -from_object_id $project_item_id -to_object_type logger_project] 0] + set logger_variable_id [logger::project::get_primary_variable -project_id $logger_project] + logger::variable::get -variable_id $logger_variable_id -array logger_variable + + set open_p [pm::project::open_p -project_item_id $project_item_id] + if {[string is false $open_p]} { + set project_options [list [list [pm::project::name -project_item_id $project_item_id] $project_item_id]] + } else { + set project_options [pm::project::get_list_of_open] + } + db_1row get_dynamic_form {} +} else { + set edit_p f +} + +if {[exists_and_not_null process_id]} { + set using_process_p t +} else { + set using_process_p f +} + +# -------------------------------------------------------------------- +# if we are editing tasks, each task has its own project. We also want +# to look up all the old information to store it for later. We use +# this for comparison, to see what has changed. +# -------------------------------------------------------------------- + +if {![string is true $edit_p] &&[empty_string_p $project_item_id]} { + + ad_return_error "[_ project-manager.Project_missing]" "[_ project-manager.lt_For_new_tasks_a_proje]" + ad_script_abort +} + +# --------------------------------------------------------------- +# permissions and title setup, etc +# --------------------------------------------------------------- + +if {[string is true $edit_p]} { + + set title "[_ project-manager.lt_Edit_a_task_term_lowe]" + set context [list [list $return_url "[_ project-manager.Go_back]"] "[_ project-manager.Edit_task_term]"] + +} else { + + set title "[_ project-manager.Add_task_term_lower]" + set context [list [list [export_vars -base one {project_item_id}] "[pm::project::name -project_item_id $project_item_id]"] "[_ project-manager.New_task_term]"] + + permission::require_permission -party_id $user_id -object_id $project_item_id -privilege create + +} + +# ------------------------------------------------------------- +# Start creating the multirow we'll use to create the interface +# ------------------------------------------------------------- + +set boolean_options [list [list "[_ project-manager.Yes]" t] [list "[_ project-manager.No]" f]] +set format_options [list [list "[_ project-manager.Enhanced_Text]" "text/enhanced"] [list "[_ project-manager.Plain_Text]" "text/plain"] [list "[_ project-manager.Fixed-width_Text]" "text/fixed-width"] [list "[_ project-manager.HTML]" "text/html"]] +set percent_options [list [list "[_ project-manager.Open]" 0] [list "[_ project-manager.Closed]" 100]] +set dependency_options [pm::task::options_list \ + -edit_p $edit_p \ + -project_item_id $project_item_id \ + -number 1 \ + -current_number 1] + +set send_email_p t + +ad_form -name task_add_edit -export {task_item_id} \ + -form { + task_id:key + + {edit_p:text(hidden)} + {dform:text(hidden)} + {using_process_p:text(hidden)} + {return_url:text(hidden),optional} + {process_task_id:text(hidden),optional} + + {send_email_p:text(select) + {label "[_ project-manager.lt_Send_email_to_assigne]"} + {options $boolean_options} + } + } + +if {[string is true $using_process_p]} { + ad_form -extend -name task_add_edit \ + -form { + {process_name:text,optional + {label "[_ project-manager.Process_name]"} + {html {size 25}} + } + } +} + +ad_form -extend -name task_add_edit \ + -form { + {task_title:text + {label "[_ project-manager.Task_name]"} + {html {size 40}} + } + + {description:text(textarea),optional + {label "[_ project-manager.Description_1]"} + {html { rows 14 cols 40 wrap soft}} + } + + {description_mime_type:text(select),optional + {label "[_ project-manager.Format]"} + {options $format_options} + } + } + +if {[string is true $edit_p]} { + if {![empty_string_p [category_tree::get_mapped_trees $root_folder_id]]} { + ad_form -extend -name task_add_edit -form { + {category_ids:integer(category),multiple {label "[_ project-manager.Categories]"} + {html {size 7}} {value {$task_id $root_folder_id}} + } + } + } +} else { + if {![empty_string_p [category_tree::get_mapped_trees $root_folder_id]]} { + ad_form -extend -name task_add_edit -form { + {category_ids:integer(category),multiple,optional {label "[_ project-manager.Categories]"} + {html {size 7}} {value {{} $root_folder_id}} + } + } + } +} + +dtype::form::add_elements -dform $dform -prefix pm -object_type pm_task -object_id [value_if_exists task_id] -form task_add_edit -exclude_static -cr_widget none + +if {[string is true $edit_p]} { + ad_form -extend -name task_add_edit \ + -form { + {comment:text(textarea),optional + {label "[_ project-manager.Description_1]"} + {html { rows 7 cols 40 wrap soft}} + {section "[_ project-manager.Comment]"} + } + + {comment_mime_type:text(select),optional + {label "[_ project-manager.Format]"} + {options $format_options} + {section "[_ project-manager.Comment]"} + } + } +} else { + ad_form -extend -name task_add_edit \ + -form { + {comment:text(hidden) + {value ""} + } + + {comment_mime_type:text(hidden) + {value "text/plain"} + } + } +} + +if {!$use_uncertain_completion_times_p} { + ad_form -extend -name task_add_edit \ + -form { + {estimated_hours_work:text + {label " "} + {html {size 5}} + {after_html $work_units} + {section "[_ project-manager.Work_required]"} + } + } +} elseif {[string is true $use_day_p]} { + ad_form -extend -name task_add_edit \ + -form { + {estimated_days_work_min:text + {label "[_ project-manager.Min]"} + {html {size 5}} + {after_html $work_units} + {section "[_ project-manager.Work_required]"} + } + + {estimated_days_work_max:text + {label "[_ project-manager.Max]"} + {html {size 5}} + {after_html $work_units} + {section "[_ project-manager.Work_required]"} + } + } +} else { + ad_form -extend -name task_add_edit \ + -form { + {estimated_hours_work_min:text + {label "[_ project-manager.Min]"} + {html {size 5}} + {after_html $work_units} + {section "[_ project-manager.Work_required]"} + } + + {estimated_hours_work_max:text + {label "[_ project-manager.Max]"} + {html {size 5}} + {after_html $work_units} + {section "[_ project-manager.Work_required]"} + } + } +} + +ad_form -extend -name task_add_edit \ + -form { + {task_end_date:text(text),optional + {label "[_ project-manager.Deadline]"} + {html {id sel1}} + {after_html { \[y-m-d \] + }} + } + } + +#------------------------ +# Check if the task will be handled on daily basis or will request hours and minutes +#------------------------ + +if { $daily_p } { + ad_form -extend -name task_add_edit \ + -form { + {task_end_time:text(hidden) + {value ""} + } + } +} else { + ad_form -extend -name task_add_edit \ + -form { + {task_end_time:date,optional + {label "[_ project-manager.Deadline_Time]"} + {value {[template::util::date::now]}} + {format {[lc_get formbuilder_time_format]}} + } + } +} + + +if {[string is true $edit_p]} { + ad_form -extend -name task_add_edit \ + -form { + {project_item_id:text(select),optional + {label $project_term} + {options $project_options} + } + } +} else { + ad_form -extend -name task_add_edit \ + -form { + {project_item_id:text(hidden)} + } +} + +ad_form -extend -name task_add_edit \ + -form { + {dependency:text(select),optional + {label "[_ project-manager.Dependency]"} + {options $dependency_options} + } + + {priority:text,optional + {label "[_ project-manager.Priority]"} + {html {size 4}} + {help_text "[_ project-manager.lt_Enter_a_number_for_or]"} + } + } + +if {[string is true $edit_p]} { + ad_form -extend -name task_add_edit \ + -form { + {percent_complete:text,optional + {label "[_ project-manager.Status]"} + {html {size 4}} + {help_text "[_ project-manager.lt_Enter_100_to_close_th_1]"} + } + + {hours:text,optional + {label $logger_variable(name)} + {html {size 4}} + {section "[_ project-manager.Log_entry]"} + {after_html $logger_variable(unit)} + } + + + {logger_variable_id:text(hidden) + {section "[_ project-manager.Log_entry]"} + } + + {log_date:text(text),optional + {label "[_ project-manager.Date_1]"} + {html {id sel2}} + {after_html { \[y-m-d \] + }} + {section "[_ project-manager.Log_entry]"} + } + + {log:text,optional + {label "[_ project-manager.Description_1]"} + {html {size 30}} + {help_text "[_ project-manager.lt_You_can_optionally_lo]"} + {section "[_ project-manager.Log_entry]"} + } + } +} elseif {[string is true $using_process_p]} { + ad_form -extend -name task_add_edit \ + -form { + {percent_complete:text(select),optional + {label "[_ project-manager.Status]"} + {options $percent_options} + } + } +} else { + ad_form -extend -name task_add_edit \ + -form { + {percent_complete:text(hidden)} + } +} + +set roles_list [pm::role::select_list_filter] +set assignee_role_list [pm::project::assignee_role_list -project_item_id $project_item_id] + +# Get assignments for when using processes +if {[string is true $using_process_p]} { + # PROCESS + set task_assignee_list [pm::process::task_assignee_role_list -process_task_id $process_task_id] +} elseif {[string is true $edit_p]} { + # EDITING + set task_assignee_list [pm::task::assignee_role_list -task_item_id $task_item_id] +} else { + # NEW + set task_assignee_list [list] +} + +foreach one_assignee $assignee_role_list { + set person_id [lindex $one_assignee 0] + set name [person::name -person_id $person_id] + lappend assignee_options [list $name $person_id] +} + +foreach role_list $roles_list { + set role_name [lindex $role_list 0] + set role [lindex $role_list 1] + + set assignees [list] + foreach one_assignee $assignee_role_list { + set person_id [lindex $one_assignee 0] + set person_role [lindex $one_assignee 1] + if {[lsearch $task_assignee_list [list $person_id $role]] >= 0 || $role == $person_role} { + lappend assignees $person_id + } + } + + ad_form -extend -name task_add_edit \ + -form [list \ + [list assignee.$role\:text(checkbox),optional,multiple \ + [list label $role_name] \ + [list options $assignee_options] \ + [list section "[_ project-manager.Assignees]"] \ + [list values $assignees] \ + ] ] +} + +ad_form -extend -name task_add_edit -new_request { + set send_email_p t + set task_title "" + set description "" + set description_mime_type "text/plain" + set estimated_hours_work 0 + set estimated_hours_work_min 0 + set estimated_hours_work_max 0 + set estimated_days_work_min 0 + set estimated_days_work_max 0 + set percent_complete 0 + set task_end_date [db_string today {}] + set dependency "" + set priority 0 +} -edit_request { + db_1row get_task_data {} + + set task_end_time [template::util::date::from_ansi $task_end_date [lc_get frombuilder_time_format]] + set task_end_date [lindex $task_end_date 0] + + set hours_day [pm::util::hours_day] + set estimated_days_work_min [expr $estimated_hours_work_min / $hours_day] + set estimated_days_work_max [expr $estimated_hours_work_max / $hours_day] + + set log_date [db_string today {}] +} -validate { +} -on_submit { + set hours_day [pm::util::hours_day] + set status_id [pm::task::default_status_open] + + set end_date_split [split $task_end_date "-"] + set end_date(day) [lindex [set end_date_split] 2] + set end_date(month) [lindex [set end_date_split] 1] + set end_date(year) [lindex [set end_date_split] 0] + set end_date(format) "" + ad_page_contract_filter_proc_date end_date end_date + + set task_end_date_list [split $end_date(date) "-"] + append task_end_date_list " [lrange $task_end_time 3 5]" + + set end_date(date) $task_end_date_list + set end_date_sql [pm::util::datenvl -value $end_date(date) -value_if_null "null" -value_if_not_null "to_timestamp('$end_date(date)','YYYY MM DD HH24 MI SS')"] + + if {[info exists log_date]} { + set log_date_split [split $log_date "-"] + set log_date_array(day) [lindex [set log_date_split] 2] + set log_date_array(month) [lindex [set log_date_split] 1] + set log_date_array(year) [lindex [set log_date_split] 0] + set log_date_array(format) "" + ad_page_contract_filter_proc_date log_date_array log_date_array + } + + if {[string is true $use_day_p]} { + # set the hours work + if {[string is true $use_uncertain_completion_times_p]} { + set estimated_hours_work_min \ + [expr $estimated_days_work_min * $hours_day] + set estimated_hours_work_max \ + [expr $estimated_days_work_max * $hours_day] + } else { + set estimated_hours_work \ + [expr $estimated_days_work * $hours_day] + } + } + + if {$estimated_hours_work_min > $estimated_hours_work_max} { + set temp $estimated_hours_work_max + set estimated_hours_work_max $estimated_hours_work_min + set estimated_hours_work_min $temp + } + + if {[string is true $use_uncertain_completion_times_p]} { + set estimated_hours_work [expr .5 * ($estimated_hours_work_max - $estimated_hours_work_min) + $estimated_hours_work_min] + } else { + set estimated_hours_work_min $estimated_hours_work + set estimated_hours_work_max $estimated_hours_work + } + +} -new_data { + db_transaction { + + # ----------------------------------- + # USING PROCESS OR CREATING NEW TASKS + # ----------------------------------- + + if {[string is true $using_process_p]} { + set process_instance_id [pm::process::instantiate \ + -process_id $process_id \ + -project_item_id $project_item_id \ + -name $process_name] + } else { + set process_instance_id "" + } + + # ----------- + # create task + # ----------- + + permission::require_permission -party_id $user_id -object_id $project_item_id -privilege create + + set task_id [dtype::form::process \ + -dform $dform \ + -prefix pm \ + -object_type pm_task \ + -object_id $task_id \ + -form task_add_edit \ + -cr_widget none \ + -defaults [list title $task_title description $description mime_type $description_mime_type context_id $project_item_id parent_id $project_item_id object_type pm_task] \ + -default_fields {percent_complete {end_date $end_date_sql} estimated_hours_work estimated_hours_work_min estimated_hours_work_max priority dform} \ + -exclude_static] + + set task_item_id [db_string get_item_id {}] + + db_dml new_task {} + + if {[exists_and_not_null category_ids]} { + category::map_object -object_id $task_id $category_ids + } + + if {$percent_complete >= 100} { + pm::task::close -task_item_id $task_item_id + } + + # ---------------- + # add in assignees + # ---------------- + + if {[array exists assignee]} { + foreach role [array names assignee] { + foreach person_id $assignee($role) { + pm::task::assign \ + -task_item_id $task_item_id \ + -party_id $person_id \ + -role_id $role + } + } + } + + # ------------------- + # add in dependencies + # ------------------- + + # if there is a numXX as the dependency, then we are relying + # on new tasks that had not been created yet. So we match them + # up with the new tasks we've just created. + if {[regexp {num(.*)} $dependency match parent]} { + set dependency $task_item_id($parent) + } + + if {[exists_and_not_null dependency]} { + pm::task::dependency_add \ + -task_item_id $task_item_id \ + -parent_id $dependency \ + -dependency_type finish_before_start \ + -project_item_id $project_item_id + } + + callback pm::task_new -package_id $package_id -task_id $task_item_id + } +} -edit_data { + db_transaction { + + pm::task::clear_client_properties \ + -task_item_id $task_item_id + + # ------------------------------------- + # Log hours and other variables to task + # ------------------------------------- + + set logger_project [lindex [application_data_link::get_linked -from_object_id $project_item_id -to_object_type logger_project] 0] + + if {[exists_and_not_null hours]} { + + pm::project::log_hours \ + -logger_project_id $logger_project \ + -variable_id $logger_variable_id \ + -value $hours \ + -description $log \ + -task_item_id $task_item_id \ + -project_item_id $project_item_id \ + -update_status_p f \ + -party_id $user_id \ + -timestamp_ansi $log_date_array(date) + } + + # --------- + # edit task + # --------- + + permission::require_permission -party_id $user_id -object_id $task_item_id -privilege write + + set task_id [dtype::form::process \ + -dform $dform \ + -prefix pm \ + -object_type pm_task \ + -object_id $task_id \ + -form task_add_edit \ + -cr_widget none \ + -defaults [list title $task_title description $description mime_type $description_mime_type context_id $project_item_id parent_id $project_item_id object_type pm_task] \ + -default_fields {percent_complete {end_date $end_date_sql} estimated_hours_work estimated_hours_work_min estimated_hours_work_max priority dform} \ + -exclude_static] + + db_dml update_task {} + + if {[exists_and_not_null category_ids]} { + category::map_object -object_id $task_id $category_ids + } + + set actual_hours_worked [pm::task::update_hours -task_item_id $task_item_id] + if {$percent_complete >= 100} { + pm::task::close -task_item_id $task_item_id + } + + # -------------------------- + # remove all old assignments + # -------------------------- + pm::task::assign_remove_everyone \ + -task_item_id $task_item_id + + # ----------------------- + # remove all dependencies + # ----------------------- + pm::task::dependency_delete_all \ + -task_item_id $task_item_id + + + # ---------------- + # add in assignees + # ---------------- + + if {[array exists assignee]} { + foreach role [array names assignee] { + foreach person_id $assignee($role) { + pm::task::assign \ + -task_item_id $task_item_id \ + -party_id $person_id \ + -role_id $role + } + } + } + + # ----------------------- + # add in the dependencies + # ----------------------- + + if {[exists_and_not_null dependency]} { + pm::task::dependency_add \ + -task_item_id $task_item_id \ + -parent_id $dependency \ + -dependency_type finish_before_start \ + -project_item_id $project_item_id + } + + callback pm::task_edit -package_id $package_id -task_id $task_item_id + } +} -after_submit { + set number 1 + set comments(1) $comment + set comments_mime_type(1) $comment_mime_type + + ad_set_client_property -persistent f -- \ + project-manager \ + project_item_id(1) \ + $project_item_id + + ad_set_client_property -persistent f -- \ + project-manager \ + task_item_id(1) \ + $task_item_id + + ad_returnredirect \ + [export_vars -base task-add-edit-3 \ + { \ + number:multiple \ + using_process_p \ + process_instance_id \ + edit_p \ + comments:array \ + comments_mime_type:array \ + send_email_p \ + return_url}] + + ad_script_abort +} + Index: openacs-4/packages/project-manager/templates/task-ae.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/task-ae.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/task-ae.xql 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,57 @@ + + + + + + select i.latest_revision as task_id, t.parent_id as project_item_id + from cr_items i, pm_tasks_revisionsx t + where i.item_id = :task_item_id + and t.object_id = i.latest_revision + + + + + + select dform + from pm_tasks_revisions + where task_revision_id = :task_id + + + + + + select title as task_title, description, mime_type as description_mime_type, + percent_complete, to_char(end_date,'YYYY-MM-DD HH24:MI:SS') as task_end_date, + estimated_hours_work, estimated_hours_work_min, + estimated_hours_work_max, priority + from pm_tasks_revisionsi + where object_id = :task_id + + + + + + select item_id + from cr_revisions + where revision_id = :task_id + + + + + + insert into pm_tasks + (task_id, task_number, status, process_instance) + values + (:task_item_id, 1, :status_id, :process_instance_id) + + + + + + update pm_tasks + set status = :status_id + where task_id = :task_item_id + + + + Index: openacs-4/packages/project-manager/templates/task-one-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/task-one-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/task-one-oracle.xql 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,138 @@ + + + oracle8.0 + + + SELECT t.item_id, + t.parent_id as project_item_id, + t.title as task_title, + t.revision_id, + t.description, + t.mime_type, + to_char(t.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, + to_char(t.earliest_start,'J') as earliest_start_j, + to_char(t.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, + to_char(t.latest_start,'J') as latest_start_j, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, + to_char(t.end_date,'YYYY-MM-DD HH24:MI:SS') as end_date, + to_char(current_date,'J') as today_j, + t.estimated_hours_work, + t.estimated_hours_work_min, + t.estimated_hours_work_max, + t.percent_complete, + t.priority, + t.dform, + i.live_revision, + p.first_names || ' ' || p.last_name as creation_user, + proj_rev.title as project_name + FROM pm_tasks_revisionsx t, + cr_items i, + persons p, + cr_items proj, + cr_revisions proj_rev + WHERE t.item_id = :task_id and + t.revision_id = :task_revision_id and + t.item_id = i.item_id and + t.creation_user = p.person_id and + t.parent_id = proj.item_id and + proj.live_revision = proj_rev.revision_id + + + + + + SELECT + t.title as task_title, + to_char(t.end_date,'MM/DD/YYYY') as end_date, + t.percent_complete, + i.live_revision, + d.parent_task_id, + d.dependency_type + FROM + pm_tasks_revisionsx t, cr_items i, pm_task_dependency d + WHERE + d.task_id = :task_id and + d.parent_task_id = t.item_id and + t.revision_id = i.live_revision and + t.item_id = i.item_id + [template::list::orderby_clause -name dependency -orderby] + + + + + + SELECT t.title as task_title, + to_char(t.end_date,'MM/DD/YYYY') as end_date, + t.percent_complete, + i.live_revision, + d.parent_task_id, + d.dependency_type, + d.task_id as d_task_id + FROM pm_tasks_revisionsx t, + cr_items i, + pm_task_dependency d + WHERE d.task_id = t.item_id and + d.parent_task_id = :task_id and + t.revision_id = i.live_revision and + t.item_id = i.item_id + [template::list::orderby_clause -name dependency2 -orderby] + + + + + + select r.one_line, + u.first_names || ' ' || u.last_name as user_info, + r.role_id + from pm_task_assignment a, + persons u, + pm_roles r + where a.task_id = :task_id and + u.person_id = a.party_id and + a.role_id = r.role_id + [template::list::orderby_clause -name people -orderby] + + + + + + SELECT x.task_id_1 as x_task_id, + r.title, + to_char(r.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, + r.earliest_start - current_date as days_to_earliest_start, + to_char(r.earliest_start,'J') as earliest_start_j, + to_char(r.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, + r.earliest_finish - current_date as days_to_earliest_finish, + to_char(r.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, + r.latest_start - current_date as days_to_latest_start, + to_char(r.latest_start,'J') as latest_start_j, + to_char(current_date,'J') as today_j, + to_char(r.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, + r.latest_finish - current_date as days_to_latest_finish + FROM pm_task_xref x, pm_tasks_revisionsx r, cr_items i + WHERE x.task_id_2 = :task_id and + x.task_id_1 = r.item_id and + r.revision_id = i.live_revision + UNION + SELECT x2.task_id_2 as x_task_id, + r2.title, + to_char(r2.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, + r2.earliest_start - current_date as days_to_earliest_start, + to_char(r2.earliest_start,'J') as earliest_start_j, + to_char(r2.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, + r2.earliest_finish - current_date as days_to_earliest_finish, + to_char(r2.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, + r2.latest_start - current_date as days_to_latest_start, + to_char(r2.latest_start,'J') as latest_start_j, + to_char(current_date,'J') as today_j, + to_char(r2.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, + r2.latest_finish - current_date as days_to_latest_finish + FROM pm_task_xref x2, pm_tasks_revisionsx r2, cr_items i2 + WHERE x2.task_id_1 = :task_id and + x2.task_id_2 = r2.item_id and + i2.live_revision = r2.revision_id + + + + Index: openacs-4/packages/project-manager/templates/task-one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/task-one-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/task-one-postgresql.xql 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,79 @@ + + + + + + SELECT + t.item_id, + t.parent_id as project_item_id, + t.title as task_title, + t.revision_id, + t.description, + t.mime_type, + to_char(t.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, + to_char(t.earliest_start,'J') as earliest_start_j, + to_char(t.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, + to_char(t.latest_start,'J') as latest_start_j, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, + to_char(t.end_date,'YYYY-MM-DD HH24:MI:SS') as end_date, + to_char(current_date,'J') as today_j, + t.estimated_hours_work, + t.estimated_hours_work_min, + t.estimated_hours_work_max, + t.percent_complete, + t.priority, + t.dform, + i.live_revision, + p.first_names || ' ' || p.last_name as creation_user, + proj_rev.title as project_name, + a.process_instance, + acs_permission__permission_p (:task_id,:user_id,'write') as write_p, + acs_permission__permission_p (:task_id,:user_id,'create') as create_p + FROM + pm_tasks_revisionsx t, + cr_items i, + persons p, + cr_items proj, + cr_revisions proj_rev, + pm_tasks_active a + WHERE + t.item_id = :task_id and + t.revision_id = :task_revision_id and + t.item_id = i.item_id and + t.creation_user = p.person_id and + t.parent_id = proj.item_id and + proj.live_revision = proj_rev.revision_id and + t.item_id = a.task_id + and exists (select 1 from acs_object_party_privilege_map ppm + where ppm.object_id = a.task_id + and ppm.privilege = 'read' + and ppm.party_id = :user_id) + + + + + + select + r.one_line, + u.first_names || ' ' || u.last_name as user_info, + r.role_id, + r.is_observer_p, + r.is_lead_p + from + pm_task_assignment a, + persons u, + pm_roles r + where + a.task_id = :task_id and + u.person_id = a.party_id and + a.role_id = r.role_id + and exists (select 1 from acs_object_party_privilege_map ppm + where ppm.object_id = a.task_id + and ppm.privilege = 'read' + and ppm.party_id = :user_id) + [template::list::orderby_clause -name people -orderby] + + + + Index: openacs-4/packages/project-manager/templates/task-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/task-one.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/task-one.adp 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,98 @@ + + + @task_term@ #@task_id@: + @task_info.task_title;noquote@ @closed_message@ + @context;noquote@ + @project_item_id@ + + + #project-manager.lt_not_current_select_live# + + + + + + + + + + + + + + #project-manager.Process_status# + + + + + + + @process_html;noquote@ + + + + + + + + + + + + + + @notification_chunk;noquote@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/project-manager/templates/task-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/templates/task-one.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/templates/task-one.tcl 11 Aug 2005 21:09:30 -0000 1.1 @@ -0,0 +1,163 @@ +# --------------------------------------------------------------- # + + +# the unique identifier for this package +#set package_id [ad_conn package_id] +#set package_url [ad_conn package_url] +#set user_id [ad_conn user_id] + + +# permissions. Seemed to be superceded below and now again because of granular permissions work. +#permission::require_permission -object_id $task_id -privilege "read" + +#set write_p [permission::permission_p -object_id $task_id -privilege "write"] +#set create_p [permission::permission_p -object_id $task_id -privilege "create"] + +# Master for the portlets +set portlet_master "/packages/project-manager/lib/portlet" + +# terminology and other parameters +set task_term [_ project-manager.Task] +set task_term_lower [_ project-manager.task] +set assignee_term [parameter::get -parameter "AssigneeName" -default "Assignee"] +set watcher_term [parameter::get -parameter "WatcherName" -default "Watcher"] +set project_term [_ project-manager.Project] +set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] + + +set use_days_p [parameter::get -parameter "UseDayInsteadOfHour" -default "t"] + +# the unique identifier for this package +set package_id [ad_conn package_id] +set package_url [ad_conn package_url] +set user_id [ad_maybe_redirect_for_registration] + +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] + +#------------------------ +# Check if the project will be handled on daily basis or will show hours and minutes +#------------------------ + +set fmt "%x %r" +if { $daily_p } { + set fmt "%x" +} + + + +# permissions. This is a general 'does the user have permission to even ask for this page to be run?' +permission::require_permission -party_id $user_id -object_id $package_id -privilege read + +# These values are now set by the query that extracts the task. +#set write_p [permission::permission_p -object_id $package_id -privilege write] +#set create_p [permission::permission_p -object_id $package_id -privilege create] + + + +# Task info ---------------------------------------------------------- + +db_1row task_query { } -column_array task_info + +# format the hours remaining section + +set task_info(hours_remaining) \ + [pm::task::hours_remaining \ + -estimated_hours_work $task_info(estimated_hours_work) \ + -estimated_hours_work_min $task_info(estimated_hours_work_min) \ + -estimated_hours_work_max $task_info(estimated_hours_work_max) \ + -percent_complete $task_info(percent_complete)] + +set task_info(days_remaining) \ + [pm::task::days_remaining \ + -estimated_hours_work $task_info(estimated_hours_work) \ + -estimated_hours_work_min $task_info(estimated_hours_work_min) \ + -estimated_hours_work_max $task_info(estimated_hours_work_max) \ + -percent_complete $task_info(percent_complete)] + +# format the dates according to the local settings +set task_info(earliest_start) [lc_time_fmt $task_info(earliest_start) $fmt] +set task_info(earliest_finish) [lc_time_fmt $task_info(earliest_finish) $fmt] +set task_info(latest_start) [lc_time_fmt $task_info(latest_start) $fmt] +set task_info(latest_finish) [lc_time_fmt $task_info(latest_finish) $fmt] +set task_info(end_date) [lc_time_fmt $task_info(end_date) $fmt] + +# we do this for the hours include portion +set project_item_id $task_info(project_item_id) + +set context [list [list "one?project_item_id=$task_info(project_item_id)" "$task_info(project_name)"] "$task_info(task_title)"] + + +set richtext_list [list $task_info(description) $task_info(mime_type)] + +set task_info(description) [template::util::richtext::get_property html_value $richtext_list] + +if {[exists_and_not_null task_info(earliest_start_j)]} { + set task_info(slack_time) [pm::task::slack_time \ + -earliest_start_j $task_info(earliest_start_j) \ + -today_j $task_info(today_j) \ + -latest_start_j $task_info(latest_start_j)] +} + +if {$task_info(percent_complete) >= 100} { + set closed_message "[_ project-manager.--_Closed]" +} else { + set closed_message "" +} + + +# if part of a process, offer link to process +if {![empty_string_p $task_info(process_instance)]} { + set process_url [pm::process::url \ + -process_instance_id $task_info(process_instance) \ + -project_item_id $task_info(project_item_id) \ + -fully_qualified_p "f"] + set process_name [pm::process::name \ + -process_instance_id $task_info(process_instance)] + set process_html "$process_name" +} else { + set process_html "" +} + + +# how to get back here +set return_url [ad_return_url] + +set task_edit_url [export_vars -base task-add-edit {{task_item_id $task_id} return_url project_item_id}] + +set logger_project [lindex [application_data_link::get_linked -from_object_id $task_info(project_item_id) -to_object_type logger_project] 0] + +set logger_url [pm::util::logger_url] + +if {[empty_string_p $logger_variable_id]} { + set logger_variable_id [logger::project::get_primary_variable \ + -project_id $logger_project] +} + +set log_url [export_vars -base "${logger_url}log" -url {{project_id $logger_project} {pm_project_id $task_info(project_item_id)} {pm_task_id $task_id} return_url}] + + + +set then_ansi [clock format [clock scan "-$logger_days days"] -format "%Y-%m-%d"] + +set day_widget "[_ project-manager.Last] [_ project-manager.Days]" + +set variable_widget [logger::ui::variable_select_widget \ + -project_id $logger_project \ + -current_variable_id $logger_variable_id \ + -select_name logger_variable_id] + +set variable_exports [export_vars -form -entire_form -exclude {logger_variable_id logger_days }] + + +# ------------------ +# Notifications info +# ------------------ +set notification_chunk [notification::display::request_widget \ + -type pm_task_notif \ + -object_id $task_id \ + -pretty_name "$task_info(task_title)" \ + -url "[ad_conn url]?[ad_conn query]" \ + ] + +# ------------------------- END OF FILE ------------------------- #