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 --- openacs-4/packages/tasks/www/delete.adp 27 Jul 2005 13:45:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ - - @title@ - @context@ - -

@question@

-

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

- 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 --- openacs-4/packages/tasks/www/mark-completed.adp 27 Jul 2005 13:45:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ - -@title@ -@context@ - -

@question@

-

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

- 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 --- openacs-4/packages/tasks/www/old-process-assign.adp 27 Jul 2005 13:44:59 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ - -@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 --- openacs-4/packages/tasks/www/process-add-edit-oracle.xql 27 Jul 2005 13:44:59 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,47 +0,0 @@ - - - - - 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-instances.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-instances.adp,v diff -u -N --- openacs-4/packages/tasks/www/process-instances.adp 27 Jul 2005 13:45:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,6 +0,0 @@ - - @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 --- openacs-4/packages/tasks/www/process-instances.tcl 27 Jul 2005 13:45:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,73 +0,0 @@ -# - -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 2005/07/27 13:45:00 maltes 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 --- openacs-4/packages/tasks/www/process-instances.xql 27 Jul 2005 13:45:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,38 +0,0 @@ - - - - - - - - - - - - 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.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-interval.tcl,v diff -u -N --- openacs-4/packages/tasks/www/process-interval.tcl 27 Jul 2005 13:44:59 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,126 +0,0 @@ -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 2005/07/27 13:44:59 maltes 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 --- openacs-4/packages/tasks/www/process-one-oracle.xql 27 Jul 2005 13:45:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,22 +0,0 @@ - - - - - - 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 --- openacs-4/packages/tasks/www/process-oracle.xql 27 Jul 2005 13:44:59 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,17 +0,0 @@ - - -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 --- openacs-4/packages/tasks/www/process-reminder.tcl 27 Jul 2005 13:44:59 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,25 +0,0 @@ -# - -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 2005/07/27 13:44:59 maltes 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-use-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/process-use-oracle.xql,v diff -u -N --- openacs-4/packages/tasks/www/process-use-oracle.xql 27 Jul 2005 13:44:59 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,13 +0,0 @@ - - - - - - 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 --- openacs-4/packages/tasks/www/process-use-postgresql.xql 27 Jul 2005 13:44:59 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ - - - - - - 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 --- openacs-4/packages/tasks/www/process-use.adp 27 Jul 2005 13:45:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,9 +0,0 @@ - -@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 --- openacs-4/packages/tasks/www/process-use.tcl 27 Jul 2005 13:45:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,64 +0,0 @@ -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 2005/07/27 13:45:00 maltes 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/processes-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/processes-oracle.xql,v diff -u -N --- openacs-4/packages/tasks/www/processes-oracle.xql 27 Jul 2005 13:44:59 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,17 +0,0 @@ - - -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/query.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/query.xql,v diff -u -N --- openacs-4/packages/tasks/www/query.xql 27 Jul 2005 13:45:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,94 +0,0 @@ - - - - - -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 --- openacs-4/packages/tasks/www/reassign-task-postgresql.xql 16 Nov 2005 14:36:20 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ - - - - - - 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 --- openacs-4/packages/tasks/www/reassign-task.adp 6 Oct 2005 16:32:53 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,5 +0,0 @@ - -@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 --- openacs-4/packages/tasks/www/reassign-task.tcl 16 Nov 2005 14:35:00 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,57 +0,0 @@ -# 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 --- openacs-4/packages/tasks/www/task-interval.tcl 17 Nov 2005 16:04:39 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,70 +0,0 @@ -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 2005/11/17 16:04:39 maltes 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/works-task.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/www/Attic/works-task.tcl,v diff -u -N --- openacs-4/packages/tasks/www/works-task.tcl 27 Jul 2005 13:45:00 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,269 +0,0 @@ -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 2005/07/27 13:45:00 maltes 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 -}