Index: openacs-4/contrib/packages/project-manager/project-manager.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/Attic/project-manager.info,v diff -u -r1.16.2.1 -r1.16.2.2 --- openacs-4/contrib/packages/project-manager/project-manager.info 20 May 2004 17:30:02 -0000 1.16.2.1 +++ openacs-4/contrib/packages/project-manager/project-manager.info 2 Jul 2004 23:13:48 -0000 1.16.2.2 @@ -7,33 +7,37 @@ f f - + Jade Rubick Project management tool for OpenACS - 2004-05-19 + 2004-07-01 Integrated Bakery Resources Track tasks, estimates and actual progress for a project. See the <a href="http://openacs.org/projects/dotwrk/project_management/">project page</a> for more information. - + - + - + - + - + + + - + + Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-functions-create.sql,v diff -u -r1.13.2.2 -r1.13.2.3 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql 20 May 2004 17:35:19 -0000 1.13.2.2 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-functions-create.sql 2 Jul 2004 23:13:48 -0000 1.13.2.3 @@ -51,7 +51,12 @@ v_folder_name, -- name ''Projects'', -- label ''Project Repository'', -- description - p_package_id -- parent_id + null, -- parent_id + p_package_id, -- context_id + null, -- folder_id + null, -- creation_date + null, -- creation_user + null -- creation_ip ); -- Register the standard content types Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-table-create.sql,v diff -u -r1.19.2.1 -r1.19.2.2 --- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 20 May 2004 17:30:02 -0000 1.19.2.1 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-table-create.sql 2 Jul 2004 23:13:48 -0000 1.19.2.2 @@ -548,7 +548,8 @@ -- PERT charts require minimum and maximum estimates -- these are optionally used estimated_hours_work_min numeric, - estimated_hours_work_max numeric + estimated_hours_work_max numeric, + ordering integer ); comment on table pm_process_task is ' Index: openacs-4/contrib/packages/project-manager/sql/postgresql/upgrade/upgrade-1.03-1.04b1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/upgrade/Attic/upgrade-1.03-1.04b1.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/contrib/packages/project-manager/sql/postgresql/upgrade/upgrade-1.03-1.04b1.sql 20 May 2004 17:42:59 -0000 1.1.2.1 +++ openacs-4/contrib/packages/project-manager/sql/postgresql/upgrade/upgrade-1.03-1.04b1.sql 2 Jul 2004 23:13:48 -0000 1.1.2.2 @@ -67,4 +67,4 @@ -- upgrade script to fix bug #1796 -update cr_items set parent_id = (select package_id from cr_folders where folder_id = item_id and label = 'Projects') where item_id = (select folder_id from cr_folders where label = 'Projects'); +update cr_items set parent_id = (select package_id from cr_folders where folder_id = item_id and label = 'Projects') where item_id = (select folder_id from cr_folders where label = 'Projects' and description = 'Project Repository'); Index: openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-manager-procs.tcl,v diff -u -r1.2.2.2 -r1.2.2.3 --- openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl 20 May 2004 17:35:19 -0000 1.2.2.2 +++ openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl 2 Jul 2004 23:13:48 -0000 1.2.2.3 @@ -181,4 +181,335 @@ return $res } ->>>>>>> 1.4 + + +ad_proc -public pm::util::logger_url {} { + Returns the URL for the primary logger URL + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-05-24 + + @return + + @error +} { + set return_val [parameter::get -parameter "LoggerPrimaryURL" -default ""] + + if {[empty_string_p $return_val]} { + ns_log Error "Project-manager: need to set up LoggerPrimaryURL in parameters" + util_user_message -message "Administrator needs to set up logger integration" + } + + return $return_val +} + + +ad_proc -public pm::util::general_comment_add { + {-object_id:required} + {-title:required} + {-comment ""} + {-mime_type:required} + {-user_id ""} + {-peeraddr ""} + {-type "task"} + {-send_email_p "f"} +} { + Adds a general comment to a task or project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-10 + + @param object_id The item_id for the task or project + + @param title The title for the comment + + @param comment The body of the comment + + @param mime_type The mime_type for the comment + + @param user_id Optional, the user_id making the comment. If left + empty, set to the ad_conn user_id + + @param peeraddr The IP address of the user making the comment. + If empty, set to the ad_conn peeraddr + + @param type Either task or project. + + @param send_email_p Whether or not to send out an email + notification t or f + + @return + + @error -1 if there is an error +} { + if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] + } + + if {[empty_string_p $peeraddr]} { + set peeraddr [ad_conn peeraddr] + } + + if {![string equal $type task] && ![string equal $type project]} { + return -1 + } + + # insert the comment into the database + set is_live [ad_parameter AutoApproveCommentsP {general-comments} {t}] + + set comment_id [db_nextval acs_object_id_seq] + + db_transaction { + db_exec_plsql insert_comment { + select acs_message__new ( + :comment_id, -- 1 p_message_id + NULL, -- 2 p_reply_to + current_timestamp, -- 3 p_sent_date + NULL, -- 4 p_sender + NULL, -- 5 p_rfc822_id + :title, -- 6 p_title + NULL, -- 7 p_description + :mime_type, -- 8 p_mime_type + NULL, -- 9 p_text + NULL, -- empty_blob() -- 10 p_data + 0, -- 11 p_parent_id + :object_id, -- 12 p_context_id + :user_id, -- 13 p_creation_user + :peeraddr, -- 14 p_creation_ip + 'acs_message', -- 15 p_object_type + :is_live -- 16 p_is_live + ) + } + + db_dml add_entry { + insert into general_comments + (comment_id, + object_id, + category) + values + (:comment_id, + :object_id, + null) + } + + db_1row get_revision { + select content_item__get_latest_revision(:comment_id) as revision_id + } + + db_dml set_content { + update cr_revisions + set content = :comment + where revision_id = :revision_id + } + + db_exec_plsql grant_permission { + begin + perform acs_permission__grant_permission ( + /* object_id => */ :comment_id, + /* grantee_id => */ :user_id, + /* privilege => */ 'read' + ); + + perform acs_permission__grant_permission ( + /* object_id => */ :comment_id, + /* grantee_id => */ :user_id, + /* privilege => */ 'write' + ); + return 0; + end; + } + } + + # now send out email + + if {[string equal $send_email_p t]} { + + # task + + if {[string equal $type task]} { + + set assignees [pm::task::assignee_email_list -task_item_id $object_id] + + if {[llength $assignees] > 0} { + + set to_address $assignees + + set from_address [db_string get_from_email "select email from parties where party_id = :user_id" -default "nobody@nowhere.com"] + + set task_url "[parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL][ad_conn package_url]task-one?task_id=$object_id" + + set subject "Task comment: $title" + + set content "$task_url\n\n$comment" + + pm::util::email \ + -to_addr $to_address \ + -from_addr $from_address \ + -subject $subject \ + -body $content \ + -mime_type $mime_type + } + + } + + # project + + if {[string equal $type project]} { + + set assignees [pm::project::assignee_email_list -project_item_id $object_id] + + if {[llength $assignees] > 0} { + + set to_address $assignees + + set from_address [db_string get_from_email "select email from parties where party_id = :user_id" -default "nobody@nowhere.com"] + + set project_url "[parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL][ad_conn package_url]one?project_item_id=$object_id" + + set subject "Project comment: $title" + + set content "$project_url\n\n$comment" + + pm::util::email \ + -to_addr $to_address \ + -from_addr $from_address \ + -subject $subject \ + -body $content \ + -mime_type $mime_type + } + + + } + } + + + return 1 +} + + +ad_proc -public pm::util::email { + {-to_addr:required} + {-from_addr:required} + {-subject:required} + {-body ""} + {-mime_type "text/plain"} +} { + Wrapper to send out email, also converts body to text/plain format + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-10 + + @param to_addr list of email addresses to send to + + @param from_addr + + @param subject + + @param body + + @param mime_type + + @return + + @error +} { + + set nice_text [ad_html_text_convert -from $mime_type -to "text/plain" -- $body] + + foreach to $to_addr { + + acs_mail_lite::send \ + -to_addr "$to" \ + -from_addr "$from_addr" \ + -subject "$subject" \ + -body "$nice_text" + } +} + + +ad_proc -public pm::util::category_selects { + {-export_vars ""} + {-category_id ""} + {-package_id ""} +} { + Returns an HTML fragment of forms, one for each + category tree, suitable for use on a page. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param export_vars Variables already exported with export_vars -form + + @param category_id If set, the currently selected category + + @return + + @error +} { + if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] + } + + # caches results for 2.5 minutes. + return [util_memoize [list pm::util::category_selects_not_cached -export_vars $export_vars -category_id $category_id -package_id $package_id] 300] +} + + + +ad_proc -private pm::util::category_selects_not_cached { + {-export_vars ""} + {-category_id ""} + -package_id:required +} { + Returns an HTML fragment of category choices, suitable + for use on a page. This proc + is used so that pm::util::category_selects can cache + the categories + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param export_vars Variables already exported with export_vars -form + + @param category_id If set, the currently selected category + + @return + + @error +} { + # Categories are arranged into category trees. + # Set up an array for each tree. The array contains the category for each tree + + set category_select "" + set number_of_categories 0 + set last_tree "" + set category_select "" + + db_foreach get_categories { } { + + if {![string equal $tree_name $last_tree] } { + append category_select "" + } + + if {[string equal $cat_id $category_id]} { + set select "selected" + } else { + set select "" + } + + append category_select "" + + set last_tree $tree_name + incr number_of_categories + } + + if {$number_of_categories < 1} { + return "" + } + + set return_val "
$export_vars
" + + return $return_val +} Index: openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-procs.tcl,v diff -u -r1.6.2.2 -r1.6.2.3 --- openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 20 May 2004 17:30:04 -0000 1.6.2.2 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 2 Jul 2004 23:13:48 -0000 1.6.2.3 @@ -224,14 +224,23 @@ -project_lead $creation_user \ ] + # we want the logger project to show up in logger! + set logger_URLs [parameter::get -parameter "LoggerURLsToKeepUpToDate" -default ""] + foreach url $logger_URLs { + # get the package_id + set node_id [site_node::get_node_id -url $url] + array set node [site_node::get -node_id $node_id] + set this_package_id $node(package_id) + + logger::package::map_project \ + -project_id $logger_project \ + -package_id $this_package_id + } + # create a project manager project (associating the logger project # with the logger project) set project_revision [db_exec_plsql new_project_item { *SQL }] - # add in the default variable (hopefully hours) - logger::project::map_variable \ - -project_id $logger_project \ - -variable_id [logger::variable::get_default_variable_id] return $project_revision } @@ -291,6 +300,26 @@ @error } { + # if we edit the name of the project, we need to edit the logger + # project name too. + + set logger_project [pm::project::get_logger_project \ + -project_item_id $project_item_id] + + set active_p [pm::status::open_p -task_status_id $status_id] + set customer_name [organizations::name -organization_id "$organization_id"] + + if {![empty_string_p $customer_name]} { + append customer_name " - " + } + + logger::project::edit \ + -project_id $logger_project \ + -name "$customer_name$project_name" \ + -description "$description" \ + -project_lead $creation_user \ + -active_p $active_p + set returnval [db_exec_plsql update_project " select pm_project__new_project_revision ( :project_item_id, @@ -476,6 +505,10 @@ } { # set temp [expr $min_latest_start + [expr $activity_time($task_item) / double($hours_day)]] + if {[empty_string_p $latest_start_j]} { + return "" + } + set t_start_date $latest_start_j set t_today $t_start_date @@ -562,10 +595,17 @@ TASKS: earliest start(i) = max(activity_time(i-1) + earliest_start(i-1)) earliest_finish(i) = earliest_start(i) + activity_time(i) - latest_start(i) = min(last_start(i+1) - activity_time(i) + latest_start(i) = min(latest_start(i+1) - activity_time(i) latest_finish(i) = latest_start(i) + activity_time(i) + (i-1 means an item that this task depends on) + +

+ + These algorithms are explained at: + http://mscmga.ms.ic.ac.uk/jeb/or/netaon.html

+ Tasks in ongoing projects are given null completion dates, unless they already have deadlines. @@ -607,6 +647,11 @@ # Before hacking on this, you might want to look at: # http://www.joelonsoftware.com/articles/fog0000000069.html + # the first thing that should be done on this code is that it + # should be broken out to a number of utility procs. + + set debug 0 + # TODO: # # ------------------------------------------------------------------------- @@ -630,7 +675,9 @@ # should look at: # http://mscmga.ms.ic.ac.uk/jeb/or/netaon.html - # ns_log Notice "-----------------------------------------" + if {[string is true $debug]} { + ns_log Notice "-----------------------------------------" + } # -------------------------------------------------------------------- # for now, hardcode in a day is 8 hours. Later, we want to set this by @@ -664,7 +711,9 @@ set task_list [concat $task_list $task_list_project] - # ns_log Notice "task_list: $task_list" + if {[string is true $debug]} { + ns_log Notice "Tasks in this project (task_list): $task_list" + } # ------------------------- # no tasks for this project @@ -681,13 +730,19 @@ # today_j (julian date for today) db_1row tasks_group_query { } - # ns_log notice "Julian today: $today_j" + if {[string is true $debug]} { + ns_log notice "Today's date (julian format): $today_j" + } # -------------------------------------------------------------- # Set up activity_time for all tasks # Also set up deadlines for tasks that have hard-coded deadlines # -------------------------------------------------------------- + if {[string is true $debug]} { + ns_log notice "Going through tasks and saving their values" + } + db_foreach tasks_query { } { # We now save information about all the tasks, so that we can @@ -703,13 +758,17 @@ set old_LF_j($my_iid) $old_latest_finish_j set old_task_status($my_iid) $status_type - # ns_log Notice "old_task_status: $my_iid $status_type" + if {[string is true $debug]} { + ns_log Notice "old_task_status: $my_iid $status_type (o=open, c=closed)" + } set activity_time($my_iid) [expr $to_work - $worked] if {[exists_and_not_null task_deadline_j]} { - # ns_log notice "$my_iid has a deadline $task_deadline_j" + if {[string is true $debug]} { + ns_log notice "$my_iid has a deadline (julian: $task_deadline_j)" + } set latest_finish($my_iid) $task_deadline_j @@ -736,7 +795,9 @@ set dependency_types($task_item_id-$parent_task_id) $dependency_type - # ns_log Notice "dependency (id: $dependency_id) task: $task_item_id parent: $parent_task_id type: $dependency_type" + if {[string is true $debug]} { + ns_log Notice "dependency (id: $dependency_id) task: $task_item_id parent: $parent_task_id type: $dependency_type" + } } @@ -749,7 +810,7 @@ # if ongoing_p is t, then end_date_j should be null db_1row project_info { } - if {[string equal $ongoing_p t] && ![empty_string_p $end_date_j]} { + if {[string is true $ongoing_p] && ![empty_string_p $end_date_j]} { ns_log Error "Project cannot be ongoing and have a non-null end-date. Setting end date to blank" set end_date_j "" } @@ -788,24 +849,31 @@ if {![info exists depends($task_item)]} { set earliest_start($task_item) $start_date_j - #set earliest_finish($task_item) [expr $earliest_start($task_item) + [expr $activity_time($task_item) / double($hours_day)]] set earliest_finish($task_item) [earliest_finish $earliest_start($task_item) $activity_time($task_item) $hours_day] lappend present_tasks $task_item - # ns_log Notice "Begin earliest_start($task_item): $earliest_start($task_item)" + if {[string is true $debug]} { + ns_log Notice "preliminary earliest_start($task_item): $earliest_start($task_item)" + } } } # ------------------------------- # stop if we have no dependencies # ------------------------------- if {[llength $present_tasks] == 0} { - # ns_log Notice "No tasks with dependencies" + + if {[string is true $debug]} { + ns_log Notice "No tasks with dependencies" + } + return [list] } - # ns_log Notice "present_tasks: $present_tasks" + if {[string is true $debug]} { + ns_log Notice "present_tasks: $present_tasks" + } # ------------------------------------------------------ # figure out the earliest start and finish times @@ -817,7 +885,9 @@ foreach task_item $present_tasks { - # ns_log Notice "this task_item: $task_item" + if {[string is true $debug]} { + ns_log Notice "-this task_item: $task_item" + } # ----------------------------------------------------- # some tasks may already have earliest_start filled in @@ -827,7 +897,9 @@ if {![exists_and_not_null earliest_start($task_item)]} { - # ns_log Notice " !info exists for $task_item" + if {[string is true $debug]} { + ns_log Notice " !info exists for $task_item" + } # --------------------------------------------- # set the earliest_start for this task = @@ -856,10 +928,12 @@ set earliest_finish($task_item) [earliest_finish $max_earliest_start $activity_time($task_item) $hours_day] - # ns_log Notice \ - # " earliest_start ($task_item): $earliest_start($task_item)" - # ns_log Notice \ - # " earliest_finish($task_item): $earliest_finish($task_item)" + if {[string is true $debug]} { + ns_log Notice \ + " earliest_start ($task_item): $earliest_start($task_item)" + ns_log Notice \ + " earliest_finish($task_item): $earliest_finish($task_item)" + } } @@ -872,7 +946,9 @@ } } - # ns_log Notice "future tasks: $future_tasks" + if {[string is true $debug]} { + ns_log Notice "future tasks: $future_tasks" + } set present_tasks $future_tasks } @@ -885,10 +961,14 @@ foreach task_item $task_list { - # ns_log Notice "*Earliest start ($task_item): $earliest_start($task_item)" - if {$max_earliest_finish < $earliest_finish($task_item)} { + if {[string is true $debug] && [exists_and_not_null earliest_finish($task_item)]} { + ns_log Notice "* EF: ($task_item): $earliest_finish($task_item)" + } + + if {[exists_and_not_null earliest_finish($task_item)] && $max_earliest_finish < $earliest_finish($task_item)} { set max_earliest_finish $earliest_finish($task_item) } + } @@ -969,13 +1049,17 @@ # info for these items # ----------------------------------------------------- - # ns_log Notice "Starting foreach task-item $task_list" + if {[string is true $debug]} { + ns_log Notice "Starting foreach task-item $task_list" + } foreach task_item $task_list { if {![info exists dependent($task_item)]} { - # ns_log Notice " !info exists dependent($task_item)" + if {[string is true $debug]} { + ns_log Notice " !info exists dependent($task_item)" + } # we check this because some tasks already have # hard deadlines set. @@ -986,14 +1070,24 @@ # has precedence. However, sometimes the project is # ongoing, so we have to make sure that there actually # is an end_date_j - if {![empty_string_p $end_date_j]} { - if {$end_date_j < $latest_finish($task_item)} { - set latest_finish($task_item) $end_date_j - } - } + # commented out: we need to trust the user. If they + # set the deadline outside the project deadline, + # that's their business + + #if {![empty_string_p $end_date_j]} { + # if {$end_date_j < $latest_finish($task_item)} { + # set latest_finish($task_item) $end_date_j + # } + #} + # we also set the latest_start date + if {[string is false [exists_and_not_null activity_time($task_item)]]} { + set activity_time($task_item) 0 + ns_log Notice "setting activity_time($task_item) 0" + } + set late_start_temp \ [latest_start \ -end_date_j $latest_finish($task_item) \ @@ -1013,10 +1107,18 @@ # we specify that the task is an ongoing task if {[empty_string_p $end_date_j]} { set ongoing_task($task_item) true - # ns_log Notice "NSDBAHNITD: end_date_j was empty ti:$task_item" + + if {[string is true $debug]} { + ns_log Notice "NSDBAHNITD: end_date_j was empty ti:$task_item" + } } else { set latest_finish($task_item) $end_date_j + if {[string is false [exists_and_not_null activity_time($task_item)]]} { + set activity_time($task_item) 0 + ns_log Notice "setting activity_time($task_item) 0 (location 2)" + } + set latest_start($task_item) \ [latest_start \ -end_date_j $latest_finish($task_item) \ @@ -1027,9 +1129,20 @@ } lappend present_tasks $task_item - # ns_log Notice "Begin latest_start($task_item): $latest_start($task_item) latest_finish: $latest_finish($task_item)" + if {[string is true $debug] && [exists_and_not_null latest_start($task_item)]} { + ns_log Notice "preliminary latest_start($task_item): $latest_start($task_item)" + } + + if {[string is true $debug] && [exists_and_not_null latest_finish($task_item)]} { + ns_log Notice "preliminary latest_finish($task_item): $latest_finish($task_item)" + } + + + } else { - #ns_log Notice " info exists dependent($task_item)" + if {[string is true $debug]} { + ns_log Notice " info exists dependent($task_item)" + } } } @@ -1038,11 +1151,15 @@ # stop if we have no dependencies # ------------------------------- if {[llength $present_tasks] == 0} { - # ns_log Notice "No tasks with dependencies" + if {[string is true $debug]} { + ns_log Notice "No tasks with dependencies" + } return [list] } - # ns_log Notice "LATEST present_tasks: $present_tasks" + if {[string is true $debug]} { + ns_log Notice "LATEST present_tasks: $present_tasks" + } # ------------------------------------------------------ # figure out the latest start and finish times @@ -1054,7 +1171,9 @@ foreach task_item $present_tasks { - # ns_log Notice "this task_item: $task_item" + if {[string is true $debug]} { + ns_log Notice "this task_item: $task_item" + } # ----------------------------------------------------- # some tasks may already have latest_start filled in. @@ -1064,7 +1183,9 @@ if {[info exists dependent($task_item)]} { - # ns_log Notice " info exists for dependent($task_item)" + if {[string is true $debug]} { + ns_log Notice " info exists for dependent($task_item)" + } # --------------------------------------------- # set the latest_start for this task = @@ -1074,20 +1195,31 @@ # (i means this task) # --------------------------------------------- - # we set this to the end date, and then move it back + # we set this to the end date, and then move it forward # as we find dependent items that have earlier # latest_start dates. The problem is that the # end_date_j is empty when there is no deadline. # So we need to remember that min_latest_start can # be an empty value set min_latest_start $end_date_j + if {[string is true $debug]} { + ns_log Notice " min_latest_start: $end_date_j" + } + foreach dependent_item $dependent($task_item) { - + + if {[string is true $debug]} { + ns_log Notice " dependent_item: $dependent_item" + } + if {[exists_and_not_null ongoing_task($dependent_item)]} { set defer_p f set my_latest_start "" - # ns_log Notice "ongoing_task, no defer" + + if {[string is true $debug]} { + ns_log Notice " ongoing_task, no defer" + } } elseif {![exists_and_not_null latest_start($dependent_item)]} { # we defer the task if the dependent item has no @@ -1109,10 +1241,17 @@ # a deadline. :( if {$defer_count($task_item) > 5} { set defer_p f - # ns_log Notice " no defer because defer count exceeded" + + if {[string is true $debug]} { + ns_log Notice " no defer because defer count exceeded" + } } else { lappend future_tasks $task_item - # ns_log Notice " defer" + + if {[string is true $debug]} { + ns_log Notice " defer" + } + set defer_p t } @@ -1122,15 +1261,26 @@ # the dependent item has a deadline + if {[string is false [exists_and_not_null activity_time($task_item)]]} { + set activity_time($task_item) 0 + ns_log Notice "setting activity_time($task_item) 0 (location 3)" + } + set my_latest_start \ [latest_start \ -end_date_j $latest_start($dependent_item) \ -hours_to_complete $activity_time($task_item) \ -hours_day $hours_day] - # ns_log Notice " my_latest_start: $my_latest_start" - - if {$my_latest_start < $min_latest_start} { + if {[string is true $debug]} { + ns_log Notice " my_latest_start: $my_latest_start" + } + + if {[exists_and_not_null min_latest_start]} { + if {$my_latest_start < $min_latest_start} { + set min_latest_start $my_latest_start + } + } else { set min_latest_start $my_latest_start } @@ -1143,9 +1293,38 @@ # we check that latest_start doesn't already exist # which it might for hard-deadlines + + # we have to be fairly careful here. We want to + # set the latest_start date to the minimum + # latest_start, but only when min_latest_start + # actually has a value + if {[exists_and_not_null latest_start($task_item)]} { - if {$min_latest_start < $latest_start($task_item)} { - set latest_start($task_item) $min_latest_start + + if {[exists_and_not_null min_latest_start]} { + + if {$min_latest_start < $latest_start($task_item)} { + set latest_start($task_item) $min_latest_start + } + + } else { + + if {[string is true $debug]} { + ns_log notice " setting latest start date (ignoring min_latest_start" + } + + if {[string is false [exists_and_not_null activity_time($task_item)]]} { + set activity_time($task_item) 0 + ns_log Notice "setting activity_time($task_item) 0 (location 4)" + } + + + set latest_start($task_item) \ + [latest_start \ + -end_date_j $latest_finish($task_item) \ + -hours_to_complete $activity_time($task_item) \ + -hours_day $hours_day] + } } else { @@ -1159,10 +1338,12 @@ set latest_start($task_item) $min_latest_start } - # ns_log Notice " min_latest_start: $min_latest_start" + if {[string is true $debug]} { + ns_log Notice " min_latest_start: $min_latest_start" + } # we now set the latest finish. Ongoing tasks set - # the latest finish to empty + # the latest finish to empty (sometimes) if {[empty_string_p $latest_start($task_item)]} { set temp_lf "" } else { @@ -1173,8 +1354,20 @@ # task, then we check whether temp_lf is earlier, # and set it to temp_lf if so + if {[string is true $debug]} { + ns_log Notice " temp_lf: $temp_lf" + } + if {[empty_string_p $temp_lf]} { - set latest_finish($task_item) "" + + # if the task is ongoing, we clear the + # latest_finish. Otherwise, we leave the + # latest_finish as it is. + + if {[exists_and_not_null ongoing_task($task_item)] && [string is true $ongoing_task($task_item)]} { + set latest_finish($task_item) "" + } + } else { if {[exists_and_not_null latest_finish($task_item)]} { if {$temp_lf < $latest_finish($task_item)} { @@ -1185,12 +1378,21 @@ } } - #ns_log Notice \ - # " latest_start ($task_item): $latest_start($task_item)" - #ns_log Notice \ - # " latest_finish($task_item): $latest_finish($task_item)" + if {[string is true $debug]} { + if {[exists_and_not_null latest_start($task_item)]} { + ns_log Notice \ + " latest_start ($task_item): $latest_start($task_item)" + } + if {[exists_and_not_null latest_finish($task_item)]} { + ns_log Notice \ + " latest_finish($task_item): $latest_finish($task_item)" + } + } + } else { - # ns_log Notice "Deferring $task_item" + if {[string is true $debug]} { + ns_log Notice "Deferring $task_item" + } } } @@ -1203,7 +1405,9 @@ } } - # ns_log Notice "future tasks: $future_tasks" + if {[string is true $debug]} { + ns_log Notice "future tasks: $future_tasks" + } set present_tasks $future_tasks } @@ -1220,8 +1424,11 @@ foreach task_item $task_list { - # ns_log Notice "*Latest start ($task_item): $latest_start($task_item)" - if {$min_latest_start > $latest_start($task_item)} { + if {[string is true $debug]} { + ns_log Notice "* LS ($task_item): $latest_start($task_item)" + } + + if {[exists_and_not_null earliest_finish($task_item)] && $min_latest_start > $latest_start($task_item)} { set max_earliest_finish $earliest_finish($task_item) } } @@ -1240,9 +1447,19 @@ # this is very inefficient and stupid foreach task_item $task_list { - set es "J[expr ceil( [set earliest_start($task_item)])]" - set ef "J[expr ceil( [set earliest_finish($task_item)])]" + if {[exists_and_not_null earliest_start($task_item)]} { + set es "J[expr ceil( [set earliest_start($task_item)])]" + } else { + set es "" + } + + if {[exists_and_not_null earliest_finish($task_item)]} { + set ef "J[expr ceil( [set earliest_finish($task_item)])]" + } else { + set ef "" + } + if {[exists_and_not_null latest_start($task_item)]} { set ls "J[expr floor([set latest_start($task_item)])]" } else { @@ -1275,7 +1492,9 @@ } - # ns_log Notice "*******************" + if {[string is true $debug]} { + ns_log Notice "*******************" + } return $task_list @@ -1342,6 +1561,33 @@ } +ad_proc -public pm::project::get_project { + -logger_project:required +} { + Returns the project_item_id when given the logger project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-05-28 + + @param logger_project + + @return project_item_id + + @error +} { + return [db_string get_logger_project " + SELECT + i.item_id + FROM + pm_projectsx p, cr_items i + WHERE + i.live_revision = p.revision_id and logger_project = :logger_project + " -default "no_project"] + +} + + + ad_proc -public pm::project::get_list_of_open { } { Returns a list of lists, of all open project ids and their names @@ -1374,3 +1620,319 @@ return $return_val } + + +ad_proc -public pm::project::close { + {-project_item_id:required} +} { + Closes a project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-07-02 + + @param project_item_id + + @return + + @error +} { + + set closed_id [pm::status::default_closed] + + db_dml update_status { + UPDATE + pm_projects + SET + status_id = :closed_id + WHERE + project_id in (select live_revision from cr_items where item_id = :project_item_id) + } + +} + + +ad_proc -public pm::project::open_p { + {-project_item_id:required} +} { + Returns true if the project is open + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-03 + + @param project_item_id + + @return 1 if open, 0 if closed + + @error +} { + set return_val [db_string get_open_or_closed { + SELECT + case when status_type = 'c' then 0 else 1 end + FROM + pm_projectsx p, + cr_items i, + pm_project_status s + WHERE + i.item_id = p.item_id and + i.live_revision = p.revision_id and + p.status_id = s.status_id and + p.item_id = :project_item_id + } -default "0"] + + return $return_val +} + + +ad_proc -public pm::project::assign { + {-project_item_id:required} + {-role_id:required} + {-party_id:required} + {-send_email_p "t"} +} { + Assigns a user to a project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param project_item_id + + @param role_id + + @param party_id + + @return + + @error +} { + + db_dml insert_assignment { + insert into pm_project_assignment + (project_id, role_id, party_id) + VALUES + (:project_item_id, :role_id, :party_id) + } + + if {[string is true $send_email_p]} { + + set project_name [pm::project::name \ + -project_item_id $project_item_id] + + set project_url [pm::project::url \ + -project_item_id $project_item_id] + + set to_addr [cc_email_from_party $party_id] + set from_addr [cc_email_from_party [ad_conn user_id]] + + set subject "Assigned to project: $project_name" + + set content "You have been assigned to a project: $project_name + +Link: $project_url" + + pm::util::email \ + -to_addr $to_addr \ + -from_addr $from_addr \ + -subject $subject \ + -body $content \ + -mime_type "text/plain" + } + + return +} + + +ad_proc -public pm::project::unassign { + {-project_item_id:required} + {-party_id:required} +} { + Removes a user from a project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param project_item_id + + @param party_id + + @return + + @error +} { + + db_dml remove_assignment { + DELETE FROM + pm_project_assignment + WHERE + project_id = :project_item_id and + party_id = :party_id + } + + return +} + + +ad_proc -public pm::project::assign_remove_everyone { + {-project_item_id:required} +} { + Removes all users from a project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param project_item_id + + @return party_ids of all users removed from the project + + @error +} { + + set current_assignees [db_list get_assignees { + SELECT + party_id + FROM + pm_project_assignment + WHERE + project_id = :project_item_id + }] + + db_dml remove_assignment { + DELETE FROM + pm_project_assignment + WHERE + project_id = :project_item_id + } + + return $current_assignees +} + + +ad_proc -public pm::project::assignee_filter_select { + {-status_id:required} +} { + Returns a list of lists, people who are assigned to projects with a + status of status_id. Used in the list-builder filters for + the projects list page. Cached 5 minutes. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param status_id + + @return + + @error +} { + return [util_memoize [list pm::project::assignee_filter_select_helper -status_id $status_id] 600] +} + + +ad_proc -private pm::project::assignee_filter_select_helper { + {-status_id:required} +} { + Returns a list of lists, people who are assigned projects with a + status of status_id. Used in the list-builder filters for + the projects list page. Cached 5 minutes. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param status_id + + @return + + @error +} { + return [db_list_of_lists get_people { +SELECT + distinct(first_names || ' ' || last_name) as fullname, + u.person_id + FROM + persons u, + pm_project_assignment a, + pm_projects p, + cr_items i + WHERE + u.person_id = a.party_id and + i.item_id = a.project_id and + p.status_id = :status_id and + i.live_revision = p.project_id + ORDER BY + fullname + }] +} + + +ad_proc -public pm::project::assignee_email_list { + -project_item_id:required +} { + Returns a list of assignee email addresses + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-30 + + @param project_item_id + + @return + + @error +} { + + return [db_list get_addresses { + SELECT + p.email + FROM + parties p, + pm_project_assignment a + WHERE + a.project_id = :project_item_id and + a.party_id = p.party_id + }] + +} + + +ad_proc -public pm::project::name { + -project_item_id:required +} { + Returns the name for a project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-07-01 + + @param project_item_id + + @return + + @error +} { + return [db_string get_name { + SELECT + title + FROM + cr_revisions p, + cr_items i + WHERE + i.live_revision = p.revision_id + and i.item_id = :project_item_id + } -default ""] +} + + +ad_proc -public pm::project::url { + -project_item_id:required +} { + Returns the URL for a project, when given the project_item_id + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-07-01 + + @param project_item_id + + @return + + @error +} { + + return "[ad_url][ad_conn package_url]one?project_item_id=$project_item_id" + +} Index: openacs-4/contrib/packages/project-manager/tcl/task-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/task-procs-postgresql.xql,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/contrib/packages/project-manager/tcl/task-procs-postgresql.xql 20 May 2004 17:30:04 -0000 1.4.2.1 +++ openacs-4/contrib/packages/project-manager/tcl/task-procs-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.4.2.2 @@ -74,7 +74,7 @@ - + SELECT r.item_id, Index: openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/task-procs.tcl,v diff -u -r1.4.2.2 -r1.4.2.3 --- openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl 20 May 2004 17:35:19 -0000 1.4.2.2 +++ openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl 2 Jul 2004 23:13:49 -0000 1.4.2.3 @@ -14,7 +14,7 @@ -ad_proc -public pm::task::dependency_options { +ad_proc -public pm::task::options_list { {-edit_p "f"} -project_item_id {-task_item_id ""} @@ -24,7 +24,8 @@ } { Returns a list of lists suitable for use in a select list for ad_form. Contains a list of possible tasks that this task can - depend upon. + depend upon, or selected. These tasks are limited to just the + one project.

@@ -105,7 +106,10 @@ set dependency_options_full "{\"--None--\" \"\"} " - if {!$edit_p} { + if {[string is true $edit_p]} { + # Do nothing + } else { + # now set up dependency options for {set j 1} {$j <= $number} {incr j} { @@ -118,7 +122,7 @@ # for editing tasks, we skip ourselves (because depending on # ourselves just sometimes isn't an option) - if {[string equal $edit_p t]} { + if {[string is true $edit_p]} { foreach key $keys { # make sure we're not dependent on ourselves @@ -501,6 +505,7 @@ -task_item_id $task_item_id] } + # simple sanity check for min and max estimated hours if {$estimated_hours_work_min > $estimated_hours_work_max} { set temp $estimated_hours_work_max set estimated_hours_work_max $estimated_hours_work_min @@ -509,6 +514,21 @@ set return_val [db_exec_plsql new_task_revision { *SQL }] + # we have to update all logged hours to make sure the hours are + # updated whenever the project is changed. + + set logger_project [pm::project::get_logger_project -project_item_id $project_item_id] + + db_dml update_logger_entries { + UPDATE + logger_entries + SET + project_id = :logger_project + WHERE + entry_id in + (select logger_entry from pm_task_logger_proj_map where task_item_id = :task_item_id) + } + # if the we've done 100% of the work, then we close the task if {$percent_complete >= 100} { pm::task::close -task_item_id $task_item_id @@ -833,6 +853,7 @@ to_char(r.latest_start, 'YYYY-MM-DD HH24:MI:SS') as latest_start_ansi, to_char(r.latest_finish, 'YYYY-MM-DD HH24:MI:SS') as latest_finish_ansi, r.description as task_description, + r.mime_type, project_revision.title as project_name FROM pm_tasks t, @@ -876,20 +897,11 @@ set latest_start [lc_time_fmt $latest_start_ansi "%x"] set latest_finish [lc_time_fmt $latest_finish_ansi "%x"] - set assignees [db_list get_assignees " - select - email - FROM - pm_task_assignment a, - parties p - WHERE - task_id = :task_item_id and - a.party_id = p.party_id - "] + set assignees [pm::task::assignee_email_list -task_item_id $task_item_id] if {[llength $assignees] > 0} { - set to_address [join $assignees ", "] + set to_address $assignees set user_id [ad_conn user_id] @@ -899,7 +911,7 @@ set subject "Task reopened (was $status_description): $task_title" - if {[parameter::get_from_package_key -package_key project-manager -parameter UseUncertainCompletionTimesP]} { + if {[string is true [parameter::get_from_package_key -package_key project-manager -parameter UseUncertainCompletionTimesP]]} { set estimated_work "\nHrs work (min): $estimated_hours_work_min\nHrs work (max): $estimated_hours_work_max" } else { set estimated_work "\nHrs work: $estimated_hours_work" @@ -908,10 +920,12 @@ set notification_text "Task reopened, was $status_description\n\n" + set task_description [ad_html_text_convert -from $mime_type -to "text/plain" -- $task_description] + append notification_text " ------------- Task ID: \#$task_item_id -Description: $task_title +Subject: $task_title Project: $project_name Link: $task_url @@ -936,11 +950,11 @@ append notification_text "\n" - acs_mail_lite::send \ + pm::util::email \ -to_addr $to_address \ -from_addr $from_address \ -subject $subject \ - -body $notification_text + -body $notification_text } return @@ -977,6 +991,7 @@ to_char(r.latest_start, 'YYYY-MM-DD HH24:MI:SS') as latest_start_ansi, to_char(r.latest_finish, 'YYYY-MM-DD HH24:MI:SS') as latest_finish_ansi, r.description as task_description, + r.mime_type, project_revision.title as project_name FROM pm_tasks t, @@ -1021,20 +1036,11 @@ set latest_finish [lc_time_fmt $latest_finish_ansi "%x"] - set assignees [db_list get_assignees " - select - email - FROM - pm_task_assignment a, - parties p - WHERE - task_id = :task_item_id and - a.party_id = p.party_id - "] + set assignees [pm::task::assignee_email_list -task_item_id $task_item_id] if {[llength $assignees] > 0} { - set to_address [join $assignees ", "] + set to_address $assignees set user_id [ad_conn user_id] @@ -1071,7 +1077,7 @@ if {![string equal $time_stamp_pretty $last_time_stamp]} { append work_log "* $time_stamp_pretty\n\n" } - append work_log "[pm::util::string_truncate_and_pad -length 25 -string "$user_name:"] $description ($value hrs)\n" + append work_log "[pm::util::string_truncate_and_pad -length 15 -string "$user_name:"] $description ($value hrs)\n" set last_time_stamp $time_stamp_pretty } @@ -1080,7 +1086,7 @@ set subject "Task closed (was $status_description) $task_title" - if {[parameter::get_from_package_key -package_key project-manager -parameter UseUncertainCompletionTimesP]} { + if {[string is true [parameter::get_from_package_key -package_key project-manager -parameter UseUncertainCompletionTimesP]]} { set estimated_work "\nHrs work (min): $estimated_hours_work_min\nHrs work (max): $estimated_hours_work_max" } else { set estimated_work "\nHrs work: $estimated_hours_work" @@ -1089,6 +1095,8 @@ set notification_text "Task closed, was $status_description\n\n" + set task_description [ad_html_text_convert -from $mime_type -to "text/plain" -- $task_description] + append notification_text " ------------- Task ID: \#$task_item_id @@ -1118,7 +1126,7 @@ $task_description" - acs_mail_lite::send \ + pm::util::email \ -to_addr $to_address \ -from_addr $from_address \ -subject $subject \ @@ -1247,7 +1255,7 @@ set which_pile overdue } elseif {$slack_arr($task) < $PRESSING_THRESHOLD} { set which_pile pressing - } elseif {$slack_arr($task) < $PRESSING_THRESHOLD} { + } elseif {$slack_arr($task) < $LONGTERM_THRESHOLD} { set which_pile longterm } else { set which_pile "" @@ -1326,7 +1334,7 @@ lappend description $longterm_item } - acs_mail_lite::send \ + pm::util::send \ -to_addr $address \ -from_addr $address \ -subject $subject \ @@ -1366,7 +1374,9 @@ {-edit_p "t"} {-comment ""} {-description ""} + {-description_mime_type "text/plain"} {-old_description ""} + {-old_description_mime_type "text/plain"} {-subject ""} {-work ""} {-work_min ""} @@ -1506,7 +1516,7 @@ } - if {[string equal $edit_p "t"]} { + if {[string is true $edit_p]} { set subject_out "Edited $task_term \#$task_item_id: $subject" set intro_text "$mod_username edited this $task_term_lower" } else { @@ -1527,14 +1537,16 @@ } + set description [ad_html_text_convert -from $description_mime_type -to "text/plain" -- $description] + set old_description [ad_html_text_convert -from $old_description_mime_type -to "text/plain" -- $old_description] - if {![string equal $description $old_description] && [string equal $edit_p t]} { - set description_out "$description \n\n-------\nOld description:\n-------\n\n[ad_html_to_text $old_description]" + if {![string equal $description $old_description] && [string is true $edit_p]} { + set description_out "$description \n\n-------\nOld description:\n-------\n\n$old_description" append intro_text "\nSee below to see the changes in the description" } else { - set description_out [ad_html_to_text $description] + set description_out $description } if {[string equal $use_uncertain_completion_times_p 1]} { @@ -1561,7 +1573,7 @@ append notification_text "\n\n-----------\nDescription\n-----------" append notification_text "\n$description_out" - acs_mail_lite::send \ + pm::util::email \ -to_addr $to_address \ -from_addr $from_address \ -subject $subject_out \ @@ -1571,3 +1583,160 @@ } +ad_proc -public pm::task::update_percent { + -task_item_id:required + -percent_complete:required +} { + Updates the task's percent complete + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-05-24 + + @param task_item_id + + @param percent_complete + + @return + + @error +} { + + db_dml update_percent { + UPDATE + pm_tasks_revisions + SET + percent_complete = :percent_complete + WHERE + task_revision_id = (select + live_revision + from + cr_items + where + item_id = :task_item_id) + } + + if {$percent_complete >= 100} { + + pm::task::close -task_item_id $task_item_id + + } else { + + pm::task::open -task_item_id $task_item_id + + } + +} + + +ad_proc -public pm::task::estimated_hours_work { + -estimated_hours_work + -estimated_hours_work_min + -estimated_hours_work_max +} { + Displays the estimated hours work in a consistent format + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-02 + + @param estimated_hours_work + + @param estimated_hours_work_min + + @param estimated_hours_work_max + + @return + + @error +} { + set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] + + if {[string equal $use_uncertain_completion_times_p 1]} { + set display_value "$estimated_hours_work_min - $estimated_hours_work_max" + } else { + set display_value "$estimated_hours_work" + } + + return $display_value +} + + +ad_proc -public pm::task::assignee_email_list { + -task_item_id:required +} { + Returns a list of assignee email addresses + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-10 + + @param task_item_id + + @return + + @error +} { + + return [db_list get_addresses { + SELECT + p.email + FROM + parties p, + pm_task_assignment a + WHERE + a.task_id = :task_item_id and + a.party_id = p.party_id + }] + +} + + +ad_proc -public pm::task::assignee_filter_select { + {-status_id:required} +} { + Returns a list of lists, people who are assigned tasks with a + status of status_id. Used in the list-builder filters for + the tasks list page. Cached 5 minutes. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param status_id + + @return + + @error +} { + return [util_memoize [list pm::task::assignee_filter_select_helper -status_id $status_id] 1] +} + + +ad_proc -private pm::task::assignee_filter_select_helper { + {-status_id:required} +} { + Returns a list of lists, people who are assigned tasks with a + status of status_id. Used in the list-builder filters for + the tasks list page. Cached 5 minutes. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param status_id + + @return + + @error +} { + return [db_list_of_lists get_people " + SELECT + distinct(first_names || ' ' || last_name) as fullname, + u.person_id + FROM + persons u, + pm_task_assignment a, + pm_tasks ts + WHERE + u.person_id = a.party_id and + ts.task_id = a.task_id and + ts.status = :status_id + ORDER BY + fullname"] +} Index: openacs-4/contrib/packages/project-manager/www/add-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/add-edit-2.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/contrib/packages/project-manager/www/add-edit-2.tcl 20 May 2004 17:30:05 -0000 1.4.2.1 +++ openacs-4/contrib/packages/project-manager/www/add-edit-2.tcl 2 Jul 2004 23:13:49 -0000 1.4.2.2 @@ -75,7 +75,7 @@ } {description:text(inform) - {label "Description"} + {label "Old Description"} {value $description} } @@ -91,7 +91,7 @@ } \ -new_data { - ad_returnredirect "one?[export_url_vars project_item_id]" + ad_returnredirect -message "Project changes saved" "one?[export_url_vars project_item_id]" ad_script_abort } -edit_data { @@ -100,7 +100,7 @@ } -after_submit { - ad_returnredirect "one?[export_url_vars project_item_id]" + ad_returnredirect -message "Project changes saved" "one?[export_url_vars project_item_id]" ad_script_abort } Index: openacs-4/contrib/packages/project-manager/www/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/add-edit.tcl,v diff -u -r1.16.2.1 -r1.16.2.2 --- openacs-4/contrib/packages/project-manager/www/add-edit.tcl 20 May 2004 17:30:05 -0000 1.16.2.1 +++ openacs-4/contrib/packages/project-manager/www/add-edit.tcl 2 Jul 2004 23:13:49 -0000 1.16.2.2 @@ -70,6 +70,18 @@ } +if {[ad_form_new_p -key project_item_id]} { + set logger_project "" + set logger_values "" +} else { + + set logger_project [pm::project::get_logger_project -project_item_id $project_item_id] + set logger_values [logger::project::get_variables -project_id $logger_project] + +} + +ns_log Notice "Logger values: $logger_values" + ad_form -name add_edit \ -form { project_id:key @@ -128,22 +140,28 @@ {options {[db_list_of_lists get_status_codes { }]}} } + {variables:text(multiselect),multiple + {label "Logged variables"} + {options {[logger::ui::variable_options_all]}} + {values {$logger_values}} + {html {size 6}} + } + } - 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 "Categories"} - {html {size 4}} {value {$project_item_id $package_id}} + {html {size 7}} {value {$project_item_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 {label "Categories"} - {html {size 4}} {value {}} + {category_ids:integer(category),multiple,optional {label "Categories"} + {html {size 7}} {value {}} } } } @@ -177,7 +195,6 @@ -select_query_name project_query \ -on_submit { - set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] @@ -215,16 +232,31 @@ ] set project_item_id [pm::project::get_project_item_id -project_id $project_id] + set logger_project [pm::project::get_logger_project -project_item_id $project_item_id] if {[exists_and_not_null category_ids]} { category::map_object -remove_old -object_id $project_item_id $category_ids } + if {[exists_and_not_null variables]} { + foreach var $variables { + logger::project::map_variable \ + -project_id $logger_project \ + -variable_id $var + } + } else { + # add in the default variable + logger::project::map_variable \ + -project_id $logger_project \ + -variable_id [logger::variable::get_default_variable_id] + } + if {$use_project_customizations_p} { - ad_returnredirect "add-edit-2?[export_url_vars project_item_id project_id]" + # warn of current bug so users can work around it + ad_returnredirect -message "You must submit changes on this page or you will lose any data on this page" "add-edit-2?[export_url_vars project_item_id project_id]" ad_script_abort } else { - ad_returnredirect "one?[export_url_vars project_item_id project_id]" + ad_returnredirect -message "Project: '$project_name' added" "one?[export_url_vars project_item_id project_id]" ad_script_abort } @@ -256,19 +288,30 @@ set project_item_id [pm::project::get_project_item_id \ -project_id $project_id] + + set logger_project [pm::project::get_logger_project -project_item_id $project_item_id] + if {[exists_and_not_null variables]} { + + logger::project::remap_variables -project_id $logger_project -new_variable_list $variables + + } else { + logger::project::remap_variables -project_id $logger_project -new_variable_list [logger::variable::get_default_variable_id] + } + if {[exists_and_not_null category_ids]} { category::map_object -remove_old -object_id $project_item_id $category_ids } } -after_submit { if {$use_project_customizations_p} { - ad_returnredirect "add-edit-2?[export_url_vars project_id old_project_id]" + # warn of current bug so users can work around it + ad_returnredirect -message "You must submit changes on this page or you will lose any data on this page" "add-edit-2?[export_url_vars project_id old_project_id]" pm::project::compute_parent_status $project_item_id ad_script_abort } else { - ad_returnredirect "one?[export_url_vars project_id]" + ad_returnredirect -message "Changes to project saved" "one?[export_url_vars project_id]" pm::project::compute_parent_status $project_item_id ad_script_abort } Index: openacs-4/contrib/packages/project-manager/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/index-postgresql.xql,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/contrib/packages/project-manager/www/index-postgresql.xql 12 Mar 2004 13:44:44 -0000 1.12 +++ openacs-4/contrib/packages/project-manager/www/index-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.12.2.1 @@ -27,6 +27,8 @@ end as customer_name, o.organization_id as customer_id FROM pm_projectsx p + LEFT JOIN pm_project_assignment pa + ON p.item_id = pa.project_id LEFT JOIN organizations o ON p.customer_id = o.organization_id LEFT JOIN ( Index: openacs-4/contrib/packages/project-manager/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/index.tcl,v diff -u -r1.13.2.1 -r1.13.2.2 --- openacs-4/contrib/packages/project-manager/www/index.tcl 20 May 2004 17:30:05 -0000 1.13.2.1 +++ openacs-4/contrib/packages/project-manager/www/index.tcl 2 Jul 2004 23:13:49 -0000 1.13.2.2 @@ -20,6 +20,7 @@ {status_id:integer,optional} category_id:multiple,optional {format "normal"} + {assignee_id:integer,optional} } -properties { context:onevalue @@ -65,75 +66,25 @@ set status_id [pm::project::default_status_open] } -# Categories are arranges into category trees. -# Set up an array for each tree. The array contains the category for each tree -db_foreach get_choices { - select - t.name as cat_name, - t.category_id as cat_id, - tm.tree_id - from - category_tree_map tm, - categories c, - category_translations t - where - c.tree_id = tm.tree_id and - c.category_id = t.category_id and - tm.object_id = :package_id and - c.deprecated_p = 'f' - order - by t.name -} { - lappend category_choices($tree_id) [list $cat_name $cat_id] -} - # We want to set up a filter for each category tree. set export_vars [export_vars -form {status_id orderby}] -set category_select "" - -foreach tree_list [db_list_of_lists get_category_trees { - select - tt.name as tree_name, - tt.tree_id - from - category_tree_map tm, - category_tree_translations tt - where - tm.object_id = :package_id and - tm.tree_id = tt.tree_id -}] { - - set tree_name [lindex $tree_list 0] - set tree_id [lindex $tree_list 1] - - if {![exists_and_not_null category_choices($tree_id)]} { - set category_choices($tree_id) [list] - } - - - - append category_select "

$export_vars $tree_name:
" +if {[exists_and_not_null category_id]} { + set temp_category_id $category_id +} else { + set temp_category_id "" } +set category_select [pm::util::category_selects \ + -export_vars $export_vars \ + -category_id $temp_category_id \ + -package_id $package_id \ + ] +set assignees_filter [pm::project::assignee_filter_select -status_id $status_id] + template::list::create \ -name projects \ -multirow projects \ @@ -168,15 +119,21 @@ } } \ -actions [list "Add project" "add-edit" "Add project" "Customers" "[site_node::get_package_url -package_key organizations]" "View customers"] \ + -bulk_actions [list "Close" "bulk-close" "Close project"] \ -sub_class { narrow } \ -filters { status_id { label "Status" - values {[db_list_of_lists get_status "select description, status_id from pm_project_status order by status_type desc, description"]} + values {[pm::status::project_status_select]} where_clause {s.status_id = :status_id} } + assignee_id { + label "Assignee" + values {$assignees_filter} + where_clause {pa.party_id = :assignee_id} + } category_id { label Categories where_clause {c.category_id = [join [value_if_exists category_id] ","]} @@ -263,23 +220,9 @@ # This spits out the CSV if we happen to be in CSV layout if {[string equal $format csv]} { - #set csv [list::write_output -name pan] - #set outputheaders [ns_conn outputheaders] - #ns_set cput $outputheaders "Content-Disposition" "attachment; filename=pan.csv" - #doc_return 200 "application/text" "$csv" - # set csv [list::write_output -name projects] - - set outputheaders [ns_conn outputheaders] - ns_set cput $outputheaders "Content-Disposition" "attachment; filename=projects.xls" - - # ns_log Notice "csv: $csv" - list::write_output -name projects - # doc_return 200 application/vnd.ms-excel $csv - # ns_return 200 application/vnd.ms-excel $csv - } Index: openacs-4/contrib/packages/project-manager/www/log.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/log.adp,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/project-manager/www/log.adp 12 Mar 2004 13:44:44 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/log.adp 2 Jul 2004 23:13:49 -0000 1.2.2.1 @@ -1,73 +1,11 @@ -@page_title;noquote@ +@title;noquote@ @context;noquote@ -log_entry_form.value - - -
- - - - - - - - - - - - - - -
- Add Entry -
- » - @variables.name@ -
-
-
+The administrator needs to set up integration with logger. -
- -
+

- -

- » - Add new log entry -

- - - -

Log history (@start_date_ansi@ to @end_date_ansi@)

- -

- The log history is - shown @log_history_n_days@ days back from your last logged entry, or @log_history_n_days@ days back from - today if you have no previously logged entries. -

- - -
+After they have done this, you can go back to the previous page, + refresh it, and then add and edit logged hours. Index: openacs-4/contrib/packages/project-manager/www/log.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/log.tcl,v diff -u -r1.2.2.1 -r1.2.2.2 --- openacs-4/contrib/packages/project-manager/www/log.tcl 20 May 2004 17:30:05 -0000 1.2.2.1 +++ openacs-4/contrib/packages/project-manager/www/log.tcl 2 Jul 2004 23:13:49 -0000 1.2.2.2 @@ -1,477 +1,11 @@ ad_page_contract { - Add/edit/display a log entry for project manager + Stub that tells people to set up logger/project-manager integration - @author Peter Marklund (peter@collaboraid.biz) @author Jade Rubick (jader@bread.com) stolen from Peter @creation-date 2003-04-16 @cvs-id $Id$ -} { - entry_id:integer,optional - project_id:integer,optional - pm_project_id:integer - {pm_task_id:integer ""} - variable_id:integer,optional - {edit:boolean "f"} - {return_url "."} -} -validate { - #project_id_required_in_add_mode { - # For the sake of simplicity of the form - # we are requiring a project_id to be provided in add mode - #if { ![exists_and_not_null entry_id] && ![exists_and_not_null project_id] } { - # ad_complain "When adding a log entry a project_id must be provided (either entry_id or project_id must be present)." - #} - #} } -if { ![exists_and_not_null project_id] } { - - if {[exists_and_not_null entry_id]} { - # do nothing - } else { - set project_id [pm::project::get_logger_project \ - -project_item_id $pm_project_id] - - } -} - -set package_id [ad_conn package_id] -set current_user_id [ad_maybe_redirect_for_registration] - -if { [exists_and_not_null entry_id] } { - set entry_exists_p [db_string entry_exists_p {}] -} else { - set entry_exists_p 0 -} - -if { [string equal [form get_action log_entry_form] "done"] } { - # User is done editing - redirect back to index page - ad_returnredirect $return_url - ad_script_abort -} - -########### -# -# Get project and variable info -# -########### - -# Get project and variable id -if { $entry_exists_p } { - permission::require_permission -object_id $entry_id -privilege read - - # We have the entry_id so try to get project and variable_id from - # the database for that entry - logger::entry::get -entry_id $entry_id -array entry_array - set project_id $entry_array(project_id) - set variable_id $entry_array(variable_id) -} - -# Get project_id if it's not provided -if { [exists_and_not_null entry_id] && ![exists_and_not_null project_id] } { - logger::entry::get -entry_id $entry_id -array entry - set project_id $entry(project_id) -} - -# Default the variable we are logging in to the primary variable of the project -if { ![exists_and_not_null variable_id] } { - set variable_id [logger::project::get_primary_variable -project_id $project_id] - - if { [empty_string_p $variable_id] } { - ad_return_error "Project has no variable" "An administrator needs to associate a variable, such as time or expense, to this project before any logging can be done." - ad_script_abort - } -} - -# We need project and variable names -logger::project::get -project_id $project_id -array project_array -logger::variable::get -variable_id $variable_id -array variable_array - -########### -# -# Build the form -# -########### - -# The creator of a log entry can always edit it -if { $entry_exists_p } { - set edit_p [expr [permission::permission_p -object_id $entry_id -privilege write] || \ - $current_user_id == $entry_array(creation_user)] -} else { - set edit_p 0 -} - -# Different page title and form mode when adding a log entry -# versus displaying/editing one -if { [exists_and_not_null entry_id] } { - # Initial request in display or edit mode or a submit of the form - set page_title "Edit Log Entry" - if { [string equal $edit "t"] && $edit_p } { - set ad_form_mode edit - } else { - set ad_form_mode display - } -} else { - # Initial request in add mode - set page_title "Add Log Entry" - set ad_form_mode edit -} - - -# Build the log entry form elements -set actions [list] -if { $edit_p } { - lappend actions { Edit edit } -} -lappend actions { Done done } - -ad_form -name log_entry_form -cancel_url $return_url -mode $ad_form_mode \ - -actions $actions -form { - entry_id:key(acs_object_id_seq) - } - -# On various occasions we need to know if we are dealing with a submit with the -# form or an initial request (could also be with error message after unaccepted submit) -set submit_p [form is_valid log_entry_form] - -ad_form -extend -name log_entry_form -form { - {project:text(inform) - {label Project} - {section "Hour log"} - {value $project_array(name)} - } - - {project_id:integer(hidden) - {value $project_id} - } - - {variable_id:integer(hidden) - {value $variable_id} - } - - {return_url:text(hidden) {value $return_url}} -} - -# Add form elements common to all modes -# The form builder date datatype doesn't take ANSI format date strings -# but wants dates in list format -set default_date [clock format [clock seconds] -format "%Y %m %d"] -ad_form -extend -name log_entry_form -form { - {value:float - {label $variable_array(name)} - {after_html $variable_array(unit)} - {html {size 9 maxlength 9}} - } - - {pm_project_id:text(hidden) - {value $pm_project_id} - } - - {pm_task_id:text(hidden) - {value $pm_task_id} - } - - {description:text,optional - {label Description} - {html {size 50}} - } - - {time_stamp:date - {label Date} - {value $default_date} - } -} - -# allow the user to edit the percentage complete when necessary -if {[exists_and_not_null pm_task_id]} { - - set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] - - db_1row get_task_values " - SELECT - title as task_title, - case when percent_complete is null then 0 - else percent_complete end as percent_complete, - estimated_hours_work, - estimated_hours_work_min, - estimated_hours_work_max, - s.description as status_description - FROM - pm_tasks_revisionsx p, - cr_items i, - pm_task_status s, - pm_tasks t - WHERE i.item_id = p.item_id and - p.item_id = :pm_task_id and - i.item_id = t.task_id and - t.status = s.status_id and - p.revision_id = i.live_revision" - - ad_form -extend -name log_entry_form -form { - - {task_title:text(inform) - {section "Task"} - {label "Subject"} - {value $task_title} - } - - {status_description:text(inform) - {label "Status"} - {value $status_description} - } - - } - - if {[string equal $use_uncertain_completion_times_p 1]} { - - set display_value "$estimated_hours_work_min - $estimated_hours_work_max" - ad_form -extend -name log_entry_form -form { - - {estimated_hours_work:text(inform) - {label "Estimated work"} - {value $display_value} - {after_html "hours"} - } - - - } - - } else { - - ad_form -extend -name log_entry_form -form { - - {estimated_hours_work:text(inform) - {label "Estimated work"} - {value $estimated_hours_work} - {after_html "hours"} - } - - } - - } - - - ad_form -extend -name log_entry_form -form { - - {percent_complete:float - {label "Complete"} - {after_html "%"} - {html {size 9 maxlength 9}} - {value $percent_complete} - } - - } - -} - - -if { [exists_and_not_null pm_task_id] } { - set context [list [list "[ad_conn package_url]task-one?task_id=$pm_task_id" "$task_title"] $page_title] -} else { - - set context [list [list "[ad_conn package_url]one?project_item_id=$pm_project_id" "$project_array(name)"] $page_title] -} - - -########### -# -# Execute the form -# -########### - -ad_form -extend -name log_entry_form -select_query_name select_logger_entries -validate { - {value - { [regexp {^([0-9]{1,6}|[0-9]{0,6}\.[0-9]{0,2})$} $value] } - {The value may not contain more than two decimals and must be between 0 and 999999.99} - } - -} -new_data { - set time_stamp_ansi "[lindex $time_stamp 0]-[lindex $time_stamp 1]-[lindex $time_stamp 2]" - - # jarkko: check to see if user has already added this entry and has come - # back with her back button. If the entry exists, we give the user a complaint - # and a link to edit this particular entry. - if { [string match [db_string check_if_exists " - select 1 - from logger_entries - where entry_id = :entry_id - " -default "0"] "0"]} { - - pm::project::log_hours \ - -entry_id $entry_id \ - -logger_project_id $project_id \ - -variable_id $variable_id \ - -value $value \ - -timestamp_ansi $time_stamp_ansi \ - -description $description \ - -task_item_id $pm_task_id \ - -project_item_id $pm_project_id - - - if {[exists_and_not_null pm_task_id]} { - db_dml update_percent " - UPDATE - pm_tasks_revisions - SET - percent_complete = :percent_complete - WHERE - task_revision_id = (select - live_revision - from - cr_items - where - item_id = :pm_task_id)" - - if {$percent_complete >= 100} { - - pm::task::close -task_item_id $pm_task_id - - } else { - - pm::task::open -task_item_id $pm_task_id - - } - - } - - } else { - - doc_return 200 text/html "[ad_header_with_extra_stuff "Problem with Your Input" "" ""] -

Problem with Your Input

- -to [ad_system_name] - -
- -You have already added this entry once. If you want to edit this entry, click here. - -[ad_footer] - " - } - - # Present the user with an add form again for quick logging - ad_returnredirect "[ad_conn url]?[export_vars {project_id variable_id pm_project_id pm_task_id}]" - ad_script_abort - -} -edit_data { - set time_stamp_ansi "[lindex $time_stamp 0]-[lindex $time_stamp 1]-[lindex $time_stamp 2]" - logger::entry::edit -entry_id $entry_id \ - -value $value \ - -time_stamp $time_stamp_ansi \ - -description $description - - set old_pm_task_id $pm_task_id - - set pm_task_id [db_string task_entry_p "select task_item_id from pm_task_logger_proj_map where logger_entry = :entry_id" -default "-1"] - - if {![string equal $pm_task_id -1] && [exists_and_not_null percent_complete]} { - - db_dml update_percent " - UPDATE - pm_tasks_revisions - SET - percent_complete = :percent_complete - WHERE - task_revision_id = (select - live_revision - from - cr_items - where - item_id = :pm_task_id)" - - pm::task::update_hours \ - -task_item_id $pm_task_id - - if {$percent_complete >= 100} { - set status_code [pm::task::default_status_closed] - } else { - set status_code [pm::task::default_status_open] - } - - db_dml update_percent " - UPDATE - pm_tasks - SET - status = :status_code - WHERE - task_id = :pm_task_id" - - - } - - set pm_task_id $old_pm_task_id - -} -after_submit { - ad_returnredirect "[ad_conn url]?[export_vars { project_id variable_id return_url pm_project_id pm_task_id}]" - # ad_returnredirect $return_url - - if {![string equal $pm_task_id -1]} { - pm::project::compute_status $pm_project_id - } - - ad_script_abort -} - -########### -# -# Log history -# -########### - -# Show the log history if the user is looking at /editing his own entry or if -# the user is adding a new entry -if { $entry_exists_p && [string equal $current_user_id $entry_array(creation_user)] } { - set entry_edited_by_owner_p 1 -} else { - set entry_edited_by_owner_p 0 -} - -set show_log_history_p [expr $entry_edited_by_owner_p || ! $entry_exists_p] - -if { $show_log_history_p } { - # Show N number of days previous to the last logged entry by the user - set ansi_format_string "%Y-%m-%d" - set last_logged_date [db_string last_logged_date { - select max(to_char(le.time_stamp, 'YYYY-MM-DD')) - from logger_entries le, - acs_objects ao - where le.entry_id = ao.object_id - and le.variable_id = :variable_id - and le.project_id = :project_id - and ao.creation_user = :current_user_id - } -default ""] - - if { ![empty_string_p $last_logged_date] } { - set end_date_ansi $last_logged_date - set end_date_seconds [clock scan $end_date_ansi] - } else { - # Default end date to now - set end_date_seconds [clock seconds] - set end_date_ansi [clock format $end_date_seconds -format $ansi_format_string] - } - set log_history_n_days 31 - set seconds_per_day [expr 60*60*24] - set start_date_seconds [expr $end_date_seconds - $log_history_n_days * $seconds_per_day] - set start_date_ansi [clock format $start_date_seconds \ - -format $ansi_format_string] -} - -set add_entry_url "log?[export_vars { project_id variable_id pm_project_id pm_task_id}]" - -if { [info exists entry_id] } { - set entry_id_or_blank $entry_id -} else { - set entry_id_or_blank {} -} - - -##### -# -# Change variable -# -##### - -db_multirow -extend { url selected_p } variables select_variables {} { - set url "log?[export_vars -override { {variable_id $unique_id} } { project_id pm_project_id pm_task_id}]" - set selected_p [string equal $variable_id $unique_id] -} +set title "Set up logger integration" +set context [list] Index: openacs-4/contrib/packages/project-manager/www/log.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/log.xql,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/project-manager/www/log.xql 12 Mar 2004 13:44:45 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/log.xql 2 Jul 2004 23:13:49 -0000 1.2.2.1 @@ -2,38 +2,4 @@ - - - select count(*) - from logger_entries - where entry_id = :entry_id - - - - - - select project_id, - variable_id, - value, - to_char(time_stamp, 'YYYY MM DD') as time_stamp, - description - from logger_entries - where entry_id = :entry_id - - - - - - select lv.variable_id as unique_id, - lv.name || ' (' || lv.unit || ')' as name - from logger_variables lv, - logger_projects lp, - logger_project_var_map lpvm - where lp.project_id = lpvm.project_id - and lv.variable_id = lpvm.variable_id - and lp.project_id = :project_id - group by lv.variable_id, lv.name, lv.unit - - - Index: openacs-4/contrib/packages/project-manager/www/one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one-postgresql.xql,v diff -u -r1.23.2.1 -r1.23.2.2 --- openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 20 May 2004 17:30:05 -0000 1.23.2.1 +++ openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.23.2.2 @@ -31,33 +31,6 @@ - - - SELECT - p.item_id, - p.project_id, - p.title as project_name, - p.project_code, - p.goal, - p.description, - 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, - i.live_revision, - to_char(p.estimated_finish_date,'Mon DD') as estimated_finish_date, - to_char(p.earliest_finish_date,'Mon DD') as earliest_finish_date, - to_char(p.latest_finish_date,'Mon DD') as latest_finish_date, - p.estimated_hours_total - FROM - pm_projectsx p, cr_items i - WHERE - p.item_id = :project_item_id and - p.item_id = i.item_id - ORDER BY - p.project_id desc - - - SELECT @@ -138,12 +111,20 @@ - select - project_id, - role_id, - party_id - from pm_project_assignment - where project_id = :project_item_id + 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 Index: openacs-4/contrib/packages/project-manager/www/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one.adp,v diff -u -r1.31.2.1 -r1.31.2.2 --- openacs-4/contrib/packages/project-manager/www/one.adp 20 May 2004 17:30:05 -0000 1.31.2.1 +++ openacs-4/contrib/packages/project-manager/www/one.adp 2 Jul 2004 23:13:49 -0000 1.31.2.2 @@ -4,10 +4,10 @@ @context;noquote@ -

(not current, select live version below)

+

(not current, select live version from the task change page)

- +
+ - -
@@ -106,6 +106,28 @@

+ + + + + + + + + + +
Assignees
+ +
+ +
+ +

+

@@ -155,44 +177,61 @@

- + + + + + + + + + + +
Subprojects
Add subproject + + + +
+ +

+ + - + - - +
SubprojectsComments
Add subproject - - - + + @comments;noquote@ +
    +
  • @comments_link;noquote@ +

- + - - + - + +
CommentsActions
- @comments;noquote@ -

- @comments_link;noquote@ +

+
+ +

- -   - - TASKS @@ -238,39 +277,39 @@ - + - - -
Logged hoursLogger
- - Log hours - + +
+ @variable_widget;noquote@ + @variable_exports;noquote@ + @day_widget;noquote@ + +
+
- @log_note@ -
- + +
-
-

REVISIONS

- -

- - - -

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.2 -r1.30.2.3 --- openacs-4/contrib/packages/project-manager/www/one.tcl 20 May 2004 17:35:19 -0000 1.30.2.2 +++ openacs-4/contrib/packages/project-manager/www/one.tcl 2 Jul 2004 23:13:49 -0000 1.30.2.3 @@ -21,25 +21,27 @@ @param use_goal_p Specifies whether or not to include the goal field 1 = yes @param use_project_code_p Specifies whether or not to show the user-specified project code 1 = yes @param use_uncertain_completion_times_p Specifies whether or not to use PERT style uncertainty times 1 = yes + @param logger_days The number of days back to view logged entries } { project_item_id:integer,optional project_id:integer,optional {orderby_subproject ""} {orderby_tasks ""} - {orderby_versions ""} {status_type "o"} + {logger_variable_id:integer ""} + {logger_days:integer "30"} } -properties { categories:onelist my_title:onevalue context:onevalue project:multirow + people:multirow tasks:multirow people:multirow write_p:onevalue create_p:onevalue - versions:multirow custom:multirow parent_task_id:onevalue task_type:onevalue @@ -54,14 +56,22 @@ comments:onevalue comments_link:onevalue } -validate { + project_exists { + if {![exists_and_not_null project_item_id] && \ + ![exists_and_not_null project_id]} { + + ad_complain "No project passed in" + + } + } project_item_id_exists { - if {![exists_and_not_null project_item_id]} { + if {![exists_and_not_null project_item_id] && [exists_and_not_null project_id]} { set project_item_id [pm::project::get_project_item_id \ -project_id $project_id] } } project_id_exists { - if {![exists_and_not_null project_id]} { + if {![exists_and_not_null project_id] && [exists_and_not_null project_item_id]} { set project_id [pm::project::get_project_id \ -project_item_id $project_item_id] } @@ -71,6 +81,11 @@ set status_type "o" } } + logger_days_positive { + if {$logger_days < 1} { + set logger_days 1 + } + } } set original_project_id $project_id @@ -81,25 +96,20 @@ # --------------------------------------------------------------- # # the unique identifier for this package -set package_id [ad_conn package_id] -set user_id [ad_maybe_redirect_for_registration] +set package_id [ad_conn package_id] +set package_url [ad_conn package_url] +set user_id [ad_maybe_redirect_for_registration] -# ---------------- -# 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 [general_comments_create_link -object_name "Project" -link_text "Add a comment" -context_id $package_id $project_item_id "[ad_conn url]?project_item_id=$project_item_id"] - - -# terminology +# 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 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 @@ -129,16 +139,48 @@ 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"] -set project(logger_variable_id) [logger::variable::get_default_variable_id] -set log_url "[ad_conn package_url]log?project_id=$project(logger_project)&pm_project_id=$project_item_id" +# ---------------- +# 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 then_ansi [db_string get_now_julian "select to_char(current_timestamp - '30 days'::INTERVAL,'YYYY-MM-DD')"] +set comments_link "Add comment" -set log_note "Last 30 days" +# 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::variable::get_default_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" + +set assignee_add_self_widget "Add myself as
[export_vars -form {project_item_id user_id return_url}][pm::role::select_list -select_name "role_id"]
" + +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" + + set my_title "$project_term \#$project_item_id: $project(project_name)" @@ -235,40 +277,35 @@ orderby_subproject { hide_p 1 } - orderby_versions { - hide_p 1 - } orderby_people { hide_p 1 } } \ -orderby { default_value latest_start,asc title { - label "Subject" - orderby_asc "title asc" - orderby_desc "title desc" + orderby_asc "title asc, task_id asc" + orderby_desc "title desc, task_id desc" default_direction asc } earliest_start { - label "Earliest start" - orderby_asc "earliest_start, u.first_names, u.last_name" - orderby_desc "earliest_start desc, u.first_names, u.last_name" + orderby_asc "earliest_start, task_id asc, u.first_names, u.last_name" + orderby_desc "earliest_start desc, task_id desc, u.first_names, u.last_name" default_direction asc } earliest_finish { - orderby_asc "earliest_finish, u.first_names, u.last_name" - orderby_desc "earliest_finish desc, u.first_names, u.last_name" + orderby_asc "earliest_finish, task_id asc, u.first_names, u.last_name" + orderby_desc "earliest_finish desc, task_id desc, u.first_names, u.last_name" default_direction asc } latest_start { - orderby_asc "latest_start, u.first_names, u.last_name" - orderby_desc "latest_start desc, u.first_names, u.last_name" + orderby_asc "latest_start, task_id asc, u.first_names, u.last_name" + orderby_desc "latest_start desc, task_id desc, u.first_names, u.last_name" default_direction asc } latest_finish { - orderby_asc "latest_finish, u.first_names, u.last_name" - orderby_desc "latest_finish desc, u.first_names, u.last_name" + orderby_asc "latest_finish, task_id asc, u.first_names, u.last_name" + orderby_desc "latest_finish desc, task_id desc, u.first_names, u.last_name" default_direction asc } } \ @@ -294,52 +331,51 @@ } +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" } + # 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% } - actual_hours_completed { - label "Hours completed" - } - } \ - -sub_class { - narrow - } \ - -filters { - project_item_id {} - orderby_versions {} - orderby_tasks {} - orderby_people {} - orderby_versions {} - } \ - -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}] } - - - -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 { } @@ -349,10 +385,10 @@ -multirow people \ -key item_id \ -elements { - party_id { + user_name { label "Who" } - role_id { + role_name { label "Role" } } \ @@ -362,7 +398,6 @@ -filters { party_id {} orderby_subproject {} - orderby_versions {} orderby_tasks {} } \ -orderby { @@ -375,62 +410,13 @@ } - -db_multirow -extend { item_url } subproject project_subproject_query { +db_multirow -extend { item_url } subproject project_people_query { } { - set item_url [export_vars -base "one" -override {{project_item_id $item_id}} {project_item_id}] -} - - -# Project versions, using list-builder --------------------------------- - -db_multirow versions project_versions { } - -template::list::create \ - -name versions \ - -multirow versions \ - -key item_id \ - -elements { - project_id { - label "Version" - link_url_col item_url - link_html { title "View this project version" } - } - project_name { - label "Subject" - } - planned_end_date { - label "Deadline" - } - } \ - -sub_class { - narrow - } \ - -filters { - project_item_id {} - orderby_subproject {} - orderby_people {} - orderby_tasks {} - } \ - -orderby { - project_name {orderby project_name} - default_value project_name,desc - } \ - -orderby_name orderby_versions \ - -html { - width 100% - } - - -db_multirow -extend { item_url } versions project_versions { -} { - set item_url [export_vars -base "one" -override {{project_item_id $item_id}} {project_id}] - - } + # -------------------------CUSTOMIZATIONS-------------------------- # If there are customizations, put them in a multirow called custom # ----------------------------------------------------------------- @@ -441,12 +427,5 @@ # end of customizations -# ----------------------------------------------------------------- -# Logger forms and so on - shows time logged, and allows you to log -# other time -# ----------------------------------------------------------------- - - - ad_return_template # ------------------------- END OF FILE ------------------------- # Index: openacs-4/contrib/packages/project-manager/www/process-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-add-edit.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/contrib/packages/project-manager/www/process-add-edit.tcl 20 May 2004 17:30:05 -0000 1.4.2.1 +++ openacs-4/contrib/packages/project-manager/www/process-add-edit.tcl 2 Jul 2004 23:13:49 -0000 1.4.2.2 @@ -78,7 +78,7 @@ db_dml new_process { *SQL* } - ad_returnredirect "process-task-add-edit?[export_vars -url {{number $number_of_tasks} process_id}]" + ad_returnredirect -message "Process added. Now add process tasks." "process-task-add-edit?[export_vars -url {{number $number_of_tasks} process_id}]" ad_script_abort } -edit_data { @@ -87,7 +87,7 @@ } -after_submit { - ad_returnredirect "process-task-add-edit?[export_vars -url {{number $number_of_tasks} process_id}]" + ad_returnredirect -message "Process changes saved. Now edit process tasks" "process-task-add-edit?[export_vars -url {{number $number_of_tasks} process_id}]" ad_script_abort } Index: openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-dependency-add-edit-postgresql.xql,v diff -u -r1.3 -r1.3.4.1 --- openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit-postgresql.xql 10 Oct 2003 22:51:04 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.3.4.1 @@ -10,7 +10,9 @@ FROM pm_process_task t LEFT JOIN pm_process_task_dependency d ON t.process_task_id = d.process_task_id WHERE - t.process_task_id in ([join $use_dependency ", "]) + t.process_task_id in ([join $use_dependency_list ", "]) + ORDER BY + t.ordering, t.process_task_id
@@ -36,24 +38,8 @@ WHERE process_id = :process_id ORDER BY - upper(one_line) + ordering - - - DELETE FROM pm_process_task_dependency - WHERE process_task_id = :tsk_id - - - - - - INSERT INTO pm_process_task_dependency - (dependency_id, process_task_id, parent_task_id, dependency_type) - VALUES - (:dependency_id, :tsk_id, :parent_tsk_id, :type_id) - - - Index: openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-dependency-add-edit.adp,v diff -u -r1.2 -r1.2.4.1 --- openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.adp 10 Nov 2003 19:34:54 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.adp 2 Jul 2004 23:13:49 -0000 1.2.4.1 @@ -3,13 +3,15 @@ @title@ -You may now add dependencies to these +You may now add dependencies to these process @task_term_lower@s. Dependencies describe the order in which items must be completed. For example, "the boards must be delivered before construction can begin". Entering dependencies is important because it allows the system to automatically compute schedules. However, you can -skip adding dependencies. +skip adding dependencies. +

+

Index: openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-dependency-add-edit.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl 20 May 2004 17:30:05 -0000 1.6.2.1 +++ openacs-4/contrib/packages/project-manager/www/process-dependency-add-edit.tcl 2 Jul 2004 23:13:49 -0000 1.6.2.2 @@ -15,7 +15,8 @@ } { - {use_dependency:multiple ""} + {use_dependency:array ""} + {use_dependency_list:multiple ""} process_id:integer dependency_id:integer,optional process_task_id:multiple,optional @@ -34,7 +35,13 @@ # --------------------------------------------------------------- # +# turn the use_dependency +if {[llength [array get use_dependency]] > 0} { + foreach {index value} [array get use_dependency] { + lappend use_dependency_list $value + } +} # HACK because there isn't a facility for exporting multiple hidden # form variables in ad_form @@ -43,12 +50,15 @@ set process_task_id_pass [string map {"-" " "} $process_task_id_pass] set process_task_id $process_task_id_pass -set use_dependency_pass $use_dependency -set use_dependency_pass [string map {"-" " "} $use_dependency_pass] -set use_dependency $use_dependency_pass +set use_dependency_list_pass $use_dependency_list +set use_dependency_list_pass [string map {"-" " "} $use_dependency_list_pass] +set use_dependency_list $use_dependency_list_pass -if {![exists_and_not_null use_dependency]} { +if {![exists_and_not_null use_dependency_list]} { + pm::process::remove_dependency \ + -process_task_id $process_task_id + ad_returnredirect "process-one?[export_url_vars process_id]" ad_script_abort } @@ -69,7 +79,7 @@ permission::require_permission -party_id $user_id -object_id $package_id -privilege create set process_task_id_pass [string map {" " "-"} $process_task_id] -set use_dependency_pass [string map {" " "-"} $use_dependency] +set use_dependency_list_pass [string map {" " "-"} $use_dependency_list] ad_form -name add_edit -form { dependency_id:key(pm_process_task_dependency_seq) @@ -78,8 +88,8 @@ {value $process_task_id_pass} } - {use_dependency:text(hidden) - {value $use_dependency_pass} + {use_dependency_list:text(hidden) + {value $use_dependency_list_pass} } {process_id:text(hidden) @@ -99,22 +109,24 @@ # convert from our hack back to a list set process_task_id [string map {"-" " "} $process_task_id] - foreach tsk_id $process_task_id { - db_dml delete_dependency { } - } + pm::process::remove_dependency \ + -process_task_id $process_task_id # convert from our hack back to a list - set use_dependency [string map {"-" " "} $use_dependency] + set use_dependency_list [string map {"-" " "} $use_dependency_list] - foreach tr $use_dependency { + foreach tr $use_dependency_list { set type_id $dependency_type($tr) set parent_tsk_id $dependency_task_id($tr) - set dependency_id [db_nextval pm_task_dependency_seq] + set tsk_revision_id $tr set tsk_id $tr - db_dml new_dependency { *SQL* } + pm::process::add_dependency \ + -process_task_id $tsk_id \ + -parent_task_id $parent_tsk_id \ + -dependency_type_id $type_id } } -edit_data { @@ -123,24 +135,24 @@ set process_task_id_pass [string map {"-" " "} $process_task_id_pass] set process_task_id $process_task_id_pass - foreach tsk_id $process_task_id { - db_dml delete_dependency { } - } + pm::process::remove_dependency -process_task_id $process_task_id - foreach tr $use_dependency { + foreach tr $use_dependency_list { set type_id $dependency_type($tr) set parent_tsk_id $dependency_task_id($tr) - set dependency_id [db_nextval pm_task_dependency_seq] set tsk_revision_id $tr set tsk_id [db_string get_task_id { }] - db_dml new_dependency { *SQL* } + pm::process::add_dependency \ + -process_task_id $tsk_id \ + -parent_task_id $parent_tsk_id \ + -dependency_type_id $type_id } } -after_submit { - ad_returnredirect [export_vars -base process-one -url {process_id}] + ad_returnredirect -message "Process task dependencies saved" [export_vars -base process-one -url {process_id}] ad_script_abort } @@ -162,22 +174,17 @@ lappend dependency_keys $dependency_tasks(task_title) } -set dependency_keys [lsort $dependency_keys] - - - - # get the information on tasks from their task_id numbers db_foreach dependency_query { } -column_array tasks { # set up the tasks that can be viewed. Takes out the current task - set dependency_options_full "" + set dependency_options_full [list] foreach key $dependency_keys { if {![string equal $key $tasks(task_title)]} { - append dependency_options_full "{\"$key\" $dependency_options($key)} " + lappend dependency_options_full [list $key $dependency_options($key)] } } @@ -186,7 +193,8 @@ {value {$tasks(task_id)}} } - {task_title.$tasks(task_id):text(inform) + {task_title.$tasks(task_id):text(hidden) + {section {$tasks(task_title)}} {label \"Subject\"} {value {$tasks(task_title)}} } Index: openacs-4/contrib/packages/project-manager/www/process-one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-one-postgresql.xql,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/contrib/packages/project-manager/www/process-one-postgresql.xql 11 Dec 2003 21:39:44 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/process-one-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.3.2.1 @@ -10,11 +10,16 @@ t.estimated_hours_work, t.estimated_hours_work_min, t.estimated_hours_work_max, - d.dependency_type + d.dependency_type, + t.ordering FROM - pm_process_task t LEFT JOIN pm_process_task_dependency d ON t.process_task_id = d.process_task_id + pm_process_task t + LEFT JOIN + pm_process_task_dependency d + ON t.process_task_id = d.process_task_id WHERE t.process_id = :process_id + [template::list::orderby_clause -orderby -name tasks] Index: openacs-4/contrib/packages/project-manager/www/process-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-one.tcl,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/contrib/packages/project-manager/www/process-one.tcl 20 May 2004 17:30:05 -0000 1.9.2.1 +++ openacs-4/contrib/packages/project-manager/www/process-one.tcl 2 Jul 2004 23:13:49 -0000 1.9.2.2 @@ -14,7 +14,8 @@ } { process_id:integer - + orderby:optional + } -properties { process_id:onevalue context_bar:onevalue @@ -34,60 +35,105 @@ 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 use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] + # set up context bar, needs parent_id - set context_bar [ad_context_bar [list "processes?process_id=$process_id" "Processes"] "One"] set use_link "" +if {[string is true $use_uncertain_completion_times_p]} { + set elements [list \ + one_line { + label "Subject" + display_template {@tasks.one_line@ + + + + + + + + + + + + + } + } \ + description { + label "Description" + } \ + estimated_hours_work_min { + label "Work estimate min" + } \ + estimated_hours_work_max { + label "Work estimate max" + } \ + ordering { + label "Order" + } ] + +} else { + + set elements [list \ + one_line { + label "Subject" + display_template {@tasks.one_line@ + + + + + + + + + + + + + } + } \ + description { + label "Description" + } \ + estimated_hours_work { + label "Work estimate" + } \ + ordering { + label "Order" + } ] +} + + + # Process tasks, using list-builder --------------------------------- template::list::create \ -name tasks \ -multirow tasks \ -key process_task_id \ - -elements { + -elements $elements \ + -orderby { + default_value ordering,asc + ordering { + label "Order" + orderby_asc "t.ordering, t.process_task_id" + orderby_desc "t.ordering desc, t.process_task_id desc" + default_direction asc + } one_line { - label "Subject" - display_template {@tasks.one_line@ - - - - - - - - - - - - - } + orderby_asc "t.one_line, t.ordering" + orderby_desc "t.one_line desc, t.ordering desc" + default_direction asc } - description { - label "Description" - } - estimated_hours_work { - label "Work estimate" - } - estimated_hours_work_min { - label "Work estimate min" - } - estimated_hours_work_max { - label "Work estimate max" - } - } \ - -orderby { - one_line {orderby one_line} - description {orderby description} estimated_hours_work {orderby estimated_hours_work} estimated_hours_work_min {orderby estimated_hours_work_min} estimated_hours_work_max {orderby estimated_hours_work_max} - default_value one_line,desc + } \ - -orderby_name orderby_tasks \ -bulk_actions { "Edit" "process-task-add-edit" "Edit tasks" "Delete" "process-task-delete" "Delete tasks" @@ -100,6 +146,7 @@ narrow } \ -filters { + process_id {} } \ -html { width 100% Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit-2-postgresql.xql,v diff -u -r1.3 -r1.3.4.1 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2-postgresql.xql 10 Oct 2003 22:51:04 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.3.4.1 @@ -10,15 +10,17 @@ description, estimated_hours_work, estimated_hours_work_min, - estimated_hours_work_max) + estimated_hours_work_max, + ordering) values (:task_id, :process_id, :one_line, :desc, :work, :work_min, - :work_max) + :work_max, + :order) @@ -29,7 +31,8 @@ description = :desc, estimated_hours_work = :work, estimated_hours_work_min = :work_min, - estimated_hours_work_max = :work_max + estimated_hours_work_max = :work_max, + ordering = :order where process_task_id = :task_id Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit-2.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 20 May 2004 17:30:05 -0000 1.6.2.1 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-2.tcl 2 Jul 2004 23:13:49 -0000 1.6.2.2 @@ -17,18 +17,44 @@ } { process_id:integer,notnull - {task_title:multiple ""} - {description:multiple ""} - {estimated_hours_work:multiple ""} - {estimated_hours_work_min:multiple ""} - {estimated_hours_work_max:multiple ""} + {task_title:array ""} + {description:array ""} + {estimated_hours_work:array ""} + {estimated_hours_work_min:array ""} + {estimated_hours_work_max:array ""} + {ordering:array ""} + {assignee:multiple ""} process_task_id:integer,multiple - {use_dependency:integer,multiple ""} + {use_dependency:array ""} } -validate { no_estimated_hours { - if {![exists_and_not_null estimated_hours_work] && ![exists_and_not_null estimated_hours_work_min] && ![exists_and_not_null estimated_hours_work_max]} { + + set flag1 0 + set flag2 0 + + foreach {index value} [array get estimated_hours_work] { + if {[empty_string_p $value]} { + set flag1 1 + } + } + + foreach {index value} [array get estimated_hours_work_min] { + if {[empty_string_p $value]} { + set flag2 1 + } + } + + foreach {index value} [array get estimated_hours_work_max] { + if {[empty_string_p $value]} { + set flag2 1 + } + } + + if {[string is true $flag1] && [string is false $flag2]} { ad_complain + } elseif {[string is false $flag1] && [string is true $flag2]} { + ad_complain } } process_id_missing { @@ -37,21 +63,28 @@ } } task_title_too_long { - foreach tt $task_title { + foreach {index tt} [array get task_title] { if {[string length $tt] > 198} { ad_complain } } } description_too_long { - foreach d $description { + foreach {index d} [array get description] { if {[string length $d] > 3998} { ad_complain } } } + description_empty { + foreach {index d} [array get description] { + if {[empty_string_p $d]} { + ad_complain + } + } + } bad_estimated_hours_work_range { - foreach wr $estimated_hours_work { + foreach {index wr} [array get estimated_hours_work] { if {$wr > 500 || $wr < 0} { ad_complain } @@ -65,11 +98,11 @@ } } } -errors { - no_estimated_hours {You must enter estimated hours. If nothing - else, enter 0 for the estimated hours} + no_estimated_hours {You must enter estimated hours. If nothing else, enter 0 for the estimated hours} process_id_missing {I don't know which process these tasks are for!} task_title_too_long {A task subject is too long. It must be 198 characters or less} description_too_long {A description subject is too long. It must be 3998 characters or less} + description_empty {The description may not be empty} bad_estimated_hours_work_range {The estimated hours must be between 0 and 499 hours} process_task_id_missing {I don't know which process task is being added or edited!} } @@ -92,27 +125,32 @@ set edit_p [db_string editing_process_tasks_p { } -default "0"] -if {[string equal $edit_p "0"]} { +if {[string is false $edit_p]} { # ----------------------------- # if we're adding process tasks # ----------------------------- set index 0 + set array_index 0 + foreach ptid $process_task_id { + + set array_index [expr $index +1] # set up the values set task_id [lindex $process_task_id $index] - set one_line [lindex $task_title $index] - set desc [lindex $description $index] + set one_line $task_title($array_index) + set desc $description($array_index) + set order $ordering($array_index) if {[string equal $use_uncertain_completion_times_p "1"]} { - set work_min [lindex $estimated_hours_work_min $index] - set work_max [lindex $estimated_hours_work_max $index] + set work_min $estimated_hours_work_min($array_index) + set work_max $estimated_hours_work_max($array_index) set work [expr .5 * [expr $work_max - $work_min] + $work_min] } else { - set work [lindex $estimated_hours_work $index] + set work $estimated_hours_work($array_index) set work_min $work set work_max $work } @@ -131,20 +169,25 @@ # ----------------------------- set index 0 + set array_index 0 + foreach ptid $process_task_id { + set array_index [expr $index +1] + # set up the values set task_id [lindex $process_task_id $index] - set one_line [lindex $task_title $index] - set desc [lindex $description $index] + set one_line $task_title($array_index) + set desc $description($array_index) + set order $ordering($array_index) if {[string equal $use_uncertain_completion_times_p "1"]} { - set work_min [lindex $estimated_hours_work_min $index] - set work_max [lindex $estimated_hours_work_max $index] + set work_min $estimated_hours_work_min($array_index) + set work_max $estimated_hours_work_max($array_index) set work [expr .5 * [expr $work_max - $work_min] + $work_min] } else { - set work [lindex $estimated_hours_work $index] + set work $estimated_hours_work($array_index) set work_min $work set work_max $work } @@ -154,38 +197,38 @@ } } -if {1 == 0} { - set revision_has_dependencies [list] - set revision_no_dependencies [list] +# remove assignments +foreach ptid $process_task_id { - for {set i 1} {$i <= $number} {incr i} { - - if {![exists_and_not_null estimated_hours_work($i)]} { - set estimated_hours_work($i) [expr .5 * ($estimated_hours_work_max($i) - $estimated_hours_work_min($i)) + $estimated_hours_work_min($i)] - } + pm::process::remove_assignees \ + -process_task_id $process_task_id - if {![exists_and_not_null estimated_hours_work_min($i)]} { - set estimated_hours_work_min($i) $estimated_hours_work($i) - } +} - if {![exists_and_not_null estimated_hours_work_max($i)]} { - set estimated_hours_work_max($i) $estimated_hours_work($i) - } +foreach ass $assignee { - # do the actual edit - db_dml edit_task { } + regexp {(.*)-(.*)-(.*)} $ass match process_task party_id role_id - if {[info exists use_dependency_p($i)] && [string equal $use_dependency_p($i) "t"]} { - lappend revision_has_dependencies $this_revision_id - } else { - lappend revision_no_dependencies $this_revision_id - } + pm::process::assign \ + -process_task_id $process_task \ + -party_id $party_id \ + -role_id $role_id - } +} +if {[llength $process_task_id] > 1} { + set task_tasks tasks +} else { + set task_tasks task } +if {[llength [array get use_dependency]] > 0} { + set dep_msg "Now set up dependencies" +} else { + set dep_msg "" +} -ad_returnredirect "process-task-assign-add-edit?[export_vars -url {use_dependency:multiple process_id process_task_id:multiple}]" +ad_returnredirect -message "Process $task_tasks saved. $dep_msg" "process-dependency-add-edit?[export_vars -url {process_task_id:multiple process_id use_dependency:array}]" + ad_script_abort Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit-postgresql.xql,v diff -u -r1.5 -r1.5.4.1 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql 10 Oct 2003 22:51:04 -0000 1.5 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.5.4.1 @@ -10,13 +10,17 @@ t.estimated_hours_work, t.estimated_hours_work_min, t.estimated_hours_work_max, - d.dependency_type + d.dependency_type, + t.ordering FROM - pm_process_task t LEFT JOIN pm_process_task_dependency d ON t.process_task_id = d.process_task_id + pm_process_task t + LEFT JOIN + pm_process_task_dependency d + ON t.process_task_id = d.process_task_id WHERE t.process_task_id in ([join $process_task_id ", "]) ORDER BY - t.process_task_id + t.ordering, t.process_task_id Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit.adp,v diff -u -r1.7 -r1.7.4.1 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp 10 Nov 2003 19:34:54 -0000 1.7 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit.adp 2 Jul 2004 23:13:49 -0000 1.7.4.1 @@ -1,66 +1,85 @@ -@context_bar;noquote@ -@title@ + @context_bar;noquote@ + @title@ -
+
- - - +
+ + - - - - - - + + + + + + - + - + Description:
+ - + - + Order - - +
- - + + + + + + + + + + + + + - -
 @num.rownum@   @num.rownum@  Subject:*

+

Subject:*

- Description:

- - - - + + + + + + + -

+

Work required:*
+ + + + - - - - - - - - - - - + + + + -
Work required:*
Min: hrs
Max: hrs
hrs
Min: hrs
+
Max: hrs
hrs
- - depends on another @task_term_lower@ +

-
+ + depends on another @task_term_lower@ + +

- -

@num.assignee_html;noquote@
-
+ + + + + + + + + + +
Index: openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-add-edit.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl 20 May 2004 17:30:05 -0000 1.8.2.1 +++ openacs-4/contrib/packages/project-manager/www/process-task-add-edit.tcl 2 Jul 2004 23:13:49 -0000 1.8.2.2 @@ -52,13 +52,19 @@ set task_term_lower [parameter::get -parameter "taskname" -default "task"] set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] +set DEFAULT_ORDERING_GAP 5 + # -------------------------------------- # the unique identifier for this package # -------------------------------------- set package_id [ad_conn package_id] set user_id [ad_maybe_redirect_for_registration] +set subsite_id [ad_conn subsite_id] +set user_group_id [application_group::group_id_from_package_id \ + -package_id $subsite_id] + # ----------- # permissions # ----------- @@ -71,10 +77,9 @@ if {[exists_and_not_null process_task_id]} { - set edit_p 1 set title "Edit a process $task_term_lower" - set context_bar [ad_context_bar [list "process-one?process_id=$process_id" "One"] "Edit tasks"] + set context_bar [ad_context_bar [list "process-one?process_id=$process_id" "Process"] "Edit tasks"] permission::require_permission -party_id $user_id -object_id $package_id -privilege write set process_tasks [list] @@ -87,7 +92,12 @@ set estimated_hours_work_v($i) $estimated_hours_work set estimated_hours_work_min_v($i) $estimated_hours_work_min set estimated_hours_work_max_v($i) $estimated_hours_work_max - + set ordering_v($i) $ordering + + if {[empty_string_p $ordering_v($i)]} { + set ordering_v($i) [expr $i * $DEFAULT_ORDERING_GAP] + } + if {[exists_and_not_null dependency_type]} { set checked_v($i) "checked" } else { @@ -102,7 +112,7 @@ set edit_p 0 set title "Add a process $task_term_lower" - set context_bar [ad_context_bar [list "process-one?process_id=$process_id" "One"] "Add tasks"] + set context_bar [ad_context_bar [list "process-one?process_id=$process_id" "Process"] "Add tasks"] permission::require_permission -party_id $user_id -object_id $package_id -privilege create for {set i 1} {$i <= $number} {incr i} { @@ -112,27 +122,99 @@ set estimated_hours_work_v($i) "" set estimated_hours_work_min_v($i) "" set estimated_hours_work_max_v($i) "" + set ordering_v($i) [expr $i * $DEFAULT_ORDERING_GAP] set checked_v($i) "" } } +# set up assignees and roles -template::multirow create num process_task_id one_line description work work_min work_max checked +set roles_list_of_lists [pm::role::select_list_filter] +set assignee_list_of_lists [db_list_of_lists get_assignees { + select + p.first_names || ' ' || p.last_name as name, + p.person_id + FROM + persons p, + acs_rels r, + membership_rels mr + WHERE + r.object_id_one = :user_group_id and + mr.rel_id = r.rel_id and + p.person_id = r.object_id_two and + member_state = 'approved' + ORDER BY + p.first_names, p.last_name +}] + + + +template::multirow create num process_task_id one_line description work work_min work_max ordering checked assignee_html + for {set i 1} {$i <= $number} {incr i} { - if {[string equal $edit_p "0"]} { + if {[string is false $edit_p]} { set process_task_id_tmp [db_nextval pm_process_task_seq] } else { set process_task_id_tmp [lindex $process_task_id [expr $i-1]] + + # remember all the assignees for this task + db_foreach assignee_query { + SELECT + a.party_id, + a.role_id + FROM + pm_process_task_assignment a + WHERE + a.process_task_id = :process_task_id_tmp + ORDER BY + a.role_id + } { + set assigned($process_task_id_tmp-$party_id-$role_id) 1 + } + } - template::multirow append num $process_task_id_tmp $one_line_v($i) $description_v($i) $estimated_hours_work_v($i) $estimated_hours_work_min_v($i) $estimated_hours_work_max_v($i) $checked_v($i) + # we set up the assignments by using this convention: + # {process_task_id}-{party_id}-{role_id} -} + set html "" + foreach role_list $roles_list_of_lists { + + set role_name [lindex $role_list 0] + set role [lindex $role_list 1] + + append html " + " + } + append html "

Assignee: $role_name

" + + foreach assignee_list $assignee_list_of_lists { + set name [lindex $assignee_list 0] + set person_id [lindex $assignee_list 1] + + if {[exists_and_not_null assigned($process_task_id_tmp-$person_id-$role)]} { + set checked "checked" + } else { + set checked "" + } + + append html " + $name +
+ " + + } + + append html "

" + template::multirow append num $process_task_id_tmp $one_line_v($i) $description_v($i) $estimated_hours_work_v($i) $estimated_hours_work_min_v($i) $estimated_hours_work_max_v($i) $ordering_v($i) $checked_v($i) $html +} + + Index: openacs-4/contrib/packages/project-manager/www/process-task-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/process-task-delete-2.tcl,v diff -u -r1.2.2.1 -r1.2.2.2 --- openacs-4/contrib/packages/project-manager/www/process-task-delete-2.tcl 20 May 2004 17:30:05 -0000 1.2.2.1 +++ openacs-4/contrib/packages/project-manager/www/process-task-delete-2.tcl 2 Jul 2004 23:13:49 -0000 1.2.2.2 @@ -21,4 +21,4 @@ db_dml delete_process_tasks { } -ad_returnredirect "process-one?[export_vars -url {process_id}]" +ad_returnredirect -message "Process task deleted" "process-one?[export_vars -url {process_id}]" Index: openacs-4/contrib/packages/project-manager/www/processes-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/processes-postgresql.xql,v diff -u -r1.1 -r1.1.4.1 --- openacs-4/contrib/packages/project-manager/www/processes-postgresql.xql 15 Sep 2003 23:09:57 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/www/processes-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.1.4.1 @@ -1,6 +1,6 @@ -postgresql7.2 +postgresql7.3 @@ -9,9 +9,11 @@ p.one_line, p.description, p.party_id, - to_char(p.creation_date,'Mon DD ''YY') as creation_date + to_char(p.creation_date,'YYYY-MM-DD') as creation_date_ansi FROM pm_process p + ORDER BY + p.one_line Index: openacs-4/contrib/packages/project-manager/www/processes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/processes.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/contrib/packages/project-manager/www/processes.tcl 20 May 2004 17:30:05 -0000 1.7.2.1 +++ openacs-4/contrib/packages/project-manager/www/processes.tcl 2 Jul 2004 23:13:49 -0000 1.7.2.2 @@ -76,6 +76,12 @@ creation_date { label "Created" } + delete { + link_url_col delete_url + display_template { + + } + } } \ -main_class { narrow @@ -96,9 +102,10 @@ } -db_multirow -extend { item_url } processes process_query { +db_multirow -extend { delete_url creation_date } processes process_query { } { - + set delete_url [export_vars -base "process-delete" {process_id}] + set creation_date [lc_time_fmt $creation_date_ansi "%x"] } Index: openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-add-edit-postgresql.xql,v diff -u -r1.15.2.1 -r1.15.2.2 --- openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 20 May 2004 17:30:05 -0000 1.15.2.1 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.15.2.2 @@ -16,6 +16,7 @@ WHERE t.process_id = :process_id ORDER BY + t.ordering, t.process_task_id Index: openacs-4/contrib/packages/project-manager/www/task-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-add-edit.adp,v diff -u -r1.12.2.3 -r1.12.2.4 --- openacs-4/contrib/packages/project-manager/www/task-add-edit.adp 21 Jun 2004 17:34:09 -0000 1.12.2.3 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.adp 2 Jul 2004 23:13:49 -0000 1.12.2.4 @@ -8,40 +8,54 @@ + + + + + + + + + + - - - + @@ -202,7 +216,7 @@ Error -
+ Send email to assignees? + + +
+ Error +
+
+
+ +  #@num.rownum@   + + + #@num.task_id@ + + + + Skip this task? + + + + +
+ Error +
+
+
- -  #@num.rownum@   - - - #@num.task_id@ - - - - Skip this task? - - - -
- Error -
-
- -

- - Subject:*
@@ -60,7 +74,7 @@

- + Comment:
@@ -135,7 +149,7 @@

Log entry:

+ Index: openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-add-edit.tcl,v diff -u -r1.27.2.3 -r1.27.2.4 --- openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 20 May 2004 17:35:19 -0000 1.27.2.3 +++ openacs-4/contrib/packages/project-manager/www/task-add-edit.tcl 2 Jul 2004 23:13:49 -0000 1.27.2.4 @@ -9,6 +9,11 @@ I'm waiting to do that until after my company updates our projects with the customer in each field. +

+ + I'd also like to move the assignments to this page, in the same manner + as the processes. + @author jader@bread.com @creation-date 2003-07-28 @cvs-id $Id$ @@ -47,7 +52,7 @@ @param dependency_task_id @param skip_task_p Whether or not to skip this particular task. Used by processes, if t, then the task is not created @param using_process_p Lets the UI know if there is a process being used (t if so) - + @param send_email_p Send out emails to assignees of new task(s) } { my_key:integer,optional @@ -77,7 +82,7 @@ skip_task_p:array,optional {using_process_p "f"} {return_url ""} - + {send_mail_p "t"} } -properties { context:onevalue @@ -111,7 +116,6 @@ set package_id [ad_conn package_id] - # --------------------------------------------------------------- # # terminology # --------------------------------------------------------------- # @@ -324,7 +328,7 @@ # the SQL function that creates the new tasks. This works. I'm # sure there must be a better way to do it. # ------------------------------------------------------- # -if {[string equal $edit_p t] && [info exists comment]} { +if {[string is true $edit_p] && [info exists comment]} { set searchToken [array startsearch comment] @@ -425,6 +429,11 @@ {value $task_id_pass} } + {send_email_p:text(select) + {options {{"Yes" t} {"No" f}}} + {value t} + } + {edit_p:text(hidden) {value $edit_p} } @@ -720,7 +729,7 @@ # any loops! # --------------------------------------------------- - if {[string equal $edit_p f]} { + if {[string is false $edit_p]} { # if we have a process, we need to bring in the dependencies # from the process. @@ -736,9 +745,10 @@ # what is the task that the process says this task # depends on? set process_index [expr $i - 1] - - if {[exists_and_not_null dependency_v([lindex $process_tasks $process_index])]} { - set process_depend $dependency_v([lindex $process_tasks $process_index]) + set this_process [lindex $process_tasks $process_index] + + if {[exists_and_not_null dependency_v($this_process)]} { + set process_depend $dependency_v($this_process) } else { set process_depend "XXX" } @@ -748,15 +758,18 @@ # one. So we add one to this index, as long as the value # is not -1 (which indicates that process_depend is not in # the process_tasks list) + # can have more than one match, so we use -all - set which_dep_task [lsearch $process_tasks $process_depend] + set which_dep_task_list [lsearch -all $process_tasks $process_depend] - if {$which_dep_task >= 0} { - incr which_dep_task - } + foreach which_dep $which_dep_task_list { - if {$which_dep_task == $process_index} { - set dependency_arr($i) "num$which_dep_task" + # indexes are from 0, we want from 1 + incr which_dep + + # num1 is a convention, used to indicate dependencies + # on tasks that haven't been created yet. + set dependency_arr($i) "num$which_dep" } } @@ -765,16 +778,34 @@ } - set dependency_options_full [pm::task::dependency_options \ + set dependency_options_full [pm::task::options_list \ -edit_p $edit_p \ -task_item_id $task_item_id_arr($i) \ -project_item_id $project_item_id_arr($i) \ -dependency_task_ids "$my_dependencies" \ -number $number \ -current_number $i] - # ns_log Notice "end_date.$i : $end_date_arr($i)" + # if the current project is closed, we need to append it to the + # list of open projects + if {![pm::project::open_p -project_item_id "$project_item_id_arr($i)"] && [exists_and_not_null project_item_id_arr($i)]} { + set project_options_plus [db_list_of_lists get_closed_project " + SELECT + case when o.name is null then p.title || ' -- Closed' else o.name || ' - ' || p.title || ' -- Closed' end as title, + p.item_id + FROM + pm_projectsx p LEFT JOIN + organizations o ON p.customer_id = o.organization_id + WHERE + p.item_id = $project_item_id_arr($i) + "] + + set project_options_plus [concat $project_options_plus $project_options] + } else { + set project_options_plus $project_options + } + ad_form -extend \ -name add_edit \ -form \ @@ -787,7 +818,7 @@ ] \ [list project_item_ids.$i:text(select) \ {label "Project"} \ - {options $project_options} \ + {options $project_options_plus} \ {value {$project_item_id_arr($i)}} \ ] \ [list task_item_id.$i:text(hidden) \ @@ -999,9 +1030,6 @@ SELECT to_char(current_date, 'YYYY-MM-DD')"] - # insert the comment into the database - set is_live [ad_parameter AutoApproveCommentsP {general-comments} {t}] - # -------------------------------------------------------------- # each task we edit returns a task_revision_id # -------------------------------------------------------------- @@ -1107,75 +1135,23 @@ # add in general comments for the task if {![empty_string_p $p_comment]} { + + pm::util::general_comment_add \ + -object_id $p_task_item_id \ + -title "$p_task_title" \ + -comment "$p_comment" \ + -mime_type "$p_comment_type" \ + -user_id $user_id \ + -peeraddr $peeraddr \ + -send_email_p "f" - set comment_id [db_nextval acs_object_id_seq] - - db_transaction { - db_exec_plsql insert_comment { - select acs_message__new ( - :comment_id, -- 1 p_message_id - NULL, -- 2 p_reply_to - current_timestamp, -- 3 p_sent_date - NULL, -- 4 p_sender - NULL, -- 5 p_rfc822_id - :p_task_title, -- 6 p_title - NULL, -- 7 p_description - :p_comment_type, -- 8 p_mime_type - NULL, -- 9 p_text - NULL, -- empty_blob(), -- 10 p_data - 0, -- 11 p_parent_id - :p_task_item_id, -- 12 p_context_id - :user_id, -- 13 p_creation_user - :peeraddr, -- 14 p_creation_ip - 'acs_message', -- 15 p_object_type - :is_live -- 16 p_is_live - ) - } - - db_dml add_entry { - insert into general_comments - (comment_id, - object_id, - category) - values - (:comment_id, - :p_task_item_id, - null) - } - - db_1row get_revision { - select content_item__get_latest_revision(:comment_id) as revision_id - } - - db_dml set_content { - update cr_revisions - set content = :p_comment - where revision_id = :revision_id - } - - db_exec_plsql grant_permission { - begin - perform acs_permission__grant_permission ( - /* object_id => */ :comment_id, - /* grantee_id => */ :user_id, - /* privilege => */ 'read' - ); - perform acs_permission__grant_permission ( - /* object_id => */ :comment_id, - /* grantee_id => */ :user_id, - /* privilege => */ 'write' - ); - return 0; - end; - } - } } } } -after_submit { - ad_returnredirect "task-assign-add-edit?[export_vars -url {comment_list edit_p return_url process_task_id:multiple revisions:multiple task_id:multiple old_description}]" + ad_returnredirect -message "Task(s) saved. Now choose assignees" "task-assign-add-edit?[export_vars -url {comment_list edit_p return_url process_task_id:multiple revisions:multiple task_id:multiple old_description send_email_p}]" # compile a list of which projects the tasks are assigned to # there is a bug here, because we don't update a project when a Index: openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-assign-add-edit.tcl,v diff -u -r1.8.2.3 -r1.8.2.4 --- openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl 20 May 2004 17:35:19 -0000 1.8.2.3 +++ openacs-4/contrib/packages/project-manager/www/task-assign-add-edit.tcl 2 Jul 2004 23:13:49 -0000 1.8.2.4 @@ -26,6 +26,7 @@ {edit_p "t"} {comment_list ""} {old_description:html ""} + {send_email_p "t"} } -properties { @@ -74,21 +75,21 @@ } if {[string equal $open_p 0]} { - ad_returnredirect $return_url + ad_returnredirect -message "Task closed" $return_url } } -# The number of assignments is set to 9, or the number of assignees + -# 2 if there are more than 5 assignees -set NUMBER_OF_ASSIGNMENTS 9 +# The number of assignments is set to 11, or the number of assignees + +# 3 if there are more than 5 assignees +set NUMBER_OF_ASSIGNMENTS 11 # find out the maximum number of assignees db_foreach get_count "select count(task_id) as my_count from pm_task_assignment where task_id in ([join $task_id ", "]) group by task_id" { if {$my_count > $NUMBER_OF_ASSIGNMENTS} { - set NUMBER_OF_ASSIGNMENTS [expr $my_count + 2] + set NUMBER_OF_ASSIGNMENTS [expr $my_count + 3] } } @@ -120,7 +121,7 @@ # permissions -if {[string equal $edit_p "t"]} { +if {[string is true $edit_p]} { set title "Edit $task_term_lower assignments" set context [list "Edit $task_term assignments"] } else { @@ -155,6 +156,10 @@ {value $return_url} } + {send_email_p:text(hidden) + {value $send_email_p} + } + {revisions:text(hidden) {value $revisions_pass}} @@ -266,33 +271,44 @@ regexp {(.*),(.*)} $pl match task_id_v num_value set t_id $task_id_v - set r_id $assignment_role($pl) + + # if they leave out the role, then use the default role + if {[exists_and_not_null assignment_role($pl)]} { + set r_id $assignment_role($pl) + } else { + set r_id [pm::role::default] + } + set p_id $assignment_party($pl) # If there is a comment for this task, then display it # prominently in the email set my_comment $comment_value($t_id) set my_old_description $old_description_value($t_id) - pm::task::email_alert \ - -task_item_id $t_id \ - -user_id $user_id \ - -assignee_id $p_id \ - -assignee_role_name $role_oneline($r_id) \ - -edit_p $edit_p \ - -comment $my_comment \ - -description $descriptions($t_id) \ - -old_description $my_old_description \ - -subject $one_lines($t_id) \ - -work_min $est_hours_work_min($t_id) \ - -work_max $est_hours_work_max($t_id) \ - -work $est_hours_work($t_id) \ - -project_name $project_names($t_id) \ - -earliest_start $earliest_starts($item_id) \ - -earliest_finish $earliest_finishes($item_id) \ - -latest_start $latest_starts($item_id) \ - -latest_finish $latest_finishes($item_id) \ - -url "[parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL][ad_conn package_url]task-one?task_id=$t_id" + if {[string is true $send_email_p]} { + pm::task::email_alert \ + -task_item_id $t_id \ + -user_id $user_id \ + -assignee_id $p_id \ + -assignee_role_name $role_oneline($r_id) \ + -edit_p $edit_p \ + -comment $my_comment \ + -description $descriptions($t_id) \ + -old_description $my_old_description \ + -subject $one_lines($t_id) \ + -work_min $est_hours_work_min($t_id) \ + -work_max $est_hours_work_max($t_id) \ + -work $est_hours_work($t_id) \ + -project_name $project_names($t_id) \ + -earliest_start $earliest_starts($item_id) \ + -earliest_finish $earliest_finishes($item_id) \ + -latest_start $latest_starts($item_id) \ + -latest_finish $latest_finishes($item_id) \ + -url "[parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL][ad_conn package_url]task-one?task_id=$t_id" + } else { + ns_log Debug "User $user_id elected to not send out email while editing task_item_id $t_id" + } # we only want to do this for new people # notification::request::new \ @@ -381,7 +397,14 @@ regexp {(.*),(.*)} $pl match task_id_v num_value set t_id $task_id_v - set r_id $assignment_role($pl) + + # if they leave out the role, then use the default role + if {[exists_and_not_null assignment_role($pl)]} { + set r_id $assignment_role($pl) + } else { + set r_id [pm::role::default] + } + set p_id $assignment_party($pl) db_dml add_assignment { } @@ -391,13 +414,13 @@ } -after_submit { if {[exists_and_not_null return_url]} { - ad_returnredirect $return_url + ad_returnredirect -message "Task assignments saved" $return_url } else { if {[llength $task_id] > 1} { - ad_returnredirect "tasks" + ad_returnredirect -message "Task assignments saved" "tasks" } else { - ad_returnredirect "task-one?task_id=$task_id" + ad_returnredirect -message "Task assignments saved" "task-one?task_id=$task_id" } } ad_script_abort @@ -467,4 +490,3 @@ incr index } - Index: openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-one-postgresql.xql,v diff -u -r1.19.2.1 -r1.19.2.2 --- openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 20 May 2004 17:30:05 -0000 1.19.2.1 +++ openacs-4/contrib/packages/project-manager/www/task-one-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.19.2.2 @@ -7,15 +7,15 @@ 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.end_date,'Mon DD ''YY') as end_date, - to_char(t.earliest_start,'Mon DD ''YY') as earliest_start, + to_char(t.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, to_char(t.earliest_start,'J') as earliest_start_j, - to_char(t.earliest_finish,'Mon DD ''YY') as earliest_finish, - to_char(t.latest_start,'Mon DD ''YY') as latest_start, + to_char(t.earliest_finish,'YYYY-MM-DD HH24:MI') as earliest_finish, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, to_char(t.latest_start,'J') as latest_start_j, - to_char(t.latest_finish,'Mon DD ''YY') as latest_finish, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, to_char(current_date,'J') as today_j, t.estimated_hours_work, t.estimated_hours_work_min, @@ -85,15 +85,15 @@ select r.one_line, - u.first_names || ' ' || u.last_name || ' (' || u.email || ')' as user_info, + u.first_names || ' ' || u.last_name as user_info, r.role_id from pm_task_assignment a, - acs_users_all u, + persons u, pm_roles r where a.task_id = :task_id and - u.party_id = a.party_id and + u.person_id = a.party_id and a.role_id = r.role_id Index: openacs-4/contrib/packages/project-manager/www/task-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-one.adp,v diff -u -r1.23.2.1 -r1.23.2.2 --- openacs-4/contrib/packages/project-manager/www/task-one.adp 20 May 2004 17:30:05 -0000 1.23.2.1 +++ openacs-4/contrib/packages/project-manager/www/task-one.adp 2 Jul 2004 23:13:49 -0000 1.23.2.2 @@ -4,7 +4,11 @@ @task_info.task_title;noquote@ @closed_message@ @context;noquote@ -

+ +

(not current, select live version from the task change page)

+
+ +
- - - - - - - - - - - - - - - - - - - - - - - - @@ -118,6 +98,39 @@
@@ -65,30 +69,6 @@
Dates
Earliest start@task_info.earliest_start@
Earliest finish@task_info.earliest_finish@
Latest start@task_info.latest_start@
Latest finish@task_info.latest_start@
Actions
+ + + + + + + +
Dates
+ + + + + + + + + + + + + + + + + + + + +
Earliest start@task_info.earliest_start@
Earliest finish@task_info.earliest_finish@
Latest start@task_info.latest_start@
Latest finish@task_info.latest_start@
+
+

+ @@ -128,7 +141,73 @@
Assignees
+ +

+ + + + + + + + + + + + + + + + + + + + +
Logger
+ Projected: + + @task_info.estimated_hours_work_min@ - + @task_info.estimated_hours_work_max@ hrs + + + @task_info.estimated_hours_work@ hrs + + + (@task_info.percent_complete@% complete)
+ + Slack: n/a + + + Slack: @task_info.slack_time@
+
+ + Slack: @task_info.slack_time@
+
+
+
+ @variable_widget;noquote@ + @variable_exports;noquote@ + @day_widget;noquote@ + +
+
+ +
+

@@ -168,62 +247,6 @@
-

- - - - - - - - - - - - - - - - - - - - - - - - -
Logged hours
- Total work: - - @task_info.estimated_hours_work_min@ - - @task_info.estimated_hours_work_max@ hrs estimated - - - @task_info.estimated_hours_work@ hrs estimated - - - @task_info.percent_complete@% complete
- - Slack: @task_info.slack_time@
-
- - Slack: n/a - -
- - Log hours - - - @log_note@ -
- -
-

Index: openacs-4/contrib/packages/project-manager/www/task-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-one.tcl,v diff -u -r1.24.2.1 -r1.24.2.2 --- openacs-4/contrib/packages/project-manager/www/task-one.tcl 20 May 2004 17:30:05 -0000 1.24.2.1 +++ openacs-4/contrib/packages/project-manager/www/task-one.tcl 2 Jul 2004 23:13:49 -0000 1.24.2.2 @@ -18,11 +18,14 @@ @param context_bar value for context bar creation @param orderby_dependency specifies how the dependencies will be sorted @param orderby_dependency2 specifies how the dependencies will be sorted (for tasks that have dependencies on this task) + @param logger_days The number of days back to view logged entries } { task_id:integer,optional task_revision_id:integer,optional orderby_dependency:optional orderby_dependency2:optional + {logger_variable_id:integer ""} + {logger_days:integer "30"} } -properties { closed_message:onevalue notification_chunk:onevalue @@ -62,6 +65,11 @@ } } } + logger_days_positive { + if {$logger_days < 1} { + set logger_days 1 + } + } } -errors { task_id_exists {That task does not exist} revision_id_exists {That task does not exist} @@ -81,8 +89,9 @@ # the unique identifier for this package -set package_id [ad_conn package_id] -set user_id [ad_maybe_redirect_for_registration] +set package_id [ad_conn package_id] +set package_url [ad_conn package_url] +set user_id [ad_maybe_redirect_for_registration] # permissions @@ -97,6 +106,12 @@ db_1row task_query { } -column_array task_info +# format the dates according to the local settings +set task_info(earliest_start) [lc_time_fmt $task_info(earliest_start) "%x"] +set task_info(earliest_finish) [lc_time_fmt $task_info(earliest_finish) "%x"] +set task_info(latest_start) [lc_time_fmt $task_info(latest_start) "%x"] +set task_info(latest_finish) [lc_time_fmt $task_info(latest_finish) "%x"] + # we do this for the hours include portion set project_item_id $task_info(project_item_id) @@ -121,11 +136,12 @@ } + # set link to comments set comments [general_comments_get_comments -print_content_p 1 -print_attachments_p 1 $task_id "[ad_conn url]?task_id=$task_id"] -set comments_link [general_comments_create_link -object_name "$task_term: $task_info(task_title)" -link_text "Add a comment" -context_id $package_id $task_id "[ad_conn url]?task_id=$task_id"] +set comments_link "Add comment" set print_link "task-print?&task_id=$task_id&project_item_id=$task_info(project_item_id)" @@ -138,12 +154,28 @@ set logger_project [pm::project::get_logger_project \ -project_item_id $task_info(project_item_id)] -set logger_variable_id [logger::variable::get_default_variable_id] -set log_url "[ad_conn package_url]log?project_id=$logger_project&pm_project_id=$task_info(project_item_id)&pm_task_id=$task_id" +set logger_url [pm::util::logger_url] -set log_note "Task logged time listed below" +if {[empty_string_p $logger_variable_id]} { + set logger_variable_id [logger::variable::get_default_variable_id] +} +set log_url [export_vars -base "${logger_url}log" {{return_url $return_url} {project_id $logger_project} {pm_project_id $task_info(project_item_id)} {pm_task_id $task_id}}] + +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" + +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 # ------------------ @@ -389,3 +421,4 @@ ad_return_template # ------------------------- END OF FILE ------------------------- # + Index: openacs-4/contrib/packages/project-manager/www/task-revisions-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-revisions-postgresql.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/contrib/packages/project-manager/www/task-revisions-postgresql.xql 20 May 2004 17:30:05 -0000 1.1.2.1 +++ openacs-4/contrib/packages/project-manager/www/task-revisions-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.1.2.2 @@ -33,7 +33,8 @@ t.item_id = :task_id and t.item_id = i.item_id and t.creation_user = p.person_id - [template::list::orderby_clause -name revisions -orderby] + ORDER BY + t.revision_id asc Index: openacs-4/contrib/packages/project-manager/www/task-revisions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-revisions.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/contrib/packages/project-manager/www/task-revisions.tcl 20 May 2004 17:30:05 -0000 1.1.2.1 +++ openacs-4/contrib/packages/project-manager/www/task-revisions.tcl 2 Jul 2004 23:13:49 -0000 1.1.2.2 @@ -21,7 +21,7 @@ } -set task_term [parameter::get -parameter "TaskName" -default "Task"] +set task_term [parameter::get -parameter "TaskName" -default "Task Revisions"] set title "$task_term Changes" @@ -64,34 +64,49 @@ label "Deadline" } } \ - -orderby { - revision_id {orderby revision_id} - percent_complete {orderby percent_complete} - end_date {orderby end_date} - default_value revision_id,desc - } \ - -orderby_name orderby_revisions \ -sub_class { narrow - } \ - -filters { - task_revision_id {} - orderby_dependency {} - orderby_dependency2 {} - } \ - -html { - width 100% - } + } +set descriptions [list] -db_multirow -extend { item_url description_rich } revisions task_revisions_query { +db_multirow -extend { item_url description_rich old_revision_id } revisions task_revisions_query { } { set item_url [export_vars -base "task-one" -override {{task_revision_id $revision_id}} -exclude {revision_id} { revision_id task_id}] set richtext_list [list $description $mime_type] set description_rich [template::util::richtext::get_property html_value $richtext_list] + set descriptions_length [llength $descriptions] + + # if there isn't any previous items, then we don't have to do a + # word diff. All the content is new. + if {$descriptions_length < 1} { + set description_rich $description_rich + lappend descriptions "$description_rich" + + } else { + + set old_description [lindex $descriptions [expr [llength $descriptions] - 1]] + set old_description [ad_html_to_text $old_description] + lappend descriptions "$description_rich" + + set description_rich [pm::util::word_diff \ + -split_by " " \ + -old "$old_description" \ + -start_old "" \ + -end_old "" \ + -start_new "" \ + -end_new "" \ + -new "[ad_html_to_text $description_rich]" \ + -filter_proc ""] + + # set description_rich [ad_html_to_text $description_rich] + set description_rich [ad_text_to_html -no_quote -includes_html -- $description_rich] + + } + } Index: openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/tasks-postgresql.xql,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql 20 May 2004 17:30:05 -0000 1.5.2.1 +++ openacs-4/contrib/packages/project-manager/www/tasks-postgresql.xql 2 Jul 2004 23:13:49 -0000 1.5.2.2 @@ -12,6 +12,8 @@ t.title, t.description, t.parent_id as project_item_id, + proj_rev.logger_project, + proj_rev.title as project_name, to_char(t.earliest_start,'J') as earliest_start_j, to_char(current_timestamp,'J') as today_j, to_char(t.latest_start,'J') as latest_start_j, @@ -36,11 +38,15 @@ LEFT JOIN pm_task_assignment ta ON t.item_id = ta.task_id LEFT JOIN persons p - ON ta.party_id = p.person_id + ON ta.party_id = p.person_id, + cr_items proj, + pm_projectsx proj_rev WHERE ts.task_id = t.item_id and i.item_id = t.item_id and - t.task_revision_id = i.live_revision + t.task_revision_id = i.live_revision and + t.parent_id = proj.item_id and + proj.live_revision = proj_rev.revision_id [template::list::filter_where_clauses -and -name tasks] [template::list::orderby_clause -orderby -name tasks] Index: openacs-4/contrib/packages/project-manager/www/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/tasks.tcl,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/contrib/packages/project-manager/www/tasks.tcl 20 May 2004 17:30:05 -0000 1.5.2.1 +++ openacs-4/contrib/packages/project-manager/www/tasks.tcl 2 Jul 2004 23:13:49 -0000 1.5.2.2 @@ -49,6 +49,7 @@ set hidden_vars [export_vars -form $exporting_vars] # how to get back here set return_url [ad_return_url -qualified] +set logger_url [pm::util::logger_url] # set up context bar set context [list "Tasks"] @@ -127,33 +128,22 @@ } actual_hours_worked { label "Hours completed" - display_template "@tasks.actual_hours_worked@/@tasks.estimated_hours_work@ (@tasks.percent_complete@\%)" + display_template "@tasks.actual_hours_worked@/@tasks.estimated_hours_work@
(@tasks.percent_complete@\%)" } project_item_id { - label "P" - display_template "P" + label "Project" + display_col project_name + link_url_eval {[export_vars -base one {project_item_id $tasks(project_item_id)}]} } log_url { - label "L" + label "Log" display_template {L} } - project_item_id { - label "P" - display_template "P" - } - log_url { - label "L" - display_template {L} - } } \ -actions [list "Add task" [export_vars -base task-select-project {return_url}] "Add a task"] \ -bulk_actions { "Log hours" "log-bulk" "Log hours for several tasks" } \ - -actions [list "Add task" [export_vars -base task-select-project {return_url}] "Add a task"] \ - -bulk_actions { - "Log hours" "log-bulk" "Log hours for several tasks" - } \ -bulk_action_export_vars { {return_url} } \ @@ -167,39 +157,14 @@ } role_id { label "Roles" - values {[db_list_of_lists get_roles " - SELECT - one_line, - role_id - FROM - pm_roles - ORDER BY - role_id"]} + values {[pm::role::select_list_filter]} where_clause { ta.role_id = :role_id } } party_id { label "People" - values {[db_list_of_lists get_people " - SELECT - distinct(first_names || ' ' || last_name) as fullname, - u.person_id - FROM - persons u, - pm_task_assignment a, - cr_items t, - pm_tasks ts, - pm_tasks_revisionsx r - WHERE - u.person_id = a.party_id and - t.item_id = a.task_id and - t.item_id = ts.task_id and - ts.status = :status_id and - t.item_id = r.item_id and - t.live_revision = r.revision_id - ORDER BY - fullname"]} + values {[pm::task::assignee_filter_select -status_id $status_id]} where_clause { ta.party_id = :party_id } @@ -276,7 +241,7 @@ } { set item_url [export_vars -base "task-one" {task_id}] - set log_url [export_vars -base "log" {{pm_task_id $task_id} {pm_project_id $project_item_id} {return_url $return_url}}] + set log_url [export_vars -base "${logger_url}log" {{project_id $logger_project} {pm_task_id $task_id} {pm_project_id $project_item_id} {return_url $return_url}}] set latest_start_pretty [lc_time_fmt $latest_start "%x"] set latest_finish_pretty [lc_time_fmt $latest_finish "%x"] Index: openacs-4/contrib/packages/project-manager/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/admin/Attic/index.adp,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/contrib/packages/project-manager/www/admin/index.adp 11 Dec 2003 21:39:44 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/admin/index.adp 2 Jul 2004 23:13:49 -0000 1.3.2.1 @@ -1,44 +1,124 @@ - + -@project_term@s -@context;noquote@ + @title@ + @context;noquote@ -Click on one of the following items to set it up: + Click on one of the following items to set it up: -

+

- +
- - - - + + + + + - - - - + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + - - - - + + + + - - - - + + + -
Rolesthe roles people can take on projects and tasks, such as manager, sales contact, tech support person, etc..
SectionActionDescription
Default rolesthe default roles a person takes on projects and tasks.
RolesViewThe roles people can take on projects and tasks, such as + manager, sales contact, tech support person, etc.. Currently, + can only be edited directly in the database.
Manage workgroupsthe default roles a person takes on projects and tasks.
Default rolesViewThe data model has a facility for default roles, although + it is not currently used at all. This shows what is in the + database for default roles. Currently unimplemented.
WorkgroupsViewThere is a data model for workgroups, but it is not a part + of the UI. Shows what is in the database (currently, nothing!)
Dependency typesNo UIWhen implemented, this page will allow you to view and + edit the descriptions given to various dependency types (such + as finish before start, etc..) Currently, the only dependency + used is finish before start, so it's not exposed in the UI
Status typesNo UIValid status codes, for example, 'Open' and 'Closed'
Project categoriesEdit categoriesProjects can be categorized according to multiple 'trees' + of categories. What this means is you can have multiple ways + of categorizing your projects. This section sets up your + categories and allows you to link them to projects. Currently, + there is a bug in the categories package that prevents the + context bar at the top of the screen from returning you to the + project-manager pages.
Dependency type descriptionsthe description given to the user for task dependencies.
Logger integrationSet upLogger is a package that lets you log time, expenses, and + other variables. Project manager requires you to + install and mount at least one instance of logger, because it + uses logger to log time and other variables against projects + and tasks. However, you can have varying levels of integration + with logger. This section sets up which logger instances you + want to be fully integrated with project-manager, so that new + project-manager projects appear in the logger instance.

+ @logger_warning;noquote@ +

Status typestype valid status codes, for example, 'Open' and 'Closed'
Set upYou must choose a logger instance to be the primary + logger linked in with project-manager. This is closely linked + in with project-manager, so you can view reports of a project, etc. +

+ @logger_primary_warning;noquote@ +

Project categoriesthe categories for projects.
SyncOnce you have chosen logger instances to be integrated + with project-manager, you may have a lot of older + project-manager projects that are not synchronized with + logger. This page lets you synchronize older project-manager + projects with logger, so that they are all linked in correctly + with that instance. This does not add in logger projects to + project-manager (although someone can certainly add that + functionality if they wish). +
+ + Parameters + Edit + The parameters allow you to do things such as set up daily + reminder emails, change what fields are shown in the project + view and edit pages, and so on. Highly recommended if you're + setting up project-manager. + + + + Projects + Update all + This page allows you to update the deadlines of all the + projects in your installation. It will take a while. + + + + Index: openacs-4/contrib/packages/project-manager/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/admin/Attic/index.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/contrib/packages/project-manager/www/admin/index.tcl 26 Jan 2004 15:39:40 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/admin/index.tcl 2 Jul 2004 23:13:49 -0000 1.3.2.1 @@ -26,29 +26,46 @@ task_term_lower:onevalue project_term:onevalue project_term_lower:onevalue + logger_link:onevalue + logger_primary_link:onevalue + logger_sync_link:onevalue } # --------------------------------------------------------------- # -# terminology -set task_term [parameter::get -parameter "TaskName" -default "Task"] -set task_term_lower [parameter::get -parameter "taskname" -default "task"] -set project_term [parameter::get -parameter "ProjectName" -default "Project"] -set project_term_lower [parameter::get -parameter "projectname" -default "project"] +set logger_URLs [parameter::get -parameter "LoggerURLsToKeepUpToDate" -default ""] +set logger_primary [parameter::get -parameter "LoggerPrimaryURL" -default ""] # set up context bar set context [list] +set title "Project Manager Administration" # the unique identifier for this package set package_id [ad_conn package_id] set user_id [ad_maybe_redirect_for_registration] -# set up link to categories +# set up links set categories_link "/categories/cadmin/one-object?object_id=$package_id" +set parameters_link "/shared/parameters?package_id=$package_id&return_url=[site_node::get_package_url -package_key project-manager]admin/" +set logger_link "logger" +set logger_primary_link "logger-primary" +set logger_sync_link "logger-sync" +set update_projects_link "update-projects" +if {[empty_string_p $logger_URLs]} { + set logger_warning "not set up" +} else { + set logger_warning "Currently integrated:

  • [join $logger_URLs "
  • "]
" +} +if {[empty_string_p $logger_primary]} { + set logger_primary_warning "not set up" +} else { + set logger_primary_warning "Currently selected:
  • $logger_primary
" +} + # permissions -permission::require_permission -party_id $user_id -object_id $package_id -privilege read +permission::require_permission -party_id $user_id -object_id $package_id -privilege admin set write_p [permission::permission_p -object_id $package_id -privilege write] set create_p [permission::permission_p -object_id $package_id -privilege create] Index: openacs-4/contrib/packages/project-manager/www/lib/entries-table-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/lib/Attic/entries-table-postgresql.xql,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/project-manager/www/lib/entries-table-postgresql.xql 12 Mar 2004 13:44:46 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/lib/entries-table-postgresql.xql 2 Jul 2004 23:13:50 -0000 1.2.2.1 @@ -15,7 +15,7 @@ le.value, le.description, task.title as project_name, - submitter.user_id, + submitter.person_id as user_id, submitter.first_names || ' ' || submitter.last_name as user_name FROM logger_entries le @@ -32,11 +32,11 @@ ON le.entry_id = task.logger_entry, logger_projects lp, acs_objects ao, - acs_users_all submitter + persons submitter WHERE le.project_id = lp.project_id and ao.object_id = le.entry_id and - ao.creation_user = submitter.user_id + ao.creation_user = submitter.person_id [ad_decode $where_clauses "" "" "and [join $where_clauses "\n and "]"] ORDER BY $order_by Index: openacs-4/contrib/packages/project-manager/www/lib/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/lib/Attic/master.adp,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/project-manager/www/lib/master.adp 12 Mar 2004 13:44:47 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/lib/master.adp 2 Jul 2004 23:13:50 -0000 1.2.2.1 @@ -6,6 +6,7 @@ @header_stuff@ Index: openacs-4/contrib/packages/project-manager/www/lib/nav-bar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/lib/Attic/nav-bar.adp,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/project-manager/www/lib/nav-bar.adp 12 Mar 2004 13:44:47 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/www/lib/nav-bar.adp 2 Jul 2004 23:13:50 -0000 1.2.2.1 @@ -6,8 +6,10 @@ -  |  - @links.name@ +  |  + + @links.name@ +    Index: openacs-4/contrib/packages/project-manager/www/lib/nav-bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/lib/Attic/nav-bar.tcl,v diff -u -r1.2.2.1 -r1.2.2.2 --- openacs-4/contrib/packages/project-manager/www/lib/nav-bar.tcl 20 May 2004 17:30:07 -0000 1.2.2.1 +++ openacs-4/contrib/packages/project-manager/www/lib/nav-bar.tcl 2 Jul 2004 23:13:50 -0000 1.2.2.2 @@ -4,7 +4,15 @@ set package_id [ad_conn package_id] set package_url [ad_conn package_url] set page_url [ad_conn url] +set page_query [ad_conn query] +if {[string is false [empty_string_p $page_query]]} { + set page_query "?$page_query" +} + +set logger_url [pm::util::logger_url] + + set admin_p [permission::permission_p -object_id $package_id -privilege admin] # The links used in the navbar on format url1 label1 url2 label2 ... @@ -16,17 +24,21 @@ lappend link_list {} lappend link_list "Tasks" - lappend link_list [list "${package_url}index"] + lappend link_list [list "${package_url}?assignee_id=${user_id}"] lappend link_list {} lappend link_list "Projects" lappend link_list [list "${package_url}processes"] lappend link_list {} lappend link_list "Processes" + lappend link_list [list "${logger_url}?user_id=${user_id}"] + lappend link_list {} + lappend link_list "Logger" + lappend link_list [list "${package_url}task-select-project"] lappend link_list {} - lappend link_list "New task" + lappend link_list "Add task" } if { $admin_p } { @@ -40,13 +52,15 @@ multirow create links name url selected_p foreach {url_list param_list label} $link_list { set selected_p 0 + foreach url $url_list { - set selected_p [logger::ui::navbar_link_selected_p $url $param_list] - if { $selected_p } { - break + + if {[string equal "$page_url$page_query" $url]} { + set selected_p 1 } } + if { ![empty_string_p $param_list] } { append url "?[export_vars $param_list]" }