Index: openacs-4/packages/tasks/tasks.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/tasks.info,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/tasks.info 30 Nov 2005 16:06:52 -0000 1.10.2.2 @@ -0,0 +1,30 @@ + + + + + Tasks + Tasks + f + f + + + Matthew Geddert + Keep track of tasks to do. + 2005-11-07 + This package uses project manager tcl and sql as the base for a simple task program without project manager's complexity. + 0 + + + + + + + + + + + + + + + Index: openacs-4/packages/tasks/catalog/tasks.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/catalog/tasks.de_DE.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/catalog/tasks.de_DE.ISO-8859-1.xml 30 Nov 2005 16:06:52 -0000 1.4.2.2 @@ -0,0 +1,83 @@ + + + + eine Aufgabe + Eine Aufgabe f�r die ausgew�hlten Kontakte hinzuf�gen + Aufgabe hinzuf�gen + Einen Task hinzuf�gen f�r + Hinzuf�gen/�ndern + Prozess zuweisen + Abbrechen + Abbrechen, nicht l�schen + Kommentar + Sind Sie sicher das sie %pretty_entries% als erledigt markieren wollen? + Fertig gestellte Aufgabe + Kontakt + Erstellt von + Spezifische Aufgabe + Datum + L�schen + L�schen %task_pretty% + Erledigt + F�llig + Follow Up Anruf + Follow Up e-Mail + Haben Sie geantwortet? + Wenn leer gibt es keine F�lligkeit + Wichtig + Eine Aufgabe und einen weitere hinzuf�gen + Aufgabe hinzuf�gen} save} {{<#_ Add Task und eine weitere hinzuf�gen + Sind Sie sich sicher, dass Sie diesen Prozess l�schen wollen: %one_line% ? + Sind Sie sich sicher, dass Sie %task2_pretty% l�schen wollen? + Vom Recruiting System l�schen + Es ist entweder eine Standardaufgabe oder eine spezifische Aufgabe (custom task) erforderlich. + Urspr�nglich erzeugt von <a href=\"%creator_url%\">%creator_name%</a> + Unterlagen zuschicken + Notiz/Brief zuschicken + Standardaufgaben k�nnen nicht in Kombination mit spezifischen Aufgaben (custom tasks) genutzt werden + Die Aufgabe <a href=\"/tasks/%task_url%\">%task%</a> wurde hinzugef�gt + Die Aufgabe wurde <a href=\"/tasks/%task_url%\">%title%</a> upgedated + Die Aufgaben \"%task%\" wurden zu %names% hinzugef�gt + Die Aufgabe \"%task_title%\" wurde gel�scht + Die Aufgaben %task_list% wurden gel�scht + Diese %num_entries% Aufgaben + Update und Anlegen neue Aufgabe + Sie sind + Als fertiggestellt markieren + %pretty_task% als fertiggestellt markieren + mehr + Nein, Abbrechen + Sehr wichtig + Nicht erlaubt + Nicht erledigt + Gelegentlich + Notizen + Priorit�t + Prozess + Anders zuweisen + Ausgew�hlte Aufgaben anders zuweisen + Aufgaben anders zuweisen + Prozess w�hlen: + W�hlen Sie den Benutzer aus der diese Aufgabe bekommen soll + W�hlen Sie den Benutzer aus der diese Aufgabe bekommen soll. Wenn Sie es leer lassen dann wird die Aufgabe Ihnen zugewiesen. + Geburtstagskarte schicken + Stundenplan der Klasse versenden + Brief schicken + Web Info Card schicken + Standard Aufgabe + Status + Aufgabe + Die Aufgabe '%task_title%' wurde als fertig markiert + Der Task <a href="%task_url%">%task%</a> wurde um 7 Tage verz�gert + Der Task <a href="%task_url%">%task%</a> wurde um 7 Tage vorgezogen + Aufgaben + Die Aufgaben %task_list% wurden als fertig markiert + Tasks Instanz %package_id% + diese %num_entries% Aufgaben + Diese Aufgabe + Aktualisierung + Normal + Die n�chsten + Ja + Sie k�nnen entwedern eine Standardaufgabe ausw�hlen oder eine eigene definieren, aber nicht beides. + Index: openacs-4/packages/tasks/catalog/tasks.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/catalog/tasks.en_US.ISO-8859-1.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/catalog/tasks.en_US.ISO-8859-1.xml 30 Nov 2005 16:06:52 -0000 1.9.2.2 @@ -0,0 +1,91 @@ + + + + a Task + Add a task to the selected contacts + Add Task + Add Task To + Add/Edit + Assign Process + Assignee + Cancel + Cancel, do not delete + Change Assignee + Comment + Are you sure you want to mark %pretty_entries% as done? + Completed Task + Contact + Created By + Custom Task + Date + Delete + Delete %task_pretty% + Done + Due + Employees + Follow Up Call + Follow Up Email + Have they responded? + If blank there is no due date + Important + Add Task and Add Another + Add Task} save} + {{<#_ Add Task and Add Another + Are you sure you want to delete this process: %one_line% + Are you sure you want to delete %task2_pretty% ? + Delete from Recruiting System + Either a custom task or standard task is required + Originally created by <a href=\"%creator_url%\">%creator_name%</a> + Provide Promotional Information + Send Personal Note/Letter + Standard tasks are cannot be used in conjunction with custom tasks + The task <a href="/tasks/%task_url%">%task%</a> was added + The task <a href="/tasks/%task_url%">%title%</a> was updated + The task "%task%" was added to %names% + The task "%task_title%" was deleted + The tasks %task_list% were deleted + these %num_entries% tasks + Update and Add New Task + You are not allowed to bulk edit a task for multiple contacts + Mark Completed + Mark %pretty_task% as Done + more + No, Cancel + Normal + Not Allowed + Not Done + Not Important + Notes + Organization + Priority + Process + Reassign + Reassign Selected Tasks + Reassign Tasks + Search Assignee + Search a keyword for new Assignee. + Select process: + Select the user to assign the tasks. + Select the user to assign the task. If "blank" then the task will be assigned to yourself. + Send Birthday Card + Send Class Schedule + Send Letter + Send Web Info Card + Standard Task + Status + Task + The task "%task_title%" was marked done + The task <a href="%task_url%">%task%</a> delayed 7 days + The task <a href="%task_url%">%task%</a> moved up 7 days + Tasks + Tasks Assigned to + The tasks %task_list% were marked done + Tasks Instance %package_id% + these %num_entries% tasks + this task + Update + Very Important + View next + Yes + You can either use a standard task or a custom task, but not both + Index: openacs-4/packages/tasks/lib/contact-tasks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/contact-tasks.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/contact-tasks.adp 30 Nov 2005 16:06:52 -0000 1.2.2.2 @@ -0,0 +1,6 @@ +

+#tasks.Add_Task# +#tasks.Assign_Process# +

+ + Index: openacs-4/packages/tasks/lib/contact-tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/contact-tasks.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/contact-tasks.tcl 30 Nov 2005 16:06:52 -0000 1.2.2.2 @@ -0,0 +1,165 @@ +set user_id [ad_conn user_id] +set party_id $contact_id +set tasks_url "/tasks/" + +if { ![contact::exists_p -party_id $contact_id] } { + set contact_id $user_id +} +if { ![exists_and_not_null orderby] } { + set orderby "priority,desc" +} +if { ![exists_and_not_null status_id] } { + set status_id "1" +} +set done_url [export_vars -url -base "${tasks_url}contact" {orderby {status_id 2} party_id}] +set not_done_url [export_vars -url -base "${tasks_url}contact" {orderby {status_id 1} party_id}] +set return_url "[ad_conn url]?[ad_conn query]" +set add_url [export_vars -base "${tasks_url}task" {return_url orderby status_id party_id}] + +set package_id [apm_package_id_from_key tasks] + +template::list::create \ + -name tasks \ + -multirow tasks \ + -key task_id \ + -elements { + deleted_p { + label {[_ tasks.Not_Done]} + display_template { + [_ tasks.Done] + [_ tasks.Not_Done] + } + } + priority { + label "[_ tasks.Priority]" + display_template { + @tasks.priority@@tasks.priority@ + } + } + title { + label "[_ tasks.Task]" + display_template { + class="done">@tasks.title@ + +
+

+ @tasks.description_html;noquote@ +

+
+
+ } + } + process_title { + label "[_ tasks.Process]" + display_template { + @tasks.process_title@ + + @tasks.process_title@ + + } + } + date { + label "[_ tasks.Date]" + display_template { + @tasks.completed_date;noquote@ + + + « @tasks.due_date;noquote@ » + + + } + } + creation_user { + label "[_ tasks.Created_By]" + display_template { + class="done">@tasks.creation_name@ + } + } + } \ + -sub_class { + narrow + } \ + -filters { + party_id {} + } -orderby { + default_value "priority,desc" + date { + label "[_ tasks.Due]" + orderby_desc "CASE WHEN t.status_id = 1 THEN t.due_date ELSE t.completed_date END desc, t.priority, lower(t.title)" + orderby_asc "CASE WHEN t.status_id = 1 THEN t.due_date ELSE t.completed_date END asc, t.priority, lower(t.title)" + default_direction desc + } + priority { + label "[_ tasks.Priority]" + orderby_desc "t.status_id, t.priority desc, CASE WHEN t.status_id = 1 THEN t.due_date ELSE t.completed_date END desc, lower(t.title)" + orderby_asc "t.status_id, t.priority asc, CASE WHEN t.status_id = 1 THEN t.due_date ELSE t.completed_date END asc, lower(t.title)" + default_direction desc + } + title { + label "[_ tasks.Task]" + orderby_desc "lower(t.title) desc, t.priority desc, t.due_date asc" + orderby_asc "lower(t.title) asc, t.priority desc, t.due_date asc" + default_direction asc + } + process_title { + label "[_ tasks.Process]" + orderby_desc "lower(p.title) desc, t.priority desc, t.due_date asc" + orderby_asc "lower(p.title) asc, t.priority desc, t.due_date asc" + default_direction asc + } + creation_user { + label "[_ tasks.Created_By]" + orderby_desc "lower(contact__name(ao.creation_user)) desc, t.due_date asc, t.priority, lower(t.title)" + orderby_asc "lower(contact__name(ao.creation_user)) asc, t.due_date asc, t.priority, lower(t.title)" + default_direction asc + } + } + + +db_multirow -extend {creation_user_url contact_url complete_url done_p task_plus_url task_minus_url description_html task_url} -unclobber tasks get_tasks " + select t.task_id, t.title, t.description, t.mime_type, t.priority, + t.party_id, p.title as process_title, p.process_id, + tasks__relative_date(t.due_date) as due_date, + tasks__relative_date(t.completed_date) as completed_date, + ao.creation_user, t.status_id, t.process_instance_id, + contact__name(ao.creation_user) as creation_name, + CASE WHEN t.due_date < now() THEN 't' ELSE 'f' END as due_date_passed_p, + s.title as status, t.object_id + from t_task_status s, acs_objects ao, t_tasks t + left outer join t_process_instances pi + on (pi.process_instance_id = t.process_instance_id) + left outer join t_processes p + on (p.process_id = pi.process_id) + where s.status_id = t.status_id + and ao.object_id = t.task_id + and ao.package_id = :package_id + and t.party_id = :contact_id + and t.start_date < now() + [template::list::orderby_clause -orderby -name tasks] +" { + set creation_user_url [contact::url -party_id $creation_user] + regsub -all "/tasks/" $creation_user_url "/contacts/" creation_user_url + set complete_url [export_vars -base "${tasks_url}mark-completed" -url {task_id orderby {party_id $contact_id} return_url}] + if { $status_id == "2" } { + set done_p 1 + } else { + set done_p 0 + } + set task_url [export_vars -base "${tasks_url}task" -url {{party_id $contact_id} orderby status_id task_id}] + set task_plus_url [export_vars -base "${tasks_url}task-interval" -url {{action plus} {days 7} {party_id $contact_id} task_id status_id orderby return_url}] + set task_minus_url [export_vars -base "${tasks_url}task-interval" -url {{action minus} {days 7} {party_id $contact_id} task_id status_id orderby return_url}] + + regsub -all "\r|\n" $description {LiNeBrEaK} description + + set description_html [ad_html_text_convert \ + -from $mime_type \ + -to "text/html" \ + -truncate_len "400" \ + -more "[_ tasks.more]" \ + -- $description] + regsub -all {LiNeBrEaKLiNeBrEaK} $description_html {LiNeBrEaK} description_html + regsub -all {LiNeBrEaK} $description_html {\ \ \¶\ } description_html + + regsub -all " " $due_date {\ } due_date + regsub -all " " $completed_date {\ } completed_date +} Index: openacs-4/packages/tasks/lib/portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/portlet.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/portlet.adp 30 Nov 2005 16:06:52 -0000 1.1.2.2 @@ -0,0 +1,19 @@ + + + + + + + + + + + +
@portlet_title;noquote@
+ +
+ + + + + Index: openacs-4/packages/tasks/lib/portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/portlet.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/portlet.tcl 30 Nov 2005 16:06:52 -0000 1.1.2.2 @@ -0,0 +1,19 @@ +# packages/contacts/lib/portlet.tcl +# +# Portlet wrapper +# +# @author Malte Sussdorff (sussdorff@sussdorff.de) +# @creation-date 2005-05-01 +# @arch-tag: c3461fd0-cb54-49bf-947a-8f710b3bd016 +# @cvs-id $Id: portlet.tcl,v 1.1.2.2 2005/11/30 16:06:52 miguelm Exp $ + +foreach required_param {portlet_title} { + if {![info exists $required_param]} { + return -code error "$required_param is a required parameter." + } +} +foreach optional_param {} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} Index: openacs-4/packages/tasks/lib/task-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/task-chunk.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/task-chunk.adp 30 Nov 2005 16:06:52 -0000 1.2.2.2 @@ -0,0 +1,5 @@ +

#tasks.Completed_Task# @title@

+ +

@content;noquote@

+
+ Index: openacs-4/packages/tasks/lib/task-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/task-chunk.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/task-chunk.tcl 30 Nov 2005 16:06:52 -0000 1.1.1.1.2.2 @@ -0,0 +1,3 @@ +set title [lindex $content 0] +set content [lindex $content 1] +set task_url [export_vars -base "/tasks/task" -url {{task_id $object_id} party_id}] Index: openacs-4/packages/tasks/lib/tasks-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/tasks-portlet.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/tasks-portlet.adp 30 Nov 2005 16:06:52 -0000 1.3.2.2 @@ -0,0 +1,26 @@ + +#tasks.Tasks# + + + + + +
+ + + + +
+ +
+
+ + Index: openacs-4/packages/tasks/lib/tasks-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/tasks-portlet.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/tasks-portlet.tcl 30 Nov 2005 16:06:52 -0000 1.3.2.2 @@ -0,0 +1,7 @@ +foreach optional_param {party_id query search_id tasks_interval page page_size page_flush_p} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + +set portlet_layout [parameter::get -parameter "DefaultPortletLayout"] \ No newline at end of file Index: openacs-4/packages/tasks/lib/tasks-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/tasks-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/tasks-postgresql.xql 30 Nov 2005 16:06:52 -0000 1.10.2.2 @@ -0,0 +1,132 @@ + + +postgresql7.2 + + + + select t.task_id, + t.title, + t.description, + t.mime_type, + t.priority, + t.party_id, + p.title as process_title, + p.process_id, + tasks__relative_date(t.due_date) as due_date, + tasks__relative_date(t.completed_date) as completed_date, + t.status_id, + t.process_instance_id, + t.assignee_id, + contact__name(t.assignee_id) as assignee_name, + contact__name(t.party_id) as contact_name, + CASE WHEN t.due_date < now() THEN 't' ELSE 'f' END as due_date_passed_p, + s.title as status, + t.object_id + from + t_task_status s, + acs_objects ao, + t_tasks t + left outer join t_process_instances pi + on (pi.process_instance_id = t.process_instance_id) + left outer join t_processes p + on (p.process_id = pi.process_id) + where s.status_id = t.status_id + and t.status_id <> 2 + and ao.object_id = t.task_id + and ao.package_id = :package_id + and t.start_date < now() + and t.due_date < ( now() + '$tasks_interval days'::interval ) + and t.assignee_id = :user_id + and t.party_id in ( select parties.party_id + from parties + left join cr_items on (parties.party_id = cr_items.item_id) + left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id), + group_distinct_member_map + where parties.party_id = group_distinct_member_map.member_id + $group_where_clause + [contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"] ) + [template::list::page_where_clause -and -name tasks -key t.task_id] + [template::list::filter_where_clauses -and -name tasks] + [template::list::orderby_clause -orderby -name tasks] + + + + + + select t.task_id + from t_task_status s, acs_objects ao, t_tasks t + where s.status_id = t.status_id + and t.status_id <> 2 + and ao.object_id = t.task_id + and ao.package_id = :package_id + and t.start_date < now() + and t.due_date < ( now() + '$tasks_interval days'::interval ) + and t.assignee_id = :user_id + and t.party_id in ( select parties.party_id + from parties + left join cr_items on (parties.party_id = cr_items.item_id) + left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id), + group_distinct_member_map + where parties.party_id = group_distinct_member_map.member_id + $group_where_clause + [contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"] ) + [template::list::filter_where_clauses -and -name tasks] + [template::list::orderby_clause -orderby -name tasks] + + + + + + select t.task_id, + t.title, + t.description, + t.mime_type, + t.priority, + t.party_id, + p.title as process_title, + p.process_id, + tasks__relative_date(t.due_date) as due_date, + tasks__relative_date(t.completed_date) as completed_date, + t.status_id, + t.process_instance_id, + t.assignee_id, + contact__name(t.assignee_id) as assignee_name, + contact__name(t.party_id) as contact_name, + CASE WHEN t.due_date < now() THEN 't' ELSE 'f' END as due_date_passed_p, + s.title as status, + t.object_id + from + t_task_status s, + acs_objects ao, + t_tasks t + left outer join t_process_instances pi + on (pi.process_instance_id = t.process_instance_id) + left outer join t_processes p + on (p.process_id = pi.process_id) + where s.status_id = t.status_id + and t.status_id <> 2 + and ao.object_id = t.task_id + and ao.package_id = :package_id + and t.start_date < now() + $employee_where_clause + [template::list::page_where_clause -and -name tasks -key t.task_id] + [template::list::filter_where_clauses -and -name tasks] + [template::list::orderby_clause -orderby -name tasks] + + + + + + select t.task_id + from t_task_status s, acs_objects ao, t_tasks t + where s.status_id = t.status_id + and t.status_id <> 2 + and ao.object_id = t.task_id + and ao.package_id = :package_id + and t.start_date < now() + $employee_where_clause + [template::list::filter_where_clauses -and -name tasks] + + + + Index: openacs-4/packages/tasks/lib/tasks.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/tasks.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/tasks.adp 30 Nov 2005 16:06:52 -0000 1.4.2.2 @@ -0,0 +1,11 @@ +

+ +#tasks.Add_Task# +#tasks.Assign_Process# +

+ + + + +
+ Index: openacs-4/packages/tasks/lib/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/tasks.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/lib/tasks.tcl 30 Nov 2005 16:06:52 -0000 1.20.2.2 @@ -0,0 +1,279 @@ +# Usage: +# +# +# elements The name of the elements to display in the list. +# page For pagination +# page_flush For pagination +# page_size How many rows are we going to show +# order_by For the order_by clause +# format The display format of the list. Normal +# emp_f Filter to specify if you are going to show the tasks of the organizations only (1) or +# or also the employess tasks (2), default to 2. +# show_filters_p Boolean to specify if you want to show the filters menu or not. Default to 0 + +foreach optional_param {party_id query search_id tasks_interval page page_size page_flush_p elements} { + if {![info exists $optional_param]} { + set $optional_param {} + } +} + +set tasks_url "/tasks/" + +set row_list [list] +foreach element $elements { + lappend row_list $element + lappend row_list {} +} + +if { ![exists_and_not_null format] } { + set format "normal" +} + +if { ![exists_and_not_null show_filters_p] } { + # Boolean to especify to show the filters or not + set show_filters_p 0 +} + +if { ![exists_and_not_null emp_f] } { + # Show tasks of the employees + set emp_f 2 +} + +# If we are not viewing the tasks of a party, view the tasks of the user +if {![exists_and_not_null party_id]} { + + # the user_id is used for the filter. user_id2 for comparison + if {![exists_and_not_null user_id]} { + set user_id [ad_conn user_id] + } + set contact_id $user_id + set user_id2 $user_id + if {$user_id == [ad_conn user_id]} { + set user_id2 "" + } + set party_id "" + unset party_id + set page_query_name own_tasks_pagination + set query_name own_tasks +} else { + set contact_id $party_id + set user_id2 "" + set page_query_name contact_tasks_pagination + set query_name contact_tasks +} + +set package_id [apm_package_id_from_key tasks] + +if { ![exists_and_not_null tasks_interval] } { + set tasks_interval 7 +} +if { ![exists_and_not_null orderby] } { + set orderby "priority,desc" +} +if { ![exists_and_not_null status_id] } { + set status_id "1" +} +if { ![exists_and_not_null package_id] } { + set package_id [ad_conn package_id] +} + +if {[exists_and_not_null search_id]} { + set group_where_clause "" +} else { + set group_where_clause "and group_distinct_member_map.group_id = [contacts::default_group]" +} + +set filters_list [list user_id [list where_clause "t.assignee_id = :user_id"] \ + search_id {} \ + query {} \ + page_size {} \ + tasks_interval {} \ + party_id {} \ + process_instance {}] + +# We are going to verify if the party_id is an organization +# if it is, then we would retrieve the tasks also of the +# employees of the organization. + +set employee_where_clause "and t.party_id = :party_id" +if { [apm_package_installed_p organizations] && [exists_and_not_null contact_id]} { + set org_p [organization::organization_p -party_id $contact_id] + if { $org_p } { + lappend filters_list emp_f { + label "[_ tasks.Tasks_Assigned_to]" + values { {"[_ tasks.Organization]" 1} { "[_ tasks.Employees]" 2 }} + } + } + + if { $org_p && [string equal $emp_f 2] } { + set emp_list [contact::util::get_employees -organization_id $contact_id] + lappend emp_list $contact_id + set employee_where_clause " and t.party_id in ([template::util::tcl_to_sql_list $emp_list])" + } +} + +set done_url [export_vars -url -base "${tasks_url}contact" {orderby {status_id 2} {party_id $contact_id}}] +set not_done_url [export_vars -url -base "${tasks_url}contact" {orderby {status_id 1} {party_id $contact_id}}] +set return_url "[ad_conn url]?[ad_conn query]" +set add_url [export_vars -base "${tasks_url}task" {return_url orderby status_id {party_id $contact_id}}] +# set bulk_actions [list "[_ tasks.Reassign]" "${tasks_url}reassign-task" "[_ tasks.Reassign_selected]"\ + "[_ tasks.Change_Assignee]" "${tasks_url}change-assignee" "[_ tasks.Change_Assignee]"] +set bulk_actions [list "[_ tasks.Change_Assignee]" "${tasks_url}change-assignee" "[_ tasks.Change_Assignee]"] + +template::list::create \ + -name tasks \ + -multirow tasks \ + -bulk_actions $bulk_actions \ + -bulk_action_method post \ + -bulk_action_export_vars { } \ + -selected_format $format \ + -key task_id \ + -orderby_name tasks_orderby \ + -page_size $page_size \ + -page_flush_p 0 \ + -page_query_name $page_query_name \ + -elements { + deleted_p { + label {[_ tasks.Not_Done]} + display_template { + [_ tasks.Done] + [_ tasks.Not_Done] + } + } + priority { + label "[_ tasks.Priority]" + display_template { + @tasks.priority@@tasks.priority@ + } + } + title { + label "[_ tasks.Task]" + display_template { + class="done">@tasks.title@ + +
+

+ @tasks.description_html;noquote@ +

+
+
+ } + } + process_title { + label "[_ tasks.Process]" + display_template { + @tasks.process_title@ + + @tasks.process_title@ + + } + } + contact_name { + label "[_ tasks.Contact]" + link_url_eval $contact_url + } + date { + label "[_ tasks.Date]" + display_template { + @tasks.completed_date;noquote@ + + + « @tasks.due_date;noquote@ » + + + } + } + assignee { + label "[_ tasks.Assignee]" + display_template { + class="done">@tasks.assignee_name@ + } + } + } \ + -sub_class { + narrow + } \ + -filters $filters_list \ + -orderby { + default_value "priority,desc" + date { + label "[_ tasks.Due]" + orderby_desc "CASE WHEN t.status_id <> 2 THEN t.due_date ELSE t.completed_date END desc, t.priority, lower(t.title)" + orderby_asc "CASE WHEN t.status_id <> 2 THEN t.due_date ELSE t.completed_date END asc, t.priority, lower(t.title)" + default_direction desc + } + priority { + label "[_ tasks.Priority]" + orderby_desc "t.status_id, t.priority desc, CASE WHEN t.status_id <> 2 THEN t.due_date ELSE t.completed_date END desc, lower(t.title)" + orderby_asc "t.status_id, t.priority asc, CASE WHEN t.status_id <> 2 THEN t.due_date ELSE t.completed_date END asc, lower(t.title)" + default_direction desc + } + title { + label "[_ tasks.Task]" + orderby_desc "lower(t.title) desc, t.priority desc, t.due_date asc" + orderby_asc "lower(t.title) asc, t.priority desc, t.due_date asc" + default_direction asc + } + process_title { + label "[_ tasks.Process]" + orderby_desc "lower(p.title) desc, t.priority desc, t.due_date asc" + orderby_asc "lower(p.title) asc, t.priority desc, t.due_date asc" + default_direction asc + } + contact_name { + label "[_ tasks.Created_By]" + orderby_desc "lower(contact__name(t.party_id)) desc, t.due_date asc, t.priority, lower(t.title)" + orderby_asc "lower(contact__name(t.party_id)) asc, t.due_date asc, t.priority, lower(t.title)" + default_direction asc + } + assignee { + label "[_ tasks.Assiggnee]" + orderby_desc "lower(contact__name(t.assignee_id)) desc, t.due_date asc, t.priority, lower(t.title)" + orderby_asc "lower(contact__name(.assignee_id)) asc, t.due_date asc, t.priority, lower(t.title)" + default_direction asc + } + } -formats { + normal { + label "Table" + layout table + row $row_list + } + } + +db_multirow -extend {assignee_url contact_url complete_url done_p task_plus_url task_minus_url description_html task_url} -unclobber tasks $query_name {} { + set contact_url [contact::url -party_id $party_id] + set assignee_url [contact::url -party_id $assignee_id] + regsub -all "/tasks/" $assignee_url "/contacts/" assignee_url + set complete_url [export_vars -base "${tasks_url}mark-completed" -url {task_id orderby {party_id $contact_id} return_url}] + if { $status_id == "2" } { + set done_p 1 + } else { + set done_p 0 + } + set task_url [export_vars -base "${tasks_url}task" -url {{party_id $contact_id} orderby status_id task_id}] + set task_plus_url [export_vars -base "${tasks_url}task-interval" -url {{action plus} {days 7} {party_id $contact_id} task_id status_id orderby return_url}] + set task_minus_url [export_vars -base "${tasks_url}task-interval" -url {{action minus} {days 7} {party_id $contact_id} task_id status_id orderby return_url}] + + regsub -all "\r|\n" $description {LiNeBrEaK} description + + set description_html [ad_html_text_convert \ + -from $mime_type \ + -to "text/html" \ + -truncate_len "400" \ + -more "[_ tasks.more]" \ + -- $description] + regsub -all {LiNeBrEaKLiNeBrEaK} $description_html {LiNeBrEaK} description_html + regsub -all {LiNeBrEaK} $description_html {\ \ \¶\ } description_html + regsub -all " " $due_date {\ } due_date + regsub -all " " $completed_date {\ } completed_date +} Index: openacs-4/packages/tasks/sql/postgresql/tasks-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/sql/postgresql/tasks-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/sql/postgresql/tasks-create.sql 30 Nov 2005 16:06:52 -0000 1.6.2.2 @@ -0,0 +1,501 @@ +----------------------------------------------------- +-- +-- Create the data model for the timecard application +-- Author: Matthew Geddert geddert@yahoo.com +-- Creation Date: 2004-02-16 +-- +----------------------------------------------------- + +create table t_processes ( + process_id integer + constraint t_process_id_pk + primary key + constraint t_process_id_fk + references acs_objects, + title varchar(1000), + description text, + mime_type varchar(200) default 'text/plain', + workflow_id integer + constraint t_process_workflow_fk + references workflows +); + +create table t_process_instances ( + process_instance_id integer + constraint t_process_instances_id_pk + primary key + constraint t_process_instances_id_fk + references acs_objects, + process_id integer + constraint t_process_instances_process_fk + references t_processes, + case_id integer, + party_id integer + constraint t_process_instances_party_fk + references parties, + object_id integer + constraint t_process_instances_tasks_object_fk + references acs_objects +); + + +create sequence t_task_status_seq start 3; + +create table t_task_status ( + status_id integer + constraint t_task_status_pk + primary key, + short_name varchar(100), + title varchar(100), + -- closed or open + status_type char(1) default 'c' + constraint t_task_status_type_ck + check (status_type in ('c', 'o')) +); + +insert into t_task_status (status_id, short_name, title, status_type) values +(1, 'open', '#acs-kernel.common_Open#', 'o'); +insert into t_task_status (status_id, short_name, title, status_type) values +(2, 'closed', '#acs-kernel.common_Closed#', 'c'); + + +create table t_process_tasks ( + task_id integer + constraint t_process_tasks_task_pk + primary key + constraint t_process_tasks_task_fk + references acs_objects, + process_id integer + constraint t_process_tasks_process_fk + references t_processes, + -- action creating this task + open_action_id integer + constraint t_process_tasks_open_action_fk + references workflow_actions, + -- action when closing task + closing_action_id integer + constraint t_process_tasks_close_action_fk + references workflow_actions, + party_id integer + constraint t_process_tasks_party_fk + references parties, + object_id integer + constraint t_process_tasks_object_fk + references acs_objects, + title varchar(1000), + description text, + mime_type varchar(200) default 'text/plain', + comment text, + status_id integer + constraint t_process_tasks_status_fk + references t_task_status, + priority integer, + -- start date relative to current date + start numeric, + -- due date relative to current date + due numeric, + assignee_id integer +); + + +create table t_tasks ( + task_id integer + constraint t_tasks_task_pk + primary key + constraint t_tasks_task_fk + references acs_objects, + process_instance_id integer + constraint t_tasks_instance_fk + references t_process_instances, + process_task_id integer + constraint t_tasks_process_task_fk + references t_process_tasks, + -- The party_id is the party whom this task is associated with (e.g. the contact) + party_id integer + constraint t_tasks_party_fk + references parties, + -- The object_id of the Object that triggered this task. If you created an offer + -- and want to have a reminder to phone, the party_id would be the recipient of the offer + -- the object_id would be the offer_id and the creation_user (assignee who is doing the job) + -- would be yourself. + -- As we are very bad in design we realized too late that it might make sense to change the + -- assignee at a later stage, we now modify the creation_user for this. + object_id integer + constraint t_tasks_object_fk + references acs_objects, + -- I wish this were content_items... + title varchar(1000), + description text, + mime_type varchar(200) default 'text/plain', + comment text, + status_id integer + constraint t_tasks_status_fk + references t_task_status, + priority integer, + start_date timestamptz, + due_date timestamptz, + completed_date timestamptz, + assignee_id integer +); + + + + + + +CREATE FUNCTION inline_0() +RETURNS integer +AS 'declare + begin + PERFORM + acs_object_type__create_type( + ''tasks_task'', -- object_type + ''Task'', -- pretty_name + ''Tasks'', -- pretty_plural + ''acs_object'', -- supertype + ''t_tasks'', -- table_name + ''task_id'', -- id_column + ''tasks_task'', -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + + PERFORM + acs_object_type__create_type( + ''tasks_process'', -- object_type + ''Task Process'', -- pretty_name + ''Task Processes'', -- pretty_plural + ''acs_object'', -- supertype + ''t_processes'', -- table_name + ''process_id'', -- id_column + ''tasks_process'', -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + + PERFORM + acs_object_type__create_type( + ''tasks_process_instance'', -- object_type + ''Task Process Instance'', -- pretty_name + ''Task Process Instances'', -- pretty_plural + ''acs_object'', -- supertype + ''t_process_instances'', -- table_name + ''process_instance_id'', -- id_column + ''tasks_process_instance'', -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + + PERFORM + acs_object_type__create_type( + ''tasks_process_task'', -- object_type + ''Process Task'', -- pretty_name + ''Process Tasks'', -- pretty_plural + ''acs_object'', -- supertype + ''t_process_tasks'', -- table_name + ''task_id'', -- id_column + ''tasks_process_task'', -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + + return 0; + + end;' +LANGUAGE 'plpgsql'; + +SELECT inline_0(); + +DROP function inline_0(); + + + +create or replace function tasks__relative_date ( + timestamptz -- date_comparative +) returns varchar +as ' +declare + p_date alias for $1; + v_date varchar; +begin + v_date := CASE WHEN to_char(p_date,''YYYY'') = to_char(now(),''YYYY'') THEN + CASE WHEN to_char(p_date,''YYYY-MM-DD'') = to_char(now(),''YYYY-MM-DD'') THEN ''Today'' + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() - ''1 day''::interval),''YYYY-MM-DD'') THEN ''Yesterday'' + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() - ''2 day''::interval),''YYYY-MM-DD'') THEN ''Two Days Ago'' + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() + ''1 day''::interval),''YYYY-MM-DD'') THEN ''Tomorrow'' + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() + ''2 day''::interval),''YYYY-MM-DD'') THEN CASE WHEN to_char(p_date,''FMDay'') not in ( ''Sunday'', ''Saturday'', ''Monday'', ''Tuesday'') THEN to_char(p_date,''Day'') ELSE to_char(p_date,''Mon DD (Dy)'') END + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() + ''3 day''::interval),''YYYY-MM-DD'') THEN CASE WHEN to_char(p_date,''FMDay'') not in ( ''Sunday'', ''Saturday'', ''Monday'', ''Tuesday'') THEN to_char(p_date,''Day'') ELSE to_char(p_date,''Mon DD (Dy)'') END + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() + ''4 day''::interval),''YYYY-MM-DD'') THEN CASE WHEN to_char(p_date,''FMDay'') not in ( ''Sunday'', ''Saturday'', ''Monday'', ''Tuesday'') THEN to_char(p_date,''Day'') ELSE to_char(p_date,''Mon DD (Dy)'') END + ELSE to_char(p_date,''Mon DD (Dy)'') END + ELSE to_char(p_date,''Mon DD, YYYY'') END; + + + return v_date; +end;' language 'plpgsql'; + +create or replace function tasks__completion_date ( + integer +) returns timestamptz +as ' +declare + p_task_id alias for $1; + v_complete_p boolean; + v_date varchar; + v_previous_p boolean; + revision record; +begin + v_complete_p := ''1'' from pm_tasks where task_id = p_task_id and status = ''2''; + v_date := NULL; + + IF v_complete_p THEN + v_previous_p := ''t''; + FOR revision IN + select ptr.percent_complete, ao.creation_date + from cr_revisions cr, pm_tasks_revisions ptr, acs_objects ao + where cr.item_id = p_task_id + and cr.revision_id = ao.object_id + and cr.revision_id = ptr.task_revision_id + order by ao.creation_date desc + LOOP + IF revision.percent_complete = ''100'' AND v_previous_p THEN + v_date := revision.creation_date; + ELSE + v_previous_p := ''f''; + EXIT; + END IF; + END LOOP; + + END IF; + + return v_date; +end;' language 'plpgsql'; + + +create or replace function tasks__completion_user ( + integer +) returns integer +as ' +declare + p_task_id alias for $1; + v_complete_p boolean; + v_user varchar; + v_previous_p boolean; + revision record; +begin + v_complete_p := ''1'' from pm_tasks where task_id = p_task_id and status = ''2''; + v_user := NULL; + + IF v_complete_p THEN + v_previous_p := ''t''; + FOR revision IN + select ptr.percent_complete, ao.creation_user + from cr_revisions cr, pm_tasks_revisions ptr, acs_objects ao + where cr.item_id = p_task_id + and cr.revision_id = ao.object_id + and cr.revision_id = ptr.task_revision_id + order by ao.creation_date desc + LOOP + IF revision.percent_complete = ''100'' AND v_previous_p THEN + v_user := revision.creation_user; + ELSE + v_previous_p := ''f''; + EXIT; + END IF; + END LOOP; + + END IF; + + return v_user; +end;' language 'plpgsql'; + + +----------------------------- + +select define_function_args('tasks_task__new','task_id,process_instance_id,process_task_id,party_id,object_id,title,description,mime_type,comment,status_id,priority,start_date,due_date,package_id,creation_user,creation_ip,context_id,assignee_id'); + +create or replace function tasks_task__new (integer,integer,integer,integer,integer,varchar,text,varchar,text,integer,integer,timestamptz,timestamptz,integer,integer,varchar,integer,integer) +returns integer as ' +declare + p_task_id alias for $1; + p_process_instance_id alias for $2; + p_process_task_id alias for $3; + p_party_id alias for $4; + p_object_id alias for $5; + p_title alias for $6; + p_description alias for $7; + p_mime_type alias for $8; + p_comment alias for $9; + p_status_id alias for $10; + p_priority alias for $11; + p_start_date alias for $12; + p_due_date alias for $13; + p_package_id alias for $14; + p_creation_user alias for $15; + p_creation_ip alias for $16; + p_context_id alias for $17; + p_assignee_id alias for $18; + v_task_id integer; + v_start_date timestamptz; +begin + v_task_id:= acs_object__new( + p_task_id, + ''tasks_task'', + now(), + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + p_title, + p_package_id + ); + + if p_start_date is null then + v_start_date := now(); + else + v_start_date := p_start_date; + end if; + + insert into t_tasks + (task_id, process_instance_id, process_task_id, party_id, object_id, + title, description, mime_type, comment, status_id, priority, + start_date, due_date, assignee_id) + values + (v_task_id, p_process_instance_id, p_process_task_id, p_party_id, + p_object_id, p_title, p_description, p_mime_type, p_comment, + p_status_id, p_priority, v_start_date, p_due_date, p_assignee_id); + + return v_task_id; +end; +' language 'plpgsql'; + + +select define_function_args('tasks_process_task__new','task_id,process_id,open_action_id,closing_action_id,party_id,object_id,title,description,mime_type,comment,status_id,priority,start,due,package_id,creation_user,creation_ip,context_id,assignee_id'); + +create or replace function tasks_process_task__new (integer,integer,integer,integer,integer,integer,varchar,text,varchar,text,integer,integer,numeric,numeric,integer,integer,varchar,integer,integer) +returns integer as ' +declare + p_task_id alias for $1; + p_process_id alias for $2; + p_open_action_id alias for $3; + p_closing_action_id alias for $4; + p_party_id alias for $5; + p_object_id alias for $6; + p_title alias for $7; + p_description alias for $8; + p_mime_type alias for $9; + p_comment alias for $10; + p_status_id alias for $11; + p_priority alias for $12; + p_start alias for $13; + p_due alias for $14; + p_package_id alias for $15; + p_creation_user alias for $16; + p_creation_ip alias for $17; + p_context_id alias for $18; + p_assignee_id alias for $19; + v_task_id integer; +begin + v_task_id:= acs_object__new( + p_task_id, + ''tasks_process_task'', + now(), + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + p_title, + p_package_id + ); + + insert into t_process_tasks + (task_id, process_id, open_action_id, closing_action_id, party_id, + object_id, title, description, mime_type, comment, status_id, + priority, start, due, assignee_id) + values + (v_task_id, p_process_id, p_open_action_id, p_closing_action_id, + p_party_id, p_object_id, p_title, p_description, p_mime_type, + p_comment, p_status_id, p_priority, p_start, p_due, p_assignee_id); + + return v_task_id; +end; +' language 'plpgsql'; + + +select define_function_args('tasks_process__new','process_id,title,description,mime_type,workflow_id,package_id,creation_user,creation_ip,context_id'); + +create or replace function tasks_process__new (integer,varchar,text,varchar,integer,integer,integer,varchar,integer) +returns integer as ' +declare + p_process_id alias for $1; + p_title alias for $2; + p_description alias for $3; + p_mime_type alias for $4; + p_workflow_id alias for $5; + p_package_id alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + p_context_id alias for $9; + v_process_id integer; +begin + v_process_id:= acs_object__new( + p_process_id, + ''tasks_process'', + now(), + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + p_title, + p_package_id + ); + + insert into t_processes + (process_id, title, description, mime_type, workflow_id) + values + (v_process_id, p_title, p_description, p_mime_type, p_workflow_id); + + return v_process_id; +end; +' language 'plpgsql'; + + +select define_function_args('tasks_process_instance__new','process_instance_id,process_id,case_id,party_id,object_id,package_id,creation_user,creation_ip,context_id'); + +create or replace function tasks_process_instance__new (integer,integer,integer,integer,integer,integer,integer,varchar,integer) +returns integer as ' +declare + p_process_instance_id alias for $1; + p_process_id alias for $2; + p_case_id alias for $3; + p_party_id alias for $4; + p_object_id alias for $5; + p_package_id alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + p_context_id alias for $9; + v_process_instance_id integer; +begin + v_process_instance_id:= acs_object__new( + p_process_instance_id, + ''tasks_process_instance'', + now(), + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + ''process instance of process '' || p_process_id || '' for object '' || p_object_id, + p_package_id + ); + + insert into t_process_instances + (process_instance_id, process_id, case_id, party_id, object_id) + values + (v_process_instance_id, p_process_id, p_case_id, p_party_id, p_object_id); + + return v_process_instance_id; +end; +' language 'plpgsql'; Index: openacs-4/packages/tasks/sql/postgresql/tasks-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/sql/postgresql/tasks-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/sql/postgresql/tasks-drop.sql 30 Nov 2005 16:06:52 -0000 1.1.2.2 @@ -0,0 +1,7 @@ +drop table t_process_tasks; +drop table t_tasks; +drop table t_task_status; +drop table t_process_instances; +drop table t_processes; + +drop sequence t_task_status_seq; Index: openacs-4/packages/tasks/sql/postgresql/upgrade/upgrade-0.1d-0.1d1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/sql/postgresql/upgrade/upgrade-0.1d-0.1d1.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/sql/postgresql/upgrade/upgrade-0.1d-0.1d1.sql 30 Nov 2005 16:06:52 -0000 1.1.2.2 @@ -0,0 +1,489 @@ +----------------------------------------------------- +-- +-- Create the data model for the timecard application +-- Author: Matthew Geddert geddert@yahoo.com +-- Creation Date: 2004-02-16 +-- +----------------------------------------------------- + +create table t_processes ( + process_id integer + constraint t_process_id_pk + primary key + constraint t_process_id_fk + references acs_objects, + title varchar(1000), + description text, + mime_type varchar(200) default 'text/plain', + workflow_id integer + constraint t_process_workflow_fk + references workflows +); + +create table t_process_instances ( + process_instance_id integer + constraint t_process_instances_id_pk + primary key + constraint t_process_instances_id_fk + references acs_objects, + process_id integer + constraint t_process_instances_process_fk + references t_processes, + case_id integer, + party_id integer + constraint t_process_instances_party_fk + references parties, + object_id integer + constraint t_process_instances_tasks_object_fk + references acs_objects +); + + +create sequence t_task_status_seq start 3; + +create table t_task_status ( + status_id integer + constraint t_task_status_pk + primary key, + short_name varchar(100), + title varchar(100), + -- closed or open + status_type char(1) default 'c' + constraint t_task_status_type_ck + check (status_type in ('c', 'o')) +); + +insert into t_task_status (status_id, short_name, title, status_type) values +(1, 'open', '#acs-kernel.common_Open#', 'o'); +insert into t_task_status (status_id, short_name, title, status_type) values +(2, 'closed', '#acs-kernel.common_Closed#', 'c'); + + +create table t_process_tasks ( + task_id integer + constraint t_process_tasks_task_pk + primary key + constraint t_process_tasks_task_fk + references acs_objects, + process_id integer + constraint t_process_tasks_process_fk + references t_processes, + -- action creating this task + open_action_id integer + constraint t_process_tasks_open_action_fk + references workflow_actions, + -- action when closing task + closing_action_id integer + constraint t_process_tasks_close_action_fk + references workflow_actions, + party_id integer + constraint t_process_tasks_party_fk + references parties, + object_id integer + constraint t_process_tasks_object_fk + references acs_objects, + title varchar(1000), + description text, + mime_type varchar(200) default 'text/plain', + comment text, + status_id integer + constraint t_process_tasks_status_fk + references t_task_status, + priority integer, + -- start date relative to current date + start numeric, + -- due date relative to current date + due numeric +); + + +create table t_tasks ( + task_id integer + constraint t_tasks_task_pk + primary key + constraint t_tasks_task_fk + references acs_objects, + process_instance_id integer + constraint t_tasks_instance_fk + references t_process_instances, + process_task_id integer + constraint t_tasks_process_task_fk + references t_process_tasks, + party_id integer + constraint t_tasks_party_fk + references parties, + object_id integer + constraint t_tasks_object_fk + references acs_objects, + title varchar(1000), + description text, + mime_type varchar(200) default 'text/plain', + comment text, + status_id integer + constraint t_tasks_status_fk + references t_task_status, + priority integer, + start_date timestamptz, + due_date timestamptz, + completed_date timestamptz +); + + + + + + +CREATE FUNCTION inline_0() +RETURNS integer +AS 'declare + begin + PERFORM + acs_object_type__create_type( + ''tasks_task'', -- object_type + ''Task'', -- pretty_name + ''Tasks'', -- pretty_plural + ''acs_object'', -- supertype + ''t_tasks'', -- table_name + ''task_id'', -- id_column + ''tasks_task'', -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + + PERFORM + acs_object_type__create_type( + ''tasks_process'', -- object_type + ''Task Process'', -- pretty_name + ''Task Processes'', -- pretty_plural + ''acs_object'', -- supertype + ''t_processes'', -- table_name + ''process_id'', -- id_column + ''tasks_process'', -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + + PERFORM + acs_object_type__create_type( + ''tasks_process_instance'', -- object_type + ''Task Process Instance'', -- pretty_name + ''Task Process Instances'', -- pretty_plural + ''acs_object'', -- supertype + ''t_process_instances'', -- table_name + ''process_instance_id'', -- id_column + ''tasks_process_instance'', -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + + PERFORM + acs_object_type__create_type( + ''tasks_process_task'', -- object_type + ''Process Task'', -- pretty_name + ''Process Tasks'', -- pretty_plural + ''acs_object'', -- supertype + ''t_process_tasks'', -- table_name + ''task_id'', -- id_column + ''tasks_process_task'', -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + + return 0; + + end;' +LANGUAGE 'plpgsql'; + +SELECT inline_0(); + +DROP function inline_0(); + + + +create or replace function tasks__relative_date ( + timestamptz -- date_comparative +) returns varchar +as ' +declare + p_date alias for $1; + v_date varchar; +begin + v_date := CASE WHEN to_char(p_date,''YYYY'') = to_char(now(),''YYYY'') THEN + CASE WHEN to_char(p_date,''YYYY-MM-DD'') = to_char(now(),''YYYY-MM-DD'') THEN ''Today'' + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() - ''1 day''::interval),''YYYY-MM-DD'') THEN ''Yesterday'' + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() - ''2 day''::interval),''YYYY-MM-DD'') THEN ''Two Days Ago'' + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() + ''1 day''::interval),''YYYY-MM-DD'') THEN ''Tomorrow'' + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() + ''2 day''::interval),''YYYY-MM-DD'') THEN CASE WHEN to_char(p_date,''FMDay'') not in ( ''Sunday'', ''Saturday'', ''Monday'', ''Tuesday'') THEN to_char(p_date,''Day'') ELSE to_char(p_date,''Mon DD (Dy)'') END + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() + ''3 day''::interval),''YYYY-MM-DD'') THEN CASE WHEN to_char(p_date,''FMDay'') not in ( ''Sunday'', ''Saturday'', ''Monday'', ''Tuesday'') THEN to_char(p_date,''Day'') ELSE to_char(p_date,''Mon DD (Dy)'') END + WHEN to_char(p_date,''YYYY-MM-DD'') = to_char((now() + ''4 day''::interval),''YYYY-MM-DD'') THEN CASE WHEN to_char(p_date,''FMDay'') not in ( ''Sunday'', ''Saturday'', ''Monday'', ''Tuesday'') THEN to_char(p_date,''Day'') ELSE to_char(p_date,''Mon DD (Dy)'') END + ELSE to_char(p_date,''Mon DD (Dy)'') END + ELSE to_char(p_date,''Mon DD, YYYY'') END; + + + return v_date; +end;' language 'plpgsql'; + +create or replace function tasks__completion_date ( + integer +) returns timestamptz +as ' +declare + p_task_id alias for $1; + v_complete_p boolean; + v_date varchar; + v_previous_p boolean; + revision record; +begin + v_complete_p := ''1'' from pm_tasks where task_id = p_task_id and status = ''2''; + v_date := NULL; + + IF v_complete_p THEN + v_previous_p := ''t''; + FOR revision IN + select ptr.percent_complete, ao.creation_date + from cr_revisions cr, pm_tasks_revisions ptr, acs_objects ao + where cr.item_id = p_task_id + and cr.revision_id = ao.object_id + and cr.revision_id = ptr.task_revision_id + order by ao.creation_date desc + LOOP + IF revision.percent_complete = ''100'' AND v_previous_p THEN + v_date := revision.creation_date; + ELSE + v_previous_p := ''f''; + EXIT; + END IF; + END LOOP; + + END IF; + + return v_date; +end;' language 'plpgsql'; + + +create or replace function tasks__completion_user ( + integer +) returns integer +as ' +declare + p_task_id alias for $1; + v_complete_p boolean; + v_user varchar; + v_previous_p boolean; + revision record; +begin + v_complete_p := ''1'' from pm_tasks where task_id = p_task_id and status = ''2''; + v_user := NULL; + + IF v_complete_p THEN + v_previous_p := ''t''; + FOR revision IN + select ptr.percent_complete, ao.creation_user + from cr_revisions cr, pm_tasks_revisions ptr, acs_objects ao + where cr.item_id = p_task_id + and cr.revision_id = ao.object_id + and cr.revision_id = ptr.task_revision_id + order by ao.creation_date desc + LOOP + IF revision.percent_complete = ''100'' AND v_previous_p THEN + v_user := revision.creation_user; + ELSE + v_previous_p := ''f''; + EXIT; + END IF; + END LOOP; + + END IF; + + return v_user; +end;' language 'plpgsql'; + + +----------------------------- + +select define_function_args('tasks_task__new','task_id,process_instance_id,process_task_id,party_id,object_id,title,description,mime_type,comment,status_id,priority,start_date,due_date,package_id,creation_user,creation_ip,context_id'); + +create or replace function tasks_task__new (integer,integer,integer,integer,integer,varchar,text,varchar,text,integer,integer,timestamptz,timestamptz,integer,integer,varchar,integer) +returns integer as ' +declare + p_task_id alias for $1; + p_process_instance_id alias for $2; + p_process_task_id alias for $3; + p_party_id alias for $4; + p_object_id alias for $5; + p_title alias for $6; + p_description alias for $7; + p_mime_type alias for $8; + p_comment alias for $9; + p_status_id alias for $10; + p_priority alias for $11; + p_start_date alias for $12; + p_due_date alias for $13; + p_package_id alias for $14; + p_creation_user alias for $15; + p_creation_ip alias for $16; + p_context_id alias for $17; + v_task_id integer; + v_start_date timestamptz; +begin + v_task_id:= acs_object__new( + p_task_id, + ''tasks_task'', + now(), + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + p_title, + p_package_id + ); + + if p_start_date is null then + v_start_date := now(); + else + v_start_date := p_start_date; + end if; + + insert into t_tasks + (task_id, process_instance_id, process_task_id, party_id, object_id, + title, description, mime_type, comment, status_id, priority, + start_date, due_date) + values + (v_task_id, p_process_instance_id, p_process_task_id, p_party_id, + p_object_id, p_title, p_description, p_mime_type, p_comment, + p_status_id, p_priority, v_start_date, p_due_date); + + return v_task_id; +end; +' language 'plpgsql'; + + +select define_function_args('tasks_process_task__new','task_id,process_id,open_action_id,closing_action_id,party_id,object_id,title,description,mime_type,comment,status_id,priority,start,due,package_id,creation_user,creation_ip,context_id'); + +create or replace function tasks_process_task__new (integer,integer,integer,integer,integer,integer,varchar,text,varchar,text,integer,integer,numeric,numeric,integer,integer,varchar,integer) +returns integer as ' +declare + p_task_id alias for $1; + p_process_id alias for $2; + p_open_action_id alias for $3; + p_closing_action_id alias for $4; + p_party_id alias for $5; + p_object_id alias for $6; + p_title alias for $7; + p_description alias for $8; + p_mime_type alias for $9; + p_comment alias for $10; + p_status_id alias for $11; + p_priority alias for $12; + p_start alias for $13; + p_due alias for $14; + p_package_id alias for $15; + p_creation_user alias for $16; + p_creation_ip alias for $17; + p_context_id alias for $18; + v_task_id integer; +begin + v_task_id:= acs_object__new( + p_task_id, + ''tasks_process_task'', + now(), + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + p_title, + p_package_id + ); + + insert into t_process_tasks + (task_id, process_id, open_action_id, closing_action_id, party_id, + object_id, title, description, mime_type, comment, status_id, + priority, start, due) + values + (v_task_id, p_process_id, p_open_action_id, p_closing_action_id, + p_party_id, p_object_id, p_title, p_description, p_mime_type, + p_comment, p_status_id, p_priority, p_start, p_due); + + return v_task_id; +end; +' language 'plpgsql'; + + +select define_function_args('tasks_process__new','process_id,title,description,mime_type,workflow_id,package_id,creation_user,creation_ip,context_id'); + +create or replace function tasks_process__new (integer,varchar,text,varchar,integer,integer,integer,varchar,integer) +returns integer as ' +declare + p_process_id alias for $1; + p_title alias for $2; + p_description alias for $3; + p_mime_type alias for $4; + p_workflow_id alias for $5; + p_package_id alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + p_context_id alias for $9; + v_process_id integer; +begin + v_process_id:= acs_object__new( + p_process_id, + ''tasks_process'', + now(), + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + p_title, + p_package_id + ); + + insert into t_processes + (process_id, title, description, mime_type, workflow_id) + values + (v_process_id, p_title, p_description, p_mime_type, p_workflow_id); + + return v_process_id; +end; +' language 'plpgsql'; + + +select define_function_args('tasks_process_instance__new','process_instance_id,process_id,case_id,party_id,object_id,package_id,creation_user,creation_ip,context_id'); + +create or replace function tasks_process_instance__new (integer,integer,integer,integer,integer,integer,integer,varchar,integer) +returns integer as ' +declare + p_process_instance_id alias for $1; + p_process_id alias for $2; + p_case_id alias for $3; + p_party_id alias for $4; + p_object_id alias for $5; + p_package_id alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + p_context_id alias for $9; + v_process_instance_id integer; +begin + v_process_instance_id:= acs_object__new( + p_process_instance_id, + ''tasks_process_instance'', + now(), + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + ''process instance of process '' || p_process_id || '' for object '' || p_object_id, + p_package_id + ); + + insert into t_process_instances + (process_instance_id, process_id, case_id, party_id, object_id) + values + (v_process_instance_id, p_process_id, p_case_id, p_party_id, p_object_id); + + return v_process_instance_id; +end; +' language 'plpgsql'; Index: openacs-4/packages/tasks/sql/postgresql/upgrade/upgrade-0.1d5-0.1d6.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/sql/postgresql/upgrade/upgrade-0.1d5-0.1d6.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/sql/postgresql/upgrade/upgrade-0.1d5-0.1d6.sql 30 Nov 2005 16:06:52 -0000 1.1.2.2 @@ -0,0 +1,114 @@ +-- We add the extra fields +alter table t_tasks add column assignee_id integer; +alter table t_process_tasks add column assignee_id integer; + +-- We create the functions + +select define_function_args('tasks_task__new','task_id,process_instance_id,process_task_id,party_id,object_id,title,description,mime_type,comment,status_id,priority,start_date,due_date,package_id,creation_user,creation_ip,context_id,assignee_id'); + +create or replace function tasks_task__new (integer,integer,integer,integer,integer,varchar,text,varchar,text,integer,integer,timestamptz,timestamptz,integer,integer,varchar,integer,integer) +returns integer as ' +declare + p_task_id alias for $1; + p_process_instance_id alias for $2; + p_process_task_id alias for $3; + p_party_id alias for $4; + p_object_id alias for $5; + p_title alias for $6; + p_description alias for $7; + p_mime_type alias for $8; + p_comment alias for $9; + p_status_id alias for $10; + p_priority alias for $11; + p_start_date alias for $12; + p_due_date alias for $13; + p_package_id alias for $14; + p_creation_user alias for $15; + p_creation_ip alias for $16; + p_context_id alias for $17; + p_assignee_id alias for $18; + v_task_id integer; + v_start_date timestamptz; +begin + v_task_id:= acs_object__new( + p_task_id, + ''tasks_task'', + now(), + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + p_title, + p_package_id + ); + + if p_start_date is null then + v_start_date := now(); + else + v_start_date := p_start_date; + end if; + + insert into t_tasks + (task_id, process_instance_id, process_task_id, party_id, object_id, + title, description, mime_type, comment, status_id, priority, + start_date, due_date, assignee_id) + values + (v_task_id, p_process_instance_id, p_process_task_id, p_party_id, + p_object_id, p_title, p_description, p_mime_type, p_comment, + p_status_id, p_priority, v_start_date, p_due_date, p_assignee_id); + + return v_task_id; +end; +' language 'plpgsql'; + + +select define_function_args('tasks_process_task__new','task_id,process_id,open_action_id,closing_action_id,party_id,object_id,title,description,mime_type,comment,status_id,priority,start,due,package_id,creation_user,creation_ip,context_id,assignee_id'); + +create or replace function tasks_process_task__new (integer,integer,integer,integer,integer,integer,varchar,text,varchar,text,integer,integer,numeric,numeric,integer,integer,varchar,integer,integer) +returns integer as ' +declare + p_task_id alias for $1; + p_process_id alias for $2; + p_open_action_id alias for $3; + p_closing_action_id alias for $4; + p_party_id alias for $5; + p_object_id alias for $6; + p_title alias for $7; + p_description alias for $8; + p_mime_type alias for $9; + p_comment alias for $10; + p_status_id alias for $11; + p_priority alias for $12; + p_start alias for $13; + p_due alias for $14; + p_package_id alias for $15; + p_creation_user alias for $16; + p_creation_ip alias for $17; + p_context_id alias for $18; + p_assignee_id alias for $19; + v_task_id integer; +begin + v_task_id:= acs_object__new( + p_task_id, + ''tasks_process_task'', + now(), + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + p_title, + p_package_id + ); + + insert into t_process_tasks + (task_id, process_id, open_action_id, closing_action_id, party_id, + object_id, title, description, mime_type, comment, status_id, + priority, start, due, assignee_id) + values + (v_task_id, p_process_id, p_open_action_id, p_closing_action_id, + p_party_id, p_object_id, p_title, p_description, p_mime_type, + p_comment, p_status_id, p_priority, p_start, p_due, p_assignee_id); + + return v_task_id; +end; +' language 'plpgsql'; \ No newline at end of file Index: openacs-4/packages/tasks/sql/postgresql/upgrade/upgrade-0.1d6-0.1d7.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/sql/postgresql/upgrade/upgrade-0.1d6-0.1d7.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/sql/postgresql/upgrade/upgrade-0.1d6-0.1d7.sql 30 Nov 2005 16:06:52 -0000 1.1.2.2 @@ -0,0 +1,66 @@ +-- We are going to update the assignee_id with the creation_user +-- if the assingee_id is null for t_tasks and t_process_tasks + +create or replace function inline_0() returns integer as ' +declare + tasks record; +begin + for tasks in select + t.task_id, + t.assignee_id, + ao.creation_user + from + t_tasks t, + acs_objects ao + where + ao.object_id = t.task_id + loop + if tasks.assignee_id is null then + + update t_tasks + set assignee_id = tasks.creation_user + where task_id = tasks.task_id; + + end if; + + end loop; + + return 1; +end;' language 'plpgsql'; + +begin; + select inline_0(); + drop function inline_0(); +end; + +create or replace function inline_0() returns integer as ' +declare + tasks record; +begin + for tasks in select + t.task_id, + t.assignee_id, + ao.creation_user + from + t_process_tasks t, + acs_objects ao + where + ao.object_id = t.task_id + loop + if tasks.assignee_id is null then + + update t_process_tasks + set assignee_id = tasks.creation_user + where task_id = tasks.task_id; + + end if; + + end loop; + + return 1; +end;' language 'plpgsql'; + +begin; + select inline_0(); + drop function inline_0(); +end; \ No newline at end of file Index: openacs-4/packages/tasks/tcl/tasks-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/tcl/tasks-callback-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/tcl/tasks-callback-procs.tcl 30 Nov 2005 16:06:53 -0000 1.4.2.2 @@ -0,0 +1,121 @@ +# packages/tasks/tcl/tasks-callback-procs.tcl + +ad_library { + + Callback procs for Tasks + + @author Matthew Geddert (openacs@geddert.com) + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-06-15 + @arch-tag: 200d82ba-f8e7-4f19-9740-39117474766f + @cvs-id $Id: tasks-callback-procs.tcl,v 1.4.2.2 2005/11/30 16:06:53 miguelm Exp $ +} + +namespace eval tasks::workflow {} +namespace eval tasks::workflow::impl {} +namespace eval tasks::workflow::impl::action_side_effect {} + +ad_proc -public -callback contact::history -impl tasks { + {-party_id:required} + {-multirow:required} + {-trunacte_len ""} +} { + Add task history to this party. Return as list +} { + set project_id "26798" + set tasks [list] + db_foreach get_tasks { + select pt.task_id, + tasks__completion_date(ci.item_id) as completion_date, + tasks__completion_user(ci.item_id) as completion_user, + cr.title, + cr.description as content + from cr_items ci, + pm_tasks_revisions ptr, + pm_tasks pt left join pm_process_instance ppi on (pt.process_instance = ppi.instance_id ), + cr_revisions cr, + acs_objects ao + where ci.parent_id = :project_id + and ci.item_id = pt.task_id + and ci.latest_revision = ptr.task_revision_id + and ci.live_revision = ptr.task_revision_id + and ptr.task_revision_id = cr.revision_id + and cr.revision_id = ao.object_id + and pt.status = '2' + and pt.deleted_p = 'f' + and task_id in ( select task_id from pm_task_assignment where party_id = :party_id and role_id = '1' ) + } { + if { [exists_and_not_null truncate_len] } { + set content_html [ad_html_text_convert -truncate_len $truncate_len -from "text/plain" -to "text/html" $content] + } else { + set content_html [ad_html_text_convert -from "text/plain" -to "text/html" $content] + } + ::template::multirow append $multirow $completion_date $task_id $completion_user [list $title $content_html] "/packages/tasks/lib/task-chunk" + } +} + + +ad_proc -public -callback contacts::bulk_actions -impl tasks { + {-multirow:required} +} { + Add task history to this party. Return as list +} { + ::template::multirow append $multirow "[_ tasks.Add_Task]" "/tasks/task" "[_ tasks.Add_a_task_to_the]" +} + + +ad_proc -public tasks::workflow::impl::action_side_effect::do { + case_id + object_id + action_id + entry_id +} { + create new tasks linked to this action +} { + ns_log notice "\#\#\# entering tasks-action-callback: $case_id, $object_id, $action_id" + + db_1row process_id { + select process_instance_id, process_id, party_id, object_id + from t_process_instances + where case_id = :case_id + } + + set tasks [db_list_of_lists process_tasks { + select task_id, title, description, + mime_type, comment, status_id, priority, + to_char((now()+ (start::varchar || ' days')::interval), 'YYYY-MM-DD') as start_date, + to_char((now()+ (due::varchar || ' days')::interval), 'YYYY-MM-DD') as due_date + from t_process_tasks + where open_action_id = :action_id + }] + + foreach task $tasks { + util_unlist $task process_task_id title description mime_type comment status_id priority start_date due_date + + set new_task_id [tasks::task::new \ + -process_instance_id $process_instance_id \ + -process_task_id $process_task_id \ + -party_id $party_id \ + -object_id $object_id \ + -title $title \ + -description $description \ + -mime_type $mime_type \ + -comment $comment \ + -status_id $status_id \ + -priority $priority \ + -start_date $start_date \ + -due_date $due_date] + } +} + +ad_proc -public tasks::workflow::impl::action_side_effect::object_type {} { + Get the object type for which this implementation is valid. +} { + return "acs_object" +} + +ad_proc -public tasks::workflow::impl::action_side_effect::pretty_name {} { + Get the pretty name of this implementation. +} { + return "tasks" +} Index: openacs-4/packages/tasks/tcl/tasks-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/tcl/tasks-install-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/tcl/tasks-install-procs.tcl 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,59 @@ +ad_library { + + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-09-21 + @arch-tag: 81868d37-99f5-48b1-8336-88e22c0e9001 + @cvs-id $Id: +} + +namespace eval tasks::install {} + +ad_proc -public tasks::install::package_install { +} { + Procedure to install certain information right after startup + + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-09-21 + +} { + set spec { + name "Tasks_Action_SideEffect" + aliases { + GetObjectType tasks::workflow::impl::action_side_effect::object_type + GetPrettyName tasks::workflow::impl::action_side_effect::pretty_name + DoSideEffect tasks::workflow::impl::action_side_effect::do + } + } + + lappend spec contract_name [workflow::service_contract::action_side_effect] + lappend spec owner tasks + + acs_sc::impl::new_from_spec -spec $spec +} + + +ad_proc -public tasks::install::after_upgrade { + {-from_version_name:required} + {-to_version_name:required} +} { + apm_upgrade_logic \ + -from_version_name $from_version_name \ + -to_version_name $to_version_name \ + -spec { + 0.1d 0.1d1 { + set spec { + name "Tasks_Action_SideEffect" + aliases { + GetObjectType tasks::workflow::impl::action_side_effect::object_type + GetPrettyName tasks::workflow::impl::action_side_effect::pretty_name + DoSideEffect tasks::workflow::impl::action_side_effect::do + } + } + + lappend spec contract_name [workflow::service_contract::action_side_effect] + lappend spec owner tasks + + acs_sc::impl::new_from_spec -spec $spec + } + } +} Index: openacs-4/packages/tasks/tcl/tasks-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/tcl/tasks-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/tcl/tasks-procs.tcl 30 Nov 2005 16:06:53 -0000 1.8.2.2 @@ -0,0 +1,301 @@ +ad_library { + + Tasks Library + + @creation-date 2003-12-18 + @author Matthew Geddert + @cvs-id $Id: tasks-procs.tcl,v 1.8.2.2 2005/11/30 16:06:53 miguelm Exp $ + +} + +namespace eval tasks {} +namespace eval tasks::task {} +namespace eval tasks::process {} +namespace eval tasks::process::task {} +namespace eval tasks::process::instance {} + +ad_proc -public tasks::task::new { + {-task_id ""} + {-process_instance_id ""} + {-process_task_id ""} + {-party_id ""} + {-object_id ""} + -title:required + {-description ""} + {-mime_type "text/plain"} + {-comment ""} + {-status_id 1} + {-priority 0} + {-start_date ""} + {-due_date ""} + {-package_id ""} + {-context_id ""} + {-assignee_id ""} +} { + if { [empty_string_p $package_id] } { + set package_id [apm_package_id_from_key "tasks"] + } + set extra_vars [ns_set create] + + if { [empty_string_p $context_id] } { + set context_id $package_id + } + + if { [empty_string_p $assignee_id] } { + set assignee_id [ad_conn user_id] + } + + oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {task_id process_instance_id process_task_id party_id object_id title description mime_type comment status_id priority start_date due_date package_id context_id assignee_id} + + set task_id [package_instantiate_object -extra_vars $extra_vars tasks_task] + + return $task_id +} + +ad_proc -public tasks::task::edit { + -task_id:required + -title:required + {-description ""} + {-mime_type "text/plain"} + {-comment ""} + {-status_id 1} + {-priority 0} + {-due_date ""} + {-assignee_id ""} +} { + set modifying_user [ad_conn user_id] + set modifying_ip [ad_conn peeraddr] + + db_dml update_task {} + db_dml update_object {} +} + +ad_proc -public tasks::task::complete { + -task_id:required +} { + db_transaction { + db_dml set_status_done {} + + if {[db_0or1row closing_action {}]} { + workflow::case::action::execute -case_id $case_id -action_id $closing_action_id -no_perm_check -no_notification + } + } +} + + +ad_proc -public tasks::process::task::new { + {-task_id ""} + -process_id:required + -open_action_id:required + -closing_action_id:required + {-party_id ""} + {-object_id ""} + -title:required + {-description ""} + {-mime_type "text/plain"} + {-comment ""} + {-status_id 1} + {-priority 0} + {-start 0} + {-due 0} + {-package_id ""} + {-assignee_id ""} +} { + if { [empty_string_p $package_id] } { + set package_id [ad_conn package_id] + } + + if { [empty_string_p $assignee_id] } { + set assignee_id [ad_conn user_id] + } + + set extra_vars [ns_set create] + set context_id $package_id + + oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {task_id process_id open_action_id closing_action_id party_id object_id title description mime_type comment status_id priority start due package_id context_id assignee_id} + + set task_id [package_instantiate_object -extra_vars $extra_vars tasks_process_task] + + return $task_id +} + +ad_proc -public tasks::process::task::edit { + -task_id:required + -open_action_id:required + {-party_id ""} + {-object_id ""} + -title:required + {-description ""} + {-mime_type "text/plain"} + {-comment ""} + {-status_id 1} + {-priority 0} + {-start 0} + {-due 0} + {-assignee_id ""} +} { + set modifying_user [ad_conn user_id] + set modifying_ip [ad_conn peeraddr] + + db_dml update_process_task {} + db_dml update_object {} +} + + +ad_proc -public tasks::process::new { + {-process_id ""} + -title:required + {-description ""} + {-mime_type "text/plain"} + {-workflow_id ""} + {-package_id ""} +} { + if { [empty_string_p $package_id] } { + set package_id [ad_conn package_id] + } + set extra_vars [ns_set create] + set context_id $package_id + + oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {process_id title description mime_type workflow_id package_id context_id} + + set task_id [package_instantiate_object -extra_vars $extra_vars tasks_process] + + return $task_id +} + +ad_proc -public tasks::process::edit { + -process_id:required + -title:required + {-description ""} + {-mime_type "text/plain"} +} { + set modifying_user [ad_conn user_id] + set modifying_ip [ad_conn peeraddr] + + db_dml update_process {} + db_dml update_object {} +} + + +ad_proc -public tasks::process::instance::new { + {-process_instance_id ""} + -process_id:required + -case_id:required + {-party_id ""} + {-object_id ""} + {-package_id ""} +} { + if { [empty_string_p $package_id] } { + set package_id [ad_conn package_id] + } + set extra_vars [ns_set create] + set context_id $package_id + + oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {process_instance_id process_id case_id party_id object_id package_id context_id} + + set task_id [package_instantiate_object -extra_vars $extra_vars tasks_process_instance] + + return $task_id +} + + + +ad_proc -public tasks::new { + -party_id:required + {-object_id ""} + {-process_id ""} + -title:required + {-description ""} + {-mime_type "text/plain"} + {-comment ""} + -due_date:required + {-priority 0} + {-status "o"} + {-user_id ""} + {-ip_addr ""} + {-package_id ""} +} { + insert new task +} { + if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] + } + if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] + } + if {[empty_string_p $ip_addr]} { + set ip_addr [ad_conn peeraddr] + } + + set task_id [db_exec_plsql create_task {}] + + return $task_id +} + +ad_proc -public tasks::edit { + -task_id:required + -title:required + {-description ""} + {-mime_type "text/plain"} + {-comment ""} + -due_date:required + {-priority 0} + {-status "o"} + {-user_id ""} + {-ip_addr ""} +} { + update task +} { + if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] + } + if {[empty_string_p $ip_addr]} { + set ip_addr [ad_conn peeraddr] + } + + db_dml update_task {} + db_dml update_object {} +} + + +ad_proc -public tasks::project_id { + {-package_id ""} +} { + Returns this tasks instance project_id +} { + if { [string is false [exists_and_not_null package_id]] } { + set package_id [ad_conn package_id] + } + set project_id [db_string get_project_id { + select pm_projectsx.item_id + from pm_projectsx, + cr_folders cf + where pm_projectsx.parent_id = cf.folder_id + and cf.package_id = :package_id + } -default {}] + if { [string is false [exists_and_not_null project_id]] } { + tasks::initialize -package_id $package_id + set project_id [tasks::project_id -package_id $package_id] + } + return $project_id +} + +ad_proc -public tasks::initialize { + {-package_id ""} +} { + Returns this tasks instance project_id +} { + if { [string is false [exists_and_not_null package_id]] } { + set package_id [ad_conn package_id] + } + if { [string is false [db_0or1row project_exists_p { select 1 from cr_folders where package_id = :package_id and label = 'Projects' }]] } { + pm::project::new -project_name "[_ tasks.Tasks_Instance]" \ + -status_id "1" \ + -organization_id "" \ + -creation_user [ad_conn user_id] \ + -creation_ip [ad_conn peeraddr] \ + -ongoing_p "t" \ + -package_id $package_id + } +} + Index: openacs-4/packages/tasks/tcl/tasks-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/tcl/tasks-procs.xql,v diff -u -N -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/tasks/tcl/tasks-procs.xql 7 Oct 2005 21:41:45 -0000 1.1.2.2 +++ openacs-4/packages/tasks/tcl/tasks-procs.xql 30 Nov 2005 16:06:53 -0000 1.1.2.3 @@ -7,14 +7,48 @@ update tasks set title = :title, description = :description, - mime_type = :mime_type, - comment = :comment, - due_date = :due_date, - priority = :priority, - status = :status + mime_type = :mime_type, + comment = :comment, + status_id = :status_id, + priority = :priority, + due_date = :due_date, + assignee_id = :assignee_id where task_id = :task_id + + + + update acs_objects + set modifying_user = :modifying_user, + modifying_ip = :modifying_ip, + last_modified = now() + where object_id = :task_id + + + + + + + + update t_process_tasks + set open_action_id = :open_action_id, + party_id = :party_id, + object_id = :object_id, + title = :title, + description = :description, + mime_type = :mime_type, + comment = :comment, + status_id = :status_id, + priority = :priority, + start = :start, + due = :due, + assignee_id = :assignee_id + where task_id = :task_id + + + + Index: openacs-4/packages/tasks/www/change-assignee.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/change-assignee.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/change-assignee.adp 30 Nov 2005 16:06:53 -0000 1.1.2.2 @@ -0,0 +1,5 @@ + +@page_title;noquote@ +@context;noquote@ + + \ No newline at end of file Index: openacs-4/packages/tasks/www/change-assignee.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/change-assignee.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/change-assignee.tcl 30 Nov 2005 16:06:53 -0000 1.1.2.2 @@ -0,0 +1,70 @@ +ad_page_contract { + + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + @creation_date 2005-10-23 +} { + {task_id:multiple,optional ""} + {process_task_id:multiple,optional ""} + {party_id ""} + {return_url ""} +} + +set required_p 0 + +if { ![exists_and_not_null task_id] } { + if { ![exists_and_not_null process_task_id] } { + set required_p 1 + } +} elseif { ![exists_and_not_null process_task_id] } { + if { ![exists_and_not_null task_id] } { + set required_p 1 + } +} + +if { $required_p } { + ad_return_complaint 1 "You need to provided either task_id or process_task_id" + ad_script_abort +} + +set page_title "[_ tasks.Change_Assignee]" +set context [list "$page_title"] + +if { ![exists_and_not_null return_url] } { + set return_url [get_referrer] +} + +if { [exists_and_not_null task_id] } { + set tasks_list [join $task_id ", \#"] +} + +if { [exists_and_not_null process_task_id] } { + set tasks_list [join $process_task_id ", \#"] +} + +ad_form -name change_assignee -form { + {tasks_show:text(inform) + {label "[_ tasks.Tasks]:"} + {value "\#$tasks_list"} + } + {task_id:text(hidden) {value $task_id}} + {process_task_id:text(hidden) {value $process_task_id}} + {party_id:party_search(party_search) + {label "[_ tasks.Search_Assignee]:"} + {help_text "[_ tasks.Search_Assignee_help]"} + } + {return_url:text(hidden) {value $return_url}} +} -on_submit { + if { [exists_and_not_null task_id] } { + foreach task $task_id { + db_dml update_tasks { } + } + } + if { [exists_and_not_null process_task_id] } { + foreach process_task $process_task_id { + db_dml update_process_tasks { } + } + } +} -after_submit { + ad_returnredirect $return_url +} \ No newline at end of file Index: openacs-4/packages/tasks/www/change-assignee.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/change-assignee.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/change-assignee.xql 30 Nov 2005 16:06:53 -0000 1.1.2.2 @@ -0,0 +1,20 @@ + + + + + + update t_tasks + set assignee_id = :party_id + where task_id = :task + + + + + + update t_process_tasks + set assignee_id = :party_id + where task_id = :process_task + + + + \ No newline at end of file Index: openacs-4/packages/tasks/www/contact.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/contact.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/contact.adp 30 Nov 2005 16:06:53 -0000 1.11.2.2 @@ -0,0 +1,21 @@ + +@party_id@ + + + + + +
+ +
Index: openacs-4/packages/tasks/www/contact.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/contact.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/contact.tcl 30 Nov 2005 16:06:53 -0000 1.10.2.2 @@ -0,0 +1,45 @@ +ad_page_contract { + + Main view page for tasks. + + @author jader@bread.com + @creation-date 2003-12-03 + @cvs-id $Id: contact.tcl,v 1.10.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @return title Page title. + @return context Context bar. + @return tasks Multirow data set of tasks + + @param mine_p is used to make the default be the user, but + still allow people to view everyone. + +} { + {tasks_orderby ""} + {page:optional "1"} + {page_size:optional "25"} + {party_id ""} + {searchterm ""} + {mine_p "t"} + {status_id "1"} + {tasks_interval "30"} + {emp_f ""} + {process_instance:integer,optional} + {cgl_orderby ""} + {tasks_orderby ""} + {page "1"} +} -properties { + task_term:onevalue + context:onevalue + tasks:multirow + hidden_vars:onevalue +} + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] +set admin_p [permission::permission_p -object_id $package_id -privilege admin] +set context [list] +set elements "checkbox deleted_p priority title process_title date assignee" + +if { [string equal $emp_f "2"]} { + lappend elements contact_name +} Index: openacs-4/packages/tasks/www/delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/delete.adp 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,9 @@ + + @title@ + @context@ + +

@question@

+

+ #tasks.Yes# - #tasks.No_Cancel# +

+ Index: openacs-4/packages/tasks/www/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/delete.tcl 30 Nov 2005 16:06:53 -0000 1.3.2.2 @@ -0,0 +1,68 @@ +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id: delete.tcl,v 1.3.2.2 2005/11/30 16:06:53 miguelm Exp $ + +} { + {task_id:integer,multiple} + {confirm_p:boolean 1} + {return_url:notnull} +} + + +set num_entries [llength $task_id] +set user_id [ad_conn user_id] + +if { [string is false $confirm_p] } { + + if { $num_entries == 0 } { + ad_returnredirect ./ + return + } + set task_pretty [ad_decode $num_entries 1 "[_ tasks.Task]" "[_ tasks.Tasks]"] + set title "[_ tasks.Delete_task_pretty]" + set context [list $title] + set task2_pretty [ad_decode $num_entries 1 "[_ tasks.this_task]" "[_ tasks.these_tasks]"] + set context [list $title] + set question "[_ tasks.lt_Are_you_sure_you_want_1]" + set yes_url "delete?[export_vars { task_id:multiple { confirm_p 1 } return_url}]" + set no_url "${return_url}" + return +} + + +set task_titles [list] +foreach task_id $task_id { + lappend task_titles [db_string get_task_title { + select t.title + from t_tasks + where t.task_id = :task_id + }] + db_dml mark_delete { + update t_tasks + set status_id = null + where task_id = :task_id + } +} + +if { $num_entries > 1 } { + set task_list "" + set num 1 + foreach task_title $task_titles { + if { $num == $num_entries } { + append task_list " and " + } elseif { $num != 1 } { + append task_list ", " + } + append task_list "\"${task_title}\"" + incr num + } + util_user_message -html -message "[_ tasks.lt_The_tasks_task_list_w]" +} else { + set task_title [lindex $task_titles 0] + util_user_message -html -message "[_ tasks.lt_The_task_lindex_task_]" +} + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/tasks/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/index-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/index-postgresql.xql 30 Nov 2005 16:06:53 -0000 1.5.2.2 @@ -0,0 +1,83 @@ + + +postgresql7.2 + + + + select t.task_id, t.title, t.party_id, t.priority, s.title as status, + tasks__relative_date(t.due_date) as due_date, t.description, + CASE WHEN t.due_date < now() THEN 't'::boolean ELSE 'f'::boolean END as overdue_p, + tasks__relative_date(t.due_date) as due_date, + contact__name(t.party_id, :name_order) as contact_name, + p.title as process_title, p.process_id, t.mime_type + from t_task_status s, acs_objects ot, t_tasks t + left outer join t_process_instances pi + on (pi.process_instance_id = t.process_instance_id) + left outer join t_processes p + on (p.process_id = pi.process_id) + where s.status_id = t.status_id + and t.status_id <> 2 + and ot.object_id = t.task_id + and ot.package_id = :package_id + and ot.creation_user = :user_id + and t.start_date < now() + and t.due_date < ( now() + '$tasks_interval days'::interval ) + and t.party_id in ( select parties.party_id + from parties + left join cr_items on (parties.party_id = cr_items.item_id) + left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id), + group_distinct_member_map + where parties.party_id = group_distinct_member_map.member_id + $group_where_clause + [contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"] ) + [template::list::page_where_clause -and -name tasks -key t.task_id] + [template::list::orderby_clause -orderby -name tasks] + + + + + + select t.task_id + from t_task_status s, acs_objects ot, t_tasks t + where s.status_id = t.status_id + and t.status_id <> 2 + and ot.object_id = t.task_id + and ot.package_id = :package_id + and ot.creation_user = :user_id + and t.start_date < now() + and t.due_date < ( now() + '$tasks_interval days'::interval ) + and t.party_id in ( select parties.party_id + from parties + left join cr_items on (parties.party_id = cr_items.item_id) + left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id), + group_distinct_member_map + where parties.party_id = group_distinct_member_map.member_id + $group_where_clause + [contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"] ) + [template::list::orderby_clause -orderby -name tasks] + + + + + + select count(*) + from t_task_status s, acs_objects ot, t_tasks t + where s.status_id = t.status_id + and t.status_id <> 2 + and ot.object_id = t.task_id + and ot.package_id = :package_id + and ot.creation_user = :user_id + and t.start_date < now() + and t.due_date < ( now() + '$tasks_interval days'::interval ) + and t.party_id in ( select parties.party_id + from parties + left join cr_items on (parties.party_id = cr_items.item_id) + left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id), + group_distinct_member_map + where parties.party_id = group_distinct_member_map.member_id + $group_where_clause + [contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"] ) + + + + Index: openacs-4/packages/tasks/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/index.adp 30 Nov 2005 16:06:53 -0000 1.9.2.2 @@ -0,0 +1,19 @@ + +

+ +
+ + + + +
+ +
\ No newline at end of file Index: openacs-4/packages/tasks/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/index.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/index.tcl 30 Nov 2005 16:06:53 -0000 1.7.2.2 @@ -0,0 +1,62 @@ +ad_page_contract { + List and manage contacts. + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id: index.tcl,v 1.7.2.2 2005/11/30 16:06:53 miguelm Exp $ +} { + {tasks_orderby:optional ""} + {format "normal"} + {search_id:integer ""} + {query ""} + {page:optional "1"} + {page_size:integer "25"} + {tasks_interval:integer "7"} + {page_flush_p "0"} +} + +set title "[_ tasks.Tasks]" +set context {} +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] +set url [ad_conn url] + +set return_url [export_vars -base $url -url {orderby format search_id query page page_size tasks_interval {page_flush_p t}}] + + +set package_id [site_node::get_element -url "/contacts" -element object_id] +if { [exists_and_not_null search_id] } { + contact::search::log -search_id $search_id +} +set search_options [concat [list [list [_ contacts.All_Contacts] ""]] [db_list_of_lists dbqd.contacts.www.index.public_searches {}]] + +set searchcount 1 +db_foreach dbqd.contacts.www.index.my_recent_searches {} { + lappend search_options [list "${searchcount}) ${recent_title}" ${recent_search_id}] + incr searchcount +} + +set form_elements { + {search_id:integer(select),optional {label ""} {options $search_options} {html {onChange "javascript:acs_FormRefresh('search')"}}} + {query:text(text),optional {label ""} {html {size 20 maxlength 255}}} + {save:text(submit) {label {[_ contacts.Search]}} {value "go"}} + {tasks_interval:integer(text),optional {label "  [_ tasks.View_next]"} {after_html "days"} {html {size 2 maxlength 3 onChange "javascript:acs_FormRefresh('search')"}}} +} + +if { [parameter::get -boolean -parameter "ForceSearchBeforeAdd" -default "0"] } { + if { [exists_and_not_null query] && $search_id == "" } { + append form_elements { + {add_person:text(submit) {label {[_ contacts.Add_Person]}} {value "1"}} + {add_organization:text(submit) {label {[_ contacts.Add_Organization]}} {value "1"}} + } + } +} + +ad_form -name "search" -method "GET" -export {orderby page_size format} -form $form_elements \ + -on_request { + } -edit_request { + } -on_refresh { + } -on_submit { + } -after_submit { + } + Index: openacs-4/packages/tasks/www/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/index.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/index.xql 30 Nov 2005 16:06:53 -0000 1.3.2.2 @@ -0,0 +1,105 @@ + + + + + + select pt.task_id + from cr_items ci, + pm_tasks_revisions ptr, + pm_tasks pt left join pm_process_instance ppi on (pt.process_instance = ppi.instance_id ), + cr_revisions cr, + acs_objects ao, + ( select task_id, party_id + from pm_task_assignment + where party_id in ( select parties.party_id + from parties left join cr_items on (parties.party_id = cr_items.item_id) left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id ) , group_distinct_member_map + where parties.party_id = group_distinct_member_map.member_id + and group_distinct_member_map.group_id = '11428599' + [contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"] ) + and role_id = '1' ) assigned_tasks + where ci.parent_id = :project_id + and ci.item_id = pt.task_id + and ci.live_revision = ptr.task_revision_id + and ci.live_revision = cr.revision_id + and pt.status = 1 + and ptr.end_date is not null + and pt.deleted_p = 'f' + and pt.task_id = assigned_tasks.task_id + and pt.task_id = ao.object_id + and CASE WHEN ao.creation_user = assigned_tasks.party_id THEN + CASE WHEN assigned_tasks.party_id = :user_id THEN 'f'::boolean ELSE 't'::boolean END + ELSE 't'::boolean END + and ptr.end_date < ( now() + :tasks_interval || ' days'::interval ) + [template::list::orderby_clause -orderby -name tasks] + + + + + + select count(*) + from cr_items ci, + pm_tasks_revisions ptr, + pm_tasks pt left join pm_process_instance ppi on (pt.process_instance = ppi.instance_id ), + cr_revisions cr, + acs_objects ao, + ( select task_id, party_id + from pm_task_assignment + where party_id in ( select parties.party_id + from parties left join cr_items on (parties.party_id = cr_items.item_id) left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id ) , group_distinct_member_map + where parties.party_id = group_distinct_member_map.member_id + and group_distinct_member_map.group_id = '11428599' + [contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id"] ) + and role_id = '1' ) assigned_tasks + where ci.parent_id = :project_id + and ci.item_id = pt.task_id + and ci.live_revision = ptr.task_revision_id + and ci.live_revision = cr.revision_id + and pt.status = 1 + and ptr.end_date is not null + and pt.deleted_p = 'f' + and pt.task_id = assigned_tasks.task_id + and pt.task_id = ao.object_id + and CASE WHEN ao.creation_user = assigned_tasks.party_id THEN + CASE WHEN assigned_tasks.party_id = :user_id THEN 'f'::boolean ELSE 't'::boolean END + ELSE 't'::boolean END + and ptr.end_date < ( now() + :tasks_interval || ' days'::interval ) + + + + + + select pt.task_id, + tasks__relative_date(ptr.end_date) as end_date, + CASE WHEN ptr.end_date < now() THEN 't'::boolean ELSE 'f'::boolean END as overdue_p, + cr.title, + ptr.priority, + contact__name(assigned_tasks.party_id,:name_order) as contact_name, + assigned_tasks.party_id, + ppi.name as process, + ppi.process_id as process_id + from cr_items ci, + pm_tasks_revisions ptr, + pm_tasks pt left join pm_process_instance ppi on (pt.process_instance = ppi.instance_id ), + cr_revisions cr, + acs_objects ao, + pm_task_assignment as assigned_tasks + where ci.parent_id = :project_id + and ci.item_id = pt.task_id + and ci.live_revision = ptr.task_revision_id + and ci.live_revision = cr.revision_id + and pt.status = 1 + and ptr.end_date is not null + and pt.deleted_p = 'f' + and pt.task_id = assigned_tasks.task_id + and pt.task_id = ao.object_id + and CASE WHEN ao.creation_user = assigned_tasks.party_id THEN + CASE WHEN assigned_tasks.party_id = :user_id THEN 'f'::boolean ELSE 't'::boolean END + ELSE 't'::boolean END + and ptr.end_date < ( now() + :tasks_interval || ' days'::interval ) + [template::list::page_where_clause -and -name tasks -key pt.task_id] + [template::list::orderby_clause -orderby -name tasks] + + + + + Index: openacs-4/packages/tasks/www/mail-merge.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/mail-merge.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/mail-merge.tcl 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,23 @@ +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id: mail-merge.tcl,v 1.1.1.1.2.2 2005/11/30 16:06:53 miguelm Exp $ + +} { + {task_id:integer,multiple} + {return_url:notnull} +} + +set party_ids [db_list get_party_ids " + select distinct party_id + from pm_task_assignment + where task_id in ('[join $task_id {','}]') +"] + +ad_returnredirect [export_vars -base "/contacts/message" -url {return_url party_ids}] +ad_script_abort + + + + Index: openacs-4/packages/tasks/www/mark-completed.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/mark-completed.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/mark-completed.adp 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,9 @@ + +@title@ +@context@ + +

@question@

+

+ #tasks.Yes# - #tasks.No_Cancel# +

+ Index: openacs-4/packages/tasks/www/mark-completed.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/mark-completed.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/mark-completed.tcl 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,69 @@ +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id: mark-completed.tcl,v 1.2.2.2 2005/11/30 16:06:53 miguelm Exp $ + +} { + {task_id:integer,multiple} + {confirm_p:boolean 1} + {status_id:integer ""} + {orderby ""} + {return_url:notnull} +} + +set num_entries [llength $task_id] + +if { [string is false $confirm_p] } { + + if { $num_entries == 0 } { + ad_returnredirect ./ + return + } + set pretty_task [ad_decode $num_entries 1 "[_ tasks.Task]" "[_ tasks.Tasks]"] + set title "[_ tasks.Mark_Done]" + set context [list $title] + set pretty_entries [ad_decode $num_entries 1 "[_ tasks.this_task]" "[_ tasks.these_tasks]"] + set question "[_ tasks.completed_sure]" + set yes_url "mark-completed?[export_vars { task_id:multiple { confirm_p 1 } status_id orderby party_id}]" + set no_url "./?[export_vars { status_id orderby party_id}]" + return +} + +set user_id [ad_conn user_id] + +db_transaction { + set task_titles [list] + foreach task_id $task_id { + set task_title [db_string get_task_title { + select t.title + from t_tasks t + where t.task_id = :task_id + }] + lappend task_titles "${task_title}" + + tasks::task::complete -task_id $task_id + } +} + + +if { $num_entries > 1 } { + set task_list "" + set num 1 + foreach task_title $task_titles { + if { $num == $num_entries } { + append task_list " and " + } elseif { $num != 1 } { + append task_list ", " + } + append task_list "\"${task_title}\"" + incr num + } + util_user_message -html -message "[_ tasks.tasks_completed]" +} else { + set task_title [lindex $task_titles 0] + util_user_message -html -message "[_ tasks.task_completed]" +} + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/tasks/www/old-process-assign.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/old-process-assign.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/old-process-assign.adp 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,9 @@ + +@title@ +@context_bar;noquote@ + +@form_definition_beg;noquote@ + @select_widget;noquote@ + +@form_definition_end;noquote@ + Index: openacs-4/packages/tasks/www/process-add-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-add-edit-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-add-edit-oracle.xql 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,47 @@ + + + + + select sysdate from dual + + + + + + insert into pm_process + (process_id, + one_line, + description, + party_id, + creation_date) + values + (:process_id, + :one_line, + :description, + :party_id, + :creation_date) + + + + + + update pm_process + set one_line = :one_line, + description = :description, + party_id = :party_id + + + + + + SELECT process_id, + one_line, + description, + party_id, + creation_date + FROM pm_process + WHERE process_id = :process_id + + + + Index: openacs-4/packages/tasks/www/process-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process-add-edit-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-add-edit-postgresql.xql 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,12 @@ + + + + + + select title, description, workflow_id + from t_processes + where process_id = :process_id + + + + Index: openacs-4/packages/tasks/www/process-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process-add-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-add-edit.adp 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,8 @@ + +@context@ +@title@ +add_edit.one_line + +
+ +
Index: openacs-4/packages/tasks/www/process-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process-add-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-add-edit.tcl 30 Nov 2005 16:06:53 -0000 1.3.2.2 @@ -0,0 +1,96 @@ +ad_page_contract { + + Simple add/edit form for processs + + @author jader@bread.com + @creation-date 2003-09-15 + @cvs-id $Id: process-add-edit.tcl,v 1.3.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @return context_bar Context bar. + @return title Page title. +} { + process_id:integer,optional + {assignee_id:integer,optional ""} +} -properties { + context_bar:onevalue + title:onevalue +} + +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] + +if { ![ad_form_new_p -key process_id] } { + set process [db_string process_get { select title from t_processes where process_id = :process_id}] + set title "Edit: $process" + set context [list [list "processes" Processes] [list [export_vars -base "process" -url {process_id}] $process] "Edit"] + # permissions + permission::require_permission -party_id $user_id -object_id $package_id -privilege write +} else { + set title "Add a Process" + set context [list [list "processes" Processes] $title] + # permissions + permission::require_permission -party_id $user_id -object_id $package_id -privilege create +} + + +ad_form -name add_edit -form { + process_id:key + assignee_id:text(hidden),optional + workflow_id:text(hidden),optional + + {title:text + {label "Process"} + {html {size 80}} + } + + {description:text(textarea),optional + {label "Description"} + {html { rows 5 cols 40 wrap soft}}} + +} -select_query_name process_query -new_data { + + db_transaction { + set workflow_id [workflow::new \ + -short_name "tasks_process_$process_id" \ + -pretty_name "tasks process $process_id" \ + -package_key tasks] + + set state_id [workflow::state::fsm::new \ + -workflow_id $workflow_id \ + -short_name new \ + -pretty_name New] + + workflow::action::fsm::new \ + -workflow_id $workflow_id \ + -short_name new \ + -pretty_name New \ + -new_state_id $state_id \ + -callbacks "tasks.Tasks_Action_SideEffect" \ + -initial_action_p t + + set process_id [tasks::process::new \ + -process_id $process_id \ + -title $title \ + -description $description \ + -mime_type "text/plain" \ + -workflow_id $workflow_id] + } + + ad_returnredirect -message "Process added. Now add a process task." [export_vars -base process-task -url {process_id assignee_id}] + ad_script_abort + +} -edit_data { + + tasks::process::edit \ + -process_id $process_id \ + -title $title \ + -description $description \ + -mime_type "text/plain" \ + -assignee_id $assignee_id\ + + +} -after_submit { + + ad_returnredirect -message "Process changes saved." [export_vars -base process -url {process_id assignee_id}] + ad_script_abort +} Index: openacs-4/packages/tasks/www/process-assign.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-assign.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-assign.tcl 30 Nov 2005 16:06:53 -0000 1.3.2.2 @@ -0,0 +1,54 @@ +ad_page_contract { + + Page to get the process if one is missing for task creation + + @author jader@bread.com + @creation-date 2003-10-08 + @cvs-id $Id: process-assign.tcl,v 1.3.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @return context_bar Context bar. + @return title Page title. + @return projects A multirow containing the list of projects + + @param process_id The process we're using to create this task +} { + {process_id:integer,notnull} + {assignee_id:integer,notnull} + {object_id:integer,optional ""} +} -properties { + + context_bar:onevalue + title:onevalue + select_widget:onevalue + select_widget_name:onevalue + form_definition_beg:onevalue + form_definition_end:onevalue + +} -validate { +} -errors { +} + + +db_1row get_process { + select title as process, workflow_id + from t_processes + where process_id = :process_id +} + +db_transaction { + + set case_id [db_nextval acs_object_id_seq] + + set instance_id [tasks::process::instance::new \ + -process_id $process_id \ + -case_id $case_id \ + -party_id $assignee_id \ + -object_id $object_id] + + workflow::case::new -no_notification \ + -case_id $case_id \ + -workflow_id $workflow_id \ + -object_id $instance_id +} + +ad_returnredirect [export_vars -base "contact" -url {{party_id $assignee_id}}] Index: openacs-4/packages/tasks/www/process-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-delete.adp 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,17 @@ + + @title@ + @context@ + +

+ #tasks.lt_Are_you_sure_you_want# + +

+ @description@ +
+ +

+ #tasks.Delete# +     + #tasks.Cancel_do_not_delete# +

+ Index: openacs-4/packages/tasks/www/process-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-delete.tcl 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,48 @@ +# + +ad_page_contract { + + Delete a process + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-25 + @arch-tag: e4153029-2cda-462d-b429-8f2b24999580 + @cvs-id $Id: process-delete.tcl,v 1.2.2.2 2005/11/30 16:06:53 miguelm Exp $ +} { + process_id:integer + assignee_id:integer,optional + {confirm_p:boolean 0} + {return_url "processes"} +} -properties { +} -validate { +} -errors { +} + +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege delete + +if {[string is false $confirm_p]} { + + db_1row get_name { + select title, description + from t_processes + where process_id = :process_id + } + + set title "Delete process: $title" + set context [list "Delete: $title"] + + set yes_url [export_vars -base process-delete {process_id assignee_id {confirm_p 1} return_url}] + set no_url $return_url + + return +} + + +db_dml delete_process { + update t_processes + set workflow_id = null + where process_id = :process_id +} + +ad_returnredirect -message "Process deleted" $return_url Index: openacs-4/packages/tasks/www/process-instances.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-instances.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-instances.adp 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,6 @@ + + @title@ + @header_stuff@ + @context@ + + Index: openacs-4/packages/tasks/www/process-instances.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-instances.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-instances.tcl 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,73 @@ +# + +ad_page_contract { + + Lists all the process instances of a given process_id + + @author (ibr@test) + @creation-date 2004-11-05 + @arch-tag: 57bfd18d-a3e5-4047-8185-06707c42f058 + @cvs-id $Id: process-instances.tcl,v 1.1.1.1.2.2 2005/11/30 16:06:53 miguelm Exp $ +} { + process_id:integer,notnull +} -properties { +} -validate { +} -errors { +} + + +# set up context bar +set title "Process Instances" +set context [list [list "Processes" processes] $title] +set header_stuff "" + +# the unique identifier for this package +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] + +# permissions +permission::require_permission -party_id $user_id -object_id $package_id -privilege read + +# Processes, using list-builder --------------------------------- + +template::list::create \ + -name instances \ + -multirow instances \ + -key instance_id \ + -elements { + edit { + display_template { + + Edit + + } + } + instance_id { + label "ID" + } + name { + label "Name" + } + project_item_id { + label "Project" + display_template { + @instances.project_name@ + } + } + active_tasks { + label "Active tasks" + } + } \ + -main_class { + narrow + } \ + -html { + width 100% + } + + +db_multirow -extend { delete_url creation_date } instances instances_query { +} { + set delete_url [export_vars -base "process-delete" {process_id}] +} + Index: openacs-4/packages/tasks/www/process-instances.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-instances.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-instances.xql 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,38 @@ + + + + + + + + + + + + SELECT + i.name, + i.instance_id, + i.project_item_id, + projectr.title as project_name, + (select count(*) + from + pm_tasks_active t, + pm_task_status s + where + t.status = s.status_id and + s.status_type = 'o' and + t.process_instance = i.instance_id) as active_tasks + FROM + pm_process_instance i, + cr_items projecti, + cr_revisions projectr + WHERE + i.process_id = :process_id and + i.project_item_id = projecti.item_id and + projecti.live_revision = projectr.revision_id + ORDER BY + i.instance_id desc + + + + Index: openacs-4/packages/tasks/www/process-interval.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process-interval.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-interval.adp 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,6 @@ + + +@title@ +@context@ + +#tasks.Done#. Index: openacs-4/packages/tasks/www/process-interval.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-interval.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-interval.tcl 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,126 @@ +ad_page_contract { + + Simple add/edit form for projects + + @author jader@bread.com, ncarroll@ee.usyd.edu.au + @creation-date 2003-05-15 + @cvs-id $Id: process-interval.tcl,v 1.1.1.1.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @return context_bar Context bar. + @return title Page title. + +} { + {party_id:integer,notnull} + process_instance:integer,optional + status_id:integer,optional + orderby:optional + {return_url ""} + action + days:integer +} -properties { +} + +if { $days != "7" } { + set days 7 +} + + +if { ![exists_and_not_null return_url] } { + set return_url [export_vars -base "contact" -url {party_id orderby status_id}] +} +if { $action == "minus" } { + set operand "-" +} else { + set operand "+" +} + +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] +set peeraddr [ad_conn peeraddr] +set project_id [tasks::project_id] + +set title "Add/Edit" +set context [list $title] + +set interval_number 1 +db_foreach get_tasks { + select pt.task_id + from pm_tasks pt, cr_items ci, cr_revisions cr, pm_tasks_revisions ptr + where pt.process_instance = :process_instance + and pt.deleted_p != 't' + and pt.status = '1' + and pt.task_id = ci.item_id + and ci.live_revision = cr.revision_id + and cr.revision_id = ptr.task_revision_id + and ptr.end_date is not null + order by ptr.end_date +} { + + db_1row get_task_info " + select ci.item_id as task_id, + cr.title as task, + to_char((ptr.end_date $operand '[expr $days * $interval_number] days'::interval),'YYYY-MM-DD') as end_date, + ptr.percent_complete, + ptr.priority, + cr.description + from pm_tasks_revisions ptr, + cr_revisions cr, + cr_items ci + where ci.item_id = :task_id + and ci.latest_revision = ptr.task_revision_id + and ci.live_revision = ptr.task_revision_id + and ptr.task_revision_id = cr.revision_id + " + if { $percent_complete >= "100" } { + set completed_p "1" + } + if {$percent_complete >= 100} { + set task_status_id [pm::task::default_status_closed] + } elseif {$percent_complete < 100} { + set task_status_id [pm::task::default_status_open] + } + set task_item_id $task_id + set project_item_id $project_id + set title $task + set mime_type "text/plain" + set estimated_hours_work "" + set estimated_hours_work_min "" + set estimated_hours_work_max "" + set actual_hours_worked "" + set update_user $user_id + set update_ip $peeraddr + + db_exec_plsql new_task_revision " + select pm_task__new_task_revision ( + :task_item_id, + :project_item_id, + :title, + :description, + :mime_type, + [pm::util::datenvl -value $end_date -value_if_null "null" -value_if_not_null ":end_date"], + :percent_complete, + :estimated_hours_work, + :estimated_hours_work_min, + :estimated_hours_work_max, + :actual_hours_worked, + :task_status_id, + current_timestamp, + :update_user, + :update_ip, + :package_id, + :priority) + " + + incr interval_number + + +} + +if { $action == "minus" } { + util_user_message -html -message "The process interval was decreased by $days days" +} else { + util_user_message -html -message "The process interval was increased by $days days" +} + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/tasks/www/process-one-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-one-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-one-oracle.xql 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,22 @@ + + + + + + SELECT t.process_task_id, + t.one_line, + t.description, + t.estimated_hours_work, + t.estimated_hours_work_min, + t.estimated_hours_work_max, + d.dependency_type, + t.ordering + FROM pm_process_task t , + pm_process_task_dependency d + WHERE t.process_task_id = d.process_task_id (+) and + t.process_id = :process_id + [template::list::orderby_clause -orderby -name tasks] + + + + Index: openacs-4/packages/tasks/www/process-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-oracle.xql 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,17 @@ + + +postgresql7.3 + + + + SELECT p.process_id, + p.one_line, + p.description, + p.party_id, + to_char(p.creation_date,'YYYY-MM-DD') as creation_date_ansi + FROM pm_process p + ORDER BY p.one_line + + + + Index: openacs-4/packages/tasks/www/process-reminder.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-reminder.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-reminder.tcl 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,25 @@ +# + +ad_page_contract { + + Sends out a process status update + + @author (jader-ibr@bread.com) + @creation-date 2004-11-18 + @arch-tag: 1a2152ed-1746-4d03-b191-b00c3fb32731 + @cvs-id $Id: process-reminder.tcl,v 1.1.1.1.2.2 2005/11/30 16:06:53 miguelm Exp $ +} { + instance_id:integer,notnull + project_item_id:integer,notnull + return_url:notnull +} -properties { +} -validate { +} -errors { +} + +pm::process::email_alert \ + -process_instance_id $instance_id \ + -project_item_id $project_item_id \ + -new_p f + +ad_returnredirect -message "Status update sent" $return_url Index: openacs-4/packages/tasks/www/process-task-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process-task-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-task-delete.adp 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,9 @@ + +@title@ +@context@ + +

@question@

+

+ #tasks.Yes# - #tasks.No_Cancel# +

+ Index: openacs-4/packages/tasks/www/process-task-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process-task-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-task-delete.tcl 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,71 @@ +ad_page_contract { + + @author Matthew Geddert openacs@geddert.com + @creation-date 2004-07-28 + @cvs-id $Id: process-task-delete.tcl,v 1.2.2.2 2005/11/30 16:06:53 miguelm Exp $ + +} { + {process_task_id:integer,multiple} + {confirm_p:boolean 0} + {status_id:integer ""} + {assignee_id:integer,optional} + {process_id:integer,notnull} + {orderby ""} +} + + +set num_entries [llength $process_task_id] + + +if { [string is false $confirm_p] } { + + if { $num_entries == 0 } { + ad_returnredirect ./ + return + } + set title "Delete [ad_decode $num_entries 1 "a Process Task" "Process Tasks"]" + set context [list $title] + set question "Are you sure you want to delete [ad_decode $num_entries 1 "this process task" "these $num_entries process tasks"]?" + set yes_url [export_vars -base process-task-delete -url { process_task_id:multiple { confirm_p 1 } assignee_id status_id orderby process_id }] + set no_url [export_vars -base process -url { process_id assignee_id status_id orderby }] + return +} + +set user_id [ad_conn user_id] + +set task_titles [list] + +db_transaction { + foreach process_task_id $process_task_id { + lappend task_titles [db_string get_task_title { + select title + from t_process_tasks + where task_id = :process_task_id + and process_id = :process_id + }] + db_dml mark_delete { + update t_process_tasks + set status_id = null + where task_id = :process_task_id + } + } +} +if { $num_entries > 1 } { + set task_list "" + set num 1 + foreach task_title $task_titles { + if { $num == $num_entries } { + append task_list " and " + } elseif { $num != 1 } { + append task_list ", " + } + append task_list "\"${task_title}\"" + incr num + } + util_user_message -html -message "The process tasks ${task_list} were deleted" +} else { + util_user_message -html -message "The process task \"[lindex $task_titles 0]\" was deleted" +} + +ad_returnredirect [export_vars -base process -url { process_id assignee_id status_id orderby }] +ad_script_abort Index: openacs-4/packages/tasks/www/process-task.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process-task.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-task.adp 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,7 @@ + + +@context@ +@title@ +add_edit.task + + Index: openacs-4/packages/tasks/www/process-task.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process-task.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-task.tcl 30 Nov 2005 16:06:53 -0000 1.3.2.2 @@ -0,0 +1,217 @@ +ad_page_contract { + + Simple add/edit form for projects + + @author jader@bread.com, ncarroll@ee.usyd.edu.au + @creation-date 2003-05-15 + @cvs-id $Id: process-task.tcl,v 1.3.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @return context_bar Context bar. + @return title Page title. + +} { + process_id:integer,notnull + process_task_id:integer,optional + assignee_id:integer,optional + status_id:integer,optional + orderby:optional +} -properties { +} -validate { + valid_process_id -requires process_id { + if { ![db_0or1row process_exists_p { select 1 from t_processes where process_id = :process_id}] } { + ad_complain "The process_id specified is not valid" + } + } +} + + +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] +db_1row process_get { + select title as process, workflow_id + from t_processes + where process_id = :process_id +} + +if { [ad_form_new_p -key process_task_id] } { + set title "Add Process Task" + set edit_buttons { + {Save save} + {{Save and Add Another} save_add_another} + } +} else { + set title "Edit: " + append title [db_string get_task_name { + select title + from t_process_tasks + where task_id = :process_task_id + }] + append edit_buttons { + {Update save} + {{Update and Add New Task} save_add_another} + {{Delete} delete} + } +} +set context [list [list "processes" Processes] [list [export_vars -base "process" -url {process_id assignee_id}] $process] $title] + +set status_options [db_list_of_lists status_options { + select title, status_id + from t_task_status + order by status_id +}] +set status_options [lang::util::localize $status_options] + +set open_options [db_list_of_lists open_action_options { + select title, closing_action_id + from t_process_tasks + where process_id = :process_id + and status_id is not null + order by lower(title) +}] +set open_options [concat [list [list "-- new --" ""]] $open_options] + +if { [ns_queryget "formbutton:delete"] != "" } { + ad_returnredirect [export_vars -base "process-task-delete" -url {process_id process_task_id assignee_id status_id orderby}] + ad_script_abort +} + +ad_form -name add_edit \ + -cancel_url [export_vars -base "process" -url {process_id assignee_id}] \ + -cancel_label "Cancel" \ + -edit_buttons $edit_buttons \ + -form { + process_task_id:key + process_id:integer(hidden) + workflow_id:integer(hidden) + + assignee_id:integer(hidden),optional + status_id:integer(hidden),optional + orderby:text(hidden),optional + + {task:text(text) + {label "Process Task"} + {html { size 80 maxlength 200}} + } + + {status:text(select) + {label "[_ tasks.Status]"} + {options $status_options} + } + + {priority:integer(select),optional + {label "Priority"} + {options {{{3 - Very Important} 3} {{2 - Important} 2} {{1 - Normal} 1} {{0 - Not Important} 0}}} + } + + {open_action_id:integer(select),optional + {label "After"} + {options $open_options} + } + + {description:text(textarea),optional,nospell + {label "Notes"} + {html { rows 5 cols 50 wrap soft}}} + + {comment:text(textarea),optional,nospell + {label "[_ tasks.Comment]"} + {html { rows 5 cols 50 wrap soft}}} + + {start:integer(text),optional + {label "Variable Start"} + {html {size 3 maxlength 3}} + {help_text {Variable start that fall on Saturday or Sunday will automatically be pushed to the next Monday}} + {after_html {days after assignment}} + } + + {due:integer(text),optional + {label "Variable Deadline"} + {html {size 3 maxlength 3}} + {help_text {Variable deadlines that fall on Saturday or Sunday will automatically be pushed to the next Monday}} + {after_html {days after assignment}} + } + + } \ + -new_request { + + set status "1" + set priority "1" + set start 0 + set due 0 + + } -edit_request { + + db_1row get_task_info { + select title as task, description, status_id as status, priority, + start, due, comment, open_action_id + from t_process_tasks + where task_id = :process_task_id + and process_id = :process_id + } + + } -on_submit { + set process_task_url [export_vars -base "/tasks/process-task" -url {process_id process_task_id assignee_id}] + } -new_data { + db_transaction { + + set state_id [workflow::state::fsm::get_id -workflow_id $workflow_id -short_name new] + + set closing_action_id [workflow::action::fsm::new \ + -workflow_id $workflow_id \ + -short_name "tasks_action_$process_task_id" \ + -pretty_name "task action $process_task_id" \ + -enabled_state_ids $state_id \ + -new_state_id $state_id \ + -callbacks "tasks.Tasks_Action_SideEffect"] + + if {[empty_string_p $open_action_id]} { + set open_action_id [workflow::action::get_id -workflow_id $workflow_id -short_name new] + } + + set process_task_id [tasks::process::task::new \ + -task_id $process_task_id \ + -process_id $process_id \ + -open_action_id $open_action_id \ + -closing_action_id $closing_action_id \ + -title $task \ + -description $description \ + -mime_type "text/plain" \ + -comment $comment \ + -status_id $status \ + -priority $priority \ + -start $start \ + -due $due \ + -assignee_id $assignee_id] + + util_user_message -html -message "The process task $task was added" + } + + + } -edit_data { + + tasks::process::task::edit \ + -task_id $process_task_id \ + -open_action_id $open_action_id \ + -title $task \ + -description $description \ + -mime_type "text/plain" \ + -comment $comment \ + -status_id $status \ + -priority $priority \ + -start $start \ + -due $due \ + -assignee_id $assignee_id + + util_user_message -html -message "The process task $task was updated" + + } -after_submit { + + if { [ns_queryget "formbutton:save_add_another"] != "" } { + set return_url [export_vars -url -base "process-task" {process_id assignee_id}] + } else { + set return_url [export_vars -url -base "process" {process_id assignee_id}] + } + ad_returnredirect $return_url + ad_script_abort + + } + Index: openacs-4/packages/tasks/www/process-use-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-use-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-use-oracle.xql 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,13 @@ + + + + + + SELECT process_id, + one_line + FROM pm_process + ORDER BY one_line + + + + Index: openacs-4/packages/tasks/www/process-use-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-use-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-use-postgresql.xql 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,14 @@ + + + + + + SELECT + process_id, + one_line + FROM pm_process + ORDER BY one_line + + + + Index: openacs-4/packages/tasks/www/process-use.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-use.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-use.adp 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,9 @@ + +@title@ +@context_bar;noquote@ + +@form_definition_beg;noquote@ + @select_widget;noquote@ + +@form_definition_end;noquote@ + Index: openacs-4/packages/tasks/www/process-use.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-use.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process-use.tcl 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,64 @@ +ad_page_contract { + + Page to get the process if one is missing for task creation + + @author jader@bread.com + @creation-date 2003-10-08 + @cvs-id $Id: process-use.tcl,v 1.1.1.1.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @return context_bar Context bar. + @return title Page title. + @return projects A multirow containing the list of projects + + @param process_id The process we're using to create this task +} { + + project_item_id:integer,notnull + +} -properties { + + context_bar:onevalue + title:onevalue + select_widget:onevalue + select_widget_name:onevalue + form_definition_beg:onevalue + form_definition_end:onevalue + +} -validate { +} -errors { +} + +# --------------------------------------------------------------- # + +set user_id [ad_maybe_redirect_for_registration] +set package_id [ad_conn package_id] + +# terminology +set project_term [parameter::get -parameter "ProjectName" -default "Project"] +set task_term [parameter::get -parameter "TaskName" -default "Task"] +set task_term_lower [parameter::get -parameter "taskname" -default "task"] +set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] + + +set title "Use a process" +set context_bar [ad_context_bar [list "processes" "Processes"] "Use"] + + +# need to change this to show all the projects you're on by +# default, and then give you the option of selecting all projects +# as an option. + +set select_widget_name process_id +set select_widget "" + +set form_definition_beg "
" + +append form_definition_beg [export_vars -form {project_item_id}] +set form_definition_end "
" + Index: openacs-4/packages/tasks/www/process.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process.adp 30 Nov 2005 16:06:53 -0000 1.3.2.2 @@ -0,0 +1,8 @@ + + +@assignee_id@ +@title@ +@context@ + + + Index: openacs-4/packages/tasks/www/process.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process.tcl 30 Nov 2005 16:06:53 -0000 1.3.2.2 @@ -0,0 +1,114 @@ +ad_page_contract { + Main view page for one process + + @author jader@bread.com + @creation-date 2003-09-25 + @cvs-id $Id: process.tcl,v 1.3.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @param process_id The process we're looking at. + + @return process_id the id for the process + @return context_bar Context bar. + @return use_link the link to use this process + +} { + process_id:integer,notnull + {assignee_id:integer,optional ""} + orderby:optional + {project_item_id ""} +} -properties { + process_id:onevalue + context_bar:onevalue + use_link:onevalue +} -validate { +} -errors { + process_id:notnull {You must specify a process to use. Please back up and select a process} +} + +# --------------------------------------------------------------- + +# the unique identifier for this package +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] + +# permissions +permission::require_permission -party_id $user_id -object_id $package_id -privilege read + +set write_p [permission::permission_p -object_id $package_id -privilege write] +set create_p [permission::permission_p -object_id $package_id -privilege create] + +set use_uncertain_completion_times_p [parameter::get -parameter "UseUncertainCompletionTimesP" -default "1"] + +# set up context bar, needs parent_id + +db_1row get_process_info { + select title + from t_processes + where process_id = :process_id +} +set context [list [list processes "Processes"] $title] + +set use_link "" + + +set elements \ + [list \ + priority { + label "Priority" + } \ + title { + label "Subject" + display_template {@tasks.task@ + } + } \ + start { + label "Start" + } \ + due { + label "Due" + } \ + after_task { + label "After" + } \ + ] + + +# Process tasks, using list-builder --------------------------------- +template::list::create \ + -name tasks \ + -multirow tasks \ + -key process_task_id \ + -elements $elements \ + -actions [list \ + "Add Process Task" [export_vars -base process-task -url {process_id assignee_id}] "Add Process Task" \ + "Edit Process" [export_vars -base process-add-edit -url {process_id assignee_id}] "Edit Process Title/Description" \ + "Delete Process" [export_vars -base process-delete -url {process_id assignee_id}] "Delete this Process" \ + "Cancel" [export_vars -base processes -url {assignee_id}] "Return to all processes" \ + ] \ + -orderby { + default_value ordering,desc + ordering { + label "Order" + orderby_asc "tp.priority asc, tp.due, lower(tp.title)" + orderby_desc "tp.priority desc, tp.due, lower(tp.title)" + default_direction desc + } + } \ + -bulk_actions { + "Delete" "process-task-delete" "Delete tasks" "#tasks.Change_Assignee#" change-assignee "#tasks.Change_Assignee#" + } \ + -bulk_action_export_vars { + process_id + assignee_id + } \ + -sub_class { + narrow + } \ + -filters { + process_id {} + } + + +db_multirow -extend { item_url } tasks task_query { +} { +} Index: openacs-4/packages/tasks/www/process.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/process.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/process.xql 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,18 @@ + + + + + + select tp.task_id as process_task_id, tp.title as task, + tp.description, tp.priority, tp.due, tp.start, + tp2.title as after_task, tp2.task_id as after_task_id + from t_process_tasks tp + left outer join t_process_tasks tp2 + on (tp2.closing_action_id = tp.open_action_id) + where tp.process_id = :process_id + and tp.status_id is not null + [template::list::orderby_clause -orderby -name tasks] + + + + Index: openacs-4/packages/tasks/www/processes-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/processes-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/processes-oracle.xql 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,17 @@ + + +oracle8.0 + + + + SELECT p.process_id, + p.one_line, + p.description, + p.party_id, + to_char(p.creation_date,'YYYY-MM-DD') as creation_date_ansi + FROM pm_process p + ORDER BY p.one_line + + + + Index: openacs-4/packages/tasks/www/processes-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/processes-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/processes-postgresql.xql 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,20 @@ + + +postgresql7.3 + + + + select p.process_id, p.title, o.creation_user, + person__name(o.creation_user) as creator_name, p.description, + to_char(o.creation_date, 'YYYY-MM-DD') as creation_date_ansi, + (select count(*) + from t_process_instances pi + where pi.process_id = p.process_id) as instances + from t_processes p, acs_objects o + where p.process_id = o.object_id + and p.workflow_id is not null + order by lower(p.title) + + + + Index: openacs-4/packages/tasks/www/processes.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/processes.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/processes.adp 30 Nov 2005 16:06:53 -0000 1.3.2.2 @@ -0,0 +1,14 @@ + + + +@assignee_id@ + + + + + + + + + + Index: openacs-4/packages/tasks/www/processes.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/processes.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/processes.tcl 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,151 @@ +ad_page_contract { + + Main view page for projects. + + @author jader@bread.com, ncarroll@ee.usyd.edu.au + @creation-date 2003-05-15 + @cvs-id $Id: processes.tcl,v 1.2.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @return title Page title. + @return context Context bar. + @return projects Multirow data set of projects. + @return task_term Terminology for tasks + @return task_term_lower Terminology for tasks (lower case) + @return project_term Terminology for projects + @return project_term_lower Terminology for projects (lower case) +} { + {assignee_id:integer ""} +} -properties { + context:onevalue + processes:multirow + write_p:onevalue + create_p:onevalue + admin_p:onevalue +} + +if { [exists_and_not_null assignee_id] } { + set cancel_url [export_vars -base "/tasks/contact" -url {{party_id $assignee_id}}] +} +# --------------------------------------------------------------- # + +# set up context bar +set context_bar [list "Processes"] + +# the unique identifier for this package +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] + +# permissions +permission::require_permission -party_id $user_id -object_id $package_id -privilege read + +set write_p [permission::permission_p -object_id $package_id -privilege write] +set create_p [permission::permission_p -object_id $package_id -privilege create] +set admin_p [permission::permission_p -object_id $package_id -privilege admin] + +set title "Manage Processes" +set context [list $title] +set actions [list "Add Process" [export_vars -base process-add-edit {assignee_id}] "Add a Process"] +if {[exists_and_not_null assignee_id]} { + lappend actions "Cancel" "$cancel_url" "Cancel" +} + + +if {$admin_p} { + set mode admin +} else { + set mode normal +} + +template::list::create \ + -name processes \ + -multirow processes \ + -key item_id \ + -pass_properties { admin_p } \ + -selected_format $mode \ + -elements { + assign { + label "" + display_template { + Assign + } + } + title { + label "Title" + display_template { + + @processes.title@ + + } + } + description { + label "Description" + } + instances { + label "Times used" + display_template { + @processes.instances@ + } + } + creator_name { + label "Manager" + link_url_eval $creator_url + } + edit { + display_template { + + } + } + delete { + display_template { + + } + } + } -actions $actions \ + -filters { + orderby_process {} + } \ + -orderby { + title {orderby title} + default_value title,desc + } \ + -orderby_name orderby_project \ + -sub_class { + narrow + } -formats { + normal { + label "Assign Layout" + layout table + row { + assign {} + title {} + description {} + creator_name {} + } + } + admin { + label "Admin Layout" + layout table + row { + assign {} + title {} + description {} + creator_name {} + instances {} + edit {} + delete {} + } + } + } + +db_multirow -extend { delete_url creation_date creator_url process_url assign_url} processes process_query { +} { + set delete_url [export_vars -base "process-delete" {process_id assignee_id}] + set creation_date [lc_time_fmt $creation_date_ansi "%x"] + set creator_url [acs_community_member_url -user_id $creation_user] + set process_url [export_vars -base process -url {process_id assignee_id}] + if { [exists_and_not_null assignee_id] } { + set assign_url [export_vars -base process-assign -url {assignee_id process_id}] + } else { + set assign_url $process_url + } +} Index: openacs-4/packages/tasks/www/query.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/query.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/query.xql 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,94 @@ + + + + + +select parties.party_id + from parties left join cr_items on (parties.party_id = cr_items.item_id) left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id ) , group_distinct_member_map + where parties.party_id = group_distinct_member_map.member_id + and group_distinct_member_map.group_id = '11428599' +$search_clause +[template::list::orderby_clause -orderby -name "contacts"] + + + + + +select count(*) + from parties left join cr_items on (parties.party_id = cr_items.item_id) left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id ) , group_distinct_member_map + where parties.party_id = group_distinct_member_map.member_id + and group_distinct_member_map.group_id = '11428599' +$search_clause + + + + + + + select admin_role.pretty_name as admin_role_pretty, + member_role.pretty_name as member_role_pretty + from acs_rel_roles admin_role, acs_rel_roles member_role + where admin_role.role = 'admin' + and member_role.role = 'member' + + + + + + + select title, search_id + from contact_searches + where owner_id = :owner_id + and title is not null + order by lower(title) + + + + + + + select arr.pretty_plural, + art.rel_type as relation_type, + ( select count(distinct gmm.member_id) from group_approved_member_map gmm where gmm.group_id = :group_id and gmm.rel_type = art.rel_type ) as member_count + from acs_rel_types art, + acs_rel_roles arr + where art.rel_type in ( select distinct gmm.rel_type from group_approved_member_map gmm where gmm.group_id = :group_id ) + and art.role_two = arr.role + + + + + + +select contact__name(parties.party_id), + parties.party_id, + cr_revisions.revision_id, + contact__name(parties.party_id,:name_order) as name, + parties.email, + ( select first_names from persons where person_id = party_id ) as first_names, + ( select last_name from persons where person_id = party_id ) as last_name, + ( select name from organizations where organization_id = party_id ) as organization + from parties left join cr_items on (parties.party_id = cr_items.item_id) left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id ) , group_distinct_member_map + where parties.party_id = group_distinct_member_map.member_id + and group_distinct_member_map.group_id = '11428599' +$search_clause +[template::list::page_where_clause -and -name "contacts" -key "party_id"] +[template::list::orderby_clause -orderby -name "contacts"] + + + + + + + select mr.member_state as state, + count(mr.rel_id) as num_contacts + from membership_rels mr, acs_rels r + where r.rel_id = mr.rel_id + and r.object_id_one = :group_id + and r.rel_type = 'membership_rel' + group by mr.member_state + + + + + Index: openacs-4/packages/tasks/www/reassign-task-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/reassign-task-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/reassign-task-postgresql.xql 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,15 @@ + + + + + + update + t_tasks + set + party_id = :reassign_party + where + task_id = :task + + + + \ No newline at end of file Index: openacs-4/packages/tasks/www/reassign-task.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/reassign-task.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/reassign-task.adp 30 Nov 2005 16:06:53 -0000 1.1.2.2 @@ -0,0 +1,5 @@ + +@page_title;noquote@ +@context;noquote@ + + \ No newline at end of file Index: openacs-4/packages/tasks/www/reassign-task.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/reassign-task.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/reassign-task.tcl 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,57 @@ +# packages/tasks/www/reassing-task.tcl + +ad_page_contract { + Reassigns checked tasks to another user + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + @creation-date 2005-10-06 +} { + {return_url ""} + task_id:multiple + reassign_party:optional +} + +set user_id [ad_conn user_id] +set page_title "[_ tasks.Reassign_Tasks]" +set context [list $page_title] + +if { ![exists_and_not_null $return_url] } { + set return_url [get_referrer] +} + +# To display the tasks in the ad_form +set show_tasks [list] +if { [exists_and_not_null task_id] } { + foreach task $task_id { + lappend show_tasks "\#$task" + } + set show_tasks [join $show_tasks ", "] +} + +ad_form -name "reassign" -form { + {task_id:text(hidden) + {value $task_id} + } + {return_url:text(hidden) + {value $return_url} + } + {show_tasks:text(text) + {label "[_ tasks.Tasks]:"} + {value $show_tasks} + {mode display} + } + {reassign_party:party_search(party_search) + {label "[_ tasks.Reassign]:"} + {help_text "[_ tasks.Select_the_user]"} + } +} -on_submit { + + # We are going to reassign the all the checked tasks to the new party_id + foreach task $task_id { + # We need to change the party_id in t_tasks table to reassign the task + db_dml update_t_tasks { } + } + +} -after_submit { + ad_returnredirect $return_url +} \ No newline at end of file Index: openacs-4/packages/tasks/www/task-interval.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/task-interval.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/task-interval.tcl 30 Nov 2005 16:06:53 -0000 1.4.2.2 @@ -0,0 +1,70 @@ +ad_page_contract { + + Simple add/edit form for projects + + @author jader@bread.com, ncarroll@ee.usyd.edu.au + @creation-date 2003-05-15 + @cvs-id $Id: task-interval.tcl,v 1.4.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @return context_bar Context bar. + @return title Page title. + +} { + {party_id:integer,optional} + task_id:integer + status_id:integer,optional + orderby:optional + {return_url ""} + action + days:integer +} -properties { +} + +if { $days != "7" } { + set days 7 +} + + +if { ![exists_and_not_null return_url] } { + set return_url [export_vars -base "contact" -url {party_id orderby status_id}] +} +if { $action == "minus" } { + set operand "-" +} else { + set operand "+" +} + +set package_id [ad_conn package_id] +set title "Add/Edit" +set context [list $title] + +db_1row get_task_info " + select t.title as task, t.description, t.mime_type, t.priority, + to_char((t.due_date $operand '$days days'::interval),'YYYY-MM-DD') as due_date, + t.status_id as status, t.comment, t.assignee_id + from t_tasks t + where t.task_id = :task_id + " + +set task_id [tasks::task::edit \ + -task_id ${task_id} \ + -title ${task} \ + -description ${description} \ + -mime_type $mime_type \ + -comment ${comment} \ + -due_date ${due_date} \ + -status_id ${status} \ + -assignee_id ${assignee_id} \ + -priority ${priority}] + +set task_url [export_vars -base "/tasks/task" -url {task_id party_id status_id orderby}] + +if { $action == "minus" } { + util_user_message -html -message "[_ tasks.task_moved_up]" +} else { + util_user_message -html -message "[_ tasks.task_delayed]" +} + + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/tasks/www/task.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/task.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/task.adp 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,11 @@ + + + + + + + +@party_id@ + + + Index: openacs-4/packages/tasks/www/task.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/task.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/task.tcl 30 Nov 2005 16:06:53 -0000 1.8.2.2 @@ -0,0 +1,284 @@ +ad_page_contract { + + Simple add/edit form for tasks + + @author jader@bread.com, ncarroll@ee.usyd.edu.au + @creation-date 2003-05-15 + @cvs-id $Id: task.tcl,v 1.8.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @return context_bar Context bar. + @return title Page title. + +} { + {party_id:integer,notnull,multiple} + {other_party_ids ""} + task_id:integer,optional + status_id:integer,optional + orderby:optional + {return_url ""} + {assign_party_id ""} + {assignee_id ""} +} -properties { +} + +set party_count [expr [llength $party_id] + [llength $other_party_ids]] +if { $party_count > 1 && ![ad_form_new_p -key "task_id"] } { + ad_return_error "[_ tasks.Not_Allowed]" "[_ tasks.lt_You_are_not_allowed_t]" +} + +if { [llength $party_id] > 1 } { + set real_party_id [lindex $party_id 0] + set other_party_ids [list] + foreach party_id $party_id { + if { $party_id != $real_party_id } { + lappend other_party_ids $party_id + } + } + set party_id $real_party_id +} + +set user_id [ad_maybe_redirect_for_registration] + +# We select the users to use in the assign_party_id element +# on the form to let the user choose who will be assigned to +# the task, plus one blank space that willl be the current party_id +set assign_parties_options [list [list " " $party_id]] +append assign_parties_options " [db_list_of_lists get_all_users { }]" + +# If the assign_party_id is present then we are going to assign +# the task to that party_id + +if { [exists_and_not_null assign_party_id] } { + set all_parties [concat $assign_party_id $other_party_ids] +} else { + set all_parties [concat $party_id $other_party_ids] +} + +set names [list] +foreach party $all_parties { + lappend names [contact::link -party_id $party] +} +set names [join $names ", "] + +if { ![exists_and_not_null return_url] } { + set return_url [export_vars -base "contact" -url {party_id status_id orderby}] +} + +set package_id [ad_conn package_id] + +set title "[_ tasks.AddEdit]" +set context [list $title] + +if { ![ad_form_new_p -key task_id] } { + append edit_buttons [list \ + [list "[_ tasks.Update]" save]�\ + [list "[_ tasks.lt_Update_and_Add_New_Ta]" save_add_another] \ + [list "[_ tasks.Delete]" delete] + ] +} else { + set edit_buttons [list \ + [list "[_ tasks.Add_Task]" save] \ + [list "[_ tasks.lt_Add_Task_and_Add_Anot]" save_add_another] + ] +} + +if { [ns_queryget "formbutton:delete"] != "" } { + ad_returnredirect [export_vars -base "delete" -url {task_id orderby status_id return_url}] + ad_script_abort +} + +set status_options [db_list_of_lists status_options { }] +set status_options [lang::util::localize $status_options] + +ad_form -name add_edit -form { + task_id:key + return_url:text(hidden),optional + orderby:text(hidden),optional + status_id:integer(hidden),optional + party_id:integer(hidden) + other_party_ids:text(hidden),optional + {names:text(hidden),optional {label "[_ tasks.Add_task_to]"}} +} + +if {[exists_and_not_null party_id] && $party_id != $user_id} { + ad_form -extend -name add_edit -form { + {assign_party_id:text(hidden) {value $party_id}} + {assign_party:text(inform),optional + {label "[_ tasks.Add_task_to]"} + {value $names} + } + } +} else { + ad_form -extend -name add_edit -form { + {assign_party_id:text(select),optional + {label "[_ tasks.Add_task_to]"} + {options { $assign_parties_options}} + {help_text "[_ tasks.Select_the_user_to]"} + } + } +} + +ad_form -extend -name add_edit \ + -cancel_url $return_url \ + -cancel_label "[_ tasks.Cancel]" \ + -edit_buttons $edit_buttons \ + -form { + {task_prescribed:text(select),optional + {label "[_ tasks.Standard_Task]"} + {options { + {{} {}} + {{[_ tasks.lt_Delete_from_Recruitin]} {[_ tasks.lt_Delete_from_Recruitin]}} + {{[_ tasks.Follow_Up_Call]} {[_ tasks.Follow_Up_Call]}} + {{[_ tasks.Follow_Up_Email]} {[_ tasks.Follow_Up_Email]}} + {{[_ tasks.Have_they_responded]} {[_ tasks.Have_they_responded]}} + {{[_ tasks.lt_Provide_Promotional_I]} {[_ tasks.lt_Provide_Promotional_I]}} + {{[_ tasks.Send_Letter]} {[_ tasks.Send_Letter]}} + {{[_ tasks.Send_Birthday_Card]} {[_ tasks.Send_Birthday_Card]}} + {{[_ tasks.Send_Class_Schedule]} {[_ tasks.Send_Class_Schedule]}} + {{[_ tasks.lt_Send_Personal_NoteLet]} {[_ tasks.lt_Send_Personal_NoteLet]}} + {{[_ tasks.Send_Web_Info_Card]} {[_ tasks.Send_Web_Info_Card]}} + }} + } + + {task:text(text),optional + {label "[_ tasks.Custom_Task]"} + {html { maxlength 1000 size 80 }} + {help_text "[_ tasks.You_can_either_use]"} + } + + {due_date:text + {label "[_ tasks.Due]"} + {html {id date1 size 10 maxlength 10}} + {help_text "[_ tasks.if_blank_there_is_no]"} + {after_html { \[y-m-d \]}} + } + + {status:text(select) + {label "[_ tasks.Status]"} + {options $status_options} + } + + {priority:integer(select),optional + {label "[_ tasks.Priority]"} + {options {{{3 - [_ tasks.Very_Important]} 3} {{2 - [_ tasks.Important]} 2} {{1 - [_ tasks.Normal]} 1} {{0 - [_ tasks.Not_Important]} 0}}} + } + + {description:text(textarea),optional,nospell + {label "[_ tasks.Notes]"} + {html { rows 6 cols 60 wrap soft}}} + + {comment:text(textarea),optional,nospell + {label "[_ tasks.Comment]"} + {html { rows 6 cols 60 wrap soft}}} + {assignee_id:text(hidden) + {value $assignee_id} + } + } -new_request { + + set title "[_ tasks.Add_Task]" + set context [list $title] + set status "1" + set priority "1" + + } -edit_request { + + db_1row get_task_info { } + set title $task + set context [list $title] + set task_prescribed_p 0 + foreach task_prescribed_option [template::element::get_property add_edit task_prescribed options] { + if { [lindex $task_prescribed_option 0] == $task } { + set task_prescribed_p 1 + } + } + if { $task_prescribed_p } { + set task_prescribed $task + set task "" + } else { + set task_prescribed "" + } + } -validate { +# {end_date {[calendar::date_valid_p -date $end_date]} {This is not a valid date. Either the date doesn't exist or it is not formatted correctly. Correct formatting is: YYYY-MM-DD or YYYYMMDD}} + } -on_submit { + + set task_prescribed [string trim $task_prescribed] + set task [string trim $task] + if { [exists_and_not_null task_prescribed] && [exists_and_not_null task] } { + template::element set_error add_edit task_prescribed "[_ tasks.lt_Standard_tasks_are_ca]" + template::element set_error add_edit task "[_ tasks.lt_Standard_tasks_are_ca]" + } elseif { ![exists_and_not_null task_prescribed] && ![exists_and_not_null task] } { + template::element set_error add_edit task_prescribed "[_ tasks.lt_Either_a_custom_task_]" + template::element set_error add_edit task "[_ tasks.lt_Either_a_custom_task_]" + } elseif { [exists_and_not_null task_prescribed] } { + set task $task_prescribed + } + if { [string is false [::template::form::is_valid add_edit]] } { + break + } + + } -new_data { + + foreach party $all_parties { + set task_id [tasks::task::new \ + -title ${task} \ + -description ${description} \ + -mime_type "text/plain" \ + -comment ${comment} \ + -party_id ${party} \ + -due_date ${due_date} \ + -status_id ${status} \ + -package_id ${package_id} \ + -priority ${priority}] + } + + if { [llength $all_parties] == 1 } { + set task_url [export_vars -base task -url {task_id status_id orderby party_id}] + util_user_message -html -message "[_ tasks.lt_The_task_a_hreftaskst]" + } else { + util_user_message -html -message "[_ tasks.lt_The_task_task_was_add]" + } + + } -edit_data { + + set task_id [tasks::task::edit \ + -task_id ${task_id} \ + -title ${task} \ + -description ${description} \ + -mime_type "text/plain" \ + -comment ${comment} \ + -due_date ${due_date} \ + -status_id ${status} \ + -priority ${priority} \ + -assignee_id ${assignee_id}] + + set task_url [export_vars -base task -url {task_id status_id orderby party_id}] + util_user_message -html -message "[_ tasks.lt_The_task_a_hreftaskst_1]" + + + } -after_submit { + if { ![exists_and_not_null return_url] } { + set return_url [export_vars -url -base "contact" {party_id}] + } + if { [ns_queryget "formbutton:save_add_another"] != "" } { + set return_url [export_vars -url -base "task" {orderby status_id party_id return_url}] + } + ad_returnredirect $return_url + ad_script_abort + + } + +if { ![ad_form_new_p -key task_id] } { + set creation_id [db_string get_it { }] + set creator_url [contact::url -party_id $creation_id] + set creator_name [contact::name -party_id $creation_id] + template::element::create add_edit creator \ + -datatype "text" \ + -widget "inform" \ + -label "" \ + -value "[_ tasks.lt_Originally_created_by]" \ + -optional +} else { + if { $party_count > 1 } { + template::element::set_properties add_edit names widget inform + } +} Index: openacs-4/packages/tasks/www/task.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/task.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/task.xql 30 Nov 2005 16:06:53 -0000 1.2.2.2 @@ -0,0 +1,62 @@ + + + + + + select + case + when + email is not null + then + title||' ('||email||')' + else + title + end, + user_id + from + cc_users + where + user_id <> :user_id + order by + title asc + + + + + + select + title, + status_id + from + t_task_status + order by + status_id + + + + + + select + t.title as task, + t.description, + t.comment, + to_char(t.due_date,'YYYY-MM-DD') as due_date, + t.priority, t.status_id as status, t.object_id, t.assignee_id + from + t_tasks t + where + t.task_id = :task_id + + + + + + select + creation_user + from + acs_objects + where + object_id = :task_id + + + \ No newline at end of file Index: openacs-4/packages/tasks/www/works-task.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/works-task.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/works-task.tcl 30 Nov 2005 16:06:53 -0000 1.1.1.1.2.2 @@ -0,0 +1,269 @@ +ad_page_contract { + + Simple add/edit form for projects + + @author jader@bread.com, ncarroll@ee.usyd.edu.au + @creation-date 2003-05-15 + @cvs-id $Id: works-task.tcl,v 1.1.1.1.2.2 2005/11/30 16:06:53 miguelm Exp $ + + @return context_bar Context bar. + @return title Page title. + +} { + {party_id:integer,notnull,multiple} + task_id:integer,optional + status_id:integer,optional + orderby:optional + {return_url ""} +} -properties { +} + +if { ![exists_and_not_null return_url] } { + set return_url [export_vars -base "contact" -url {party_id orderby status_id}] +} + +set package_id [ad_conn package_id] +set user_id [ad_maybe_redirect_for_registration] +set project_id [tasks::project_id] + +set title "Add/Edit" +set context [list $title] + +if { ![ad_form_new_p -key task_id] } { + append edit_buttons { + {Update save} + {{Update and Add New Task} save_add_another} + {{Delete} delete} + } +} else { + set edit_buttons { + {{Add Task} save} + {{Add Task and Add Another} save_add_another} + } +} + +if { [ns_queryget "formbutton:delete"] != "" } { + ad_returnredirect [export_vars -base "delete" -url {task_id status_id orderby return_url}] + ad_script_abort +} + + +ad_form -name add_edit \ + -cancel_url $return_url \ + -cancel_label "Cancel" \ + -edit_buttons $edit_buttons \ + -form { + task_id:key + return_url:text(hidden),optional + status_id:integer(hidden),optional + orderby:text(hidden),optional + party_id:integer(hidden) + + {task_prescribed:text(select),optional + {label "Standard Task"} + {options { + {{} {}} + {{Delete from Recruiting System} {Delete from Recruiting System}} + {{Follow Up Call} {Follow Up Call}} + {{Follow Up Email} {Follow Up Email}} + {{Have they responded?} {Have they responded?}} + {{Provide Promotional Information} {Provide Promotional Information}} + {{Send Letter} {Send Letter}} + {{Send Birthday Card} {Send Birthday Card}} + {{Send Class Schedule} {Send Class Schedule}} + {{Send Personal Note/Letter} {Send Personal Note/Letter}} + {{Send Web Info Card} {Send Web Info Card}} + }} + } + + {task:text(text),optional + {label "Custom Task"} + {html { maxlength 1000 size 35 }} + {help_text {You can either use a standard task or a custom task, but not both}} + } + + {end_date:text(text) + {label "Due"} + {html {id date1 size 10 maxlength 10}} + {help_text {if blank there is no due date}} + {after_html { + + + }} + } + + {completed_p:text(checkbox),optional + {label "Status"} + {options {{Completed 1}}} + } + + {priority:integer(select),optional + {label "Priority"} + {options {{{3 - Very Important} 3} {{2 - Important} 2} {{1 - Normal} 1} {{0 - Not Important} 0}}} + } + + {description:text(textarea),optional,nospell + {label "Notes"} + {html { rows 6 cols 60 wrap soft}}} + + } -new_request { + + set title "Add Task" + set context [list $title] + set status_id "1" + set priority "1" + + } -edit_request { + + db_1row get_task_info { + select ci.item_id as task_id, + cr.title as task, + to_char(ptr.end_date,'YYYY-MM-DD') as end_date, + ptr.percent_complete, + ptr.priority, + cr.description + from pm_tasks_revisions ptr, + cr_revisions cr, + cr_items ci + where ci.item_id = :task_id + and ci.latest_revision = ptr.task_revision_id + and ci.live_revision = ptr.task_revision_id + and ptr.task_revision_id = cr.revision_id + + } + if { $percent_complete >= "100" } { + set completed_p "1" + } + set title ${task} + set context [list $title] + set task_prescribed_p 0 + foreach task_prescribed_option [template::element::get_property add_edit task_prescribed options] { + if { [lindex $task_prescribed_option 0] == $task } { + set task_prescribed_p 1 + } + } + if { $task_prescribed_p } { + set task_prescribed $task + set task "" + } else { + set task_prescribed "" + set task $task + } + } -validate { + {end_date {[calendar::date_valid_p -date $end_date]} {This is not a valid date. Either the date doesn't exist or it is not formatted correctly. Correct formatting is: YYYY-MM-DD or YYYYMMDD}} + } -on_submit { + set task_prescribed [string trim $task_prescribed] + set task [string trim $task] + if { [exists_and_not_null task_prescribed] && [exists_and_not_null task] } { + template::element set_error add_edit task_prescribed "Standard tasks are cannot be used in conjunction with custom tasks" + template::element set_error add_edit task "Standard tasks are cannot be used in conjunction with custom tasks" + } elseif { ![exists_and_not_null task_prescribed] && ![exists_and_not_null task] } { + template::element set_error add_edit task_prescribed "Either a custom task or standard task is required" + template::element set_error add_edit task "Either a custom task or standard task is required" + } elseif { [exists_and_not_null task_prescribed] } { + set task $task_prescribed + } + if { [string is false [::template::form::is_valid add_edit]] } { + break + } + + set user_id [ad_conn user_id] + set peeraddr [ad_conn peeraddr] + if { $completed_p == "1" } { + set percent_complete "100" + } else { + set percent_complete "0" + } + } -new_data { + + set task_id [pm::task::new -project_id ${project_id} \ + -title ${task} \ + -description ${description} \ + -mime_type "text/plain" \ + -end_date ${end_date} \ + -percent_complete ${percent_complete} \ + -creation_user ${user_id} \ + -creation_ip ${peeraddr} \ + -package_id ${package_id} \ + -priority ${priority}] + pm::task::assign -task_item_id $task_id -party_id $party_id + + set task_url [export_vars -base task -url {task_id status_id orderby party_id}] + util_user_message -html -message "The task $task was added" + + } -edit_data { + + if {$percent_complete >= 100} { + set task_status_id [pm::task::default_status_closed] + } elseif {$percent_complete < 100} { + set task_status_id [pm::task::default_status_open] + } + set task_item_id $task_id + set project_item_id $project_id + set title $task + set mime_type "text/plain" + set estimated_hours_work "" + set estimated_hours_work_min "" + set estimated_hours_work_max "" + set actual_hours_worked "" + set update_user $user_id + set update_ip $peeraddr + + db_exec_plsql new_task_revision " + select pm_task__new_task_revision ( + :task_item_id, + :project_item_id, + :title, + :description, + :mime_type, + [pm::util::datenvl -value $end_date -value_if_null "null" -value_if_not_null ":end_date"], + :percent_complete, + :estimated_hours_work, + :estimated_hours_work_min, + :estimated_hours_work_max, + :actual_hours_worked, + :task_status_id, + current_timestamp, + :update_user, + :update_ip, + :package_id, + :priority) + " + + set task_url [export_vars -base task -url {task_id status_id orderby party_id}] + util_user_message -html -message "The task $title was updated" + + + } -after_submit { + if { ![exists_and_not_null return_url] } { + set return_url [export_vars -url -base "contact" {party_id}] + } + if { [ns_queryget "formbutton:save_add_another"] != "" } { + set return_url [export_vars -url -base "task" {orderby status_id party_id return_url}] + } + ad_returnredirect $return_url + ad_script_abort + + } + +if { ![ad_form_new_p -key task_id] } { + set creation_id [db_string get_it { select creation_user from acs_objects where object_id = :task_id }] + template::element::create add_edit creator \ + -datatype "text" \ + -widget "inform" \ + -label "" \ + -value "Originally created by [contact::name -party_id $creation_id]" \ + -optional +} Index: openacs-4/packages/tasks/www/resources/tasks.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/resources/tasks.css,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/tasks/www/resources/tasks.css 30 Nov 2005 16:06:53 -0000 1.1.2.2 @@ -0,0 +1,115 @@ +/*------- For Portlets ----------*/ + +td.highlighted { + background-color:#ddddff; +} + +td.highlight { + background-color:#ffffdd; + border-bottom: 1px dotted #A0BDEB; +} + +td.subheader { + background-color:#ffffdd; + border-top: 1px dotted #e6e6fa; + border-bottom: 1px dotted #e6e6fa; + border-left: 1px solid #e6e6fa; +} + +td.list-bg { + border-left: 1px solid #e6e6fa; +} + +td.list-bottom-bg { + border-bottom: 1px solid #e6e6fa; + border-left: 1px solid #e6e6fa; +} + +td.list-right-bg { + border-bottom: 1px solid #e6e6fa; + border-right: 1px solid #e6e6fa; +} + +th.project { + background-color:#9999cc; +} + +td.project-filter-pane { + background-color: #bbbbee; + vertical-align: top; +} + +.shaded { + background-color: #dddddd; +} + +.selected { + background-color: #eeccdd; +} + +th { + font-size: 9pt; + text-align: left; + background-color:dfdfff; +} + + +/* From logger */ + +table.logger_navbar { + background-color: #41329c; + clear: both; +} +a.logger_navbar { + color: white; + text-decoration: none; +} +a.logger_navbar:visited { + color: white; +} +a.logger_navbar:hover { + color: white; + text-decoration: underline; +} +td.logger_navbar { + font-family: tahoma,verdana,arial,helvetica; + font-size: 70%; + font-weight: bold; + color: #ccccff; + text-decoration: none; +} + +td.fill-list-right { + border-bottom: 3px solid #A0BDEB; + border-right: 1px solid #A0BDEB; + background-color: #eaf2ff; +} + +td.fill-list-right2 { + border-right: 1px solid #A0BDEB; + background-color: #eaf2ff; +} + +td.fill-list-bottom { + border-bottom: 3px solid #A0BDEB; + border-left: 1px solid #A0BDEB; + background-color: #eaf2ff; +} + +td.fill-list-middle { + border-left: 1px solid #A0BDEB; + background-color: #eaf2ff; +} + +td.fill-list-bg { + background-color: #eaf2ff; +} + +#search-block { + border:1px solid #000; + background-color: #EAF2FF; + padding:5px; + width:70%; +} + +/* ----------- End of Portlets -------*/