Index: openacs-4/packages/project-manager/www/add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/add-edit.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager/www/add-edit.adp 29 Apr 2005 17:43:37 -0000 1.1 +++ openacs-4/packages/project-manager/www/add-edit.adp 11 Aug 2005 21:31:56 -0000 1.2 @@ -1,8 +1,6 @@ - - -@context_bar;noquote@ -@title@ - -
- -
+ + + + + + \ No newline at end of file Index: openacs-4/packages/project-manager/www/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/add-edit.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/project-manager/www/add-edit.tcl 10 Aug 2005 18:33:34 -0000 1.17 +++ openacs-4/packages/project-manager/www/add-edit.tcl 11 Aug 2005 21:31:56 -0000 1.18 @@ -34,318 +34,13 @@ } -# --------------------------------------------------------------- # -# 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 - +# We need to know if project_id is sent or not to figure out id we sent it on +# the include or not +if { [exists_and_not_null project_id] } { + set project_id_p 1 } 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 + set project_id_p 0 } - -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 +# Retrieving the name of the template to call +set template_src [parameter::get -parameter "ProjectAdd"] Index: openacs-4/packages/project-manager/www/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/one.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/project-manager/www/one.adp 30 Jul 2005 00:26:33 -0000 1.8 +++ openacs-4/packages/project-manager/www/one.adp 11 Aug 2005 21:31:55 -0000 1.9 @@ -1,133 +1 @@ - - - @my_title;noquote@ -- #project-manager.Closed# - - - @my_title;noquote@ - -@context;noquote@ -@project_item_id@ - -

#project-manager.lt_not_current_set_live#

-
- -

- -

- -

- -

- - -

- - - - - -

- -

- -

- -

- -

- - -

- - - - - -

- -

- -

- - -

- - - -

- - - - - - \ No newline at end of file + \ No newline at end of file Index: openacs-4/packages/project-manager/www/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/one.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/project-manager/www/one.tcl 10 Aug 2005 18:33:34 -0000 1.9 +++ openacs-4/packages/project-manager/www/one.tcl 11 Aug 2005 21:31:55 -0000 1.10 @@ -1,4 +1,4 @@ -ad_page_contract { + ad_page_contract { Main view page for one project. Also shows logged time, and allows a user to log time @@ -84,62 +84,7 @@ } } -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)"] -} - - -ad_return_template "../templates/project-one" +# Retrieving the value of the parameter to know wich include to call +set template_src [parameter::get -parameter "ProjectOne"] # ------------------------- END OF FILE ------------------------- # Index: openacs-4/packages/project-manager/www/task-add-edit-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-add-edit-one.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/project-manager/www/task-add-edit-one.adp 27 Jul 2005 19:01:57 -0000 1.2 +++ openacs-4/packages/project-manager/www/task-add-edit-one.adp 11 Aug 2005 21:31:55 -0000 1.3 @@ -1,7 +1,16 @@ - - @title;noquote@ - @context@ - -

- -
+ + + + + + + + + + + + + + + + \ No newline at end of file Index: openacs-4/packages/project-manager/www/task-add-edit-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-add-edit-one.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/project-manager/www/task-add-edit-one.tcl 10 Aug 2005 18:33:34 -0000 1.16 +++ openacs-4/packages/project-manager/www/task-add-edit-one.tcl 11 Aug 2005 21:31:55 -0000 1.17 @@ -31,687 +31,18 @@ {assignee:array,multiple,optional} } - -# --------------------------------------------------------------- -# 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]" +# Checking if the variables exist to sent them in the include +if { [exists_and_not_null task_item_id] } { + set exist_task_p 1 } else { - set work_units "[_ project-manager.hrs]" + set exist_task_p 0 } -# --------------------------------------------------------------- -# 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 {} +if { [array exists assignee] } { + set exist_assignee_p 1 } else { - set edit_p f + set exist_assignee_p 0 } -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 -} - -ad_return_template "../templates/project-taeo" +# Retrieving the value of the parameter to know which template to call +set template_src [parameter::get -parameter "TaskAdd"] Index: openacs-4/packages/project-manager/www/task-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-one.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/project-manager/www/task-one.adp 30 Jul 2005 00:26:33 -0000 1.8 +++ openacs-4/packages/project-manager/www/task-one.adp 11 Aug 2005 21:31:55 -0000 1.9 @@ -1,98 +1,38 @@ - - - @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/www/task-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-one.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/project-manager/www/task-one.tcl 10 Aug 2005 18:33:34 -0000 1.11 +++ openacs-4/packages/project-manager/www/task-one.tcl 11 Aug 2005 21:31:55 -0000 1.12 @@ -72,169 +72,29 @@ revision_id_exists {That task does not exist} } - # --------------------------------------------------------------- # -# 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] +# Checking if the optional variables exist to know if we are going +# to send them in the include - -# 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 { [exists_and_not_null task_id] } { + set exist_task_p 1 +} else { + set exist_task_p 0 } -if {$task_info(percent_complete) >= 100} { - set closed_message "[_ project-manager.--_Closed]" +if { [exists_and_not_null task_revision_id] } { + set exist_task_rev_p 1 } else { - set closed_message "" + set exist_task_rev_p 0 } - -# 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" +if { [exists_and_not_null orderby_people] } { + set exist_order_by_p 1 } else { - set process_html "" + set exist_order_by_p 0 } - -# 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]" \ - ] - - -ad_return_template "../templates/project-to" - +# Retrieving the value of the parameter to knwo wich template we call +set template_src [parameter::get -parameter "TaskOne"] # ------------------------- END OF FILE ------------------------- #