Index: openacs-4/packages/project-manager/lib/projects.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/projects.tcl,v
diff -u -r1.39 -r1.40
--- openacs-4/packages/project-manager/lib/projects.tcl 29 Nov 2006 12:02:17 -0000 1.39
+++ openacs-4/packages/project-manager/lib/projects.tcl 19 Feb 2007 15:56:54 -0000 1.40
@@ -16,7 +16,7 @@
# subprojects_p Should subprojects be displayed as well?
set required_param_list "package_id"
-set optional_param_list [list orderby pm_status_id searchterm bulk_p action_p page_num page_size\
+set optional_param_list [list projects_orderby pm_status_id searchterm bulk_p actions_p page_num page_size\
filter_p base_url end_date_f user_space_p hidden_vars]
set optional_unset_list [list assignee_id date_range is_observer_p previous_status_f current_package_f subprojects_p]
set dotlrn_installed_p [apm_package_installed_p dotlrn]
@@ -133,15 +133,19 @@
set subprojects_from_clause ", acs_objects ao"
set subprojects_where_clause "ao.object_type = 'content_folder' and ao.object_id = p.parent_id"
} else {
- unset subprojects_p
+ set subprojects_p ""
}
} else {
+ set subprojects_p ""
+}
+
+if {$subprojects_p eq ""} {
unset subprojects_p
}
# We want to set up a filter for each category tree.
-set export_vars [export_vars -form {pm_status_id orderby}]
+set export_vars [export_vars -form {pm_status_id projects_orderby}]
if {[exists_and_not_null category_id]} {
set temp_category_id $category_id
@@ -183,16 +187,17 @@
}
} else {
set p_range_where ""
+ set start_range_f ""
+ set end_range_f ""
}
##############################################
-set default_orderby [pm::project::index_default_orderby]
-set default_orderby "project_name,desc"
+set default_orderby "project_name,asc"
-if {[exists_and_not_null orderby]} {
+if {[exists_and_not_null projects_orderby]} {
pm::project::index_default_orderby \
- -set $orderby
+ -set $projects_orderby
}
# Get url of the contacts package if it has been mounted for the links on the index page.
@@ -208,7 +213,7 @@
-set row_list "checkbox {}\nproject_name {}\n"
+set row_list "project_name {}\n"
foreach element $elements {
append row_list "$element {}\n"
}
@@ -237,7 +242,7 @@
}
} else {
- set actions [list "Project: $community_name" "$base_url"]
+ set actions ""
}
if {[exists_and_not_null is_observer_p]} {
@@ -388,6 +393,10 @@
$contact_column@projects.customer_name@
"
}
+ subsite {
+ label "[_ acs-subsite.subsite]"
+ display_template "@projects.subsite_name;noquote@"
+ }
creation_date {
label "[_ project-manager.Creation_date]"
display_template "@projects.creation_date_lc@"
@@ -500,12 +509,12 @@
row $row_list
}
} \
- -orderby_name orderby \
+ -orderby_name projects_orderby \
-html {
width 100%
}
-db_multirow -extend { item_url customer_url category_select earliest_finish_date latest_finish_date start_date_lc earliest_start_date creation_date_lc planned_end_date_lc} projects project_folders " " {
+db_multirow -extend { item_url customer_url category_select earliest_finish_date latest_finish_date start_date_lc earliest_start_date creation_date_lc planned_end_date_lc subsite_url subsite_name} projects project_folders " " {
set earliest_finish_date [lc_time_fmt $earliest_finish_date $fmt]
set latest_finish_date [lc_time_fmt $latest_finish_date $fmt]
set creation_date_lc [lc_time_fmt $creation_date $fmt]
@@ -516,6 +525,11 @@
set base_url $_base_url
}
+ # Display the subsite
+ set subsite_id [site_node::closest_ancestor_package -url $base_url -package_key "acs-subsite"]
+ set subsite_url [site_node::get_url_from_object_id -object_id $subsite_id]
+ set subsite_name [acs_object_name $subsite_id]
+
set item_url [export_vars -base "${base_url}one" {project_item_id}]
# root CR folder
Index: openacs-4/packages/project-manager/lib/task-calendar.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/task-calendar.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/project-manager/lib/task-calendar.tcl 23 Nov 2006 09:38:21 -0000 1.7
+++ openacs-4/packages/project-manager/lib/task-calendar.tcl 19 Feb 2007 15:56:54 -0000 1.8
@@ -3,8 +3,6 @@
set date [calendar::adjust_date -date $date -julian_date $julian_date]
set base_url [ad_conn package_url]
-ns_log Error "The task calendar page is currently broken to a state where performance is seriously harmed."
-ad_script_abort
set title "#project-manager.Task_calendar#"
set context [list $title]
set header_stuff "
@@ -48,20 +46,35 @@
set edit_hidden_vars [export_vars -form {return_url {new_tasks "0"}}]
set users_clause ""
+# Shall we hide observers ?
+if {![exists_and_not_null hide_observer_p]} {
+ set hide_observer_p "f"
+}
+
if { ![exists_and_not_null package_id]} {
set calendar [pm::calendar::one_month_display \
-user_id $user_id \
-date $date \
+ -hide_observer_p $hide_observer_p \
-hide_closed_p $hide_closed_p \
-display_p $display_p \
]
- set package_id [dotlrn_community::get_package_id_from_package_key -package_key project-manager -community_id [dotlrn_community::get_community_id]]
- if { ![string eq [ad_conn package_id] [dotlrn::get_package_id]]} {
- set users_clause "and pa.project_id in (select p.item_id
- from pm_projectsx p
+
+ # Figure out all the PM package ids
+ set package_ids ""
+ foreach package_id [apm_package_ids_from_key -package_key "project-manager"] {
+ if {![string eq [ad_conn package_id] $package_id]} {
+ lappend package_ids $package_id
+ }
+ }
+
+ if {$package_ids ne ""} {
+ set users_clause "and pa.project_id in (select item_id
+ from cr_items i, acs_objects o
where
- p.item_id = pa.project_id
- and p.object_package_id = :package_id)"
+ i.item_id = o.object_id
+ and i.content_type = 'pm_project'
+ and o.package_id in ([template::util::tcl_to_sql_list $package_ids]))"
}
@@ -70,6 +83,7 @@
-user_id $user_id \
-date $date \
-hide_closed_p $hide_closed_p \
+ -hide_observer_p $hide_observer_p \
-display_p $display_p \
-package_id $package_id \
]
Index: openacs-4/packages/project-manager/lib/tasks.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/tasks.tcl,v
diff -u -r1.63 -r1.64
--- openacs-4/packages/project-manager/lib/tasks.tcl 15 Feb 2007 13:22:41 -0000 1.63
+++ openacs-4/packages/project-manager/lib/tasks.tcl 19 Feb 2007 15:56:54 -0000 1.64
@@ -346,8 +346,8 @@
default_direction desc
} \
end_date {
- orderby_asc "priority desc, end_date, task_item_id asc"
- orderby_desc "priority desc, end_date desc, task_item_id desc"
+ orderby_asc "end_date, priority desc, task_item_id asc"
+ orderby_desc "end_date desc, priority desc, task_item_id desc"
default_direction asc
} \
estimated_hours_work_max {
@@ -633,7 +633,7 @@
# We dont want to show watchers
if {![string eq $role_type "observer"]} {
- append user_html "$assignee_name"
+ append user_html "$assignee_name"
append user_html ""
}
if {[string eq $assignee_id $user_id]} {
Index: openacs-4/packages/project-manager/tcl/calendar-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/calendar-procs-postgresql.xql,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/project-manager/tcl/calendar-procs-postgresql.xql 30 Jul 2005 00:26:33 -0000 1.7
+++ openacs-4/packages/project-manager/tcl/calendar-procs-postgresql.xql 19 Feb 2007 15:56:54 -0000 1.8
@@ -59,8 +59,8 @@
ts.task_id = t.item_id and
i.item_id = t.item_id and
t.task_revision_id = i.live_revision and
- t.latest_start >= :first_of_month_date and
- t.latest_start <= :last_of_month_date and
+ t.end_date >= :first_of_month_date and
+ t.end_date <= :last_of_month_date and
t.parent_id = projecti.item_id and
o.object_id=t.item_id and
projecti.live_revision = projectr.revision_id
@@ -75,65 +75,42 @@
- SELECT
- ts.task_id,
- ts.task_id as item_id,
- ts.task_number,
- t.task_revision_id,
- t.title,
- t.parent_id as project_item_id,
- o.package_id as instance_id,
- to_char(t.earliest_start,'J') as earliest_start_j,
- to_char(current_timestamp,'J') as today_j,
- to_char(t.end_date,'J') as latest_start_j,
- to_char(t.latest_finish,'J') as latest_finish_j,
- to_char(t.end_date,'YYYY-MM-DD HH24:MI') as latest_start,
- to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish,
- t.percent_complete,
- t.estimated_hours_work,
- t.estimated_hours_work_min,
- t.estimated_hours_work_max,
- case when t.actual_hours_worked is null then 0
- else t.actual_hours_worked end as actual_hours_worked,
- to_char(t.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start,
- to_char(t.earliest_finish,'YYYY-MM-DD HH24:MI') as earliest_finish,
- to_char(t.end_date,'YYYY-MM-DD HH24:MI') as latest_start,
- to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish,
- p.first_names || ' ' || p.last_name || ' (' ||
- substring(r.one_line from 1 for 1) || ')' as full_name,
- p.person_id,
- s.status_type as status,
- r.is_lead_p,
- projectr.title as project_name
- FROM
- pm_tasks_active ts,
- pm_task_status s,
- cr_items i,
- acs_objects o,
- pm_tasks_revisionsx t
- LEFT JOIN pm_task_assignment ta
- ON t.item_id = ta.task_id
- LEFT JOIN persons p
- ON ta.party_id = p.person_id
- LEFT JOIN pm_roles r
- ON ta.role_id = r.role_id,
- cr_items projecti,
- cr_revisions projectr
- WHERE
- ts.status = s.status_id and
- ts.task_id = t.item_id and
- i.item_id = t.item_id and
- t.task_revision_id = i.live_revision and
- t.end_date >= :first_of_month_date and
- t.end_date <= :last_of_month_date and
- t.parent_id = projecti.item_id and
- o.object_id= t.item_id and
- projecti.live_revision = projectr.revision_id
- $selected_users_clause
- $instance_clause
+ SELECT t.item_id as task_id,
+ t.parent_id as project_item_id,
+ t.title,
+ to_char(t.end_date,'YYYY-MM-DD HH24:MI:SS') as day_date,
+ to_char(t.end_date,'J') as day_date_j,
+ s.status_type as status,
+ s.description as status_description,
+ t.priority,
+ t.parent_id,
+ r.is_lead_p,
+ op.title as project_name,
+ op.package_id as instance_id,
+ ta.party_id as person_id
+ FROM
+ (select tr.*
+ from cr_items ci, pm_tasks_revisionsx tr
+ -- get only live revisions
+ where ci.live_revision = tr.task_revision_id) t,
+ pm_tasks_active ti,
+ pm_task_status s,
+ pm_task_assignment ta,
+ pm_roles r,
+ cr_items cp,
+ acs_objects op
+ where t.parent_id = cp.item_id and
+ t.item_id = ti.task_id and
+ ti.status = s.status_id
+ and cp.live_revision = op.object_id
+ and t.item_id = ta.task_id and ta.role_id = r.role_id and ta.party_id in ([join $selected_users ","])
+ and s.status_type = 'o'
$hide_closed_clause
+ $instance_clause
+ and t.end_date >= :first_of_month_date
+ and t.end_date <= :last_of_month_date
ORDER BY
- t.end_date, ts.task_id, r.role_id, p.first_names, p.last_name
+ t.end_date
Index: openacs-4/packages/project-manager/tcl/calendar-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/calendar-procs.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/project-manager/tcl/calendar-procs.tcl 19 Sep 2005 16:57:08 -0000 1.9
+++ openacs-4/packages/project-manager/tcl/calendar-procs.tcl 19 Feb 2007 15:56:54 -0000 1.10
@@ -50,29 +50,31 @@
{-hide_closed_p "t"}
{-display_p "l"}
{-display_item "t"}
+ {-hide_observer_p "f"}
{-package_id ""}
} {
Creates a month widget for tasks if display_item=t
Creates a month widget for projects if display_item=p
+
+ @param hide_observer_p Should we hide tasks where the user_id is only an observer ?
} {
set dotlrn_installed_p [apm_package_installed_p dotlrn]
set day_template "\$day_number"
set prev_nav_template "<"
set next_nav_template ">"
set instance_clause ""
- if {$dotlrn_installed_p} {
- if { [empty_string_p $package_id]} {
- set package_id [dotlrn_community::get_package_id_from_package_key -package_key project-manager -community_id [dotlrn_community::get_community_id]]
- } else {
- set package_id [ad_conn package_id]
- }
- if { ![string eq [ad_conn package_id] [dotlrn::get_package_id]]} {
- set instance_clause "and o.package_id=:package_id"
- }
- } else {
- set package_id [ad_conn package_id]
- }
+ if {$package_id eq ""} {
+ if {$dotlrn_installed_p} {
+ set package_id [dotlrn_community::get_package_id_from_package_key -package_key project-manager -community_id [dotlrn_community::get_community_id]]
+ if { ![string eq [ad_conn package_id] [dotlrn::get_package_id]]} {
+ set instance_clause "and op.package_id=:package_id"
+ }
+ }
+ } else {
+ set instance_clause "and op.package_id = :package_id"
+ }
+
if {[empty_string_p $date]} {
set date [dt_systime]
@@ -94,6 +96,11 @@
set hide_closed_clause ""
}
+ # Do not show observer tasks if not wanted
+ if {$hide_observer_p eq "t"} {
+ append hide_closed_clause " and r.is_observer_p = 'f'"
+ }
+
set selected_users [pm::calendar::users_to_view]
set selected_users_clause " and ts.task_id in (select task_id from pm_task_assignment where party_id in ([join $selected_users ", "]))"
@@ -106,7 +113,7 @@
set query_name "select_monthly_tasks"
#display tasks by deadline
-
+
if { [string eq $display_p d]} {
set query_name "select_monthly_tasks_by_deadline"
}
@@ -128,8 +135,8 @@
![empty_string_p $is_lead_p] && \
[string is true $is_lead_p]} {
- set font_begin "$font_begin"
- set font_end "$font_end"
+ set font_begin "$font_begin"
+ set font_end "$font_end"
}
# if this is another row of the same item, just add the name.
@@ -141,7 +148,7 @@
# save the last item for output
if {![empty_string_p $last_task_id]} {
- ns_set put $items $last_latest_start_j "${day_details}
"
+ ns_set put $items $day_date_j "${day_details}"
}
# set up the next item for output
@@ -155,26 +162,26 @@
}
# begin setting up this calendar item
- set day_details "
${detail_begin}$title${detail_end} - $project_name"
+ set day_details "${font_begin}
${detail_begin}$title${detail_end} - $project_name${font_end}"
# only add to the list if we want to see closed tasks
#append day_details "
${font_begin}${full_name}${font_end}
"
}
set last_task_id $task_id
- set last_latest_start_j $latest_start_j
+ set last_day_date_j $day_date_j
}
if {![empty_string_p $last_task_id ]} {
- ns_set put $items $latest_start_j "$day_details
"
+ ns_set put $items $day_date_j "$day_details"
}
# Display stuff
set day_number_template "$day_template"
-
+
return [dt_widget_month -calendar_details $items -date $date \
-master_bgcolor black \
-header_bgcolor lavender \
Index: openacs-4/packages/project-manager/tcl/project-manager-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/project-manager-callback-procs.tcl,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/project-manager/tcl/project-manager-callback-procs.tcl 31 Jan 2007 15:34:14 -0000 1.15
+++ openacs-4/packages/project-manager/tcl/project-manager-callback-procs.tcl 19 Feb 2007 15:56:54 -0000 1.16
@@ -272,46 +272,66 @@
fconfigure $f -translation binary
puts -nonewline $f [lindex $file 3]
close $f
-
+
# Create the content item
if {$folder_id ne ""} {
-
+ set package_id [acs_object::package_id -object_id $folder_id]
set existing_item_id [fs::get_item_id -name $file_title -folder_id $folder_id]
if {$existing_item_id ne ""} {
set item_id $existing_item_id
} else {
set item_id [db_nextval "acs_object_id_seq"]
+ content::item::new -name $file_title \
+ -parent_id $folder_id \
+ -item_id $item_id \
+ -package_id $package_id \
+ -creation_ip 127.0.0.1 \
+ -creation_user $sender_id \
+ -title $file_title
}
-
- set revision_id [fs::add_file \
- -name $file_title \
+ set revision_id [content::revision::new \
-item_id $item_id \
- -parent_id $folder_id \
-tmp_filename $file_path\
-creation_user $sender_id \
- -creation_ip $peeraddr \
+ -creation_ip 127.0.0.1 \
+ -package_id $package_id \
-title $file_title \
- -no_notification \
- -no_callback \
-description "File send by e-mail from $email(from) to $email(to) on subject $email(subject)" \
- -package_id [acs_object::package_id -object_id $folder_id] \
- -mime_type $mime_type]
+ -mime_type $mime_type \
+ -is_live "t"
+ ]
file delete $file_path
} else {
-
- set revision_id [cr_import_content \
- -title $file_title \
- -description "File send by e-mail from $email(from) to $email(to) on subject $email(subject)" \
+ set package_id [acs_object::package_id -object_id $sender_id]
+ set existing_item_id [content::item::get_id_by_name -name $file_title -parent_id $sender_id]
+ if {$existing_item_id ne ""} {
+ set item_id $existing_item_id
+ } else {
+ set item_id [db_nextval "acs_object_id_seq"]
+ content::item::new -name $file_title \
+ -parent_id $sender_id \
+ -item_id $item_id \
+ -package_id $package_id \
+ -creation_ip 127.0.0.1 \
+ -creation_user $sender_id \
+ -title $file_title
+ }
+
+ set revision_id [content::revision::new \
-item_id $item_id \
+ -tmp_filename $file_path\
-creation_user $sender_id \
- -creation_ip $peeraddr \
- $context_id \
- $file_path \
- [file size $file_path] \
- $mime_type \
- "[clock seconds]-[expr round([ns_rand]*100000)]"]
+ -creation_ip 127.0.0.1 \
+ -package_id $package_id \
+ -title $file_title \
+ -description "File send by e-mail from $email(from) to $email(to) on subject $email(subject)" \
+ -mime_type $mime_type \
+ -is_live "t"
+ ]
+
+ file delete $file_path
}
# Create a list of file_id and file_title
@@ -323,8 +343,14 @@
if {[exists_and_not_null email_body(text/html)]} {
set comment $email_body(text/html)
} else {
- set comment [ad_text_to_html $email_body(text/plain)]
+ if {[exists_and_not_null email_body(text/plain)]} {
+ set comment [ad_text_to_html $email_body(text/plain)]
+ } else {
+ # No Body was given in the email
+ set comment ""
+ }
}
+
set mime_type "text/html"
append comment "
"
foreach file $files {
Index: openacs-4/packages/project-manager/tcl/project-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/project-procs.tcl,v
diff -u -r1.43 -r1.44
--- openacs-4/packages/project-manager/tcl/project-procs.tcl 31 Jan 2007 15:34:14 -0000 1.43
+++ openacs-4/packages/project-manager/tcl/project-procs.tcl 19 Feb 2007 15:56:54 -0000 1.44
@@ -1750,6 +1750,11 @@
project_id in (select live_revision from cr_items where item_id = :project_item_id)
}
+ # Close all tasks
+ foreach task_id [db_list select_tasks {}] {
+ pm::task::close -task_item_id $task_id
+ }
+
if {!$no_callback_p} {
callback pm::project_close -package_id [ad_conn package_id] -project_id $project_item_id
}
Index: openacs-4/packages/project-manager/tcl/project-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/project-procs.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/project-manager/tcl/project-procs.xql 14 Nov 2006 16:12:43 -0000 1.2
+++ openacs-4/packages/project-manager/tcl/project-procs.xql 19 Feb 2007 15:56:54 -0000 1.3
@@ -84,6 +84,19 @@
+
+
+ SELECT
+ task_id
+ FROM
+ cr_items i,
+ pm_tasks_active t
+ WHERE
+ i.item_id = t.task_id and
+ i.parent_id = :project_item_id
+
+
+
select