+
+
Index: openacs-4/contrib/packages/project-manager/lib/task-calendar.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/lib/Attic/task-calendar.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/project-manager/lib/task-calendar.tcl 21 Jul 2005 16:28:40 -0000 1.1
@@ -0,0 +1,130 @@
+ad_page_contract {
+
+ Shows tasks on the calendar
+
+ @author Jade Rubick (jader@bread.com)
+ @author Deds Castillo (deds@infiniteinfo.com)
+ @creation-date 2002-08-28
+ @cvs-id $Id: task-calendar.tcl,v 1.1 2005/07/21 16:28:40 annyf Exp $
+
+} {
+ {view "month"}
+ {date ""}
+ {julian_date ""}
+ {hide_closed_p "t"}
+} -properties {
+ title:onevalue
+ context:onevalue
+ roles:multirow
+}
+
+set user_id [auth::require_login]
+
+set date [calendar::adjust_date -date $date -julian_date $julian_date]
+set base_url [ad_conn package_url][project_manager_portlet::package_key]/
+
+
+set title "Task calendar"
+set context [list $title]
+set header_stuff "
+"
+
+set return_url [ad_return_url]\#top
+
+set edit_hidden_vars [export_vars -form {return_url}]
+
+set calendar [pm::calendar::one_month_display \
+ -user_id $user_id \
+ -date $date \
+ -hide_closed_p $hide_closed_p \
+ ]
+
+
+if {[string is true $hide_closed_p]} {
+ set hide_show_closed "Show closed"
+ set here [export_vars -base ${base_url}task-calendar {{hide_closed_p f} view date julian_date}]
+} else {
+ set hide_show_closed "Hide closed"
+ set here [export_vars -base ${base_url}task-calendar {{hide_closed_p t} view date julian_date}]
+}
+
+# ---------------------------------------------
+# make a key of list of roles and abbreviations
+# ---------------------------------------------
+
+db_multirow roles roles_and_abbrevs {
+ SELECT
+ one_line as role,
+ substring(one_line from 1 for 1) as abbreviation
+ FROM
+ pm_roles
+}
+
+
+# -------------------------------------
+# make a list of users in this subsite.
+# -------------------------------------
+
+set users_to_view [pm::calendar::users_to_view]
+
+set subsite_id [ad_conn subsite_id]
+
+set user_group_id [application_group::group_id_from_package_id \
+ -package_id $subsite_id]
+
+
+db_multirow -extend {checked_p} users users_list {
+ select
+ p.first_names || ' ' || p.last_name as name,
+ p.person_id as party_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
+} {
+ if {[lsearch $users_to_view $party_id] == -1} {
+ set checked_p f
+ } else {
+ set checked_p t
+ }
+}
Index: openacs-4/contrib/packages/project-manager/tcl/calendar-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/calendar-procs-postgresql.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/packages/project-manager/tcl/calendar-procs-postgresql.xql 13 Jan 2005 13:54:35 -0000 1.2
+++ openacs-4/contrib/packages/project-manager/tcl/calendar-procs-postgresql.xql 21 Jul 2005 16:28:08 -0000 1.3
@@ -61,12 +61,110 @@
t.latest_start <= :last_of_month_date and
t.parent_id = projecti.item_id and
projecti.live_revision = projectr.revision_id
+ $instance_clause
$hide_closed_clause
$selected_users_clause
ORDER BY
t.latest_start, ts.task_id, r.role_id, p.first_names, p.last_name
+
+
+ SELECT
+ p.item_id as project_item_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 (
+ select
+ om.category_id,
+ om.object_id,
+ t.name as category_name
+ from
+ category_object_map om,
+ category_translations t,
+ categories ctg
+ where
+ om.category_id = t.category_id and
+ ctg.category_id = t.category_id and
+ ctg.deprecated_p = 'f')
+ c ON p.item_id = c.object_id,
+ cr_items i,
+ cr_folders f,
+ pm_project_status s
+ WHERE
+ p.project_id = i.live_revision and
+ s.status_id = p.status_id
+ and i.parent_id = f.folder_id
+ and f.package_id = :package_id
+ [template::list::filter_where_clauses -and -name projects]
+ [template::list::orderby_clause -orderby -name projects]
+
+
+
+
+
+ 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,
+ 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,
+ to_char(t.latest_finish,'J') as latest_finish_j,
+ to_char(t.latest_start,'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.latest_start,'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,
+ 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.latest_start >= :first_of_month_date and
+ t.latest_start <= :last_of_month_date and
+ t.parent_id = projecti.item_id and
+ (select context_id from acs_objects where object_id=(select context_id from acs_objects where object_id=(select context_id from acs_objects where object_id=t.parent_id))) = :package_id and
+ projecti.live_revision = projectr.revision_id
+ $hide_closed_clause
+ $selected_users_clause
+ ORDER BY
+ t.latest_start, ts.task_id, r.role_id, p.first_names, p.last_name
+
+
+
Index: openacs-4/contrib/packages/project-manager/tcl/calendar-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/calendar-procs.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/packages/project-manager/tcl/calendar-procs.tcl 13 Jan 2005 13:54:35 -0000 1.2
+++ openacs-4/contrib/packages/project-manager/tcl/calendar-procs.tcl 21 Jul 2005 16:28:08 -0000 1.3
@@ -51,10 +51,19 @@
} {
Creates a month widget for tasks
} {
+
set day_template "\$day_number"
set prev_nav_template "<"
set next_nav_template ">"
+ set package_id [ad_conn package_id]
+
+ if { ![string eq $package_id [dotlrn::get_package_id]]} {
+ set instance_clause "and (select context_id from acs_objects where object_id=(select context_id from acs_objects where object_id=(select context_id from acs_objects where object_id=t.parent_id))) = :package_id"
+ } else {
+ set instance_clause ""
+ }
+ #ad_return_complaint 1 "$package_id $instance_clause"
if {[empty_string_p $date]} {
set date [dt_systime]
}
@@ -82,83 +91,86 @@
set last_latest_start_j ""
set assignee_list [list]
- db_foreach select_monthly_tasks {} {
-
- # highlight what you're assigned to.
- if {[string equal $person_id $user_id]} {
- set font_begin ""
- set font_end ""
- } else {
- set font_begin ""
- set font_end ""
- }
-
- if { \
- ![empty_string_p $is_lead_p] && \
- [string is true $is_lead_p]} {
-
- set font_begin "$font_begin"
- set font_end "$font_end"
- }
-
- # if this is another row of the same item, just add the name.
- if {[string equal $last_task_id $task_id]} {
- append day_details "
, ${font_begin}${full_name}${font_end}
"
- } else {
-
- # this is the beginning of an item.
-
- # save the last item for output
- if {![empty_string_p $last_task_id]} {
- ns_set put $items $last_latest_start_j "${day_details}"
- }
-
- # set up the next item for output
-
- if {[string equal $status "c"]} {
- set detail_begin ""
- set detail_end ""
- } else {
- set detail_begin ""
- set detail_end ""
- }
-
- # begin setting up this calendar item
- set day_details "
"
-
- # 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
- }
-
- if {![empty_string_p $last_task_id ]} {
-
- ns_set put $items $latest_start_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 \
- -header_text_color black \
- -header_text_size "+1" \
- -day_header_bgcolor lavender \
- -day_bgcolor white \
- -today_bgcolor #FFF8DC \
- -empty_bgcolor lightgrey \
- -day_text_color black \
- -prev_next_links_in_title 1 \
- -prev_month_template $prev_nav_template \
- -next_month_template $next_nav_template \
- -day_number_template $day_number_template]
+
+ db_foreach select_monthly_tasks {} {
+
+ # highlight what you're assigned to.
+ if {[string equal $person_id $user_id]} {
+ set font_begin ""
+ set font_end ""
+ } else {
+ set font_begin ""
+ set font_end ""
+ }
+
+ if { \
+ ![empty_string_p $is_lead_p] && \
+ [string is true $is_lead_p]} {
+
+ set font_begin "$font_begin"
+ set font_end "$font_end"
+ }
+
+ # if this is another row of the same item, just add the name.
+ if {[string equal $last_task_id $task_id]} {
+ append day_details "
, ${font_begin}${full_name}${font_end}
"
+ } else {
+
+ # this is the beginning of an item.
+
+ # save the last item for output
+ if {![empty_string_p $last_task_id]} {
+ ns_set put $items $last_latest_start_j "${day_details}"
+ }
+
+ # set up the next item for output
+
+ if {[string equal $status "c"]} {
+ set detail_begin ""
+ set detail_end ""
+ } else {
+ set detail_begin ""
+ set detail_end ""
+ }
+
+ # begin setting up this calendar item
+ set day_details "