Index: openacs-4/packages/project-manager/lib/date-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/date-portlet.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager/lib/date-portlet.tcl 26 May 2005 09:34:27 -0000 1.1 +++ openacs-4/packages/project-manager/lib/date-portlet.tcl 30 Jul 2005 00:26:33 -0000 1.2 @@ -14,10 +14,22 @@ set use_goal_p [parameter::get -parameter "UseGoalP" -default "1"] set use_project_code_p [parameter::get -parameter "UseUserProjectCodesP" -default "1"] +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] + +#------------------------ +# Check if the project will be handled on daily basis or will show hours and minutes +#------------------------ + +set fmt "%x %r" +if { $daily_p } { + set fmt "%x" +} + db_1row project_query { } -column_array project -set project(planned_start_date) [lc_time_fmt $project(planned_start_date) "%x"] -set project(planned_end_date) [lc_time_fmt $project(planned_end_date) "%x"] -set project(estimated_finish_date) [lc_time_fmt $project(estimated_finish_date) "%x"] -set project(earliest_finish_date) [lc_time_fmt $project(earliest_finish_date) "%x"] -set project(latest_finish_date) [lc_time_fmt $project(latest_finish_date) "%x"] +set project(planned_start_date) [lc_time_fmt $project(planned_start_date) $fmt] +set project(planned_end_date) [lc_time_fmt $project(planned_end_date) $fmt] +set project(estimated_finish_date) [lc_time_fmt $project(estimated_finish_date) $fmt] +set project(earliest_finish_date) [lc_time_fmt $project(earliest_finish_date) $fmt] +set project(latest_finish_date) [lc_time_fmt $project(latest_finish_date) $fmt] Index: openacs-4/packages/project-manager/lib/date-portlet.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/date-portlet.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager/lib/date-portlet.xql 26 May 2005 09:34:27 -0000 1.1 +++ openacs-4/packages/project-manager/lib/date-portlet.xql 30 Jul 2005 00:26:33 -0000 1.2 @@ -10,12 +10,12 @@ SELECT - to_char(p.planned_start_date,'YYYY-MM-DD HH24:MI') as planned_start_date, - to_char(p.planned_end_date,'YYYY-MM-DD HH24:MI') as planned_end_date, + to_char(p.planned_start_date,'YYYY-MM-DD HH24:MI:SS') as planned_start_date, + to_char(p.planned_end_date,'YYYY-MM-DD HH24:MI:SS') as planned_end_date, p.ongoing_p, - to_char(p.estimated_finish_date,'YYYY-MM-DD HH24:MI') as estimated_finish_date, - to_char(p.earliest_finish_date,'YYYY-MM-DD HH24:MI') as earliest_finish_date, - to_char(p.latest_finish_date,'YYYY-MM-DD HH24:MI') as latest_finish_date, + to_char(p.estimated_finish_date,'YYYY-MM-DD HH24:MI:SS') as estimated_finish_date, + to_char(p.earliest_finish_date,'YYYY-MM-DD HH24:MI:SS') as earliest_finish_date, + to_char(p.latest_finish_date,'YYYY-MM-DD HH24:MI:SS') as latest_finish_date, p.actual_hours_completed, p.estimated_hours_total FROM Index: openacs-4/packages/project-manager/lib/dependency-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/dependency-portlet-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager/lib/dependency-portlet-postgresql.xql 3 Jun 2005 22:13:44 -0000 1.1 +++ openacs-4/packages/project-manager/lib/dependency-portlet-postgresql.xql 30 Jul 2005 00:26:33 -0000 1.2 @@ -5,7 +5,7 @@ SELECT t.title as task_title, - to_char(t.end_date,'MM/DD/YYYY') as end_date, + to_char(t.end_date,'YYYY-MM-DD HH24:MI') as end_date, t.percent_complete, i.live_revision, d.parent_task_id, @@ -30,7 +30,7 @@ SELECT t.title as task_title, - to_char(t.end_date,'MM/DD/YYYY') as end_date, + to_char(t.end_date,'YYYY-MM-DD HH24:MI') as end_date, t.percent_complete, i.live_revision, d.parent_task_id, Index: openacs-4/packages/project-manager/lib/dependency-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/dependency-portlet.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager/lib/dependency-portlet.tcl 3 Jun 2005 22:13:44 -0000 1.1 +++ openacs-4/packages/project-manager/lib/dependency-portlet.tcl 30 Jul 2005 00:26:33 -0000 1.2 @@ -77,4 +77,5 @@ } { set item_url [export_vars -base "task-one" -override {{task_id $parent_task_id}} { task_id $d_task_id }] # set item_url [export_vars -base "task-one" {{task_id $d_task_id}}] + set end_date [lc_time_fmt $end_date $fmt] } Index: openacs-4/packages/project-manager/lib/project-calendar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/project-calendar.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager/lib/project-calendar.adp 22 Jul 2005 21:29:27 -0000 1.1 +++ openacs-4/packages/project-manager/lib/project-calendar.adp 30 Jul 2005 00:26:33 -0000 1.2 @@ -1,6 +1,5 @@ - - View options - Key + +

@@ -11,35 +10,27 @@
-

View options

+ + @hide_show_closed;noquote@--> -

Key

- -
- -
@roles.abbreviation;noquote@
-
@roles.role;noquote@
-
-
-

Users to view

@edit_hidden_vars;noquote@ + +
Index: openacs-4/packages/project-manager/lib/project-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/project-portlet.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/project-manager/lib/project-portlet.tcl 29 Jul 2005 23:27:57 -0000 1.8 +++ openacs-4/packages/project-manager/lib/project-portlet.tcl 30 Jul 2005 00:26:33 -0000 1.9 @@ -30,11 +30,11 @@ set project(description) [template::util::richtext::get_property html_value $richtext_list] set project_root [pm::util::get_root_folder] -set project(planned_start_date) [lc_time_fmt $project(planned_start_date) "%x"] -set project(planned_end_date) [lc_time_fmt $project(planned_end_date) "%x"] -set project(estimated_finish_date) [lc_time_fmt $project(estimated_finish_date) "%x"] -set project(earliest_finish_date) [lc_time_fmt $project(earliest_finish_date) "%x"] -set project(latest_finish_date) [lc_time_fmt $project(latest_finish_date) "%x"] +set project(planned_start_date) [lc_time_fmt $project(planned_start_date) $fmt] +set project(planned_end_date) [lc_time_fmt $project(planned_end_date) $fmt] +set project(estimated_finish_date) [lc_time_fmt $project(estimated_finish_date) $fmt] +set project(earliest_finish_date) [lc_time_fmt $project(earliest_finish_date) $fmt] +set project(latest_finish_date) [lc_time_fmt $project(latest_finish_date) $fmt] set edit_url "[ad_conn package_url]add-edit?[export_url_vars project_item_id]" set variables(customer_id) $project(customer_id) Index: openacs-4/packages/project-manager/lib/project-portlet.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/project-portlet.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/project-manager/lib/project-portlet.xql 7 Jul 2005 00:19:47 -0000 1.4 +++ openacs-4/packages/project-manager/lib/project-portlet.xql 30 Jul 2005 00:26:33 -0000 1.5 @@ -17,13 +17,13 @@ p.goal, p.description, p.mime_type, - to_char(p.planned_start_date,'YYYY-MM-DD HH24:MI') as planned_start_date, - to_char(p.planned_end_date,'YYYY-MM-DD HH24:MI') as planned_end_date, + to_char(p.planned_start_date,'YYYY-MM-DD HH24:MI:SS') as planned_start_date, + to_char(p.planned_end_date,'YYYY-MM-DD HH24:MI:SS') as planned_end_date, p.ongoing_p, i.live_revision, - to_char(p.estimated_finish_date,'YYYY-MM-DD HH24:MI') as estimated_finish_date, - to_char(p.earliest_finish_date,'YYYY-MM-DD HH24:MI') as earliest_finish_date, - to_char(p.latest_finish_date,'YYYY-MM-DD HH24:MI') as latest_finish_date, + to_char(p.estimated_finish_date,'YYYY-MM-DD HH24:MI:SS') as estimated_finish_date, + to_char(p.earliest_finish_date,'YYYY-MM-DD HH24:MI:SS') as earliest_finish_date, + to_char(p.latest_finish_date,'YYYY-MM-DD HH24:MI:SS') as latest_finish_date, p.actual_hours_completed, p.estimated_hours_total, p.parent_id, Index: openacs-4/packages/project-manager/lib/project-week-calendar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/project-week-calendar.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/lib/project-week-calendar.adp 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,81 @@ + + + + + + + + +
+ back one week + @dates@ + forward one week +
+ + + + + + + + + + + + + + + +
+ @items.start_date_weekday@: + + @items.start_date@ +
+ + + + + + + + + + + +
+ + + + + @items.end_time@ + + @items.event_name@ + @items.users_list;noquote@ + + + +
+
+
+ +
+
+
+

Users to view

+ +
+ @edit_hidden_vars;noquote@ + + +
Index: openacs-4/packages/project-manager/lib/project-week-calendar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/project-week-calendar.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/lib/project-week-calendar.tcl 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,191 @@ +set p_date [clock format [clock scan $p_date] -format "%Y-%m-%d"] + +set selected_users [pm::calendar::users_to_view] + +set instance_clause "" +set package_id [dotlrn_community::get_package_id_from_package_key -package_key project-manager -community_id [dotlrn_community::get_community_id]] +set base_url "[apm_package_url_from_id $package_id]" + +if { ![string eq [ad_conn package_id] [dotlrn::get_package_id]]} { + set instance_clause "and f.package_id=:package_id" +} + +set return_url [ad_return_url]\#top + +set edit_hidden_vars [export_vars -form {return_url {new_tasks "0"}}] + + +if {[empty_string_p $p_date]} { + # Default to todays date in the users (the connection) timezone + set server_now_time [dt_systime] + set user_now_time [lc_time_system_to_conn $server_now_time] + set p_date [lc_time_fmt $user_now_time "%x"] +} + +set user_id [ad_conn user_id] + + +set start_date $p_date + +# Convert date from user timezone to system timezone +#set system_start_date [lc_time_conn_to_system "$p_date 00:00:00"] + +set first_day_of_week [lc_get firstdayofweek] +set first_us_weekday [lindex [lc_get -locale en_US day] $first_day_of_week] +set last_us_weekday [lindex [lc_get -locale en_US day] [expr [expr $first_day_of_week + 6] % 7]] + +db_1row select_weekday_info {} +db_1row select_week_info {} + +set current_weekday 0 + +#s/item_id/url +multirow create items \ + users_list \ + event_name \ + event_url \ + status_summary \ + start_date \ + day_of_week \ + start_date_weekday \ + start_time \ + end_time \ + no_time_p \ + add_url \ + day_url + +# Convert date from user timezone to system timezone +set first_weekday_of_the_week_tz [lc_time_conn_to_system "$first_weekday_of_the_week 00:00:00"] +set last_weekday_of_the_week_tz [lc_time_conn_to_system "$last_weekday_of_the_week 00:00:00"] + + +set order_by_clause "order by to_char(p.planned_end_date, 'J'),to_char(p.planned_end_date,'HH24:MI')" +set interval_limitation_clause [db_map week_interval_limitation] +set additional_limitations_clause "" +set additional_select_clause ",(to_date(p.planned_end_date,'YYYY-MM-DD HH24:MI:SS') - to_date(:first_weekday_of_the_week_tz,'YYYY-MM-DD HH24:MI:SS')) as day_of_week" +set selected_users [pm::calendar::users_to_view] +set selected_users_clause " and i.item_id in (select project_id from pm_project_assignment where party_id in ([join $selected_users ", "]))" + +set tasks [db_list_of_lists select_items {}] + +db_foreach select_items {} { + + set base_url "[apm_package_url_from_id $instance_id]" + set item_template "${base_url}one?project_id=\$item_id" + + # Convert from system timezone to user timezone + set ansi_start_date [lc_time_system_to_conn $ansi_start_date] + set ansi_end_date [lc_time_system_to_conn $ansi_end_date] + set start_date_weekday [lc_time_fmt $ansi_start_date "%A"] + + set start_date [lc_time_fmt $ansi_start_date "%x"] + set end_date [lc_time_fmt $ansi_end_date "%x"] + + set start_time [lc_time_fmt $ansi_start_date "%X"] + set end_time [lc_time_fmt $ansi_end_date "%X"] + + # need to add dummy entries to show all days + for { } { $current_weekday < $day_of_week } { incr current_weekday } { + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + multirow append items \ + "" \ + "" \ + "" \ + "" \ + [lc_time_fmt $ansi_this_date "%x"] \ + ${current_weekday} \ + [lc_time_fmt $ansi_this_date %A] \ + "" \ + "" \ + "" + + } + + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + if {[string equal $start_time "12:00 AM"] && [string equal $end_time "12:00 AM"]} { + set no_time_p t + } else { + set no_time_p f + } + + set users_list "" + foreach user $selected_users { + if {[db_string users {select 1 from pm_project_assignment where party_id=:user and project_id=:project_id} -default 0]} { + db_1row name {select p.first_names || ' ' || p.last_name as full_name from persons p where person_id=:user} + if { $user == $user_id } { + append users_list "" + } else { + append users_list "" + } + } + } + append users_list "
$full_name
$full_name
" + + + multirow append items \ + $users_list \ + $name \ + [subst $item_template] \ + $status_summary \ + $start_date \ + $day_of_week \ + ${start_date_weekday} \ + $start_time \ + $end_time \ + $no_time_p + + set current_weekday $day_of_week +} + +if {$current_weekday < 7} { + # need to add dummy entries to show all hours + for { } { $current_weekday < 7 } { incr current_weekday } { + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + multirow append items \ + ""\ + "" \ + "" \ + "" \ + [lc_time_fmt $ansi_this_date "%x"] \ + $current_weekday \ + [lc_time_fmt $ansi_this_date %A] \ + "" \ + "" \ + "" + + } +} + +# Navigation Bar +set dates "[lc_time_fmt $first_weekday_date "%q"] - [lc_time_fmt $last_weekday_date "%q"]" +set previous_week_url "?view=week&p_date=[ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian - 7]]]\#top_p" +set next_week_url "?view=week&p_date=[ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian + 7]]]\#top_p" + +# ------------------------------------- +# make a list of users in this subsite. +# ------------------------------------- + +set users_to_view [pm::calendar::users_to_view] + +set community_id [dotlrn_community::get_community_id] + +set users_list "community_members" + +if {[empty_string_p $community_id]} { + set users_list "dotlrn_members" +} + + +db_multirow -extend {checked_p} users $users_list {} { + if {[lsearch $users_to_view $party_id] == -1} { + set checked_p f + } else { + set checked_p t + } +} + + + + + + Index: openacs-4/packages/project-manager/lib/project-week-calendar.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/project-week-calendar.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/lib/project-week-calendar.xql 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,129 @@ + + + + postgresql7.1 + + + + select to_char(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS'), 'D') + as day_of_the_week, + to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS')- '1 week'::interval, :first_us_weekday), 'YYYY-MM-DD HH24:MI:SS') + as first_weekday_of_the_week, + to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS'), :last_us_weekday), 'YYYY-MM-DD HH24:MI:SS') + as last_weekday_of_the_week + from dual + + + + + + +select to_char(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS'), 'D') +as day_of_the_week, +cast(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday) as date) +as first_weekday_date, +to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday),'J') +as first_weekday_julian, +cast(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday) + cast('6 days' as interval) as date) +as last_weekday_date, +to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday) + cast('6 days' as interval),'J') +as last_weekday_julian, +cast(:start_date::timestamptz - cast('7 days' as interval) as date) as last_week, +to_char(:start_date::timestamptz - cast('7 days' as interval), 'Month DD, YYYY') as last_week_pretty, +cast(:start_date::timestamptz + cast('7 days' as interval) as date) as next_week, +to_char(:start_date::timestamptz + cast('7 days' as interval), 'Month DD, YYYY') as next_week_pretty +from dual + + + + + + + + SELECT DISTINCT + to_char(p.planned_end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, + to_char(p.planned_end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, + to_number(to_char(p.planned_start_date,'HH24'),'90') as start_hour, + to_number(to_char(p.planned_end_date,'HH24'),'90') as end_hour, + to_number(to_char(p.planned_end_date,'MI'),'90') as end_minutes, + p.title as name, + p.status_id as status_summary, + p.object_id as item_id, + i.item_id as project_id, + f.package_id as instance_id + $additional_select_clause + 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 + WHERE + p.project_id = i.live_revision + and i.parent_id = f.folder_id + and i.item_id = p.item_id + $instance_clause + $selected_users_clause + and exists (select 1 from acs_object_party_privilege_map ppm + where ppm.object_id = p.project_id + and ppm.privilege = 'read' + and ppm.party_id = :user_id) and + p.planned_end_date between $interval_limitation_clause + $additional_limitations_clause + + + + + + to_date(:first_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS') and to_date(:last_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS') + 1 + + + + + + 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 = :community_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 + + + + + + + select + du.first_names || ' ' || du.last_name as name, + du.user_id as party_id + FROM + dotlrn_users du + + + + + + Index: openacs-4/packages/project-manager/lib/projects-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/projects-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/project-manager/lib/projects-postgresql.xql 21 Jun 2005 11:24:54 -0000 1.3 +++ openacs-4/packages/project-manager/lib/projects-postgresql.xql 30 Jul 2005 00:26:33 -0000 1.4 @@ -12,18 +12,18 @@ p.object_type as content_type, p.title as project_name, p.project_code, - to_char(p.planned_start_date, 'MM/DD/YY') as planned_start_date, - to_char(p.planned_end_date, 'MM/DD/YY') as planned_end_date, + to_char(p.planned_start_date, 'YYYY-MM-DD HH24:MI:SS') as planned_start_date, + to_char(p.planned_end_date, 'YYYY-MM-DD HH24:MI:SS') as planned_end_date, p.ongoing_p, c.category_id, c.category_name, p.earliest_finish_date - current_date as days_to_earliest_finish, p.latest_finish_date - current_date as days_to_latest_finish, p.actual_hours_completed, p.estimated_hours_total, - to_char(p.estimated_finish_date, 'MM/DD/YY') as estimated_finish_date, - to_char(p.earliest_finish_date, 'MM/DD/YY') as earliest_finish_date, - to_char(p.latest_finish_date, 'MM/DD/YY') as latest_finish_date, + to_char(p.estimated_finish_date, 'YYYY-MM-DD HH24:MI:SS') as estimated_finish_date, + to_char(p.earliest_finish_date, 'YYYY-MM-DD HH24:MI:SS') as earliest_finish_date, + to_char(p.latest_finish_date, 'YYYY-MM-DD HH24:MI:SS') as latest_finish_date, case when o.name is null then '--no customer--' else o.name end as customer_name, o.organization_id as customer_id 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.9 -r1.10 --- openacs-4/packages/project-manager/lib/projects.tcl 19 Jul 2005 06:25:54 -0000 1.9 +++ openacs-4/packages/project-manager/lib/projects.tcl 30 Jul 2005 00:26:33 -0000 1.10 @@ -300,6 +300,8 @@ db_multirow -extend { item_url } "projects_${package_id}" 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 item_url [export_vars -base "${base_url}one" {project_item_id}] } Index: openacs-4/packages/project-manager/lib/related-tasks-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/related-tasks-portlet-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager/lib/related-tasks-portlet-postgresql.xql 3 Jun 2005 22:13:44 -0000 1.1 +++ openacs-4/packages/project-manager/lib/related-tasks-portlet-postgresql.xql 30 Jul 2005 00:26:33 -0000 1.2 @@ -6,16 +6,16 @@ SELECT x.task_id_1 as x_task_id, r.title, - to_char(r.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, + to_char(r.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, r.earliest_start - current_date as days_to_earliest_start, to_char(r.earliest_start,'J') as earliest_start_j, - to_char(r.earliest_finish,'YYYY-MM-DD HH24:MI') as earliest_finish, + to_char(r.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, r.earliest_finish - current_date as days_to_earliest_finish, - to_char(r.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, + to_char(r.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, r.latest_start - current_date as days_to_latest_start, to_char(r.latest_start,'J') as latest_start_j, to_char(current_date,'J') as today_j, - to_char(r.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, + to_char(r.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, r.latest_finish - current_date as days_to_latest_finish FROM pm_task_xref x, pm_tasks_revisionsx r, cr_items i @@ -27,16 +27,16 @@ SELECT x2.task_id_2 as x_task_id, r2.title, - to_char(r2.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, + to_char(r2.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, r2.earliest_start - current_date as days_to_earliest_start, to_char(r2.earliest_start,'J') as earliest_start_j, - to_char(r2.earliest_finish,'YYYY-MM-DD HH24:MI') as earliest_finish, + to_char(r2.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, r2.earliest_finish - current_date as days_to_earliest_finish, - to_char(r2.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, + to_char(r2.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, r2.latest_start - current_date as days_to_latest_start, to_char(r2.latest_start,'J') as latest_start_j, to_char(current_date,'J') as today_j, - to_char(r2.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, + to_char(r2.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, r2.latest_finish - current_date as days_to_latest_finish FROM pm_task_xref x2, pm_tasks_revisionsx r2, cr_items i2 Index: openacs-4/packages/project-manager/lib/related-tasks-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/related-tasks-portlet.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager/lib/related-tasks-portlet.tcl 3 Jun 2005 22:13:44 -0000 1.1 +++ openacs-4/packages/project-manager/lib/related-tasks-portlet.tcl 30 Jul 2005 00:26:33 -0000 1.2 @@ -7,6 +7,7 @@ # @arch-tag: c502a3ed-d1c0-4217-832a-6ccd86256024 # @cvs-id $Id$ + template::list::create \ -name related_tasks \ -multirow related_tasks \ @@ -56,10 +57,10 @@ } { set item_url [export_vars -base "task-one" -override {{task_id $x_task_id}}] - set earliest_start_pretty [lc_time_fmt $earliest_start "%x"] - set earliest_finish_pretty [lc_time_fmt $earliest_finish "%x"] - set latest_start_pretty [lc_time_fmt $latest_start "%x"] - set latest_finish_pretty [lc_time_fmt $latest_finish "%x"nn] + set earliest_start_pretty [lc_time_fmt $earliest_start $fmt] + set earliest_finish_pretty [lc_time_fmt $earliest_finish $fmt] + set latest_start_pretty [lc_time_fmt $latest_start $fmt] + set latest_finish_pretty [lc_time_fmt $latest_finish "$fmt"nn] set slack_time [pm::task::slack_time \ -earliest_start_j $earliest_start_j \ Index: openacs-4/packages/project-manager/lib/task-calendar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/task-calendar.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/project-manager/lib/task-calendar.adp 21 Jul 2005 22:10:19 -0000 1.2 +++ openacs-4/packages/project-manager/lib/task-calendar.adp 30 Jul 2005 00:26:33 -0000 1.3 @@ -1,6 +1,5 @@ View options - Key By latest finish @@ -21,31 +20,22 @@ @hide_show_closed;noquote@ -

Key

-
- -
@roles.abbreviation;noquote@
-
@roles.role;noquote@
-
-
-

Users to view

@edit_hidden_vars;noquote@ + +
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.3 -r1.4 --- openacs-4/packages/project-manager/lib/task-calendar.tcl 22 Jul 2005 22:04:29 -0000 1.3 +++ openacs-4/packages/project-manager/lib/task-calendar.tcl 30 Jul 2005 00:26:33 -0000 1.4 @@ -44,14 +44,24 @@ set return_url [ad_return_url]\#top -set edit_hidden_vars [export_vars -form {return_url}] +set edit_hidden_vars [export_vars -form {return_url {new_tasks "0"}}] -set calendar [pm::calendar::one_month_display \ - -user_id $user_id \ - -date $date \ - -hide_closed_p $hide_closed_p \ - -display_p $display_p \ - ] +if { ![exists_and_not_null package_id]} { + set calendar [pm::calendar::one_month_display \ + -user_id $user_id \ + -date $date \ + -hide_closed_p $hide_closed_p \ + -display_p $display_p \ + ] +} else { + set calendar [pm::calendar::one_month_display \ + -user_id $user_id \ + -date $date \ + -hide_closed_p $hide_closed_p \ + -display_p $display_p \ + -package_id $package_id \ + ] +} if {[string is true $hide_closed_p]} { Index: openacs-4/packages/project-manager/lib/task-week-calendar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/task-week-calendar.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/lib/task-week-calendar.adp 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,93 @@ + + By latest finish + + + By deadline + +
+
+
+ + + + + + + + +
+ back one week + @dates@ + forward one week +
+ + + + + + + + + + + + + + + +
+ @items.start_date_weekday@: + + @items.start_date@ +
+ + + + + + + + + + + +
+ + + + + @items.end_time@ + + @items.event_name;noquote@ + @items.users_list;noquote@ + + + +
+
+
+ +
+
+ +
+
+
+

Users to view

+ +
+ @edit_hidden_vars;noquote@ + + +
Index: openacs-4/packages/project-manager/lib/task-week-calendar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/task-week-calendar.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/lib/task-week-calendar.tcl 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,190 @@ +set t_date [clock format [clock scan $t_date] -format "%Y-%m-%d"] +set selected_users [pm::calendar::users_to_view] + +set instance_clause "" +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 o.package_id=:package_id" +} + +set return_url [ad_return_url]\#top + +set edit_hidden_vars [export_vars -form {return_url {new_tasks "0"}}] + +if {[empty_string_p $t_date]} { + # Default to todays date in the users (the connection) timezone + set server_now_time [dt_systime] + set user_now_time [lc_time_system_to_conn $server_now_time] + set t_date [lc_time_fmt $user_now_time "%x"] +} + +set user_id [ad_conn user_id] +set base_url [apm_package_url_from_id $package_id] +set start_date $t_date + +# Convert date from user timezone to system timezone +#set system_start_date [lc_time_conn_to_system "$t_date 00:00:00"] + +set first_day_of_week [lc_get firstdayofweek] +set first_us_weekday [lindex [lc_get -locale en_US day] $first_day_of_week] +set last_us_weekday [lindex [lc_get -locale en_US day] [expr [expr $first_day_of_week + 6] % 7]] + +db_1row select_weekday_info {} +db_1row select_week_info {} + +set current_weekday 0 + +#s/item_id/url +multirow create items \ + item_id \ + users_list \ + event_name \ + event_url \ + status_summary \ + start_date \ + day_of_week \ + start_date_weekday \ + start_time \ + end_time \ + no_time_p \ + add_url \ + day_url + +# Convert date from user timezone to system timezone +set first_weekday_of_the_week_tz [lc_time_conn_to_system "$first_weekday_of_the_week 00:00:00"] +set last_weekday_of_the_week_tz [lc_time_conn_to_system "$last_weekday_of_the_week 00:00:00"] + + +set order_by_clause "order by to_char(t.end_date, 'J'),to_char(t.end_date,'HH24:MI')" +set interval_limitation_clause [db_map week_interval_limitation] +set additional_select_clause ",(to_date(t.end_date,'YYYY-MM-DD HH24:MI:SS') - to_date(:first_weekday_of_the_week_tz,'YYYY-MM-DD HH24:MI:SS')) as day_of_week" +set items_query "select_items" +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 ", "]))" + + +if { [string eq $display_p l] } { + set order_by_clause "order by to_char(t.latest_finish, 'J'),to_char(t.latest_finish,'HH24:MI')" + set interval_limitation_clause [db_map week_interval_limitation] + set additional_select_clause ",(to_date(t.latest_finish,'YYYY-MM-DD HH24:MI:SS') - to_date(:first_weekday_of_the_week_tz,'YYYY-MM-DD HH24:MI:SS')) as day_of_week" + set items_query "select_items_by_latest_finish" +} + + +db_foreach $items_query {} { + set base_url "[apm_package_url_from_id $instance_id]" + set item_template "${base_url}task-one?task_id=\$item_id" + + # Convert from system timezone to user timezone + set ansi_start_date [lc_time_system_to_conn $ansi_start_date] + set ansi_end_date [lc_time_system_to_conn $ansi_end_date] + set start_date_weekday [lc_time_fmt $ansi_start_date "%A"] + set start_date [lc_time_fmt $ansi_start_date "%x"] + set end_date [lc_time_fmt $ansi_end_date "%x"] + + set start_time [lc_time_fmt $ansi_start_date "%X"] + set end_time [lc_time_fmt $ansi_end_date "%X"] + + # need to add dummy entries to show all days + for { } { $current_weekday < $day_of_week } { incr current_weekday } { + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + multirow append items \ + 0 \ + "" \ + "" \ + "" \ + "" \ + [lc_time_fmt $ansi_this_date "%x"] \ + ${current_weekday} \ + [lc_time_fmt $ansi_this_date %A] \ + "" \ + "" \ + "" + } + + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + if {[string equal $start_time "12:00 AM"] && [string equal $end_time "12:00 AM"]} { + set no_time_p t + } else { + set no_time_p f + } + + set users_list "" + foreach user $selected_users { + if {[db_string users {select 1 from pm_task_assignment where party_id=:user and task_id=:item_id} -default 0]} { + db_1row name {select p.first_names || ' ' || p.last_name as full_name from persons p where person_id=:user} + if { $user == $user_id } { + append users_list "" + } else { + append users_list "" + } + } + } + append users_list "
$full_name
$full_name
" + multirow append items \ + $task_item_id \ + $users_list \ + "$name" \ + [subst $item_template] \ + $status_summary \ + $start_date \ + $day_of_week \ + ${start_date_weekday} \ + $start_time \ + $end_time \ + $no_time_p + + set current_weekday $day_of_week +} + +if {$current_weekday < 7} { + # need to add dummy entries to show all hours + for { } { $current_weekday < 7 } { incr current_weekday } { + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + multirow append items \ + 0 \ + "" \ + "" \ + "" \ + "" \ + [lc_time_fmt $ansi_this_date "%x"] \ + $current_weekday \ + [lc_time_fmt $ansi_this_date %A] \ + "" \ + "" \ + "" + } +} + +# Navigation Bar +set dates "[lc_time_fmt $first_weekday_date "%q"] - [lc_time_fmt $last_weekday_date "%q"]" +set previous_week_url "?view=week&t_date=[ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian - 7]]]&display_p=$display_p\#top" +set next_week_url "?view=week&t_date=[ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian + 7]]]&display_p=$display_p\#top" + + + + +# ------------------------------------- +# make a list of users in this subsite. +# ------------------------------------- + +set users_to_view [pm::calendar::users_to_view] + +set community_id [dotlrn_community::get_community_id] + +set users_list "community_members" + +if {[empty_string_p $community_id]} { + set users_list "dotlrn_members" +} + + +db_multirow -extend {checked_p} users $users_list {} { + if {[lsearch $users_to_view $party_id] == -1} { + set checked_p f + } else { + set checked_p t + } +} Index: openacs-4/packages/project-manager/lib/task-week-calendar.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/task-week-calendar.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/lib/task-week-calendar.xql 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,162 @@ + + + + postgresql7.1 + + + + select to_char(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS'), 'D') + as day_of_the_week, + to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS')- '1 week'::interval, :first_us_weekday), 'YYYY-MM-DD HH24:MI:SS') + as first_weekday_of_the_week, + to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS'), :last_us_weekday), 'YYYY-MM-DD HH24:MI:SS') + as last_weekday_of_the_week + from dual + + + + + + +select to_char(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS'), 'D') +as day_of_the_week, +cast(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday) as date) +as first_weekday_date, +to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday),'J') +as first_weekday_julian, +cast(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday) + cast('6 days' as interval) as date) +as last_weekday_date, +to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday) + cast('6 days' as interval),'J') +as last_weekday_julian, +cast(:start_date::timestamptz - cast('7 days' as interval) as date) as last_week, +to_char(:start_date::timestamptz - cast('7 days' as interval), 'Month DD, YYYY') as last_week_pretty, +cast(:start_date::timestamptz + cast('7 days' as interval) as date) as next_week, +to_char(:start_date::timestamptz + cast('7 days' as interval), 'Month DD, YYYY') as next_week_pretty +from dual + + + + + + + select distinct to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, + to_char(t.end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, + to_number(to_char(t.earliest_start,'HH24'),'90') as start_hour, + to_number(to_char(t.end_date,'HH24'),'90') as end_hour, + to_number(to_char(t.end_date,'MI'),'90') as end_minutes, + t.title as name, + ts.status as status_summary, + ts.task_id as item_id, + i.item_id as task_item_id, + o.package_id as instance_id + $additional_select_clause + + FROM + acs_objects o, + 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.parent_id = projecti.item_id and + end_date between $interval_limitation_clause and + o.object_id=t.item_id and + projecti.live_revision = projectr.revision_id + $instance_clause + $selected_users_clause + + + + + + select distinct to_char(latest_finish, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, + to_char(t.latest_finish, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, + to_number(to_char(t.earliest_start,'HH24'),'90') as start_hour, + to_number(to_char(t.latest_finish,'HH24'),'90') as end_hour, + to_number(to_char(t.latest_finish,'MI'),'90') as end_minutes, + t.title as name, + ts.status as status_summary, + ts.task_id as item_id, + i.item_id as task_item_id, + o.package_id as instance_id + $additional_select_clause + + FROM + acs_objects o, + 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.parent_id = projecti.item_id and + latest_finish between $interval_limitation_clause and + o.object_id=t.item_id and + projecti.live_revision = projectr.revision_id + $instance_clause + $selected_users_clause + + + + + + + to_date(:first_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS') and to_date(:last_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS') + 1 + + + + + + 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 = :community_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 + + + + + + + select + du.first_names || ' ' || du.last_name as name, + du.user_id as party_id + FROM + dotlrn_users du + + + + + Index: openacs-4/packages/project-manager/lib/tasks-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/tasks-portlet.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/project-manager/lib/tasks-portlet.adp 28 Jul 2005 10:57:56 -0000 1.3 +++ openacs-4/packages/project-manager/lib/tasks-portlet.adp 30 Jul 2005 00:26:33 -0000 1.4 @@ -8,7 +8,7 @@ - + Index: openacs-4/packages/project-manager/lib/tasks-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/tasks-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/project-manager/lib/tasks-postgresql.xql 28 Jul 2005 07:54:14 -0000 1.3 +++ openacs-4/packages/project-manager/lib/tasks-postgresql.xql 30 Jul 2005 00:26:33 -0000 1.4 @@ -8,19 +8,19 @@ t.item_id as task_item_id, t.parent_id as project_item_id, t.title, - to_char(t.end_date,'YYYY-MM-DD HH24:MI') as end_date, - to_char(t.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, + to_char(t.end_date,'YYYY-MM-DD HH24:MI:SS') as end_date, + to_char(t.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, t.earliest_start - current_date as days_to_earliest_start, to_char(t.earliest_start,'J') as earliest_start_j, - to_char(t.earliest_finish,'YYYY-MM-DD HH24:MI') as earliest_finish, + to_char(t.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, t.earliest_finish - current_date as days_to_earliest_finish, - to_char(t.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, t.latest_start - current_date as days_to_latest_start, to_char(t.latest_start,'J') as latest_start_j, to_char(current_date,'J') as today_j, - to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, t.latest_finish - current_date as days_to_latest_finish, - to_char(t.end_date,'YYYY-MM-DD HH24:MI') as end_date, + to_char(t.end_date,'YYYY-MM-DD HH24:MI:SS') as end_date, t.end_date - current_date as days_to_end_date, u.person_id, u.first_names, 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.7 -r1.8 --- openacs-4/packages/project-manager/lib/tasks.tcl 21 Jun 2005 22:16:39 -0000 1.7 +++ openacs-4/packages/project-manager/lib/tasks.tcl 30 Jul 2005 00:26:33 -0000 1.8 @@ -404,11 +404,11 @@ set edit_url [export_vars \ -base "task-add-edit" {{task_id $task_item_id} project_item_id return_url}] - set earliest_start_pretty [lc_time_fmt $earliest_start "%x"] - set earliest_finish_pretty [lc_time_fmt $earliest_finish "%x"] - set latest_start_pretty [lc_time_fmt $latest_start "%x"] - set latest_finish_pretty [lc_time_fmt $latest_finish "%x"] - set end_date_pretty [lc_time_fmt $end_date "%x"] + set earliest_start_pretty [lc_time_fmt $earliest_start $fmt] + set earliest_finish_pretty [lc_time_fmt $earliest_finish $fmt] + set latest_start_pretty [lc_time_fmt $latest_start $fmt] + set latest_finish_pretty [lc_time_fmt $latest_finish $fmt] + set end_date_pretty [lc_time_fmt $end_date $fmt] if {[exists_and_not_null earliest_start_j]} { set slack_time [pm::task::slack_time \ Index: openacs-4/packages/project-manager/lib/view-week-display-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/view-week-display-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/lib/view-week-display-oracle.xql 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,33 @@ + + + + oracle8.1.6 + + + + select to_char(to_date(:start_date, 'yyyy-mm-dd'), 'D') + as day_of_the_week, + to_char(next_day(to_date(:start_date, 'yyyy-mm-dd')-7, :first_us_weekday)) + as first_weekday_of_the_week, + to_char(next_day(to_date(:start_date, 'yyyy-mm-dd'), :last_us_weekday)) + as last_weekday_of_the_week + from dual + + + + + +select to_char(to_date(:start_date, 'YYYY-MM-DD'), 'D') as day_of_the_week, +next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, :first_us_weekday) as first_weekday_date, +to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, :first_us_weekday),'J') as first_weekday_julian, +next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, :first_us_weekday) + 6 as last_weekday_date, +to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, :first_us_weekday) + 6,'J') as last_weekday_julian, +to_char(to_date(:start_date) - 7, 'YYYY-MM-DD') as last_week, +to_char(to_date(:start_date) - 7, 'Month DD, YYYY') as last_week_pretty, +to_char(to_date(:start_date) + 7, 'YYYY-MM-DD') as next_week, +to_char(to_date(:start_date) + 7, 'Month DD, YYYY') as next_week_pretty +from dual + + + + Index: openacs-4/packages/project-manager/lib/view-week-display-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/view-week-display-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/lib/view-week-display-postgresql.xql 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,70 @@ + + + + postgresql7.1 + + + + select to_char(to_date(:start_date, 'YYYY-MM-DD'), 'D') + as day_of_the_week, + to_char(next_day(to_date(:start_date, 'YYYY-MM-DD')- '1 week'::interval, :first_us_weekday), 'YYYY-MM-DD') + as first_weekday_of_the_week, + to_char(next_day(to_date(:start_date, 'YYYY-MM-DD'), :last_us_weekday), 'YYYY-MM-DD') + as last_weekday_of_the_week + from dual + + + + + +select to_char(start_date, :ansi_date_format) as ansi_start_date, + to_char(end_date, :ansi_date_format) as ansi_end_date, + coalesce(e.name, a.name) as name, + coalesce(e.status_summary, a.status_summary) as status_summary, + e.event_id as item_id, + (to_date(start_date,:ansi_date_format) - to_date(:first_weekday_of_the_week_tz, + :ansi_date_format)) as day_of_week, + cals.calendar_id, + cals.calendar_name, + cit.type as item_type +from acs_activities a, + acs_events e, + timespans s, + time_intervals t, + calendars cals, + cal_items ci left join + cal_item_types cit on cit.item_type_id = ci.item_type_id +where e.timespan_id = s.timespan_id +and s.interval_id = t.interval_id +and e.activity_id = a.activity_id +and start_date between + to_date(:first_weekday_of_the_week_tz, :ansi_date_format) and + to_date(:last_weekday_of_the_week_tz, :ansi_date_format) +and cals.calendar_id = ci.on_which_calendar +and e.event_id = ci.cal_item_id +$calendars_clause +order by to_char(start_date, 'J'), to_char(start_date,'HH24:MI') + + + + + +select to_char(to_date(:start_date, 'YYYY-MM-DD'), 'D') +as day_of_the_week, +cast(next_day(to_date(:start_date, 'YYYY-MM-DD') - cast('7 days' as interval), :first_us_weekday) as date) +as first_weekday_date, +to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - cast('7 days' as interval), :first_us_weekday),'J') +as first_weekday_julian, +cast(next_day(to_date(:start_date, 'YYYY-MM-DD') - cast('7 days' as interval), :first_us_weekday) + cast('6 days' as interval) as date) +as last_weekday_date, +to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - cast('7 days' as interval), :first_us_weekday) + cast('6 days' as interval),'J') +as last_weekday_julian, +cast(:start_date::timestamptz - cast('7 days' as interval) as date) as last_week, +to_char(:start_date::timestamptz - cast('7 days' as interval), 'Month DD, YYYY') as last_week_pretty, +cast(:start_date::timestamptz + cast('7 days' as interval) as date) as next_week, +to_char(:start_date::timestamptz + cast('7 days' as interval), 'Month DD, YYYY') as next_week_pretty +from dual + + + + Index: openacs-4/packages/project-manager/lib/view-week-display.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/view-week-display.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/lib/view-week-display.adp 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,66 @@ + + + + + + + +
+ back one week + @dates@ + forward one week +
+ + + + + + + + + + + + + + + +
+ @items.start_date_weekday@: + + + #calendar.Add_Item# + + @items.start_date@ +
+ + + + + + + + + + + +
+ + + + + @items.start_time@ - @items.end_time@ + + @items.event_name@ + + + + + [@items.calendar_name@] + +
+
+
+ +
Index: openacs-4/packages/project-manager/lib/view-week-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/view-week-display.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/lib/view-week-display.tcl 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,176 @@ +set date [clock format [clock scan $date] -format "%Y-%m-%d"] + +if {[info exists url_stub_callback]} { + # This parameter is only set if this file is called from .LRN. + # This way I make sure that for the time being this adp/tcl + # snippet is backwards-compatible. + set portlet_mode_p 1 +} else { + set portlet_mode_p 0 +} + +if {[info exists portlet_mode_p] && $portlet_mode_p} { + set item_template "\${url_stub}cal-item-view?show_cal_nav=0&return_url=[ad_urlencode "../"]&action=edit&cal_item_id=\$item_id" + set url_stub_callback "calendar_portlet_display::get_url_stub" + set page_num_formvar [export_form_vars page_num] + set page_num_urlvar "&page_num=$page_num" +} else { + set item_template "cal-item-view?cal_item_id=\$item_id" + set url_stub_callback "" + set page_num_formvar "" + set page_num_urlvar "" + set base_url "" +} + +if { ![info exists show_calendar_name_p] } { + set show_calendar_name_p 1 +} + +if {[exists_and_not_null calendar_id_list]} { + set calendars_clause [db_map dbqd.calendar.www.views.openacs_in_portal_calendar] +} else { + set calendars_clause [db_map dbqd.calendar.www.views.openacs_calendar] +} + +if {[empty_string_p $date]} { + # Default to todays date in the users (the connection) timezone + set server_now_time [dt_systime] + set user_now_time [lc_time_system_to_conn $server_now_time] + set date [lc_time_fmt $user_now_time "%x"] +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +set start_date $date + +# Convert date from user timezone to system timezone +#set system_start_date [lc_time_conn_to_system "$date 00:00:00"] + +set first_day_of_week [lc_get firstdayofweek] +set first_us_weekday [lindex [lc_get -locale en_US day] $first_day_of_week] +set last_us_weekday [lindex [lc_get -locale en_US day] [expr [expr $first_day_of_week + 6] % 7]] + +db_1row select_weekday_info {} +db_1row select_week_info {} + +set current_weekday 0 + +#s/item_id/url +multirow create items \ + event_name \ + event_url \ + calendar_name \ + status_summary \ + start_date \ + day_of_week \ + start_date_weekday \ + start_time \ + end_time \ + no_time_p \ + add_url \ + day_url + +# Convert date from user timezone to system timezone +set first_weekday_of_the_week_tz [lc_time_conn_to_system "$first_weekday_of_the_week 00:00:00"] +set last_weekday_of_the_week_tz [lc_time_conn_to_system "$last_weekday_of_the_week 00:00:00"] + +set order_by_clause " order by to_char(start_date, 'J'), to_char(start_date,'HH24:MI')" +set interval_limitation_clause [db_map dbqd.calendar.www.views.week_interval_limitation] +set additional_limitations_clause "" +set additional_select_clause " , (to_date(start_date,'YYYY-MM-DD HH24:MI:SS') - to_date(:first_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS')) as day_of_week" + +db_foreach dbqd.calendar.www.views.select_items {} { + # Convert from system timezone to user timezone + set ansi_start_date [lc_time_system_to_conn $ansi_start_date] + set ansi_end_date [lc_time_system_to_conn $ansi_end_date] + + set start_date_weekday [lc_time_fmt $ansi_start_date "%A"] + + set start_date [lc_time_fmt $ansi_start_date "%x"] + set end_date [lc_time_fmt $ansi_end_date "%x"] + + set start_time [lc_time_fmt $ansi_start_date "%X"] + set end_time [lc_time_fmt $ansi_end_date "%X"] + + # need to add dummy entries to show all days + for { } { $current_weekday < $day_of_week } { incr current_weekday } { + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + multirow append items \ + "" \ + "" \ + "" \ + "" \ + [lc_time_fmt $ansi_this_date "%x"] \ + $current_weekday \ + [lc_time_fmt $ansi_this_date %A] \ + "" \ + "" \ + "" \ + "${base_url}cal-item-new?date=${ansi_this_date}&start_time=&end_time=" \ + "?view=day&date=$ansi_this_date&page_num_urlvar" + } + + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + if {[string equal $start_time "12:00 AM"] && [string equal $end_time "12:00 AM"]} { + set no_time_p t + } else { + set no_time_p f + } + + # In case we need to dispatch to a different URL (ben) + if {![empty_string_p $url_stub_callback]} { + # Cache the stuff + if {![info exists url_stubs($calendar_id)]} { + set url_stubs($calendar_id) [$url_stub_callback $calendar_id] + } + + set url_stub $url_stubs($calendar_id) + } + + multirow append items \ + $name \ + [subst $item_template] \ + $calendar_name \ + $status_summary \ + $start_date \ + $day_of_week \ + $start_date_weekday \ + $start_time \ + $end_time \ + $no_time_p \ + "?view=day&date=$ansi_start_date&page_num_urlvar" \ + "${base_url}cal-item-new?date=${ansi_this_date}&start_time=&end_time=" + set current_weekday $day_of_week +} + +if {$current_weekday < 7} { + # need to add dummy entries to show all hours + for { } { $current_weekday < 7 } { incr current_weekday } { + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + multirow append items \ + "" \ + "" \ + "" \ + "" \ + [lc_time_fmt $ansi_this_date "%x"] \ + $current_weekday \ + [lc_time_fmt $ansi_this_date %A] \ + "" \ + "" \ + "" \ + "${base_url}cal-item-new?date=${ansi_this_date}&start_time=&end_time=" \ + "?view=day&date=$ansi_this_date&page_num_urlvar" + } +} + +# Navigation Bar +set dates "[lc_time_fmt $first_weekday_date "%q"] - [lc_time_fmt $last_weekday_date "%q"]" +if {$portlet_mode_p} { + set previous_week_url "?$page_num_urlvar&view=week&date=[ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian - 7]]]" + set next_week_url "?$page_num_urlvar&view=week&date=[ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian + 7]]]" +} else { + set previous_week_url "?view=week&date=[ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian - 7]]]" + set next_week_url "?view=week&date=[ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian + 7]]]" +} + 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.6 -r1.7 --- openacs-4/packages/project-manager/tcl/calendar-procs-postgresql.xql 22 Jul 2005 21:29:28 -0000 1.6 +++ openacs-4/packages/project-manager/tcl/calendar-procs-postgresql.xql 30 Jul 2005 00:26:33 -0000 1.7 @@ -129,9 +129,9 @@ 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 $hide_closed_clause - $selected_users_clause ORDER BY t.end_date, ts.task_id, r.role_id, p.first_names, p.last_name
@@ -161,12 +161,19 @@ to_char(p.estimated_finish_date, 'MM/DD/YY') as estimated_finish_date, to_char(p.earliest_finish_date, 'MM/DD/YY') as earliest_finish_date, to_char(p.latest_finish_date, 'MM/DD/YY') as latest_finish_date, + persons.first_names || ' ' || persons.last_name || ' (' || + substring(r.one_line from 1 for 1) || ')' as full_name, + persons.person_id, case when o.name is null then '--no customer--' else o.name 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 + ON p.item_id = pa.project_id + LEFT JOIN persons + ON pa.party_id = persons.person_id + LEFT JOIN pm_roles r + ON pa.role_id = r.role_id LEFT JOIN organizations o ON p.customer_id = o.organization_id LEFT JOIN ( @@ -189,6 +196,7 @@ p.project_id = i.live_revision and i.parent_id = f.folder_id $instance_clause + $selected_users_clause and exists (select 1 from acs_object_party_privilege_map ppm where ppm.object_id = p.project_id and ppm.privilege = 'read' 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.6 -r1.7 --- openacs-4/packages/project-manager/tcl/calendar-procs.tcl 22 Jul 2005 21:29:28 -0000 1.6 +++ openacs-4/packages/project-manager/tcl/calendar-procs.tcl 30 Jul 2005 00:26:33 -0000 1.7 @@ -50,6 +50,7 @@ {-hide_closed_p "t"} {-display_p "l"} {-display_item "t"} + {-package_id ""} } { Creates a month widget for tasks if display_item=t Creates a month widget for projects if display_item=p @@ -60,13 +61,14 @@ set next_nav_template ">" set instance_clause "" - set package_id [dotlrn_community::get_package_id_from_package_key -package_key project-manager -community_id [dotlrn_community::get_community_id]] + 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]] + } - - if { ![string eq [ad_conn package_id] [dotlrn::get_package_id]]} { set instance_clause "and o.package_id=:package_id" } + if {[empty_string_p $date]} { set date [dt_systime] @@ -229,8 +231,8 @@ set hide_closed_clause "" } - set selected_users [pm::calendar::users_to_view] - set selected_users_clause " and ts.project_id in (select project_id from pm_project_assignment where party_id in ([join $selected_users ", "]))" + set selected_users [pm::calendar::users_to_view] + set selected_users_clause " and i.item_id in (select project_id from pm_project_assignment where party_id in ([join $selected_users ", "]))" set last_project_id "" set deadline "" @@ -276,7 +278,7 @@ set day_details "

${detail_begin}$project_id
$project_name${detail_end}" # only add to the list if we want to see closed projects - #append day_details "

  • ${font_begin}${full_name}${font_end}
  • " + append day_details "
    • ${font_begin}${full_name}${font_end}
    • " } Index: openacs-4/packages/project-manager/tcl/project-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/project-procs-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/project-manager/tcl/project-procs-postgresql.xql 8 Jun 2005 20:54:20 -0000 1.5 +++ openacs-4/packages/project-manager/tcl/project-procs-postgresql.xql 30 Jul 2005 00:26:33 -0000 1.6 @@ -108,8 +108,8 @@ else t.actual_hours_worked end as worked, t.estimated_hours_work as to_work, t.item_id as my_iid, - to_char(end_date,'J') as task_deadline_j, - to_char(earliest_start,'J') as old_earliest_start_j, + to_char(to_date(to_char(end_date,'YYYY-MM-DD HH24:MI'),'YYYY-MM-DD HH24:MI'),'J') as task_deadline_j, + to_char(to_date(earliest_start,'YYYY-MM-DD HH24:MI'),'J') as old_earliest_start_j, to_char(earliest_finish,'J') as old_earliest_finish_j, to_char(latest_start,'J') as old_latest_start_j, to_char(latest_finish,'J') as old_latest_finish_j, @@ -245,4 +245,134 @@ + + + SELECT + i.item_id, + i.content_type + FROM + cr_items i, + pm_tasks_active t + WHERE + i.item_id = t.task_id and + i.parent_id = :project_item_id + + + + + + select + sum(t.actual_hours_worked) as actual_hours_completed, + sum(t.estimated_hours_work) as estimated_hours_total, + to_char(current_timestamp,'YYYY-MM-DD HH24:MI') as today + from + pm_tasks_revisionsx t, + cr_items i, + pm_tasks_active a + where + i.item_id = a.task_id and + t.item_id in ([join $task_list ", "]) and + i.live_revision = t.revision_id + + + + + + SELECT + case when t.actual_hours_worked is null then 0 + else t.actual_hours_worked end as worked, + t.estimated_hours_work as to_work, + t.item_id as my_iid, + to_char(end_date,'YYYY-MM-DD HH24:MI') as task_deadline, + to_char(earliest_start,'YYYY-MM-DD HH24:MI') as old_earliest_start, + to_char(earliest_finish,'YYYY-MM-DD HH24::MI') as old_earliest_finish, + to_char(latest_start,'YYYY-MM-DD HH24::MI') as old_latest_start, + to_char(latest_finish,'YYYY-MM-DD HH24::MI') as old_latest_finish, + t.percent_complete as my_percent_complete, + s.status_type + from + pm_tasks_revisionsx t, + cr_items i, + pm_tasks_active ti, + pm_task_status s + where + t.item_id in ([join $task_list ", "]) and + i.live_revision = t.revision_id and + i.item_id = ti.task_id and + ti.status = s.status_id + + + + + + select + d.dependency_id, + d.task_id as task_item_id, + d.parent_task_id, + d.dependency_type + from + pm_task_dependency d + where + d.task_id in ([join $task_list ", "]) + + + + + + select + to_char(planned_start_date,'YYYY-MM-DD HH24:MI') as start_date, + to_char(planned_end_date,'YYYY-MM-DD HH24:MI') as end_date, + ongoing_p + from + pm_projects + where + project_id = (select live_revision from cr_items where item_id = :project_item_id) + + + + + + update + pm_projects + set + actual_hours_completed = :actual_hours_completed, + estimated_hours_total = :estimated_hours_total, + earliest_finish_date = :max_earliest_finish, + latest_finish_date = :min_latest_start + where + project_id = (select live_revision from cr_items where item_id = :project_item_id) + + + + + + select + parent_id + from + cr_items + where + item_id = :my_item_id + + + + + + select pm_project__get_root_folder (:package_id, 'f') + + + + + + update + pm_tasks_revisions + set + earliest_start = :es, + earliest_finish = :ef, + latest_start = :ls, + latest_finish = :lf + where + task_revision_id = (select live_revision from cr_items where item_id = :task_item) + + + 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.11 -r1.12 --- openacs-4/packages/project-manager/tcl/project-procs.tcl 28 Jul 2005 10:57:56 -0000 1.11 +++ openacs-4/packages/project-manager/tcl/project-procs.tcl 30 Jul 2005 00:26:33 -0000 1.12 @@ -175,7 +175,7 @@ -update_tasks_p $update_status_p] if {[string is true $update_status_p]} { - pm::project::compute_status $project_item_id + pm::project::compute_status $project_item_id } set log_title "$project_array(name)\: [pm::task::name -task_item_id $task_item_id]: logged $value $variable_array(unit)" @@ -663,7 +663,7 @@ @error No error codes } { - + # Before hacking on this, you might want to look at: # http://www.joelonsoftware.com/articles/fog0000000069.html @@ -785,7 +785,7 @@ } set latest_finish($my_iid) $task_deadline_j - + set latest_start($my_iid) [pm::project::latest_start \ -end_date_j $task_deadline_j \ -hours_to_complete $activity_time($my_iid) \ @@ -2090,10 +2090,917 @@ return $return_val } else { - + ad_set_client_property -- project-manager project-index-orderby $set return $set - + } } + + +ad_proc -public pm::project::compute_status_mins { + project_item_id +} { + Compute status of project according to mins on the dates. +} { + set debug 0 + set hours_day [pm::util::hours_day] + + + # ------------------------- + # get subprojects and tasks + # ------------------------- + set task_list [list] + set task_list_project [list] + + foreach sub_item [db_list_of_lists select_project_children { }] { + set my_id [lindex $sub_item 0] + set my_type [lindex $sub_item 1] + + if {[string equal $my_type "pm_project"]} { + + # --------------------------------------------- + # gets all tasks that are a part of subprojects + # --------------------------------------------- + set project_return [pm::project::compute_status $my_id] + set task_list_project [concat $task_list_project $project_return] + + } elseif {[string equal $my_type "pm_task"]} { + lappend task_list $my_id + } + } + + set task_list [concat $task_list $task_list_project] + + if {[string is true $debug]} { + ns_log Notice "Tasks in this project (task_list): $task_list" + } + + # ------------------------- + # no tasks for this project + # ------------------------- + if {[llength $task_list] == 0} { + return [list] + } + + # -------------------------------------------------------------- + # we now have list of tasks that includes all subprojects' tasks + # -------------------------------------------------------------- + + # returns actual_hours_completed, estimated_hours_total, and + # today (julian date for today) + db_1row tasks_group_query { } + + if {[string is true $debug]} { + ns_log notice "Today's date (julian format): $today" + } + + # -------------------------------------------------------------- + # 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 + # save on database hits later. Specifically, what we'll do is + # we won't need to save changes if the earliest_start, + # earliest finish, latest_start and latest_finish all haven't + # changed at all. We also save whether the task is open (o) or + # closed(c). + + set old_ES($my_iid) $old_earliest_start + set old_EF($my_iid) $old_earliest_finish + set old_LS($my_iid) $old_latest_start + set old_LF($my_iid) $old_latest_finish + set task_percent_complete($my_iid) $my_percent_complete + + set activity_time($my_iid) [expr [expr $to_work * [expr 100 - $my_percent_complete] / 100]] + + if {[exists_and_not_null task_deadline]} { + + if {[string is true $debug]} { + ns_log notice "$my_iid has a deadline (julian: $task_deadline)" + } + + set latest_finish($my_iid) $task_deadline + set hours_to_complete $activity_time($my_iid) + + set date [lindex [split $task_deadline " "] 0] + set hours [lindex [split [lindex [split $task_deadline " "] 1] :] 0] + set mins [lindex [split [lindex [split $task_deadline " "] 1] :] 1] + set mins [expr ($hours*60) + $mins] + + set date_j [dt_ansi_to_julian_single_arg $date] + set today_j $date_j + set mins_to_complete [expr $hours_to_complete * 60] + set t_total_mins $mins_to_complete + + + + while { $mins_to_complete > [expr $hours_day * 60]} { + + set [expr $today_j - 1] + + # if it is a holiday, don't subtract from total time + + if {[is_workday_p $t_today]} { + set t_total_mins [expr $t_total_mins - [expr $hours_day * 60]] + } + + } + + set t_mins [expr $mins - $t_total_mins] + set hours [expr round ($t_mins/60)] + set t_mins [expr round($t_mins) % 60] + set latest_start($my_iid) "[dt_julian_to_ansi $date_j] $hours:$t_mins" + + } + } + + # -------------------------------------------------------------------- + # We need to keep track of all the dependencies so we can meaningfully + # compute deadlines, earliest start times, etc.. + # -------------------------------------------------------------------- + + db_foreach dependency_query { } { + + # task_item_id depends on parent_task_id + lappend depends($task_item_id) $parent_task_id + + # parent_task_id is dependent on task_item_id + lappend dependent($parent_task_id) $task_item_id + + set dependency_types($task_item_id-$parent_task_id) $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" + } + } + + + # -------------------------------------------------------------- + # need to get some info on this project, so that we can base the + # task information off of them + # -------------------------------------------------------------- + + # gives up end_date, start_date, and ongoing_p + # if ongoing_p is t, then end_date should be null + db_1row project_info { } + + if {[string is true $ongoing_p] && ![empty_string_p $end_date]} { + ns_log Error "Project cannot be ongoing and have a non-null end-date. Setting end date to blank" + set end_date "" + } + + + # -------------------------------------------------------------- + # task_list contains all the tasks + # a subset of those do not depend on any other tasks + # -------------------------------------------------------------- + + # ---------------------------------------------------------------------- + # we want to go through and fill in all the values for earliest start. + # the brain-dead, brute force way of doing this, would be go through the + # task_list length(task_list) times, and each time, compute the values + # for each item that depends on one of those tasks. This is extremely + # inefficient. + # ---------------------------------------------------------------------- + # Instead, we create two lists, one is of tasks we just added + # earliest_start values for, the next is a new list of ones we're going to + # add earliest_start values for. We call these lists + # present_tasks and future_tasks + # ---------------------------------------------------------------------- + + set present_tasks [list] + set future_tasks [list] + + # ----------------------------------------------------- + # make a list of tasks that don't depend on other tasks + # ----------------------------------------------------- + # while we're at it, save earliest_start and earliest_finish + # info for these items + # ----------------------------------------------------- + + foreach task_item $task_list { + + if {![info exists depends($task_item)]} { + + set earliest_start($task_item) $start_date + + set date [lindex [split $earliest_start($task_item) " "] 0] + set hours [lindex [split [lindex [split $earliest_start($task_item) " "] 1] :] 0] + set mins [lindex [split [lindex [split $earliest_start($task_item) " "] 1] :] 1] + set mins [expr ($hours*60) + $mins] + + set date_j [dt_ansi_to_julian_single_arg $date] + set today_j $date_j + set mins_to_complete [expr $activity_time($task_item) * 60] + set t_total_mins $mins_to_complete + + + while { $mins_to_complete > [expr $hours_day * 60]} { + + set today_j [expr $today_j + 1] + + # if it is a holiday, don't subtract from total time + + if {[is_workday_p $today_j]} { + set t_total_mins [expr $t_total_mins + [expr $hours_day * 60]] + + + } + + } + + set t_mins [expr $mins + $t_total_mins] + if { $t_mins > 60 } { + set hours [expr round ($t_mins/60)] + } else { + set hours 0 + } + set t_mins [expr round($t_mins) % 60] + set earliest_finish($task_item) "[dt_julian_to_ansi $date_j] $hours:$t_mins" + + lappend present_tasks $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} { + + if {[string is true $debug]} { + ns_log Notice "No tasks with dependencies" + } + + return [list] + } + + if {[string is true $debug]} { + ns_log Notice "present_tasks: $present_tasks" + } + + # ------------------------------------------------------ + # figure out the earliest start and finish times + # ------------------------------------------------------ + + while {[llength $present_tasks] > 0} { + + set future_tasks [list] + + foreach task_item $present_tasks { + + if {[string is true $debug]} { + ns_log Notice "-this task_item: $task_item" + } + + # ----------------------------------------------------- + # some tasks may already have earliest_start filled in + # the first run of tasks, for example, had their values + # filled in earlier + # ----------------------------------------------------- + + if {![exists_and_not_null earliest_start($task_item)]} { + + if {[string is true $debug]} { + ns_log Notice " !info exists for $task_item" + } + + # --------------------------------------------- + # set the earliest_start for this task = + # max(activity_time(i-1) + earliest_start(i-1)) + # + # (i-1 means an item that this task depends on) + # --------------------------------------------- + + set max_earliest_start 0 + + # testing if this fixes the bug + if {![exists_and_not_null depends($task_item)]} { + set depends($task_item) [list] + } + + foreach dependent_item $depends($task_item) { + + set my_earliest_start [my_earliest_start $earliest_start($dependent_item) $activity_time($dependent_item) $hours_day] + + if {$my_earliest_start > $max_earliest_start} { + set max_earliest_start $my_earliest_start + } + } + + set earliest_start($task_item) $max_earliest_start + + set earliest_finish($task_item) [earliest_finish $max_earliest_start $activity_time($task_item) $hours_day] + + 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)" + } + + } + + # ------------------------------- + # add to list of tasks to process + # ------------------------------- + + if {[info exists dependent($task_item)]} { + set future_tasks [concat $future_tasks $dependent($task_item)] + } + } + + if {[string is true $debug]} { + ns_log Notice "future tasks: $future_tasks" + } + + set present_tasks $future_tasks + } + + # ---------------------------------------------- + # set up earliest date project will be completed + # ---------------------------------------------- + + set max_earliest_finish $today + + foreach task_item $task_list { + + 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) + } + + } + + + # ----------------------------------------------------------------- + # Now compute latest_start and latest_finish dates. + # Note the latest_finish dates may be set to an arbitrary deadline. + # Also note that it is possible for a project to be ongoing. + # In that case, the latest_start and latest_finish dates should + # be set to null, unless there is a hard deadline (end_date). + # ----------------------------------------------------------------- + # If these represent the dependency hierarchy: + # 2155 + # / | \ + # 2161 2173 2179 + # | | + # 2167 2195 + # ---------------------------------------------------------------------- + # we want to go through and fill in all the values for latest start + # and latest_finish. + # the brain-dead, brute force way of doing this, would be go through the + # task_list length(task_list) times, and each time, compute the values + # for each item that depends on one of those tasks. This is extremely + # inefficient. + # ---------------------------------------------------------------------- + # Instead, we create two lists, one is of tasks we just added + # latest_finish values for, the next is a new list of ones we're going to + # add latest_finish values for. We call these lists + # present_tasks and future_tasks + # ---------------------------------------------------------------------- + # Here's a description of the algorithm. + # 1. The algorithm starts with those tasks that don't have other + # tasks depending on them. + # + # So in the example above, we'll start with + # present_tasks: 2167 2173 2195 + # future tasks: + # + # 2. While we make the present_tasks list, we store latest_start + # and latest_finish information for each of those tasks. If the + # project is ongoing, then we also keep track of tasks that have + # no latest_start or latest_finish. We keep this in the + # ongoing_task(task_id) array. If is exists, then we know that + # that task is an ongoing task, so no deadline will exist for it. + # + # 3. Stop if we don't have any dependencies + # + # 4. Then we get into a loop. + # While there are present_tasks: + # Create the future_tasks list + # For each present task: + # If the task has a dependent task: + # Go through these dependent tasks: + # If the dependent task is ongoing don't defer + # If the dependent task doesn't have LS set, + # then defer, and add to future_tasks list + # Otherwise set the LS value for that task + # If there are no deferals, get the minimum LS of + # dependents, set LF + # Add the dependent tasks to the future_tasks + # Set present_tasks equal to future_tasks, clear future_tasks + + # ---------------------------------------------------------------------- + # The biggest problem with this algorithm is that you can have items at + # two different levels in the hierarchy. + # + # if you trace through this algorithm, you'll see that we'll get to 2155 + # before 2161's values have been set, which can cause an error. The + # solution we arrive at is to defer to the future_tasks list any item + # that causes an error. That should work. + + set present_tasks [list] + set future_tasks [list] + + # ----------------------------------------------------- + # make a list of tasks that don't have tasks depend on them + # ----------------------------------------------------- + # while we're at it, save latest_start and latest_finish + # info for these items + # ----------------------------------------------------- + + 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)]} { + + if {[string is true $debug]} { + ns_log Notice " !info exists dependent($task_item)" + } + + # we check this because some tasks already have + # hard deadlines set. + if {[info exists latest_finish($task_item)]} { + + # if the project needs to be completed before the + # actual hard deadline, then the project deadline + # has precedence. However, sometimes the project is + # ongoing, so we have to make sure that there actually + # is an end_date + + # 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]} { + # if {$end_date < $latest_finish($task_item)} { + # set latest_finish($task_item) $end_date + # } + #} + + # 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 hours_to_complete $activity_time($task_item) + + set date [lindex [split $latest_finish($task_item) " "] 0] + set hours [lindex [split [lindex [split $latest_finish($task_item) " "] 1] :] 0] + set mins [lindex [split [lindex [split $latest_finish($task_item) " "] 1] :] 1] + set mins [expr ($hours*60) + $mins] + + set date_j [dt_ansi_to_julian_single_arg $date] + set today_j $date_j + set mins_to_complete [expr $hours_to_complete * 60] + set t_total_mins $mins_to_complete + + + + while { $mins_to_complete > [expr $hours_day * 60]} { + + set [expr $today_j - 1] + + # if it is a holiday, don't subtract from total time + + if {[is_workday_p $t_today]} { + set t_total_mins [expr $t_total_mins - [expr $hours_day * 60]] + } + + } + + set t_mins [expr $mins - $t_total_mins] + set hours [expr round ($t_mins/60)] + set t_mins [expr round($t_mins) % 60] + set late_start_temp "[dt_julian_to_ansi $date_j] $hours:$t_mins" + + if {$late_start_temp < $latest_start($task_item)} { + set latest_start($task_item) $late_start_temp + } + + } else { + + # this section is for items that have no solid + # deadline, but also have no items dependent on them + + # we either set the latest start and finish of the item or + # we specify that the task is an ongoing task + if {[empty_string_p $end_date]} { + set ongoing_task($task_item) true + + if {[string is true $debug]} { + ns_log Notice "NSDBAHNITD: end_date was empty ti:$task_item" + } + } else { + set latest_finish($task_item) $end_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 (location 2)" + } + + set latest_start($task_item) \ + [latest_start \ + -end_date $latest_finish($task_item) \ + -hours_to_complete $activity_time($task_item) \ + -hours_day $hours_day] + + } + } + lappend present_tasks $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 { + if {[string is true $debug]} { + ns_log Notice " info exists dependent($task_item)" + } + } + } + + + # ------------------------------- + # stop if we have no dependencies + # ------------------------------- + if {[llength $present_tasks] == 0} { + if {[string is true $debug]} { + ns_log Notice "No tasks with dependencies" + } + return [list] + } + + if {[string is true $debug]} { + ns_log Notice "LATEST present_tasks: $present_tasks" + } + + # ------------------------------------------------------ + # figure out the latest start and finish times + # ------------------------------------------------------ + + while {[llength $present_tasks] > 0} { + + set future_tasks [list] + + foreach task_item $present_tasks { + + if {[string is true $debug]} { + ns_log Notice "this task_item: $task_item" + } + + # ----------------------------------------------------- + # some tasks may already have latest_start filled in. + # the first run of tasks, for example, had their values + # filled in earlier + # ----------------------------------------------------- + + if {[info exists dependent($task_item)]} { + + if {[string is true $debug]} { + ns_log Notice " info exists for dependent($task_item)" + } + + # --------------------------------------------- + # set the latest_start for this task = + # min(latest_start(i+1) - activity_time(i)) + # + # (i+1 means an item that depends on this task) + # (i means this task) + # --------------------------------------------- + + # 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 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 + + if {[string is true $debug]} { + ns_log Notice " min_latest_start: $end_date" + } + + 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 "" + + 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 + # latest_start date set + + if {[info exists defer_count($task_item)]} { + incr defer_count($task_item) + } else { + set defer_count($task_item) 1 + } + + # we use a magic number here. + # basically, we don't want to defer the + # item forever. Ideally, this should + # be cleaned up better. Defering is necessary + # given this algorithm, but there are + # times when you don't want to defer. + # This is hackish, and I'm embarrased, but on + # a deadline. :( + if {$defer_count($task_item) > 5} { + set defer_p f + + if {[string is true $debug]} { + ns_log Notice " no defer because defer count exceeded" + } + } else { + lappend future_tasks $task_item + + if {[string is true $debug]} { + ns_log Notice " defer" + } + + set defer_p t + } + + + + } else { + + # 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 $latest_start($dependent_item) \ + -hours_to_complete $activity_time($task_item) \ + -hours_day $hours_day] + + if {[string is true $debug]} { + ns_log Notice " my_latest_start: $my_latest_start" + } + + # we also only want to move forward the latest_start + # date if the dependent item is not already completed! + + if {$task_percent_complete($dependent_item) < 100} { + 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 + } + } + + set defer_p f + } + + } + + if {[string equal $defer_p f]} { + + # 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 {[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 $latest_finish($task_item) \ + -hours_to_complete $activity_time($task_item) \ + -hours_day $hours_day] + + } + } else { + + # so this task has no hard deadline. + # We now set the value to the minimum of the + # dependent tasks. Note that if the dependent + # tasks all have no hard deadlines, and the + # project is ongoing, then the value will be + # set to "" + + set latest_start($task_item) $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 (sometimes) + if {[empty_string_p $latest_start($task_item)]} { + set temp_lf "" + } else { + set temp_lf [my_latest_finish $min_latest_start $activity_time($task_item) $hours_day] + } + + # if there is already a hard deadline for this + # 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]} { + + # 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)} { + set latest_finish($task_item) $temp_lf + } + } else { + set latest_finish($task_item) $temp_lf + } + } + + 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 { + if {[string is true $debug]} { + ns_log Notice "Deferring $task_item" + } + } + } + + # ------------------------------- + # add to list of tasks to process + # ------------------------------- + + if {[info exists depends($task_item)]} { + set future_tasks [concat $future_tasks $depends($task_item)] + } + } + + if {[string is true $debug]} { + ns_log Notice "future tasks: $future_tasks" + } + + set present_tasks $future_tasks + } + + # ---------------------------------------------- + # set up latest start date for project + # ---------------------------------------------- + + if {[empty_string_p $end_date]} { + set min_latest_start "" + set max_earliest_finish "" + } else { + set min_latest_start $end_date + + foreach task_item $task_list { + + 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) + } + } + + set max_earliest_finish "[set max_earliest_finish]" + set min_latest_start "[set min_latest_start]" + } + + + # estimated_finish_date + # latest_finish + + db_dml update_project { } + + # now we go through and save all the values for the tasks! + # this is very inefficient and stupid + + foreach task_item $task_list { + + if {[exists_and_not_null earliest_start($task_item)]} { + set es "[set earliest_start($task_item)]" + } else { + set es "" + } + + if {[exists_and_not_null earliest_finish($task_item)]} { + set ef "[set earliest_finish($task_item)]" + } else { + set ef "" + } + + if {[exists_and_not_null latest_start($task_item)]} { + set ls "[set latest_start($task_item)]" + } else { + set ls "" + } + + if {[exists_and_not_null latest_finish($task_item)]} { + set lf "$latest_finish($task_item)" + } else { + set lf "" + } + + # Only update the task if something has actually + # changed. Hopefully this should help speed things up. + + if { \ + [string equal $es $old_ES($task_item)] && \ + [string equal $ef $old_EF($task_item)] && \ + [string equal $ls $old_LS($task_item)] && \ + [string equal $lf $old_LF($task_item)]} { + # do nothing + } else { + db_dml update_task { } + } + + + } + + + if {[string is true $debug]} { + ns_log Notice "*******************" + } + + return $task_list + +} Index: openacs-4/packages/project-manager/tcl/task-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/task-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/project-manager/tcl/task-procs.tcl 28 Jul 2005 07:47:19 -0000 1.11 +++ openacs-4/packages/project-manager/tcl/task-procs.tcl 30 Jul 2005 00:26:33 -0000 1.12 @@ -781,9 +781,13 @@ } db_dml mark_delete "update pm_tasks set deleted_p = 't' where task_id = :task_item_id" + + if {[parameter::get -parameter UseDayInsteadOfHour -default f]} { + pm::project::compute_status [pm::task::project_item_id -task_item_id $task_item_id] + } else { + pm::project::compute_status_mins [pm::task::project_item_id -task_item_id $task_item_id] + } - pm::project::compute_status [pm::task::project_item_id -task_item_id $task_item_id] - return 1 } Index: openacs-4/packages/project-manager/www/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/add-edit.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/project-manager/www/add-edit.tcl 7 Jul 2005 00:20:09 -0000 1.13 +++ openacs-4/packages/project-manager/www/add-edit.tcl 30 Jul 2005 00:26:33 -0000 1.14 @@ -49,6 +49,8 @@ set use_project_code_p [parameter::get -parameter "UseUserProjectCodesP" -default "1"] set ongoing_by_default_p [parameter::get -parameter "OngoingByDefaultP" -default "f"] +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] if {[exists_and_not_null project_item_id] && ![exists_and_not_null project_id]} { set project_id [pm::project::get_project_id -project_item_id $project_item_id] @@ -118,22 +120,39 @@ {after_html { \[d.m.y \] }} } - + + {planned_end_date:text(text) {label "[_ project-manager.Deadline_1]"} {html {id sel2}} {after_html { \[d.m.y \] }} } + } - {planned_end_time:date +#------------------------ +# Check if the project will be handled on daily basis or will request hours and minutes +#------------------------ + +if { $daily_p } { + ad_form -extend -name add_edit -form { + {planned_end_time:text(hidden) + {value ""} + } + } +} else { + ad_form -extend -name add_edit -form { + {planned_end_time:date {label "[_ project-manager.Deadline_Time]"} {value {[template::util::date::now]}} {format {[lc_get formbuilder_time_format]}} } + } +} - - {ongoing_p:text(select) + +ad_form -extend -name add_edit -form { + {ongoing_p:text(select) {label "[_ project-manager.Project_is_ongoing]"} {options {{"[_ acs-kernel.common_no]" f} {"[_ acs-kernel.common_Yes]" t}}} {value $ongoing_p} @@ -315,6 +334,10 @@ ad_returnredirect -message "[_ project-manager.lt_Changes_to_project_sa]" "one?[export_url_vars project_id]" # to add back in subproject support, should use # compute_parent_status - pm::project::compute_status $project_item_id + if { [parameter::get -parameter UseDayInsteadOfHour -default f]} { + pm::project::compute_status $project_item_id + } else { + pm::project::compute_status_mins $project_item_id + } ad_script_abort } Index: openacs-4/packages/project-manager/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/index.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/project-manager/www/index.adp 21 Jun 2005 11:36:15 -0000 1.4 +++ openacs-4/packages/project-manager/www/index.adp 30 Jul 2005 00:26:33 -0000 1.5 @@ -5,4 +5,4 @@ #project-manager.Projects# @context;noquote@ - \ No newline at end of file + \ No newline at end of file Index: openacs-4/packages/project-manager/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/index.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/project-manager/www/index.tcl 16 Jun 2005 05:33:58 -0000 1.5 +++ openacs-4/packages/project-manager/www/index.tcl 30 Jul 2005 00:26:33 -0000 1.6 @@ -55,6 +55,19 @@ set create_p [permission::permission_p -object_id $package_id -privilege create] set admin_p [permission::permission_p -object_id $package_id -privilege admin] +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] + +#------------------------ +# Check if the project will be handled on daily basis or will show hours and minutes +#------------------------ + +set fmt "%x %r" +if { $daily_p } { + set fmt "%x" +} + + # root CR folder set root_folder [pm::util::get_root_folder -package_id $package_id] Index: openacs-4/packages/project-manager/www/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/one.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/project-manager/www/one.adp 28 Jul 2005 10:57:56 -0000 1.7 +++ openacs-4/packages/project-manager/www/one.adp 30 Jul 2005 00:26:33 -0000 1.8 @@ -10,19 +10,63 @@

      #project-manager.lt_not_current_set_live#

      - - - +
      - -

      - +

      + +

      + +

      + +

      + + +

      + + +

      + +

      + +

      +

      - select current_timestamp from dual; + select to_date(current_timestamp,'YYYY-MM-DD HH24:MI') from dual; Index: openacs-4/packages/project-manager/www/processes-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/processes-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager/www/processes-postgresql.xql 29 Apr 2005 17:43:38 -0000 1.1 +++ openacs-4/packages/project-manager/www/processes-postgresql.xql 30 Jul 2005 00:26:33 -0000 1.2 @@ -9,7 +9,7 @@ p.one_line, p.description, p.party_id, - to_char(p.creation_date,'YYYY-MM-DD') as creation_date_ansi, + to_char(p.creation_date,'YYYY-MM-DD HH24:MI:SS') as creation_date_ansi, (select count(*) from pm_process_instance i where i.process_id = p.process_id) as instances FROM Index: openacs-4/packages/project-manager/www/processes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/processes.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/project-manager/www/processes.tcl 26 May 2005 09:34:29 -0000 1.4 +++ openacs-4/packages/project-manager/www/processes.tcl 30 Jul 2005 00:26:33 -0000 1.5 @@ -49,6 +49,19 @@ set create_p [permission::permission_p -object_id $package_id -privilege create] set admin_p [permission::permission_p -object_id $package_id -privilege admin] +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] + +#------------------------ +# Check if the project will be handled on daily basis or will show hours and minutes +#------------------------ + +set fmt "%x %r" +if { $daily_p } { + set fmt "%x" +} + + # root CR folder # set root_folder [db_string get_root "select pm_project__get_root_folder (:package_id, 'f')"] @@ -106,7 +119,7 @@ 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"] + set creation_date [lc_time_fmt $creation_date_ansi $fmt] } Index: openacs-4/packages/project-manager/www/task-add-edit-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-add-edit-3.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/project-manager/www/task-add-edit-3.tcl 26 May 2005 09:34:29 -0000 1.4 +++ openacs-4/packages/project-manager/www/task-add-edit-3.tcl 30 Jul 2005 00:26:33 -0000 1.5 @@ -94,8 +94,11 @@ -privilege create if {[lsearch $computed_projects $project_item_id($num)] < 0} { - - pm::project::compute_status $project_item_id($num) + if {[parameter::get -parameter "UseDayInsteadOfHour" -default "f" -package_id $package_id]} { + pm::project::compute_status $project_item_id($num) + } else { + pm::project::compute_status_mins $project_item_id($num) + } lappend computed_projects $project_item_id($num) } } Index: openacs-4/packages/project-manager/www/task-add-edit-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-add-edit-one.tcl,v diff -u -r1.14 -r1.15 --- openacs-4/packages/project-manager/www/task-add-edit-one.tcl 27 Jul 2005 16:49:58 -0000 1.14 +++ openacs-4/packages/project-manager/www/task-add-edit-one.tcl 30 Jul 2005 00:26:33 -0000 1.15 @@ -43,6 +43,10 @@ set hours_day [pm::util::hours_day] set root_folder_id [content::folder::get_folder_from_package -package_id $package_id] +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] + + if {[string is true $use_day_p]} { set work_units "[_ project-manager.days]" } else { @@ -276,13 +280,31 @@ {after_html { \[y-m-d \] }} } - {task_end_time:date,optional - {label "[_ project-manager.Deadline_Time]"} - {value {[template::util::date::now]}} - {format {[lc_get formbuilder_time_format]}} - } } +#------------------------ +# Check if the task will be handled on daily basis or will request hours and minutes +#------------------------ + +if { $daily_p } { + ad_form -extend -name task_add_edit \ + -form { + {task_end_time:text(hidden) + {value ""} + } + } +} else { + ad_form -extend -name task_add_edit \ + -form { + {task_end_time:date,optional + {label "[_ project-manager.Deadline_Time]"} + {value {[template::util::date::now]}} + {format {[lc_get formbuilder_time_format]}} + } + } +} + + if {[string is true $edit_p]} { ad_form -extend -name task_add_edit \ -form { Index: openacs-4/packages/project-manager/www/task-calendar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-calendar.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/project-manager/www/task-calendar.adp 27 Jul 2005 19:01:57 -0000 1.3 +++ openacs-4/packages/project-manager/www/task-calendar.adp 30 Jul 2005 00:26:33 -0000 1.4 @@ -1,2 +1,2 @@ - \ No newline at end of file + Index: openacs-4/packages/project-manager/www/task-calendar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-calendar.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/project-manager/www/task-calendar.tcl 26 May 2005 09:34:29 -0000 1.4 +++ openacs-4/packages/project-manager/www/task-calendar.tcl 30 Jul 2005 00:26:33 -0000 1.5 @@ -14,6 +14,7 @@ {date ""} {julian_date ""} {hide_closed_p "t"} + {display_p "l"} } -properties { title:onevalue context:onevalue @@ -63,13 +64,16 @@ " set return_url [ad_return_url] +set package_id [ad_conn package_id] 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 \ + -package_id [ad_conn package_id] \ + -display_p $display_p \ ] Index: openacs-4/packages/project-manager/www/task-one-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-one-oracle.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/project-manager/www/task-one-oracle.xql 5 Jun 2005 22:58:35 -0000 1.2 +++ openacs-4/packages/project-manager/www/task-one-oracle.xql 30 Jul 2005 00:26:33 -0000 1.3 @@ -9,13 +9,13 @@ t.revision_id, t.description, t.mime_type, - to_char(t.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, + to_char(t.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, to_char(t.earliest_start,'J') as earliest_start_j, - 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.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, to_char(t.latest_start,'J') as latest_start_j, - to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, - to_char(t.end_date,'YYYY-MM-DD HH24:MI') as end_date, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, + to_char(t.end_date,'YYYY-MM-DD HH24:MI:SS') as end_date, to_char(current_date,'J') as today_j, t.estimated_hours_work, t.estimated_hours_work_min, @@ -99,16 +99,16 @@ SELECT x.task_id_1 as x_task_id, r.title, - to_char(r.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, + to_char(r.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, r.earliest_start - current_date as days_to_earliest_start, to_char(r.earliest_start,'J') as earliest_start_j, - to_char(r.earliest_finish,'YYYY-MM-DD HH24:MI') as earliest_finish, + to_char(r.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, r.earliest_finish - current_date as days_to_earliest_finish, - to_char(r.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, + to_char(r.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, r.latest_start - current_date as days_to_latest_start, to_char(r.latest_start,'J') as latest_start_j, to_char(current_date,'J') as today_j, - to_char(r.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, + to_char(r.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, r.latest_finish - current_date as days_to_latest_finish FROM pm_task_xref x, pm_tasks_revisionsx r, cr_items i WHERE x.task_id_2 = :task_id and @@ -117,16 +117,16 @@ UNION SELECT x2.task_id_2 as x_task_id, r2.title, - to_char(r2.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, + to_char(r2.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, r2.earliest_start - current_date as days_to_earliest_start, to_char(r2.earliest_start,'J') as earliest_start_j, - to_char(r2.earliest_finish,'YYYY-MM-DD HH24:MI') as earliest_finish, + to_char(r2.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, r2.earliest_finish - current_date as days_to_earliest_finish, - to_char(r2.latest_start,'YYYY-MM-DD HH24:MI') as latest_start, + to_char(r2.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, r2.latest_start - current_date as days_to_latest_start, to_char(r2.latest_start,'J') as latest_start_j, to_char(current_date,'J') as today_j, - to_char(r2.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, + to_char(r2.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, r2.latest_finish - current_date as days_to_latest_finish FROM pm_task_xref x2, pm_tasks_revisionsx r2, cr_items i2 WHERE x2.task_id_1 = :task_id and Index: openacs-4/packages/project-manager/www/task-one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-one-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/project-manager/www/task-one-postgresql.xql 5 Jun 2005 22:58:35 -0000 1.4 +++ openacs-4/packages/project-manager/www/task-one-postgresql.xql 30 Jul 2005 00:26:33 -0000 1.5 @@ -10,13 +10,13 @@ t.revision_id, t.description, t.mime_type, - to_char(t.earliest_start,'YYYY-MM-DD HH24:MI') as earliest_start, + to_char(t.earliest_start,'YYYY-MM-DD HH24:MI:SS') as earliest_start, to_char(t.earliest_start,'J') as earliest_start_j, - 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.earliest_finish,'YYYY-MM-DD HH24:MI:SS') as earliest_finish, + to_char(t.latest_start,'YYYY-MM-DD HH24:MI:SS') as latest_start, to_char(t.latest_start,'J') as latest_start_j, - to_char(t.latest_finish,'YYYY-MM-DD HH24:MI') as latest_finish, - to_char(t.end_date,'YYYY-MM-DD HH24:MI') as end_date, + to_char(t.latest_finish,'YYYY-MM-DD HH24:MI:SS') as latest_finish, + to_char(t.end_date,'YYYY-MM-DD HH24:MI:SS') as end_date, to_char(current_date,'J') as today_j, t.estimated_hours_work, t.estimated_hours_work_min, Index: openacs-4/packages/project-manager/www/task-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-one.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/project-manager/www/task-one.adp 28 Jul 2005 10:57:56 -0000 1.7 +++ openacs-4/packages/project-manager/www/task-one.adp 30 Jul 2005 00:26:33 -0000 1.8 @@ -83,10 +83,12 @@

      - + return_url="@return_url@" + fmt= @fmt@ /> +

      Index: openacs-4/packages/project-manager/www/task-one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-one.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/project-manager/www/task-one.tcl 28 Jul 2005 10:57:56 -0000 1.9 +++ openacs-4/packages/project-manager/www/task-one.tcl 30 Jul 2005 00:26:33 -0000 1.10 @@ -106,7 +106,20 @@ set package_url [ad_conn package_url] set user_id [ad_maybe_redirect_for_registration] +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] +#------------------------ +# Check if the project will be handled on daily basis or will show hours and minutes +#------------------------ + +set fmt "%x %r" +if { $daily_p } { + set fmt "%x" +} + + + # permissions. This is a general 'does the user have permission to even ask for this page to be run?' permission::require_permission -party_id $user_id -object_id $package_id -privilege read @@ -120,6 +133,29 @@ db_1row task_query { } -column_array task_info +# format the hours remaining section + +set task_info(hours_remaining) \ + [pm::task::hours_remaining \ + -estimated_hours_work $task_info(estimated_hours_work) \ + -estimated_hours_work_min $task_info(estimated_hours_work_min) \ + -estimated_hours_work_max $task_info(estimated_hours_work_max) \ + -percent_complete $task_info(percent_complete)] + +set task_info(days_remaining) \ + [pm::task::days_remaining \ + -estimated_hours_work $task_info(estimated_hours_work) \ + -estimated_hours_work_min $task_info(estimated_hours_work_min) \ + -estimated_hours_work_max $task_info(estimated_hours_work_max) \ + -percent_complete $task_info(percent_complete)] + +# format the dates according to the local settings +set task_info(earliest_start) [lc_time_fmt $task_info(earliest_start) $fmt] +set task_info(earliest_finish) [lc_time_fmt $task_info(earliest_finish) $fmt] +set task_info(latest_start) [lc_time_fmt $task_info(latest_start) $fmt] +set task_info(latest_finish) [lc_time_fmt $task_info(latest_finish) $fmt] +set task_info(end_date) [lc_time_fmt $task_info(end_date) $fmt] + # we do this for the hours include portion set project_item_id $task_info(project_item_id) Index: openacs-4/packages/project-manager/www/task-week-calendar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-week-calendar.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/www/task-week-calendar.adp 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,95 @@ + +Title + + + By latest finish + + + By deadline + +
      +
      + + + + + + + +
      + back one week + @dates@ + forward one week +
      + + + + + + + + + + + + + + + +
      + @items.start_date_weekday@: + + + #calendar.Add_Item# + + @items.start_date@ +
      + + + + + + + + + + + +
      + + + + + @items.end_time@ + + @items.event_name@ + @items.users_list;noquote@ + + + +
      +
      +
      + +
      +
      +
      +

      Users to view

      + +
      + @edit_hidden_vars;noquote@ + + +
      Index: openacs-4/packages/project-manager/www/task-week-calendar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-week-calendar.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/www/task-week-calendar.tcl 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,193 @@ +ad_page_contract { + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) +} { + {date ""} + {display_p "l"} +} + + +set date [clock format [clock scan $date] -format "%Y-%m-%d"] +set selected_users [pm::calendar::users_to_view] + +set package_id [ad_conn package_id] +set instance_clause "and o.package_id=:package_id" + +set return_url [ad_return_url]\#top + +set edit_hidden_vars [export_vars -form {return_url {new_tasks "0"}}] + +if {[empty_string_p $date]} { + # Default to todays date in the users (the connection) timezone + set server_now_time [dt_systime] + set user_now_time [lc_time_system_to_conn $server_now_time] + set date [lc_time_fmt $user_now_time "%x"] +} + +set user_id [ad_conn user_id] +set base_url [apm_package_url_from_id $package_id] +set start_date $date + +# Convert date from user timezone to system timezone +#set system_start_date [lc_time_conn_to_system "$date 00:00:00"] + +set first_day_of_week [lc_get firstdayofweek] +set first_us_weekday [lindex [lc_get -locale en_US day] $first_day_of_week] +set last_us_weekday [lindex [lc_get -locale en_US day] [expr [expr $first_day_of_week + 6] % 7]] + +db_1row select_weekday_info {} +db_1row select_week_info {} + +set current_weekday 0 + +#s/item_id/url +multirow create items \ + item_id \ + users_list \ + event_name \ + event_url \ + status_summary \ + start_date \ + day_of_week \ + start_date_weekday \ + start_time \ + end_time \ + no_time_p \ + add_url \ + day_url + +# Convert date from user timezone to system timezone +set first_weekday_of_the_week_tz [lc_time_conn_to_system "$first_weekday_of_the_week 00:00:00"] +set last_weekday_of_the_week_tz [lc_time_conn_to_system "$last_weekday_of_the_week 00:00:00"] + + +set order_by_clause "order by to_char(t.end_date, 'J'),to_char(t.end_date,'HH24:MI')" +set interval_limitation_clause [db_map week_interval_limitation] +set additional_select_clause ",(to_date(t.end_date,'YYYY-MM-DD HH24:MI:SS') - to_date(:first_weekday_of_the_week_tz,'YYYY-MM-DD HH24:MI:SS')) as day_of_week" +set items_query "select_items" +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 ", "]))" + + +if { [string eq $display_p l] } { + set order_by_clause "order by to_char(t.latest_finish, 'J'),to_char(t.latest_finish,'HH24:MI')" + set interval_limitation_clause [db_map week_interval_limitation] + set additional_select_clause ",(to_date(t.latest_finish,'YYYY-MM-DD HH24:MI:SS') - to_date(:first_weekday_of_the_week_tz,'YYYY-MM-DD HH24:MI:SS')) as day_of_week" + set items_query "select_items_by_latest_finish" +} + + +db_foreach $items_query {} { + set base_url "[apm_package_url_from_id $instance_id]" + set item_template "${base_url}task-one?task_id=\$item_id" + + # Convert from system timezone to user timezone + set ansi_start_date [lc_time_system_to_conn $ansi_start_date] + set ansi_end_date [lc_time_system_to_conn $ansi_end_date] + set start_date_weekday [lc_time_fmt $ansi_start_date "%A"] + set start_date [lc_time_fmt $ansi_start_date "%x"] + set end_date [lc_time_fmt $ansi_end_date "%x"] + + set start_time [lc_time_fmt $ansi_start_date "%X"] + set end_time [lc_time_fmt $ansi_end_date "%X"] + + # need to add dummy entries to show all days + for { } { $current_weekday < $day_of_week } { incr current_weekday } { + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + multirow append items \ + 0 \ + "" \ + "" \ + "" \ + "" \ + [lc_time_fmt $ansi_this_date "%x"] \ + ${current_weekday} \ + [lc_time_fmt $ansi_this_date %A] \ + "" \ + "" \ + "" + } + + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + if {[string equal $start_time "12:00 AM"] && [string equal $end_time "12:00 AM"]} { + set no_time_p t + } else { + set no_time_p f + } + + set users_list "" + foreach user $selected_users { + if {[db_string users {select 1 from pm_task_assignment where party_id=:user and task_id=:item_id} -default 0]} { + db_1row name {select p.first_names || ' ' || p.last_name as full_name from persons p where person_id=:user} + if { $user == $user_id } { + append users_list "" + } else { + append users_list "" + } + } + } + append users_list "
      $full_name
      $full_name
      " + multirow append items \ + $task_item_id \ + $users_list \ + "$name" \ + [subst $item_template] \ + $status_summary \ + $start_date \ + $day_of_week \ + ${start_date_weekday} \ + $start_time \ + $end_time \ + $no_time_p + + set current_weekday $day_of_week +} + +if {$current_weekday < 7} { + # need to add dummy entries to show all hours + for { } { $current_weekday < 7 } { incr current_weekday } { + set ansi_this_date [dt_julian_to_ansi [expr $first_weekday_julian + $current_weekday]] + multirow append items \ + 0 \ + "" \ + "" \ + "" \ + "" \ + [lc_time_fmt $ansi_this_date "%x"] \ + $current_weekday \ + [lc_time_fmt $ansi_this_date %A] \ + "" \ + "" \ + "" + } +} + +# Navigation Bar +set dates "[lc_time_fmt $first_weekday_date "%q"] - [lc_time_fmt $last_weekday_date "%q"]" +set previous_week_url "?view=week&date=[ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian - 7]]]&display_p=$display_p\#top" +set next_week_url "?view=week&date=[ad_urlencode [dt_julian_to_ansi [expr $first_weekday_julian + 7]]]&display_p=$display_p\#top" + + + + +# ------------------------------------- +# make a list of users in this subsite. +# ------------------------------------- + +set users_to_view [pm::calendar::users_to_view] + +set community_id [dotlrn_community::get_community_id] + +set users_list "community_members" + +if {[empty_string_p $community_id]} { + set users_list "dotlrn_members" +} + + +db_multirow -extend {checked_p} users $users_list {} { + if {[lsearch $users_to_view $party_id] == -1} { + set checked_p f + } else { + set checked_p t + } +} Index: openacs-4/packages/project-manager/www/task-week-calendar.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-week-calendar.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager/www/task-week-calendar.xql 30 Jul 2005 00:26:33 -0000 1.1 @@ -0,0 +1,162 @@ + + + + postgresql7.1 + + + + select to_char(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS'), 'D') + as day_of_the_week, + to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS')- '1 week'::interval, :first_us_weekday), 'YYYY-MM-DD HH24:MI:SS') + as first_weekday_of_the_week, + to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS'), :last_us_weekday), 'YYYY-MM-DD HH24:MI:SS') + as last_weekday_of_the_week + from dual + + + + + + +select to_char(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS'), 'D') +as day_of_the_week, +cast(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday) as date) +as first_weekday_date, +to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday),'J') +as first_weekday_julian, +cast(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday) + cast('6 days' as interval) as date) +as last_weekday_date, +to_char(next_day(to_date(:start_date, 'YYYY-MM-DD HH24:MI:SS') - cast('7 days' as interval), :first_us_weekday) + cast('6 days' as interval),'J') +as last_weekday_julian, +cast(:start_date::timestamptz - cast('7 days' as interval) as date) as last_week, +to_char(:start_date::timestamptz - cast('7 days' as interval), 'Month DD, YYYY') as last_week_pretty, +cast(:start_date::timestamptz + cast('7 days' as interval) as date) as next_week, +to_char(:start_date::timestamptz + cast('7 days' as interval), 'Month DD, YYYY') as next_week_pretty +from dual + + + + + + + select distinct to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, + to_char(t.end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, + to_number(to_char(t.earliest_start,'HH24'),'90') as start_hour, + to_number(to_char(t.end_date,'HH24'),'90') as end_hour, + to_number(to_char(t.end_date,'MI'),'90') as end_minutes, + t.title as name, + ts.status as status_summary, + ts.task_id as item_id, + i.item_id as task_item_id, + o.package_id as instance_id + $additional_select_clause + + FROM + acs_objects o, + 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.parent_id = projecti.item_id and + end_date between $interval_limitation_clause and + o.object_id=t.item_id and + projecti.live_revision = projectr.revision_id + $instance_clause + $selected_users_clause + + + + + + select distinct to_char(latest_finish, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, + to_char(t.latest_finish, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, + to_number(to_char(t.earliest_start,'HH24'),'90') as start_hour, + to_number(to_char(t.latest_finish,'HH24'),'90') as end_hour, + to_number(to_char(t.latest_finish,'MI'),'90') as end_minutes, + t.title as name, + ts.status as status_summary, + ts.task_id as item_id, + i.item_id as task_item_id, + o.package_id as instance_id + $additional_select_clause + + FROM + acs_objects o, + 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.parent_id = projecti.item_id and + latest_finish between $interval_limitation_clause and + o.object_id=t.item_id and + projecti.live_revision = projectr.revision_id + $instance_clause + $selected_users_clause + + + + + + + to_date(:first_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS') and to_date(:last_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS') + 1 + + + + + + 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 = :community_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 + + + + + + + select + du.first_names || ' ' || du.last_name as name, + du.user_id as party_id + FROM + dotlrn_users du + + + + + Index: openacs-4/packages/project-manager/www/tasks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/tasks.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/project-manager/www/tasks.adp 26 May 2005 09:34:29 -0000 1.3 +++ openacs-4/packages/project-manager/www/tasks.adp 30 Jul 2005 00:26:33 -0000 1.4 @@ -10,7 +10,7 @@
      - +
      Index: openacs-4/packages/project-manager/www/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/tasks.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/project-manager/www/tasks.tcl 26 May 2005 09:34:29 -0000 1.4 +++ openacs-4/packages/project-manager/www/tasks.tcl 30 Jul 2005 00:26:33 -0000 1.5 @@ -56,5 +56,16 @@ # permissions permission::require_permission -party_id $user_id -object_id $package_id -privilege read +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] +#------------------------ +# Check if the project will be handled on daily basis or will show hours and minutes +#------------------------ +set fmt "%x %r" +if { $daily_p } { + set fmt "%x" +} + + Index: openacs-4/packages/project-manager/www/admin/update-projects.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/admin/update-projects.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/project-manager/www/admin/update-projects.tcl 26 May 2005 09:34:30 -0000 1.3 +++ openacs-4/packages/project-manager/www/admin/update-projects.tcl 30 Jul 2005 00:26:34 -0000 1.4 @@ -14,6 +14,7 @@ # make sure user is administrator set user_id [ad_conn user_id] +set daily_p [parameter::get -parameter UseDayInsteadOfHour -default f] permission::require_permission -party_id $user_id -object_id $user_id -privilege admin @@ -28,7 +29,11 @@ set projects_list [db_list get_projects "select item_id from cr_items where content_type = 'pm_project'"] foreach project $projects_list { - pm::project::compute_status $project + if {$daily_p} { + pm::project::compute_status $project + } else { + pm::project::compute_status_mins $project + } ns_write ". " } Index: openacs-4/packages/project-manager/www/lib/nav-bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/lib/nav-bar.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/project-manager/www/lib/nav-bar.tcl 3 Jun 2005 22:13:45 -0000 1.4 +++ openacs-4/packages/project-manager/www/lib/nav-bar.tcl 30 Jul 2005 00:26:34 -0000 1.5 @@ -18,7 +18,10 @@ # The links used in the navbar on format url1 label1 url2 label2 ... set link_list {} +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] + if { [ad_conn user_id] != 0} { if { [empty_string_p $project_item_id] } { lappend link_list [list "${package_url}tasks"] @@ -28,8 +31,12 @@ lappend link_list {} lappend link_list "[_ project-manager.Tasks]" - - lappend link_list [list "${package_url}task-calendar"] + + if { $daily_p} { + lappend link_list [list "${package_url}task-calendar"] + } else { + lappend link_list [list "${package_url}task-week-calendar"] + } lappend link_list {} lappend link_list "[_ project-manager.Task_Calendar]" Index: openacs-4/packages/project-manager-portlet/sql/postgresql/upgrade/upgrade-0.3d-0.4d.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager-portlet/sql/postgresql/upgrade/upgrade-0.3d-0.4d.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/project-manager-portlet/sql/postgresql/upgrade/upgrade-0.3d-0.4d.sql 30 Jul 2005 00:34:39 -0000 1.1 @@ -0,0 +1,232 @@ +-- +-- Copyright (C) 2001, 2002 MIT +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- /project-manager-project-calendarportlet/sql/oracle/project-manager-project-calendarportlet-create.sql +-- + +-- Creates Project Manager portlet + +-- Copyright (C) 2005 Cognovis +-- @author Bjoern Kiesbye (kiesbye@theservice.de) +-- @creation-date 2005-08-06 + + +-- This is free software distributed under the terms of the GNU Public +-- License version 2 or higher. Full text of the license is available +-- from the GNU Project: http://www.fsf.org/copyleft/gpl.html + +create function inline_0() +returns integer as ' +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id := portal_datasource__new( + ''project_manager_project_calendar_portlet'', + ''Displays the Project Manager'' + ); + + + -- the standard 4 params + + -- shadeable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shadeable_p'', + ''t'' +); + + + -- hideable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''hideable_p'', + ''t'' +); + + -- user_editable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''user_editable_p'', + ''t'' +); + + -- shaded_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shaded_p'', + ''f'' +); + + -- link_hideable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''link_hideable_p'', + ''t'' +); + + + perform portal_datasource__set_def_param( + ds_id, + ''t'', + ''f'', + ''scoped_p'', + ''t'' + ); + + + -- Project Manager Project Calendar Porltet specific params + + -- Project_manager_id must be configured + + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''f'', + ''project_manager_id'', + '''' + ); + + + + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + -- create the implementation + foo := acs_sc_impl__new ( + ''portal_datasource'', + ''project_manager_project_calendar_portlet'', + ''project_manager_project_calendar_portlet'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- add all the hooks + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''project_manager_project_calendar_portlet'', + ''GetMyName'', + ''project_manager_project_calendar_portlet::get_my_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''project_manager_project_calendar_portlet'', + ''GetPrettyName'', + ''project_manager_project_calendar_portlet::get_pretty_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''project_manager_project_calendar_portlet'', + ''Link'', + ''project_manager_project_calendar_portlet::link'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''project_manager_project_calendar_portlet'', + ''AddSelfToPage'', + ''project_manager_project_calendar_portlet::add_self_to_page'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''project_manager_project_calendar_portlet'', + ''Show'', + ''project_manager_project_calendar_portlet::show'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''project_manager_project_calendar_portlet'', + ''Edit'', + ''project_manager_project_calendar_portlet::edit'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''project_manager_project_calendar_portlet'', + ''RemoveSelfFromPage'', + ''project_manager_project_calendar_portlet::remove_self_from_page'', + ''TCL'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- Add the binding + perform acs_sc_binding__new ( + ''portal_datasource'', + ''project_manager_project_calendar_portlet'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + Index: openacs-4/packages/project-manager-portlet/www/project-manager-calendar-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager-portlet/www/project-manager-calendar-portlet.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/project-manager-portlet/www/project-manager-calendar-portlet.adp 21 Jul 2005 22:10:34 -0000 1.2 +++ openacs-4/packages/project-manager-portlet/www/project-manager-calendar-portlet.adp 30 Jul 2005 00:34:39 -0000 1.3 @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file Index: openacs-4/packages/project-manager-portlet/www/project-manager-calendar-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager-portlet/www/project-manager-calendar-portlet.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/project-manager-portlet/www/project-manager-calendar-portlet.tcl 21 Jul 2005 22:10:34 -0000 1.2 +++ openacs-4/packages/project-manager-portlet/www/project-manager-calendar-portlet.tcl 30 Jul 2005 00:34:39 -0000 1.3 @@ -5,8 +5,14 @@ {julian_date ""} {hide_closed_p "t"} {display_p "l"} + {t_date ""} } set user_id [ad_conn user_id] +set package_id [dotlrn_community::get_package_id_from_package_key -package_key project-manager -community_id [dotlrn_community::get_community_id]] +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f" -package_id $package_id] + + Index: openacs-4/packages/project-manager-portlet/www/project-manager-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager-portlet/www/project-manager-portlet.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager-portlet/www/project-manager-portlet.adp 10 Jun 2005 18:27:35 -0000 1.1 +++ openacs-4/packages/project-manager-portlet/www/project-manager-portlet.adp 30 Jul 2005 00:34:39 -0000 1.2 @@ -23,4 +23,4 @@ - + Index: openacs-4/packages/project-manager-portlet/www/project-manager-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager-portlet/www/project-manager-portlet.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/project-manager-portlet/www/project-manager-portlet.tcl 13 Jun 2005 17:46:51 -0000 1.2 +++ openacs-4/packages/project-manager-portlet/www/project-manager-portlet.tcl 30 Jul 2005 00:34:39 -0000 1.3 @@ -27,7 +27,19 @@ project_term_lower:onevalue } +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] +#------------------------ +# Check if the project will be handled on daily basis or will show hours and minutes +#------------------------ + +set fmt "%x %r" +if { $daily_p } { + set fmt "%x" +} + + array set config $cf set base_url "[ad_conn package_url]project-manager/" Index: openacs-4/packages/project-manager-portlet/www/project-manager-project-calendar-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager-portlet/www/project-manager-project-calendar-portlet.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager-portlet/www/project-manager-project-calendar-portlet.adp 22 Jul 2005 21:28:32 -0000 1.1 +++ openacs-4/packages/project-manager-portlet/www/project-manager-project-calendar-portlet.adp 30 Jul 2005 00:34:39 -0000 1.2 @@ -1 +1,6 @@ - \ No newline at end of file + + + + + + \ No newline at end of file Index: openacs-4/packages/project-manager-portlet/www/project-manager-project-calendar-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager-portlet/www/project-manager-project-calendar-portlet.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/project-manager-portlet/www/project-manager-project-calendar-portlet.tcl 22 Jul 2005 21:28:32 -0000 1.1 +++ openacs-4/packages/project-manager-portlet/www/project-manager-project-calendar-portlet.tcl 30 Jul 2005 00:34:39 -0000 1.2 @@ -4,9 +4,13 @@ {date ""} {julian_date ""} {hide_closed_p "t"} - {display_p "l"} + {p_date ""} } set user_id [ad_conn user_id] +set package_id [dotlrn_community::get_package_id_from_package_key -package_key project-manager -community_id [dotlrn_community::get_community_id]] +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f" -package_id $package_id] + Index: openacs-4/packages/project-manager-portlet/www/project-manager-task-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager-portlet/www/project-manager-task-portlet.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/project-manager-portlet/www/project-manager-task-portlet.adp 21 Jun 2005 22:16:39 -0000 1.3 +++ openacs-4/packages/project-manager-portlet/www/project-manager-task-portlet.adp 30 Jul 2005 00:34:39 -0000 1.4 @@ -1,3 +1,3 @@ + base_url="@base_url@" filters_p="0" display_mode="list" fmt=@fmt@> Index: openacs-4/packages/project-manager-portlet/www/project-manager-task-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager-portlet/www/project-manager-task-portlet.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/project-manager-portlet/www/project-manager-task-portlet.tcl 21 Jun 2005 22:16:39 -0000 1.3 +++ openacs-4/packages/project-manager-portlet/www/project-manager-task-portlet.tcl 30 Jul 2005 00:34:39 -0000 1.4 @@ -1,3 +1,15 @@ +# daily? +set daily_p [parameter::get -parameter "UseDayInsteadOfHour" -default "f"] + +#------------------------ +# Check if the project will be handled on daily basis or will show hours and minutes +#------------------------ + +set fmt "%x %r" +if { $daily_p } { + set fmt "%x" +} + array set config $cf set community_id [dotlrn_community::get_community_id_from_url]