View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011000 | mantisbt | bugtracker | public | 2009-10-05 10:16 | 2009-10-07 14:19 |
Reporter | frodgers | Assigned To | dhx | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.0rc1 | ||||
Target Version | 1.2.0rc2 | Fixed in Version | 1.2.0rc2 | ||
Summary | 0011000: Add EVENTS to Tag attach/detach | ||||
Description | Add EVENTS to tag_attach and tag_detach to allow Plugins to interact with these changes. One use would be to have an email sent when tags are modified. | ||||
Tags | No tags attached. | ||||
Attached Files | tag_events.patch (1,157 bytes)
diff --git a/core/events_inc.php b/core/events_inc.php index 35861bb..016cdcd 100644 --- a/core/events_inc.php +++ b/core/events_inc.php @@ -108,6 +108,8 @@ event_declare_many( array( 'EVENT_BUGNOTE_EDIT_FORM' => EVENT_TYPE_EXECUTE, 'EVENT_BUGNOTE_EDIT' => EVENT_TYPE_EXECUTE, 'EVENT_BUGNOTE_DELETED' => EVENT_TYPE_EXECUTE, + 'EVENT_TAG_ATTACHED' => EVENT_TYPE_EXECUTE, + 'EVENT_TAG_DETACHED' => EVENT_TYPE_EXECUTE, # Email notification events 'EVENT_NOTIFY_USER_INCLUDE' => EVENT_TYPE_DEFAULT, diff --git a/tag_attach.php b/tag_attach.php index 99a80da..028897f 100644 --- a/tag_attach.php +++ b/tag_attach.php @@ -126,6 +126,7 @@ tag_bug_attach( $t_tag_row['id'], $f_bug_id, $t_user_id ); } } + event_signal( 'EVENT_TAG_ATTACHED', array( $f_bug_id ) ); form_security_purge( 'tag_attach' ); diff --git a/tag_detach.php b/tag_detach.php index 5c739b8..8945701 100644 --- a/tag_detach.php +++ b/tag_detach.php @@ -36,6 +36,8 @@ tag_bug_detach( $f_tag_id, $f_bug_id ); + event_signal( 'EVENT_TAG_DETACHED', array( $f_bug_id ) ); + form_security_purge( 'tag_detach' ); print_successful_redirect_to_bug( $f_bug_id ); revised_tag_events.patch (2,433 bytes)
diff --git a/core/events_inc.php b/core/events_inc.php index 35861bb..016cdcd 100644 --- a/core/events_inc.php +++ b/core/events_inc.php @@ -108,6 +108,8 @@ event_declare_many( array( 'EVENT_BUGNOTE_EDIT_FORM' => EVENT_TYPE_EXECUTE, 'EVENT_BUGNOTE_EDIT' => EVENT_TYPE_EXECUTE, 'EVENT_BUGNOTE_DELETED' => EVENT_TYPE_EXECUTE, + 'EVENT_TAG_ATTACHED' => EVENT_TYPE_EXECUTE, + 'EVENT_TAG_DETACHED' => EVENT_TYPE_EXECUTE, # Email notification events 'EVENT_NOTIFY_USER_INCLUDE' => EVENT_TYPE_DEFAULT, diff --git a/docbook/developers/en/event-reference-bug.sgml b/docbook/developers/en/event-reference-bug.sgml index 70e89d8..eb0c69b 100644 --- a/docbook/developers/en/event-reference-bug.sgml +++ b/docbook/developers/en/event-reference-bug.sgml @@ -408,6 +408,38 @@ </blockquote> </blockquote> + <blockquote id="dev.eventref.bug.action.tagattached"> + <title>EVENT_TAG_ATTACHED (Execute)</title> + + <blockquote> + <para> + This event allows plugins to do post-processing of attached tags. + </para> + + <itemizedlist> + <title>Parameters</title> + <listitem><para><Integer>: Bug ID</para></listitem> + <listitem><para><Array of Integers>: Tag IDs</para></listitem> + </itemizedlist> + </blockquote> + </blockquote> + + <blockquote id="dev.eventref.bug.action.tagdetached"> + <title>EVENT_TAG_DETACHED (Execute)</title> + + <blockquote> + <para> + This event allows plugins to do post-processing of detached tags. + </para> + + <itemizedlist> + <title>Parameters</title> + <listitem><para><Integer>: Bug ID</para></listitem> + <listitem><para><Integer>: Tag ID</para></listitem> + </itemizedlist> + </blockquote> + </blockquote> + </sect2> </sect1> diff --git a/tag_attach.php b/tag_attach.php index 99a80da..b725e17 100644 --- a/tag_attach.php +++ b/tag_attach.php @@ -127,6 +127,8 @@ } } + event_signal( 'EVENT_TAG_ATTACHED', array( $f_bug_id, $t_tags_attach ) ); + form_security_purge( 'tag_attach' ); print_successful_redirect_to_bug( $f_bug_id ); diff --git a/tag_detach.php b/tag_detach.php index 5c739b8..0262561 100644 --- a/tag_detach.php +++ b/tag_detach.php @@ -36,6 +36,8 @@ tag_bug_detach( $f_tag_id, $f_bug_id ); + event_signal( 'EVENT_TAG_DETACHED', array( $f_bug_id, $f_tag_id ) ); + form_security_purge( 'tag_detach' ); print_successful_redirect_to_bug( $f_bug_id ); | ||||
Thanks for the patch! It's just missing two things... documentation (in /docbook/developers/en/event-reference-bug.sgml) and an event argument for the actual tag that has been added or removed. |
|
I've updated the patch to include updates to event-reference-bug.smgl and added additional parameters to the event to include tag ids. Please delete previous patch named tag_events.patch |
|
Thanks for the patch (and taking the time to document it). I've committed it to 1.2.x and 1.3.x as it'll be useful for developers in 1.2.x writing plugins. I've just made one minor edit which is to make the arguments for both events consistent. In other words, multiple tag IDs can be sent in each event call. |
|
MantisBT: master-1.2.x 608f34b6 2009-10-06 02:55 Details Diff |
Issue 0011000: Add events for tag_attach and tag_detach Events should be raised on the attachment and detachment of tags from a bug. In the event that multiple tags are attached or detached at once, all tag IDs should be passed to the plugin in a single event. Thanks to frodgers for providing this patch. |
Affected Issues 0011000 |
|
mod - core/events_inc.php | Diff File | ||
mod - docbook/developers/en/event-reference-bug.sgml | Diff File | ||
mod - tag_attach.php | Diff File | ||
mod - tag_detach.php | Diff File | ||
MantisBT: master 485f6d50 2009-10-06 02:55 Details Diff |
Issue 0011000: Add events for tag_attach and tag_detach Events should be raised on the attachment and detachment of tags from a bug. In the event that multiple tags are attached or detached at once, all tag IDs should be passed to the plugin in a single event. Thanks to frodgers for providing this patch. |
Affected Issues 0011000 |
|
mod - core/events_inc.php | Diff File | ||
mod - docbook/developers/en/event-reference-bug.sgml | Diff File | ||
mod - tag_attach.php | Diff File | ||
mod - tag_detach.php | Diff File |