Index: openacs-4/contrib/packages/project-manager/www/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one.tcl,v diff -u -r1.30.2.19 -r1.30.2.20 --- openacs-4/contrib/packages/project-manager/www/one.tcl 30 Apr 2005 06:53:09 -0000 1.30.2.19 +++ openacs-4/contrib/packages/project-manager/www/one.tcl 2 May 2005 08:15:49 -0000 1.30.2.20 @@ -94,415 +94,34 @@ # 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] +set user_id [auth::require_login] # terminology and other parameters set project_term [parameter::get -parameter "ProjectName" -default "Project"] -set project_term_lower [parameter::get -parameter "projectname" -default "project"] -set task_term [parameter::get -parameter "TaskName" -default "Task"] -set use_goal_p [parameter::get -parameter "UseGoalP" -default "1"] -set hide_done_tasks_p [parameter::get -parameter "HideDoneTaskP" -default "1"] -set use_project_code_p [parameter::get -parameter "UseUserProjectCodesP" -default "1"] -set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] 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 -set write_p [permission::permission_p -object_id $package_id -privilege write] -set create_p [permission::permission_p -object_id $package_id -privilege create] - - -set process_instance_options [pm::process::instance_options \ - -project_item_id $project_item_id \ - -process_instance_id $instance_id] - - -set process_reminder_url [export_vars -base process-reminder {instance_id project_item_id return_url}] - -if {[empty_string_p $process_instance_options]} { - set instance_html "" -} else { - - set instance_html " -
- [export_vars -form -entire_form -exclude {instance_id}] - - -
" -} - -# we do this so that the list builder templates don't add a where -# clause when instance_id is set. -if {[empty_string_p $instance_id]} { - unset instance_id -} - -# categories - -set categories [list] -set cat_list [category::get_mapped_categories $project_item_id] -foreach cat $cat_list { - lappend categories [category::get_name $cat] -} - +# Get Project Information db_1row project_query { } -column_array project -set richtext_list [list $project(description) $project(mime_type)] - -set project(description) [template::util::richtext::get_property html_value $richtext_list] - -set project_root [db_exec_plsql get_root_folder { }] - -set project(planned_start_date) [lc_time_fmt $project(planned_start_date) "%x"] -set project(planned_end_date) [lc_time_fmt $project(planned_end_date) "%x"] -set project(estimated_finish_date) [lc_time_fmt $project(estimated_finish_date) "%x"] -set project(earliest_finish_date) [lc_time_fmt $project(earliest_finish_date) "%x"] -set project(latest_finish_date) [lc_time_fmt $project(latest_finish_date) "%x"] - -# ---------------- -# general comments -# ---------------- -set comments [general_comments_get_comments -print_content_p 1 -print_attachments_p 1 $project_item_id "[ad_conn url]?project_item_id=$project_item_id"] - -set comments_link "Add comment" - - -# we can also get the link to the logger instance. -set logger_url [pm::util::logger_url] -set logger_project_url "$logger_url?project_id=$project(logger_project)" - -if {![exists_and_not_null logger_variable_id]} { - set logger_variable_id [logger::project::get_primary_variable \ - -project_id $project(logger_project)] -} - -set variable_widget [logger::ui::variable_select_widget \ - -project_id $project(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 }] - -set log_url "${logger_url}log?project_id=$project(logger_project)&pm_project_id=$project_item_id&return_url=$return_url&variable_id=$logger_variable_id" - -# There is no point showing an empty listbox, which happens if the user assigns all roles to himself. Doing it this way avoids another trip to the database. -set select_list_html [pm::role::project_select_list -select_name "role_id" -project_item_id $project_item_id -party_id $user_id] -if {[string compare $select_list_html ""]} { - set assignee_add_self_widget "Add myself as
[export_vars -form {project_item_id user_id return_url}]$select_list_html
" - set roles_listbox_p 1 -} else { - set roles_listbox_p 0 -} - -# Only need a 'remove myself' link if you are already assigned -set assigned_p [pm::project::assigned_p -project_item_id $project_item_id -party_id $user_id] -if {$assigned_p} { - set assignee_remove_self_url [export_vars -base project-assign-remove {project_item_id user_id return_url}] -} - -set assignee_edit_url [export_vars -base project-assign-edit {project_item_id return_url}] - -set today_ansi [clock format [clock scan today] -format "%Y-%m-%d"] -set then_ansi [clock format [clock scan "-$logger_days days"] -format "%Y-%m-%d"] - - -set day_widget "Last Days" - - +# 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 edit_url "[ad_conn package_url]add-edit?[export_url_vars project_item_id]" - -# set up context bar, needs parent_id +# set up context bar, needs project(parent_id) if {[string equal $project(parent_id) $project_root]} { set context [list "$project(project_name)"] } else { - set context [list [list "one?project_item_id=$project(parent_id)" "Parent"] "$project(project_name)"] + 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)"] } -set processes_html [pm::process::select_html] -# Tasks, using list-builder --------------------------------- - -# Hide finished tasks. This should be added as a filter, but I did not have time to look it up in the howto. - -if {$hide_done_tasks_p} { - set done_clause "and t.percent_complete < 100" -} else { - set done_clause "" -} - -set process_link "process-use?project_item_id=$project_item_id" - -set default_orderby [pm::project::one_default_orderby] - -if {[exists_and_not_null orderby_tasks]} { - pm::project::one_default_orderby \ - -set $orderby_tasks -} - - -template::list::create \ - -name tasks \ - -multirow tasks \ - -key task_item_id \ - -html {width 100%} \ - -elements { - task_item_id { - label "ID" - } - status_type { - label "Done" - display_template { - - } - } - title { - label "Subject" - display_template "@tasks.title@@tasks.title@" - } - parent_task_id { - label "Dep" - display_template { - @tasks.parent_task_id@ - } - } - priority { - label "Priority" - display_template { - @tasks.priority@ - } - } - slack_time { - label "Slack" - display_template " - - - @tasks.slack_time@ - - " - } - earliest_start { - label "Earliest Start" - display_template "@tasks.earliest_start_pretty@@tasks.earliest_start_pretty@" - } - earliest_finish { - label "Earliest Finish" - display_template "@tasks.earliest_finish_pretty@@tasks.earliest_finish_pretty@" - } - latest_start { - label "Latest Start" - display_template "@tasks.latest_start_pretty@@tasks.latest_start_pretty@" - } - latest_finish { - label "Latest Finish" - display_template "@tasks.latest_finish_pretty@@tasks.latest_finish_pretty@" - } - last_name { - label "Who" - display_template { - - - - - - @tasks.first_names@ @tasks.last_name@ - - - - -
-
- } - - } - } \ - -bulk_actions { - "Edit" "task-add-edit" "Edit tasks" - } \ - -bulk_action_export_vars { - project_item_id - {return_url} - } \ - -sub_class { - narrow - } \ - -filters { - project_item_id { - hide_p 1 - } - instance_id { - hide_p 1 - where_clause {ti.process_instance = :instance_id} - } - orderby_subproject { - hide_p 1 - } - orderby_people { - hide_p 1 - } - } \ - -orderby { - default_value $default_orderby - title { - orderby_asc "title asc, task_item_id asc" - orderby_desc "title desc, task_item_id desc" - default_direction asc - } - priority { - orderby_asc "priority, earliest_start, task_item_id asc, u.first_names, u.last_name" - orderby_desc "priority desc, earliest_start desc, task_item_id desc, u.first_names, u.last_name" - default_direction desc - } - earliest_start { - orderby_asc "earliest_start, task_item_id asc, u.first_names, u.last_name" - orderby_desc "earliest_start desc, task_item_id desc, u.first_names, u.last_name" - default_direction asc - } - earliest_finish { - orderby_asc "earliest_finish, task_item_id asc, u.first_names, u.last_name" - orderby_desc "earliest_finish desc, task_item_id desc, u.first_names, u.last_name" - default_direction asc - } - latest_start { - orderby_asc "latest_start, task_item_id asc, u.first_names, u.last_name" - orderby_desc "latest_start desc, task_item_id desc, u.first_names, u.last_name" - default_direction asc - } - latest_finish { - orderby_asc "latest_finish, task_item_id asc, u.first_names, u.last_name" - orderby_desc "latest_finish desc, task_item_id desc, u.first_names, u.last_name" - default_direction asc - } - } \ - -orderby_name orderby_tasks - - -db_multirow -extend { item_url earliest_start_pretty earliest_finish_pretty latest_start_pretty latest_finish_pretty slack_time my_user_id} tasks project_tasks_query { -} { - set item_url [export_vars -base "task-one" { {task_id $task_item_id}}] - - set earliest_start_pretty [lc_time_fmt $earliest_start "%x"] - set earliest_finish_pretty [lc_time_fmt $earliest_finish "%x"] - set latest_start_pretty [lc_time_fmt $latest_start "%x"] - set latest_finish_pretty [lc_time_fmt $latest_finish "%x"] - - set slack_time [pm::task::slack_time \ - -earliest_start_j $earliest_start_j \ - -today_j $today_j \ - -latest_start_j $latest_start_j] - - set my_user_id $user_id -} - - -if {$use_subprojects_p} { - - # Subprojects, using list-builder --------------------------------- - - db_multirow subproject project_subproject_query { } - - template::list::create \ - -name subproject \ - -multirow subproject \ - -key item_id \ - -elements { - project_name { - label "Subject" - link_url_col item_url - link_html { title "View this subproject" } - } - actual_hours_completed { - label "Hours completed" - } - } \ - -sub_class { - narrow - } \ - -filters { - project_item_id {} - orderby_tasks {} - orderby_people {} - } \ - -orderby { - project_name {orderby project_name} - default_value project_name,desc - } \ - -orderby_name orderby_subproject \ - -html { - width 100% - } - - - - db_multirow -extend { item_url } subproject project_subproject_query { - } { - set item_url [export_vars -base "one" -override {{project_item_id $item_id}} {project_item_id}] - } -} - -# People, using list-builder --------------------------------- - -db_multirow people project_people_query { } - -template::list::create \ - -name people \ - -multirow people \ - -key item_id \ - -elements { - user_name { - label "Who" - display_template { - - @people.user_name@ - - } - } - role_name { - label "Role" - } - } \ - -sub_class { - narrow - } \ - -filters { - party_id {} - orderby_subproject {} - orderby_tasks {} - } \ - -orderby { - role_id {orderby role_id} - default_value role_id,desc - } \ - -orderby_name orderby_subproject \ - -html { - width 100% - } - - -db_multirow -extend { item_url } subproject project_people_query { -} { - -} - - - -# -------------------------CUSTOMIZATIONS-------------------------- -# If there are customizations, put them in a multirow called custom -# ----------------------------------------------------------------- - -db_1row custom_query { } -column_array custom - -set customer_link "[site_node::get_package_url -package_key organizations]one?organization_id=$custom(customer_id)" - -# end of customizations - ad_return_template # ------------------------- END OF FILE ------------------------- #