Index: openacs.org-dev/packages/bug-tracker/www/bug-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/packages/bug-tracker/www/bug-add.tcl,v diff -u -r1.1 -r1.2 --- openacs.org-dev/packages/bug-tracker/www/bug-add.tcl 9 Jul 2002 17:35:01 -0000 1.1 +++ openacs.org-dev/packages/bug-tracker/www/bug-add.tcl 5 Nov 2002 17:36:48 -0000 1.2 @@ -1,18 +1,23 @@ ad_page_contract { - Bug listing page. The most complicated page in the package. + Bug add page. @author Lars Pind (lars@pinds.com) - @date 2002-03-25 + @creation-date 2002-03-25 @cvs-id $Id$ } { cancel:optional + {component_id ""} {return_url ""} } +if { [empty_string_p $return_url] } { + set return_url "." +} + # If the user hit cancel, ignore everything else if { [exists_and_not_null cancel] } { ad_returnredirect $return_url - return + ad_script_abort } ad_require_permission [ad_conn package_id] create @@ -21,13 +26,13 @@ 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] set page_title "New Bug" -set context_bar [ad_context_bar $page_title] +set context_bar [bug_tracker::context_bar $page_title] set user_id [ad_conn user_id] @@ -44,13 +49,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 +67,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 \ @@ -103,10 +108,14 @@ element set_properties bug bug_id -value [db_nextval "acs_object_id_seq"] 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 }] + -value [bug_tracker::conn user_version_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] + + if { ![empty_string_p [bug_tracker::conn component_id]] } { + element set_properties bug component_id -value [bug_tracker::conn component_id] + } element set_properties bug desc_format -value "plain" @@ -117,15 +126,7 @@ db_transaction { - set bug_id [element::get_value bug bug_id] - set component_id [element::get_value bug component_id] - set bug_type [element::get_value bug bug_type] - set severity [element::get_value bug severity] - set priority [element::get_value bug priority] - set found_in_version [element::get_value bug found_in_version] - set summary [element::get_value bug summary] - set description [element::get_value bug description] - set desc_format [element::get_value bug desc_format] + form get_values bug bug_id component_id bug_type severity priority found_in_version summary description desc_format set ip_address [ns_conn peeraddr] set user_agent [ns_set get [ns_conn headers] "User-Agent"] @@ -150,11 +151,14 @@ } - bt_bug_notify $bug_id "open" $description $desc_format + bug_tracker::bug_notify -bug_id $bug_id -action "open" -comment $description -comment_format $desc_format + # Sign up the submitter of the bug for instant alerts. We do this after calling + # the alert procedure so that the submitter isn't alerted about his own submittal of the bug + bug_tracker::add_instant_alert -bug_id $bug_id -user_id $user_id + ad_returnredirect $return_url - return + ad_script_abort } ad_return_template -