Index: openacs-4/contrib/packages/project-manager/www/task-select-project.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/task-select-project.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/project-manager/www/task-select-project.tcl 27 Apr 2004 00:49:29 -0000 1.3 +++ openacs-4/contrib/packages/project-manager/www/task-select-project.tcl 6 May 2004 17:58:17 -0000 1.4 @@ -14,13 +14,17 @@ } { {process_id:integer ""} - {return_url ""} + {return_url "index"} + {status_type "o"} + {searchterm ""} + {orderby ""} } -properties { context_bar:onevalue title:onevalue choices:onevalue + searchterm_copy:onevalue } -validate { } -errors { @@ -31,6 +35,13 @@ set user_id [ad_maybe_redirect_for_registration] set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege write + +if {[empty_string_p $searchterm]} { + unset searchterm +} + + # terminology set project_term [parameter::get -parameter "ProjectName" -default "Project"] set task_term [parameter::get -parameter "TaskName" -default "Task"] @@ -40,10 +51,18 @@ set title "Select a $project_term to assign this $task_term to" +if {![exists_and_not_null searchterm]} { + set searchterm_copy "" + set searchterm_where_clause "" +} else { + set searchterm_copy $searchterm + set searchterm_where_clause "upper(p.title) like upper('%$searchterm%')" +} + if {[exists_and_not_null process_id]} { - set context_bar [ad_context_bar [list "processes" "Processes"] "Use"] + set context [list [list "processes" "Processes"] "Use"] } else { - set context_bar [ad_context_bar [list "tasks" "Tasks"] "Select Project"] + set context [list [list "tasks" "Tasks"] "Select Project"] } # need to change this to show all the projects you're on by @@ -52,12 +71,77 @@ set root_folder [db_string get_root "select pm_project__get_root_folder (:package_id, 'f')"] -set export_vars [export_vars -url {process_id return_url}] +set hidden_vars [export_vars -form {process_id return_url}] -db_foreach select_a_project { } -column_array proj { - append choices "$proj(project_name) $proj(description)
" -} if_no_rows { - append choices "No open projects to add tasks to" -} +template::list::create \ + -name projects \ + -multirow projects \ + -key project_item_id \ + -elements { + customer_name { + label "Customer" + } + project_item_id { + label "Project" + link_url_col item_url + display_template "@projects.project_name@" + } + description { + label "Description" + display_template "@projects.description_html;noquote@" + } + } \ + -sub_class { + narrow + } \ + -filters { + customer_name { + label "Customer" + where_clause {p.organization_id = :customer_id} + } + searchterm { + label "Project Search term" + where_clause $searchterm_where_clause + } + + status_type { + label "Status" + values {{"Open" o} {"Closed" c}} + where_clause { + s.status_type = :status_type + } + } + return_url { + hide_p 1 + } + } \ + -orderby { + default_value customer_name,asc + project_item_id { + label "Project" + orderby_desc "upper(p.title) desc" + orderby_asc "upper(p.title) asc" + default_direction asc + } + customer_name { + label "Customer" + orderby_desc "upper(o.name) desc, upper(p.title) desc" + orderby_asc "upper(o.name) asc, upper(p.title) asc" + default_direction asc + } + } \ + -orderby_name orderby \ + -html { + width 100% + } + +db_multirow -extend { item_url description_html } projects select_a_project { +} { + set item_url [export_vars -base "task-add-edit" {project_item_id process_id return_url}] + + set richtext_list [list $description $mime_type] + set description_html [template::util::richtext::get_property html_value $richtext_list] +} +