Index: openacs-4/packages/bug-tracker/lib/version-bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/lib/version-bar.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/lib/version-bar.tcl 3 May 2002 16:29:59 -0000 1.1 +++ openacs-4/packages/bug-tracker/lib/version-bar.tcl 28 Aug 2002 15:44:18 -0000 1.2 @@ -2,8 +2,8 @@ # Project info -set current_version_id [bt_conn current_version_id] -set current_version_name [bt_conn current_version_name] +set current_version_id [bug_tracker::conn current_version_id] +set current_version_name [bug_tracker::conn current_version_name] # User info (user may not be logged in) @@ -12,10 +12,10 @@ set return_url "[ad_conn url][ad_decode [ad_conn query] "" "" "?[ad_conn query]"]" set login_url "/register/?[export_vars -url { return_url }]" -set user_version_id [bt_conn user_version_id] -set user_version_name [bt_conn user_version_name] -set user_first_names [bt_conn user_first_names] -set user_last_name [bt_conn user_last_name] +set user_version_id [bug_tracker::conn user_version_id] +set user_version_name [bug_tracker::conn user_version_name] +set user_first_names [bug_tracker::conn user_first_names] +set user_last_name [bug_tracker::conn user_last_name] Index: openacs-4/packages/bug-tracker/tcl/bug-tracker-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/tcl/bug-tracker-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/tcl/bug-tracker-procs.tcl 31 Jul 2002 22:57:41 -0000 1.2 +++ openacs-4/packages/bug-tracker/tcl/bug-tracker-procs.tcl 28 Aug 2002 15:44:18 -0000 1.3 @@ -1,630 +1,592 @@ +ad_library { -ad_proc bt_conn { args } { + Bug Tracker Library - global bt_conn + @creation-date 2002-05-03 + @author Lars Pind + @cvs-id $Id$ - set flag [lindex $args 0] - if { [string index $flag 0] != "-" } { - set var $flag - set flag "-get" - } else { - set var [lindex $args 1] - } +} - switch -- $flag { - -set { - set bt_conn($var) [lindex $args 2] - } +namespace eval bug_tracker { - -get { - if { [info exists bt_conn($var)] } { - return $bt_conn($var) - } else { - switch -- $var { - project_name - project_description - current_version_id - current_version_name { - array set info [bt_get_project_info] - foreach name [array names info] { - set bt_conn($name) $info($name) - } - return $bt_conn($var) - } - user_first_names - user_last_name - user_email - user_version_id - user_version_name { - if { [ad_conn user_id] == 0 } { - return "" - } else { - array set info [bt_get_user_prefs] + ad_proc conn { args } { + + global bt_conn + + set flag [lindex $args 0] + if { [string index $flag 0] != "-" } { + set var $flag + set flag "-get" + } else { + set var [lindex $args 1] + } + + switch -- $flag { + -set { + set bt_conn($var) [lindex $args 2] + } + + -get { + if { [info exists bt_conn($var)] } { + return $bt_conn($var) + } else { + switch -- $var { + project_name - project_description - current_version_id - current_version_name { + array set info [get_project_info] foreach name [array names info] { set bt_conn($name) $info($name) } return $bt_conn($var) } + user_first_names - user_last_name - user_email - user_version_id - user_version_name { + if { [ad_conn user_id] == 0 } { + return "" + } else { + array set info [get_user_prefs] + foreach name [array names info] { + set bt_conn($name) $info($name) + } + return $bt_conn($var) + } + } + default { + error "Unknown variable $var" + } } - default { - error "Unknown variable $var" - } } } + + default { + error "bt_conn: unknown flag $flag" + } } - - default { - error "bt_conn: unknown flag $flag" - } } -} - -##### -# -# Cached project info procs -# -##### - -ad_proc bt_get_project_info_internal { - package_id -} { - set found_p [db_0or1row project_info { - select pck.instance_name as project_name, - prj.description as project_description, - ver.version_id as current_version_id, - coalesce(ver.version_name, 'None') as current_version_name - from apm_packages pck, - bt_projects prj - left outer join bt_versions ver - on (ver.project_id = prj.project_id and active_version_p = 't') - where pck.package_id = :package_id - and prj.project_id = pck.package_id - } -column_array result] - if { !$found_p } { - set count [db_string count_project { select count(*) from bt_projects where project_id = :package_id }] - if { $count == 0 } { - db_exec_plsql create_project { - select bt_project__new(:package_id) + ##### + # + # Cached project info procs + # + ##### + + ad_proc get_project_info_internal { + package_id + } { + set found_p [db_0or1row project_info { + select pck.instance_name as project_name, + prj.description as project_description, + ver.version_id as current_version_id, + coalesce(ver.version_name, 'None') as current_version_name + from apm_packages pck, + bt_projects prj + left outer join bt_versions ver + on (ver.project_id = prj.project_id and active_version_p = 't') + where pck.package_id = :package_id + and prj.project_id = pck.package_id + } -column_array result] + + if { !$found_p } { + set count [db_string count_project { select count(*) from bt_projects where project_id = :package_id }] + if { $count == 0 } { + db_exec_plsql create_project { + select bt_project__new(:package_id) + } + # we call ourselves again, so we'll get the info this time + return [get_project_info_internal $package_id] + } else { + error "Couldn't find project in database" } - # we call ourselves again, so we'll get the info this time - return [bt_get_project_info_internal $package_id] } else { - error "Couldn't find project in database" + return [array get result] } - } else { - return [array get result] } -} - -ad_proc bt_get_project_info { - -package_id -} { - if { ![info exists package_id] } { - set package_id [ad_conn package_id] + + ad_proc get_project_info { + -package_id + } { + if { ![info exists package_id] } { + set package_id [ad_conn package_id] + } + + # temp hack: don't cache + return [get_project_info_internal $package_id] + + # return [util_memoize "bt_get_project_info_internal $package_id"] } - - # temp hack: don't cache - return [bt_get_project_info_internal $package_id] - - # return [util_memoize "bt_get_project_info_internal $package_id"] -} - -ad_proc bt_set_project_name { - -package_id - project_name -} { - if { ![info exists package_id] } { - set package_id [ad_conn package_id] - } - db_dml project_name_update { - update apm_packages - set instance_name = :project_name - where package_id = :package_id + ad_proc set_project_name { + -package_id + project_name + } { + if { ![info exists package_id] } { + set package_id [ad_conn package_id] + } + + db_dml project_name_update { + update apm_packages + set instance_name = :project_name + where package_id = :package_id + } + + # Flush cache + util_memoize_flush "bt_get_project_info_internal $package_id" } - # Flush cache - util_memoize_flush "bt_get_project_info_internal $package_id" -} - - - - -##### -# -# Cached user prefs procs -# -##### - -ad_proc bt_get_user_prefs_internal { - package_id - user_id -} { - set found_p [db_0or1row user_info { - select u.first_names as user_first_names, - u.last_name as user_last_name, - u.email as user_email, - ver.version_id as user_version_id, - coalesce(ver.version_name, 'None') as user_version_name - from cc_users u, - bt_user_prefs up - left outer join bt_versions ver - on (ver.version_id = up.user_version) - where u.user_id = :user_id - and up.user_id = u.user_id - and up.project_id = :package_id - } -column_array result] - - if { !$found_p } { - set count [db_string count_user_prefs { select count(*) from bt_user_prefs where project_id = :package_id and user_id = :user_id }] - if { $count == 0 } { - db_dml create_user_prefs { - insert into bt_user_prefs (user_id, project_id) values (:user_id, :package_id) + + + + ##### + # + # Cached user prefs procs + # + ##### + + ad_proc get_user_prefs_internal { + package_id + user_id + } { + set found_p [db_0or1row user_info { + select u.first_names as user_first_names, + u.last_name as user_last_name, + u.email as user_email, + ver.version_id as user_version_id, + coalesce(ver.version_name, 'None') as user_version_name + from cc_users u, + bt_user_prefs up + left outer join bt_versions ver + on (ver.version_id = up.user_version) + where u.user_id = :user_id + and up.user_id = u.user_id + and up.project_id = :package_id + } -column_array result] + + if { !$found_p } { + set count [db_string count_user_prefs { select count(*) from bt_user_prefs where project_id = :package_id and user_id = :user_id }] + if { $count == 0 } { + db_dml create_user_prefs { + insert into bt_user_prefs (user_id, project_id) values (:user_id, :package_id) + } + # we call ourselves again, so we'll get the info this time + return [get_user_prefs_internal $package_id $user_id] + } else { + error "Couldn't find user in database" } - # we call ourselves again, so we'll get the info this time - return [bt_get_user_prefs_internal $package_id $user_id] } else { - error "Couldn't find user in database" + return [array get result] } - } else { - return [array get result] } -} - -ad_proc bt_get_user_prefs { - -package_id - -user_id -} { - if { ![info exists package_id] } { - set package_id [ad_conn package_id] + + ad_proc get_user_prefs { + -package_id + -user_id + } { + if { ![info exists package_id] } { + set package_id [ad_conn package_id] + } + + if { ![info exists user_id] } { + set user_id [ad_conn user_id] + } + + # temp hack: don't cache + return [get_user_prefs_internal $package_id $user_id] + + # return [util_memoize "bt_get_user_prefs_internal $package_id $user_id"] } - - if { ![info exists user_id] } { - set user_id [ad_conn user_id] + + + ##### + # + # Bug Types + # + ##### + + ad_proc bug_type_get_options {} { + return { { "Bug" bug } { "Suggestion" suggestion } { "Todo" todo } } } - - # temp hack: don't cache - return [bt_get_user_prefs_internal $package_id $user_id] - - # return [util_memoize "bt_get_user_prefs_internal $package_id $user_id"] -} - - -##### -# -# Bug Types -# -##### - -ad_proc bt_bug_type_get_options {} { - return { { "Bug" bug } { "Suggestion" suggestion } { "Todo" todo } } -} - -ad_proc bt_bug_type_pretty { - bug_type -} { - array set bug_types { - bug "Bug" - suggestion "Suggestion" - todo "Todo" + + ad_proc bug_type_pretty { + bug_type + } { + array set bug_types { + bug "Bug" + suggestion "Suggestion" + todo "Todo" + } + if { [info exists bug_types($bug_type)] } { + return $bug_types($bug_type) + } else { + return "" + } } - if { [info exists bug_types($bug_type)] } { - return $bug_types($bug_type) - } else { - return "" + + + ##### + # + # Status + # + ##### + + ad_proc status_get_options {} { + return { { "Open" open } { "Resolved" resolved } { "Closed" closed } } } -} - - -##### -# -# Status -# -##### - -ad_proc bt_status_get_options {} { - return { { "Open" open } { "Resolved" resolved } { "Closed" closed } } -} - -ad_proc bt_status_pretty { - status -} { - array set status_codes { - open "Open" - resolved "Resolved" - closed "Closed" + + ad_proc status_pretty { + status + } { + array set status_codes { + open "Open" + resolved "Resolved" + closed "Closed" + } + if { [info exists status_codes($status)] } { + return $status_codes($status) + } else { + return "" + } } - if { [info exists status_codes($status)] } { - return $status_codes($status) - } else { - return "" + + + + ##### + # + # Resolution + # + ##### + + ad_proc resolution_get_options {} { + return { + { "Fixed" fixed } { "By Design" bydesign } { "Won't Fix" wontfix } { "Postponed" postponed } + { "Duplicate" duplicate } { "Not Reproducable" norepro } + } } -} - - - -##### -# -# Resolution -# -##### - -ad_proc bt_resolution_get_options {} { - return { - { "Fixed" fixed } { "By Design" bydesign } { "Won't Fix" wontfix } { "Postponed" postponed } - { "Duplicate" duplicate } { "Not Reproducable" norepro } + + ad_proc resolution_pretty { + resolution + } { + array set resolution_codes { + fixed "Fixed" + bydesign "By Design" + wontfix "Won't Fix" + postponed "Postponed" + duplicate "Duplicate" + norepro "Not Reproducable" + } + if { [info exists resolution_codes($resolution)] } { + return $resolution_codes($resolution) + } else { + return "" + } } -} - -ad_proc bt_resolution_pretty { - resolution -} { - array set resolution_codes { - fixed "Fixed" - bydesign "By Design" - wontfix "Won't Fix" - postponed "Postponed" - duplicate "Duplicate" - norepro "Not Reproducable" + + + + ##### + # + # Severity/Priority codes + # + ##### + + ad_proc severity_codes_get_options { + } { + set package_id [ad_conn package_id] + + set severity_list [db_list_of_lists severities { + select sort_order || ' - ' || severity_name, severity_id + from bt_severity_codes + where project_id = :package_id + order by sort_order + }] + + return $severity_list } - if { [info exists resolution_codes($resolution)] } { - return $resolution_codes($resolution) - } else { - return "" + + ad_proc severity_get_default { + } { + set package_id [ad_conn package_id] + + set default_severity_id [db_string default_severity { + select severity_id + from bt_severity_codes + where project_id = :package_id + and default_p = 't' + order by sort_order + limit 1 + } -default ""] + + return $default_severity_id } -} - - - -##### -# -# Severity/Priority codes -# -##### - -ad_proc bt_severity_codes_get_options { -} { - set package_id [ad_conn package_id] - set severity_list [db_list_of_lists severities { - select sort_order || ' - ' || severity_name, severity_id - from bt_severity_codes - where project_id = :package_id - order by sort_order - }] + ad_proc priority_codes_get_options { + } { + set package_id [ad_conn package_id] - return $severity_list -} - -ad_proc bt_severity_get_default { -} { - set package_id [ad_conn package_id] + set priority_list [db_list_of_lists priorities { + select sort_order || ' - ' || priority_name, priority_id + from bt_priority_codes + where project_id = :package_id + order by sort_order + }] + + return $priority_list + } - set default_severity_id [db_string default_severity { - select severity_id - from bt_severity_codes - where project_id = :package_id - and default_p = 't' - order by sort_order - limit 1 - } -default ""] + ad_proc priority_get_default { + } { + set package_id [ad_conn package_id] + + set default_priority_id [db_string default_priority { + select priority_id + from bt_priority_codes + where project_id = :package_id + and default_p = 't' + order by sort_order + limit 1 + } -default ""] + + return $default_priority_id + } - return $default_severity_id -} - -ad_proc bt_priority_codes_get_options { -} { - set package_id [ad_conn package_id] - set priority_list [db_list_of_lists priorities { - select sort_order || ' - ' || priority_name, priority_id - from bt_priority_codes - where project_id = :package_id - order by sort_order - }] - return $priority_list -} - -ad_proc bt_priority_get_default { -} { - set package_id [ad_conn package_id] + ##### + # + # Versions + # + ##### - set default_priority_id [db_string default_priority { - select priority_id - from bt_priority_codes - where project_id = :package_id - and default_p = 't' - order by sort_order - limit 1 - } -default ""] + ad_proc version_get_options { + -include_unknown:boolean + -include_undecided:boolean + } { + set package_id [ad_conn package_id] + + set versions_list [db_list_of_lists versions \ + { select version_name, version_id from bt_versions where project_id = :package_id order by version_name }] - return $default_priority_id -} - - - -##### -# -# Versions -# -##### - -ad_proc bt_version_get_options { - -include_unknown:boolean - -include_undecided:boolean -} { - set package_id [ad_conn package_id] + if { $include_unknown_p } { + set versions_list [concat { { "Unknown" "" } } $versions_list] + } + + if { $include_undecided_p } { + set versions_list [concat { { "Undecided" "" } } $versions_list] + } + + return $versions_list + } - set versions_list [db_list_of_lists versions \ - { select version_name, version_id from bt_versions where project_id = :package_id order by version_name }] - - if { $include_unknown_p } { - set versions_list [concat { { "Unknown" "" } } $versions_list] - } - if { $include_undecided_p } { - set versions_list [concat { { "Undecided" "" } } $versions_list] - } + ##### + # + # Components + # + ##### - return $versions_list -} - - -##### -# -# Components -# -##### - -ad_proc bt_components_get_options { - -include_unknown:boolean -} { - set package_id [ad_conn package_id] - - set components_list [db_list_of_lists components \ - { select component_name, component_id from bt_components where project_id = :package_id order by component_name }] - - if { $include_unknown_p } { - set components_list [concat { { "Unknown" "" } } $components_list] - } + ad_proc components_get_options { + -include_unknown:boolean + } { + set package_id [ad_conn package_id] - return $components_list -} - - -##### -# -# Description -# -##### - -ad_proc bt_bug_convert_comment_to_html { - -comment - -format -} { - switch $format { - html { - return [ad_html_text_convert -from html -to html -- $comment] + set components_list [db_list_of_lists components \ + { select component_name, component_id from bt_components where project_id = :package_id order by component_name }] + + if { $include_unknown_p } { + set components_list [concat { { "Unknown" "" } } $components_list] + } + + return $components_list + } + + + ##### + # + # Description + # + ##### + + ad_proc bug_convert_comment_to_html { + -comment + -format + } { + switch $format { + html { + return [ad_html_text_convert -from html -to html -- $comment] + } + pre { + return "
[ad_html_text_convert -from html -to html -- $comment]
" + } + default { + return [ad_html_text_convert -from text -to html -- $comment] + } } - pre { - return "
[ad_html_text_convert -from text -to html -- $comment]
" + } + + ad_proc bug_convert_comment_to_text { + -comment + -format + } { + switch $format { + html { + return [ad_html_text_convert -from html -to text -- $comment] + } + default { + return [ad_html_text_convert -from text -to text -- $comment] + } } - default { - return [ad_html_text_convert -from text -to html -- $comment] - } } -} - -ad_proc bt_bug_convert_comment_to_text { - -comment - -format -} { - switch $format { - html { - return [ad_html_text_convert -from html -to text -- $comment] + + ##### + # + # Actions + # + ##### + + ad_proc bug_action_pretty { + action + } { + array set action_codes { + open "Opened" + edit "Edited" + reassign "Reassigned" + comment "Comment" + resolve "Resolved" + reopen "Reopened" + close "Closed" } - default { - return [ad_html_text_convert -from text -to text -- $comment] + if { [info exists action_codes($action)] } { + return $action_codes($action) + } else { + return "" } + } + + ##### + # + # Users (assignee) + # + ##### + + ad_proc users_get_options { + -include_unassigned:boolean + } { + set users_list [db_list_of_lists users \ + { select first_names || ' ' || last_name, user_id from cc_users order by first_names, last_name }] + + if { $include_unassigned_p } { + set users_list [concat { { "Unassigned" "" } } $users_list] + } + + return $users_list } -} - -##### -# -# Actions -# -##### - -ad_proc bt_bug_action_pretty { - action -} { - array set action_codes { - open "Opened" - edit "Edited" - reassign "Reassigned" - comment "Commented added" - resolve "Resolved" - reopen "Reopened" - close "Closed" - } - if { [info exists action_codes($action)] } { - return $action_codes($action) - } else { - return "" - } -} - - -##### -# -# Comment widget -# -##### - -ad_proc -public template::widget::comment { element_reference tag_attributes } { - - upvar $element_reference element - - if { [info exists element(html)] } { - array set attributes $element(html) - } - - array set attributes $tag_attributes - - set output {} - - if { [info exists element(history)] } { - append output "$element(history)" - } - - if { [info exists element(header)] } { - append output "

$element(header)

" - } - - append output "" - - return $output -} - -##### -# -# Users (assignee) -# -##### - -ad_proc bt_users_get_options { - -include_unassigned:boolean -} { - set users_list [db_list_of_lists users \ - { select first_names || ' ' || last_name, user_id from cc_users order by first_names, last_name }] - - if { $include_unassigned_p } { - set users_list [concat { { "Unassigned" "" } } $users_list] - } - return $users_list -} - - -##### -# -# Notification -# -##### - -ad_proc bt_bug_notify { - bug_id - action - comment - comment_format -} { - ns_log Notice "bug_id = $bug_id" - - set package_id [ad_conn package_id] - - db_1row bug { - select b.bug_id, - b.bug_number, - b.summary, - o.creation_user as submitter_user_id, - submitter.first_names as submitter_first_names, - submitter.last_name as submitter_last_name, - submitter.email as submitter_email, - b.component_id, - c.component_name, - o.creation_date, - to_char(o.creation_date, 'fmMM/DDfm/YYYY') as creation_date_pretty, - b.severity, - sc.sort_order || ' - ' || sc.severity_name as severity_pretty, - b.priority, - pc.sort_order || ' - ' || pc.priority_name as priority_pretty, - b.status, - b.resolution, - b.bug_type, - b.user_agent, - b.original_estimate_minutes, - b.latest_estimate_minutes, - b.elapsed_time_minutes, - b.found_in_version, - coalesce((select version_name - from bt_versions found_in_v - where found_in_v.version_id = b.found_in_version), 'Unknown') as found_in_version_name, - b.fix_for_version, - coalesce((select version_name - from bt_versions fix_for_v - where fix_for_v.version_id = b.fix_for_version), 'Undecided') as fix_for_version_name, - b.fixed_in_version, - coalesce((select version_name - from bt_versions fixed_in_v - where fixed_in_v.version_id = b.fixed_in_version), 'Unknown') as fixed_in_version_name, - b.assignee as assignee_user_id, - assignee.first_names as assignee_first_names, - assignee.last_name as assignee_last_name, - assignee.email as assignee_email, - to_char(now(), 'fmMM/DDfm/YYYY') as now_pretty - from bt_bugs b left outer join - cc_users assignee on (assignee.user_id = b.assignee), - acs_objects o, - bt_components c, - bt_priority_codes pc, - bt_severity_codes sc, - cc_users submitter - where b.bug_id = :bug_id - and b.project_id = :package_id - and o.object_id = b.bug_id - and c.component_id = b.component_id - and pc.priority_id = b.priority - and sc.severity_id = b.severity - and submitter.user_id = o.creation_user - } -column_array bug - - set subject "Bug #$bug(bug_number). $bug(summary): [bt_bug_action_pretty $action] by [bt_conn user_first_names] [bt_conn user_last_name]" - - set body "Bug #$bug(bug_number). $bug(summary) - -Action: [bt_bug_action_pretty $action] by [bt_conn user_first_names] [bt_conn user_last_name] -" - if { ![empty_string_p $comment] } { + + ##### + # + # Notification + # + ##### + + ad_proc bug_notify { + bug_id + action + comment + comment_format + } { + ns_log Notice "bug_id = $bug_id" + + set package_id [ad_conn package_id] + + db_1row bug { + select b.bug_id, + b.bug_number, + b.summary, + o.creation_user as submitter_user_id, + submitter.first_names as submitter_first_names, + submitter.last_name as submitter_last_name, + submitter.email as submitter_email, + b.component_id, + c.component_name, + o.creation_date, + to_char(o.creation_date, 'fmMM/DDfm/YYYY') as creation_date_pretty, + b.severity, + sc.sort_order || ' - ' || sc.severity_name as severity_pretty, + b.priority, + pc.sort_order || ' - ' || pc.priority_name as priority_pretty, + b.status, + b.resolution, + b.bug_type, + b.user_agent, + b.original_estimate_minutes, + b.latest_estimate_minutes, + b.elapsed_time_minutes, + b.found_in_version, + coalesce((select version_name + from bt_versions found_in_v + where found_in_v.version_id = b.found_in_version), 'Unknown') as found_in_version_name, + b.fix_for_version, + coalesce((select version_name + from bt_versions fix_for_v + where fix_for_v.version_id = b.fix_for_version), 'Undecided') as fix_for_version_name, + b.fixed_in_version, + coalesce((select version_name + from bt_versions fixed_in_v + where fixed_in_v.version_id = b.fixed_in_version), 'Unknown') as fixed_in_version_name, + b.assignee as assignee_user_id, + assignee.first_names as assignee_first_names, + assignee.last_name as assignee_last_name, + assignee.email as assignee_email, + to_char(now(), 'fmMM/DDfm/YYYY') as now_pretty + from bt_bugs b left outer join + cc_users assignee on (assignee.user_id = b.assignee), + acs_objects o, + bt_components c, + bt_priority_codes pc, + bt_severity_codes sc, + cc_users submitter + where b.bug_id = :bug_id + and b.project_id = :package_id + and o.object_id = b.bug_id + and c.component_id = b.component_id + and pc.priority_id = b.priority + and sc.severity_id = b.severity + and submitter.user_id = o.creation_user + } -column_array bug + + set subject "Bug #$bug(bug_number). $bug(summary): [bug_action_pretty $action] by [conn user_first_names] [conn user_last_name]" + + set body "Bug #$bug(bug_number). $bug(summary) + + Action: [bug_action_pretty $action] by [conn user_first_names] [conn user_last_name] + " + if { ![empty_string_p $comment] } { + append body " + Comment: + + [bug_convert_comment_to_text -comment $comment -format $comment_format] + " + } + append body " -Comment: - -[bt_bug_convert_comment_to_text -comment $comment -format $comment_format] -" - } - - append body " -[ad_url][ad_conn package_url]bug?[export_vars -url { { bug_number $bug(bug_number) } }] -" - - array set recipient [list] - set recipient(${bug(submitter_email)}) 1 - set recipient(${bug(assignee_email)}) 1 - - # don't spam the current user - set recipient([bt_conn user_email]) 0 - - set component_id $bug(component_id) - set sender_email [db_string maintainer { select email from cc_users where user_id = bt_component__default_assignee(:component_id) } -default [ad_system_owner] ] - - foreach email [array names recipient] { - if { $recipient($email) && ![empty_string_p $email] } { - if {[catch {ns_sendmail $email $sender_email $subject $body} errmsg]} { - # In case we can't send the email - ns_log Notice "\[bug-tracker\] Error sending email: $errmsg" - } + [ad_url][ad_conn package_url]bug?[export_vars -url { { bug_number $bug(bug_number) } }] + " + + array set recipient [list] + set recipient(${bug(submitter_email)}) 1 + set recipient(${bug(assignee_email)}) 1 + + # don't spam the current user + set recipient([conn user_email]) 0 + + set component_id $bug(component_id) + set sender_email [db_string maintainer { select email from cc_users where user_id = bt_component__default_assignee(:component_id) } -default [ad_system_owner] ] + + foreach email [array names recipient] { + if { $recipient($email) && ![empty_string_p $email] } { + if {[catch {ns_sendmail $email $sender_email $subject $body} errmsg]} { + # In case we can't send the email + ns_log Notice "\[bug-tracker\] Error sending email: $errmsg" + } + } } - } + } } - \ No newline at end of file Index: openacs-4/packages/bug-tracker/www/bug-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/bug-add.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/bug-add.tcl 11 Jul 2002 08:28:20 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/bug-add.tcl 28 Aug 2002 15:44:18 -0000 1.3 @@ -21,7 +21,7 @@ ad_maybe_redirect_for_registration # Set some common bug-tracker variables -set project_name [bt_conn project_name] +set project_name [bug_tracker::conn project_name] set package_id [ad_conn package_id] set package_key [ad_conn package_key] @@ -44,13 +44,13 @@ -datatype integer \ -widget select \ -label "Component" \ - -options [bt_components_get_options] + -options [bug_tracker::components_get_options] element create bug bug_type \ -datatype text \ -widget select \ -label "Type of bug" \ - -options [bt_bug_type_get_options] \ + -options [bug_tracker::bug_type_get_options] \ -optional element create bug summary \ @@ -62,21 +62,21 @@ -datatype integer \ -widget select \ -label "Severity" \ - -options [bt_severity_codes_get_options] \ + -options [bug_tracker::severity_codes_get_options] \ -optional element create bug priority \ -datatype integer \ -widget select \ -label "Priority" \ - -options [bt_priority_codes_get_options] \ + -options [bug_tracker::priority_codes_get_options] \ -optional element create bug found_in_version \ -datatype integer \ -widget select \ -label "Version" \ - -options [bt_version_get_options -include_unknown] \ + -options [bug_tracker::version_get_options -include_unknown] \ -optional element create bug description \ @@ -105,8 +105,8 @@ element set_properties bug found_in_version \ -value [db_string user_version { select user_version from bt_user_prefs where user_id = :user_id and project_id = :package_id }] - element set_properties bug severity -value [bt_severity_get_default] - element set_properties bug priority -value [bt_priority_get_default] + element set_properties bug severity -value [bug_tracker::severity_get_default] + element set_properties bug priority -value [bug_tracker::priority_get_default] element set_properties bug desc_format -value "plain" @@ -150,7 +150,7 @@ } - bt_bug_notify $bug_id "open" $description $desc_format + bug_tracker::bug_notify $bug_id "open" $description $desc_format ad_returnredirect $return_url ad_script_abort Index: openacs-4/packages/bug-tracker/www/bug.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/bug.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/bug-tracker/www/bug.tcl 28 Aug 2002 11:33:16 -0000 1.3 +++ openacs-4/packages/bug-tracker/www/bug.tcl 28 Aug 2002 15:44:18 -0000 1.4 @@ -67,7 +67,7 @@ set write_p [ad_permission_p [ad_conn package_id] write] -set project_name [bt_conn project_name] +set project_name [bug_tracker::conn project_name] set package_id [ad_conn package_id] set package_key [ad_conn package_key] @@ -97,13 +97,13 @@ -datatype integer \ -widget [ad_decode [info exists field_editable_p(component_id)] 1 select inform] \ -label "Component" \ - -options [bt_components_get_options] + -options [bug_tracker::components_get_options] element create bug bug_type \ -datatype text \ -widget [ad_decode [info exists field_editable_p(bug_type)] 1 select inform] \ -label "Type of bug" \ - -options [bt_bug_type_get_options] \ + -options [bug_tracker::bug_type_get_options] \ -optional element create bug summary \ @@ -120,35 +120,35 @@ element create bug status \ -widget [ad_decode [info exists field_editable_p(status)] 1 select inform] \ -datatype text \ - -options [bt_status_get_options] \ + -options [bug_tracker::status_get_options] \ -label "Status" element create bug resolution \ -widget [ad_decode [info exists field_editable_p(resolution)] 1 select inform] \ -datatype text \ -label "Resolution" \ - -options [ad_decode $mode resolve [bt_resolution_get_options] [concat {{"" ""}} [bt_resolution_get_options]]] \ + -options [ad_decode $mode resolve [bug_tracker::resolution_get_options] [concat {{"" ""}} [bug_tracker::resolution_get_options]]] \ -optional element create bug severity \ -datatype integer \ -widget [ad_decode [info exists field_editable_p(severity)] 1 select inform] \ -label "Severity" \ - -options [bt_severity_codes_get_options] \ + -options [bug_tracker::severity_codes_get_options] \ -optional element create bug priority \ -datatype integer \ -widget [ad_decode [info exists field_editable_p(priority)] 1 select inform] \ -label "Priority" \ - -options [bt_priority_codes_get_options] \ + -options [bug_tracker::priority_codes_get_options] \ -optional element create bug found_in_version \ -datatype text \ -widget [ad_decode [info exists field_editable_p(found_in_version)] 1 select inform] \ -label "Found in Version" \ - -options [bt_version_get_options -include_unknown] \ + -options [bug_tracker::version_get_options -include_unknown] \ -optional element create bug user_agent \ @@ -160,21 +160,21 @@ -datatype integer \ -widget [ad_decode [info exists field_editable_p(assignee)] 1 select inform] \ -label "Assigned to" \ - -options [bt_users_get_options -include_unassigned] \ + -options [bug_tracker::users_get_options -include_unassigned] \ -optional element create bug fix_for_version \ -datatype text \ -widget [ad_decode [info exists field_editable_p(fix_for_version)] 1 select inform] \ -label "Fix for Version" \ - -options [bt_version_get_options -include_undecided] \ + -options [bug_tracker::version_get_options -include_undecided] \ -optional element create bug fixed_in_version \ -datatype text \ -widget [ad_decode [info exists field_editable_p(fixed_in_version)] 1 select inform] \ -label "Fixed in Version" \ - -options [bt_version_get_options -include_undecided] \ + -options [bug_tracker::version_get_options -include_undecided] \ -optional switch -- $mode { @@ -289,7 +289,7 @@ element set_properties bug component_id \ -value [ad_decode [info exists field_editable_p(component_id)] 1 $bug(component_id) $bug(component_name)] element set_properties bug bug_type \ - -value [ad_decode [info exists field_editable_p(bug_type)] 1 $bug(bug_type) [bt_bug_type_pretty $bug(bug_type)]] + -value [ad_decode [info exists field_editable_p(bug_type)] 1 $bug(bug_type) [bug_tracker::bug_type_pretty $bug(bug_type)]] element set_properties bug summary \ -value [ad_decode [info exists field_editable_p(summary)] 1 $bug(summary) "$bug(summary)"] element set_properties bug submitter \ @@ -298,9 +298,9 @@ -label "$bug(submitter_first_names) $bug(submitter_last_name)"] ($bug(submitter_email))" element set_properties bug status \ - -value [ad_decode [info exists field_editable_p(status)] 1 $bug(status) [bt_status_pretty $bug(status)]] + -value [ad_decode [info exists field_editable_p(status)] 1 $bug(status) [bug_tracker::status_pretty $bug(status)]] element set_properties bug resolution \ - -value [ad_decode [info exists field_editable_p(resolution)] 1 $bug(resolution) [bt_resolution_pretty $bug(resolution)]] + -value [ad_decode [info exists field_editable_p(resolution)] 1 $bug(resolution) [bug_tracker::resolution_pretty $bug(resolution)]] element set_properties bug severity \ -value [ad_decode [info exists field_editable_p(severity)] 1 $bug(severity) $bug(severity_pretty)] element set_properties bug priority \ @@ -350,16 +350,16 @@ and actor.user_id = ba.actor order by action_date } { - append action_html "$action_date_pretty [bt_bug_action_pretty $action] by $actor_first_names $actor_last_name -
[bt_bug_convert_comment_to_html -comment $comment -format $comment_format]
" + append action_html "$action_date_pretty [bug_tracker::bug_action_pretty $action] by $actor_first_names $actor_last_name +
[bug_tracker::bug_convert_comment_to_html -comment $comment -format $comment_format]
" } if { [string equal $mode "view"] } { element set_properties bug description -value $action_html } else { element set_properties bug description \ -history $action_html \ - -header "$bug(now_pretty) [bt_bug_action_pretty $mode] by [bt_conn user_first_names] [bt_conn user_last_name]" \ + -header "$bug(now_pretty) [bug_tracker::bug_action_pretty $mode] by [bug_tracker::conn user_first_names] [bug_tracker::conn user_last_name]" \ -value "" } @@ -438,7 +438,7 @@ } } - bt_bug_notify $bug_id $mode $description $desc_format + bug_tracker::bug_notify $bug_id $mode $description $desc_format ad_returnredirect $return_url ad_script_abort Index: openacs-4/packages/bug-tracker/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/index.tcl 3 May 2002 16:29:59 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/index.tcl 28 Aug 2002 15:44:18 -0000 1.2 @@ -16,7 +16,7 @@ ad_require_permission [ad_conn package_id] read -set project_name [bt_conn project_name] +set project_name [bug_tracker::conn project_name] set package_id [ad_conn package_id] set package_key [ad_conn package_key] @@ -56,7 +56,7 @@ if { [info exists bug_type] } { lappend where_clauses "b.bug_type = :bug_type" - append human_readable_filter " of type [bt_bug_type_pretty $bug_type]" + append human_readable_filter " of type [bug_tracker::bug_type_pretty $bug_type]" } if { [info exists assignee] } { @@ -157,16 +157,16 @@ [ad_decode $where_clauses "" "" "and [join $where_clauses " and "]"] order by b.bug_number desc " { - set desc_as_text [bt_bug_convert_comment_to_text -comment $description -format $desc_format] + set desc_as_text [bug_tracker::bug_convert_comment_to_text -comment $description -format $desc_format] if { [string length $desc_as_text] > $truncate_len } { set description_short "[util_close_html_tags [string range $desc_as_text 0 $truncate_len]]..." } else { set description_short [util_close_html_tags $desc_as_text] } set submitter_url [acs_community_member_url -user_id $submitter_user_id] - set status_pretty [bt_status_pretty $status] - set resolution_pretty [bt_resolution_pretty $resolution] - set bug_type_pretty [bt_bug_type_pretty $bug_type] + set status_pretty [bug_tracker::status_pretty $status] + set resolution_pretty [bug_tracker::resolution_pretty $resolution] + set bug_type_pretty [bug_tracker::bug_type_pretty $bug_type] set original_estimate_pretty [ad_decode $original_estimate_minutes "" "" 0 "" "$original_estimate_minutes minutes"] set latest_estimate_pretty [ad_decode $latest_estimate_minutes "" "" 0 "" "$latest_estimate_minutes minutes"] set elapsed_time_pretty [ad_decode $elapsed_time_minutes "" "" 0 "" "$elapsed_time_minutes minutes"] @@ -182,7 +182,7 @@ group by unique_id order by bt_bug__status_sort_order(b.status) } { - set name "[bt_status_pretty $unique_id] Bugs" + set name "[bug_tracker::status_pretty $unique_id] Bugs" set name_url "?[export_vars -url { { status $unique_id } }]" } @@ -196,7 +196,7 @@ order by bt_bug__bug_type_sort_order(b.bug_type) } { set stat_name "Type of bug" - set name [bt_bug_type_pretty $unique_id] + set name [bug_tracker::bug_type_pretty $unique_id] set name_url "?[export_vars -url { { bug_type $unique_id } }]" } Index: openacs-4/packages/bug-tracker/www/prefs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/prefs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/prefs.tcl 11 Jul 2002 08:28:20 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/prefs.tcl 28 Aug 2002 15:44:18 -0000 1.3 @@ -22,7 +22,7 @@ ad_require_permission [ad_conn package_id] read # Set some common bug-tracker variables -set project_name [bt_conn project_name] +set project_name [bug_tracker::conn project_name] set package_id [ad_conn package_id] set package_key [ad_conn package_key] Index: openacs-4/packages/bug-tracker/www/admin/component-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/component-ae.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/admin/component-ae.tcl 11 Jul 2002 08:28:20 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/admin/component-ae.tcl 28 Aug 2002 15:44:18 -0000 1.3 @@ -16,7 +16,7 @@ ad_script_abort } -set project_name [bt_conn project_name] +set project_name [bug_tracker::conn project_name] set package_id [ad_conn package_id] set package_key [ad_conn package_key] Index: openacs-4/packages/bug-tracker/www/admin/formwizard.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/formwizard.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/admin/formwizard.tcl 3 May 2002 16:29:59 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/admin/formwizard.tcl 28 Aug 2002 15:44:18 -0000 1.2 @@ -192,7 +192,7 @@ } # Set some common bug-tracker variables -set project_name \[bt_conn project_name\] +set project_name \[bug_tracker::conn project_name\] set package_id \[ad_conn package_id\] set package_key \[ad_conn package_key\] Index: openacs-4/packages/bug-tracker/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/admin/index.tcl 3 May 2002 16:29:59 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/admin/index.tcl 28 Aug 2002 15:44:18 -0000 1.2 @@ -7,7 +7,7 @@ } { } -set project_name [bt_conn project_name] +set project_name [bug_tracker::conn project_name] set package_id [ad_conn package_id] set package_key [ad_conn package_key] Index: openacs-4/packages/bug-tracker/www/admin/project-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/project-edit.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/admin/project-edit.tcl 11 Jul 2002 08:28:20 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/admin/project-edit.tcl 28 Aug 2002 15:44:18 -0000 1.3 @@ -16,7 +16,7 @@ ad_script_abort } -set project_name [bt_conn project_name] +set project_name [bug_tracker::conn project_name] set package_id [ad_conn package_id] set package_key [ad_conn package_key] @@ -41,7 +41,7 @@ if { [template::form is_request project_info] } { template::element set_properties project_info name \ - -value [bt_conn project_name] + -value [bug_tracker::conn project_name] template::element set_properties project_info description \ -value [db_string project_description { select description from bt_projects where project_id = :package_id }] @@ -55,7 +55,7 @@ where project_id = :package_id } - bt_set_project_name $name + bug_tracker::set_project_name $name } ad_returnredirect $return_url Index: openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.tcl 11 Jul 2002 08:28:20 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.tcl 28 Aug 2002 15:44:18 -0000 1.3 @@ -15,7 +15,7 @@ ad_script_abort } -set project_name [bt_conn project_name] +set project_name [bug_tracker::conn project_name] set package_id [ad_conn package_id] set package_key [ad_conn package_key] Index: openacs-4/packages/bug-tracker/www/admin/version-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/version-ae.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/admin/version-ae.tcl 11 Jul 2002 08:28:20 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/admin/version-ae.tcl 28 Aug 2002 15:44:18 -0000 1.3 @@ -14,7 +14,7 @@ ad_script_abort } -set project_name [bt_conn project_name] +set project_name [bug_tracker::conn project_name] set package_id [ad_conn package_id] set package_key [ad_conn package_key] Index: openacs-4/packages/bug-tracker/www/admin/versions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/versions.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/admin/versions.tcl 3 May 2002 16:29:59 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/admin/versions.tcl 28 Aug 2002 15:44:18 -0000 1.2 @@ -7,7 +7,7 @@ } { } -set project_name [bt_conn project_name] +set project_name [bug_tracker::conn project_name] set package_id [ad_conn package_id] set package_key [ad_conn package_key]