diff options
Diffstat (limited to 'extensions/example/code')
30 files changed, 0 insertions, 980 deletions
diff --git a/extensions/example/code/attachment-process_data.pl b/extensions/example/code/attachment-process_data.pl deleted file mode 100644 index 67cbf3880..000000000 --- a/extensions/example/code/attachment-process_data.pl +++ /dev/null @@ -1,42 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Frédéric Buclin. -# Portions created by Frédéric Buclin are Copyright (C) 2009 -# Frédéric Buclin. All Rights Reserved. -# -# Contributor(s): Frédéric Buclin <LpSolit@gmail.com> - -use strict; -use warnings; - -use Bugzilla; -my $args = Bugzilla->hook_args; - -my $type = $args->{attributes}->{mimetype}; -my $filename = $args->{attributes}->{filename}; - -# Make sure images have the correct extension. -# Uncomment the two lines below to make this check effective. -if ($type =~ /^image\/(\w+)$/) { - my $format = $1; - if ($filename =~ /^(.+)(:?\.[^\.]+)$/) { - my $name = $1; -# $args->{attributes}->{filename} = "${name}.$format"; - } - else { - # The file has no extension. We append it. -# $args->{attributes}->{filename} .= ".$format"; - } -} diff --git a/extensions/example/code/auth-login_methods.pl b/extensions/example/code/auth-login_methods.pl deleted file mode 100644 index 0ae12aa6b..000000000 --- a/extensions/example/code/auth-login_methods.pl +++ /dev/null @@ -1,27 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2008 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; -my $modules = Bugzilla->hook_args->{modules}; -if (exists $modules->{Example}) { - $modules->{Example} = 'extensions/example/lib/AuthLogin.pm'; -} diff --git a/extensions/example/code/auth-verify_methods.pl b/extensions/example/code/auth-verify_methods.pl deleted file mode 100644 index 7ae52f012..000000000 --- a/extensions/example/code/auth-verify_methods.pl +++ /dev/null @@ -1,27 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2008 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; -my $modules = Bugzilla->hook_args->{modules}; -if (exists $modules->{Example}) { - $modules->{Example} = 'extensions/example/lib/AuthVerify.pm'; -} diff --git a/extensions/example/code/bug-columns.pl b/extensions/example/code/bug-columns.pl deleted file mode 100644 index 92ccf6d23..000000000 --- a/extensions/example/code/bug-columns.pl +++ /dev/null @@ -1,27 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2008 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): Elliotte Martin <elliotte_martin@yahoo.com> - - -use strict; -use warnings; -use Bugzilla; - -my $columns = Bugzilla->hook_args->{'columns'}; -push (@$columns, "delta_ts AS example") diff --git a/extensions/example/code/bug-end_of_create.pl b/extensions/example/code/bug-end_of_create.pl deleted file mode 100644 index 0325ddd59..000000000 --- a/extensions/example/code/bug-end_of_create.pl +++ /dev/null @@ -1,35 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is ITA Software -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> -# Bradley Baetz <bbaetz@acm.org> - -use strict; -use warnings; -use Bugzilla; - -# This code doesn't actually *do* anything, it's just here to show you -# how to use this hook. -my $args = Bugzilla->hook_args; -my $bug = $args->{'bug'}; -my $timestamp = $args->{'timestamp'}; - -my $bug_id = $bug->id; -# Uncomment this line to see a line in your webserver's error log whenever -# you file a bug. -# warn "Bug $bug_id has been filed!"; diff --git a/extensions/example/code/bug-end_of_create_validators.pl b/extensions/example/code/bug-end_of_create_validators.pl deleted file mode 100644 index 95d64ae85..000000000 --- a/extensions/example/code/bug-end_of_create_validators.pl +++ /dev/null @@ -1,37 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is ITA Software -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; -use Data::Dumper; - -# This code doesn't actually *do* anything, it's just here to show you -# how to use this hook. -my $params = Bugzilla->hook_args->{'params'}; - -# Uncomment this line below to see a line in your webserver's error log -# containing all validated bug field values every time you file a bug. -# warn Dumper($params); - -# This would remove all ccs from the bug, preventing ANY ccs from being -# added on bug creation. -# $params->{cc} = []; diff --git a/extensions/example/code/bug-end_of_update.pl b/extensions/example/code/bug-end_of_update.pl deleted file mode 100644 index 036563517..000000000 --- a/extensions/example/code/bug-end_of_update.pl +++ /dev/null @@ -1,56 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Everything Solved, Inc. -# Portions created by Everything Solved are Copyright (C) 2008 -# Everything Solved, Inc. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; -use Bugzilla::Status; - -# This code doesn't actually *do* anything, it's just here to show you -# how to use this hook. -my $args = Bugzilla->hook_args; -my $bug = $args->{'bug'}; -my $timestamp = $args->{'timestamp'}; -my $changes = $args->{'changes'}; - -foreach my $field (keys %$changes) { - my $used_to_be = $changes->{$field}->[0]; - my $now_it_is = $changes->{$field}->[1]; -} - -my $status_message; -if (my $status_change = $changes->{'bug_status'}) { - my $old_status = new Bugzilla::Status({ name => $status_change->[0] }); - my $new_status = new Bugzilla::Status({ name => $status_change->[1] }); - if ($new_status->is_open && !$old_status->is_open) { - $status_message = "Bug re-opened!"; - } - if (!$new_status->is_open && $old_status->is_open) { - $status_message = "Bug closed!"; - } -} - -my $bug_id = $bug->id; -my $num_changes = scalar keys %$changes; -my $result = "There were $num_changes changes to fields on bug $bug_id" - . " at $timestamp."; -# Uncomment this line to see $result in your webserver's error log whenever -# you update a bug. -# warn $result; diff --git a/extensions/example/code/bug-fields.pl b/extensions/example/code/bug-fields.pl deleted file mode 100644 index f8475426d..000000000 --- a/extensions/example/code/bug-fields.pl +++ /dev/null @@ -1,27 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2008 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): Elliotte Martin <elliotte_martin@yahoo.com> - - -use strict; -use warnings; -use Bugzilla; - -my $fields = Bugzilla->hook_args->{'fields'}; -push (@$fields, "example") diff --git a/extensions/example/code/bug-format_comment.pl b/extensions/example/code/bug-format_comment.pl deleted file mode 100644 index c11e8cac2..000000000 --- a/extensions/example/code/bug-format_comment.pl +++ /dev/null @@ -1,45 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2009 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): -# Max Kanat-Alexander <mkanat@bugzilla.org> - - -use strict; -use warnings; -use Bugzilla; -use Bugzilla::ExampleHook qw(replace_bar); - -# This replaces every occurrence of the word "foo" with the word -# "bar" - -my $regexes = Bugzilla->hook_args->{'regexes'}; -push(@$regexes, { match => qr/\bfoo\b/, replace => 'bar' }); - -# And this links every occurrence of the word "bar" to example.com, -# but it won't affect "foo"s that have already been turned into "bar" -# above (because each regex is run in order, and later regexes don't modify -# earlier matches, due to some cleverness in Bugzilla's internals). -# -# For example, the phrase "foo bar" would become: -# bar <a href="http://example.com/bar">bar</a> -# -# See lib/Bugzilla/ExampleHook.pm in this extension for the code of -# "replace_bar". -my $bar_match = qr/\b(bar)\b/; -push(@$regexes, { match => $bar_match, replace => \&replace_bar }); diff --git a/extensions/example/code/buglist-columns.pl b/extensions/example/code/buglist-columns.pl deleted file mode 100644 index 4487b2dc8..000000000 --- a/extensions/example/code/buglist-columns.pl +++ /dev/null @@ -1,26 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -## The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2008 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): Elliotte Martin <elliotte_martin@yahoo.com> - -use strict; -use warnings; -use Bugzilla; - -my $columns = Bugzilla->hook_args->{'columns'}; -$columns->{'example'} = { 'name' => 'bugs.delta_ts' , 'title' => 'Example' }; diff --git a/extensions/example/code/colchange-columns.pl b/extensions/example/code/colchange-columns.pl deleted file mode 100644 index 6174d3940..000000000 --- a/extensions/example/code/colchange-columns.pl +++ /dev/null @@ -1,27 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2008 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): Elliotte Martin <elliotte_martin@yahoo.com> - - -use strict; -use warnings; -use Bugzilla; - -my $columns = Bugzilla->hook_args->{'columns'}; -push (@$columns, "example") diff --git a/extensions/example/code/config-add_panels.pl b/extensions/example/code/config-add_panels.pl deleted file mode 100644 index 5f4f5bdd4..000000000 --- a/extensions/example/code/config-add_panels.pl +++ /dev/null @@ -1,25 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2008 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): Bradley Baetz <bbaetz@acm.org> - -use strict; -use warnings; -use Bugzilla; -my $modules = Bugzilla->hook_args->{panel_modules}; -$modules->{Example} = "extensions::example::lib::ConfigExample"; diff --git a/extensions/example/code/config-modify_panels.pl b/extensions/example/code/config-modify_panels.pl deleted file mode 100644 index bd93962bf..000000000 --- a/extensions/example/code/config-modify_panels.pl +++ /dev/null @@ -1,32 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2008 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; -my $panels = Bugzilla->hook_args->{panels}; - -# Add the "Example" auth methods. -my $auth_params = $panels->{'auth'}->{params}; -my ($info_class) = grep($_->{name} eq 'user_info_class', @$auth_params); -my ($verify_class) = grep($_->{name} eq 'user_verify_class', @$auth_params); - -push(@{ $info_class->{choices} }, 'CGI,Example'); -push(@{ $verify_class->{choices} }, 'Example'); diff --git a/extensions/example/code/config.pl b/extensions/example/code/config.pl deleted file mode 100644 index 1da490cc2..000000000 --- a/extensions/example/code/config.pl +++ /dev/null @@ -1,26 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2008 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> -# Bradley Baetz <bbaetz@acm.org> - -use strict; -use warnings; -use Bugzilla; -my $config = Bugzilla->hook_args->{config}; -$config->{Example} = "extensions::example::lib::ConfigExample"; diff --git a/extensions/example/code/flag-end_of_update.pl b/extensions/example/code/flag-end_of_update.pl deleted file mode 100644 index e1705cc57..000000000 --- a/extensions/example/code/flag-end_of_update.pl +++ /dev/null @@ -1,42 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Everything Solved, Inc. -# Portions created by Everything Solved are Copyright (C) 2008 -# Everything Solved, Inc. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; -use Bugzilla::Util qw(diff_arrays); - -# This code doesn't actually *do* anything, it's just here to show you -# how to use this hook. -my $args = Bugzilla->hook_args; -my ($object, $timestamp, $old_flags, $new_flags) = - @$args{qw(object timestamp old_flags new_flags)}; -my ($removed, $added) = diff_arrays($old_flags, $new_flags); -my ($granted, $denied) = (0, 0); -foreach my $new_flag (@$added) { - $granted++ if $new_flag =~ /\+$/; - $denied++ if $new_flag =~ /-$/; -} -my $bug_id = (ref $object eq 'Bugzilla::Bug') ? $object->id : $object->bug_id; -my $result = "$granted flags were granted and $denied flags were denied" - . " on bug $bug_id at $timestamp."; -# Uncomment this line to see $result in your webserver's error log whenever -# you update flags. -# warn $result; diff --git a/extensions/example/code/install-before_final_checks.pl b/extensions/example/code/install-before_final_checks.pl deleted file mode 100644 index ef1bee22c..000000000 --- a/extensions/example/code/install-before_final_checks.pl +++ /dev/null @@ -1,28 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2008 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): Elliotte Martin <elliotte_martin@yahoo.com> - - -use strict; -use warnings; -use Bugzilla; - -my $silent = Bugzilla->hook_args->{'silent'}; - -print "Install-before_final_checks hook\n" unless $silent; diff --git a/extensions/example/code/mailer-before_send.pl b/extensions/example/code/mailer-before_send.pl deleted file mode 100644 index 322c78088..000000000 --- a/extensions/example/code/mailer-before_send.pl +++ /dev/null @@ -1,28 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Everything Solved, Inc. -# Portions created by the Initial Developer are Copyright (C) 2008 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; -my $email = Bugzilla->hook_args->{email}; -# If you add a header to an email, it's best to start it with -# 'X-Bugzilla-<Extension>' so that you don't conflict with -# other extensions. -$email->header_set('X-Bugzilla-Example-Header', 'Example'); diff --git a/extensions/example/code/object-before_create.pl b/extensions/example/code/object-before_create.pl deleted file mode 100644 index 5961b6186..000000000 --- a/extensions/example/code/object-before_create.pl +++ /dev/null @@ -1,33 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is ITA Software -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; - -my $args = Bugzilla->hook_args; -my $class = $args->{'class'}; -my $params = $args->{'params'}; - -# Note that this is a made-up class, for this example. -if ($class->isa('Bugzilla::ExampleObject')) { - warn "About to create an ExampleObject!"; - warn "Got the following parameters: " . join(', ', keys(%$params)); -} diff --git a/extensions/example/code/object-before_set.pl b/extensions/example/code/object-before_set.pl deleted file mode 100644 index 43007efdb..000000000 --- a/extensions/example/code/object-before_set.pl +++ /dev/null @@ -1,34 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is ITA Software -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; - -my $args = Bugzilla->hook_args; -my ($object, $field, $value) = @$args{qw(object field value)}; - -# Note that this is a made-up class, for this example. -if ($object->isa('Bugzilla::ExampleObject')) { - warn "The field $field is changing from " . $object->{$field} - . " to $value!"; -} - - diff --git a/extensions/example/code/object-end_of_create_validators.pl b/extensions/example/code/object-end_of_create_validators.pl deleted file mode 100644 index 42ed6f776..000000000 --- a/extensions/example/code/object-end_of_create_validators.pl +++ /dev/null @@ -1,34 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is ITA Software -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; - -my $args = Bugzilla->hook_args; -my $class = $args->{'class'}; -my $params = $args->{'params'}; - -# Note that this is a made-up class, for this example. -if ($class->isa('Bugzilla::ExampleObject')) { - # Always set example_field to 1, even if the validators said otherwise. - $params->{example_field} = 1; -} - diff --git a/extensions/example/code/object-end_of_set_all.pl b/extensions/example/code/object-end_of_set_all.pl deleted file mode 100644 index d4b643522..000000000 --- a/extensions/example/code/object-end_of_set_all.pl +++ /dev/null @@ -1,34 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is ITA Software -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; - -my $args = Bugzilla->hook_args; -my $object = $args->{'class'}; -my $params = $args->{'params'}; - -# Note that this is a made-up class, for this example. -if ($object->isa('Bugzilla::ExampleObject')) { - if ($params->{example_field} == 1) { - $object->{example_field} = 1; - } -} - diff --git a/extensions/example/code/object-end_of_update.pl b/extensions/example/code/object-end_of_update.pl deleted file mode 100644 index 72773cf60..000000000 --- a/extensions/example/code/object-end_of_update.pl +++ /dev/null @@ -1,34 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is ITA Software -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; - -my $args = Bugzilla->hook_args; -my ($object, $old_object, $changes) = @$args{qw(object old_object changes)}; - -# Note that this is a made-up class, for this example. -if ($object->isa('Bugzilla::ExampleObject')) { - if (defined $changes->{'name'}) { - my ($old, $new) = @{ $changes->{'name'} }; - print "The name field changed from $old to $new!"; - } -} diff --git a/extensions/example/code/page-before_template.pl b/extensions/example/code/page-before_template.pl deleted file mode 100644 index dcf059367..000000000 --- a/extensions/example/code/page-before_template.pl +++ /dev/null @@ -1,33 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Canonical Ltd. -# Portions created by Canonical Ltd. are Copyright (C) 2009 -# Canonical Ltd. All Rights Reserved. -# -# Contributor(s): -# Max Kanat-Alexander <mkanat@bugzilla.org> - - -use strict; -use warnings; -use Bugzilla; - -my %args = %{ Bugzilla->hook_args }; -my ($vars, $page) = @args{qw(vars page_id)}; - -# You can see this hook in action by loading page.cgi?id=example.html -if ($page eq 'example.html') { - $vars->{cgi_variables} = { Bugzilla->cgi->Vars }; -} diff --git a/extensions/example/code/product-confirm_delete.pl b/extensions/example/code/product-confirm_delete.pl deleted file mode 100644 index d961dfaa7..000000000 --- a/extensions/example/code/product-confirm_delete.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/perl -w -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Testopia System. -# -# The Initial Developer of the Original Code is Greg Hendricks. -# Portions created by Greg Hendricks are Copyright (C) 2008 -# Novell. All Rights Reserved. -# -# Contributor(s): Greg Hendricks <ghendricks@novell.com> - -use strict; - -my $vars = Bugzilla->hook_args->{vars}; - -$vars->{'example'} = 1
\ No newline at end of file diff --git a/extensions/example/code/sanitycheck-check.pl b/extensions/example/code/sanitycheck-check.pl deleted file mode 100644 index 10083389b..000000000 --- a/extensions/example/code/sanitycheck-check.pl +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is ITA Softwware. -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): Bradley Baetz <bbaetz@everythingsolved.com> - -use strict; - -my $dbh = Bugzilla->dbh; -my $sth; - -my $status = Bugzilla->hook_args->{'status'}; - -# Check that all users are Australian -$status->('example_check_au_user'); - -my $sth = $dbh->prepare("SELECT userid, login_name - FROM profiles - WHERE login_name NOT LIKE '%.au'"); -$sth->execute; - -my $seen_nonau = 0; -while (my ($userid, $login, $numgroups) = $sth->fetchrow_array) { - $status->('example_check_au_user_alert', - { userid => $userid, login => $login }, - 'alert'); - $seen_nonau = 1; -} - -$status->('example_check_au_user_prompt') if $seen_nonau; diff --git a/extensions/example/code/sanitycheck-repair.pl b/extensions/example/code/sanitycheck-repair.pl deleted file mode 100644 index f9ad0b3b1..000000000 --- a/extensions/example/code/sanitycheck-repair.pl +++ /dev/null @@ -1,38 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is ITA Software. -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): Bradley Baetz <bbaetz@everythingsolved.com> - -use strict; - -use Bugzilla; - -my $cgi = Bugzilla->cgi; -my $dbh = Bugzilla->dbh; - -my $status = Bugzilla->hook_args->{'status'}; - -if ($cgi->param('example_repair_au_user')) { - $status->('example_repair_au_user_start'); - - #$dbh->do("UPDATE profiles - # SET login_name = CONCAT(login_name, '.au') - # WHERE login_name NOT LIKE '%.au'"); - - $status->('example_repair_au_user_end'); -} diff --git a/extensions/example/code/template-before_create.pl b/extensions/example/code/template-before_create.pl deleted file mode 100644 index fa21f08cc..000000000 --- a/extensions/example/code/template-before_create.pl +++ /dev/null @@ -1,30 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is ITA Software. -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; - -my $config = Bugzilla->hook_args->{'config'}; -# This will be accessible as "example_global_variable" in every -# template in Bugzilla. See Bugzilla/Template.pm's create() function -# for more things that you can set. -$config->{VARIABLES}->{example_global_variable} = sub { return 'value' }; diff --git a/extensions/example/code/template-before_process.pl b/extensions/example/code/template-before_process.pl deleted file mode 100644 index 66f9a56f6..000000000 --- a/extensions/example/code/template-before_process.pl +++ /dev/null @@ -1,33 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Example Plugin. -# -# The Initial Developer of the Original Code is Matt Rogers. -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Matt Rogers <mattr@kde.org> - -use strict; -use warnings; -use Bugzilla; - -my %args = %{ Bugzilla->hook_args }; -my ($vars, $file, $template) = $args{qw(vars file template)}; - -$vars->{'example'} = 1; - -if ($file =~ m{^bug/show}) { - $vars->{'showing_a_bug'} = 1; -} diff --git a/extensions/example/code/webservice-error_codes.pl b/extensions/example/code/webservice-error_codes.pl deleted file mode 100644 index 94c4c52fc..000000000 --- a/extensions/example/code/webservice-error_codes.pl +++ /dev/null @@ -1,25 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Bug Tracking System. -# -# The Initial Developer of the Original Code is Everything Solved, Inc. -# Portions created by Everything Solved, Inc. are Copyright (C) 2008 -# Everything Solved, Inc. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; -my $error_map = Bugzilla->hook_args->{error_map}; -$error_map->{'example_my_error'} = 10001; diff --git a/extensions/example/code/webservice.pl b/extensions/example/code/webservice.pl deleted file mode 100644 index ff503be39..000000000 --- a/extensions/example/code/webservice.pl +++ /dev/null @@ -1,25 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Bug Tracking System. -# -# The Initial Developer of the Original Code is Everything Solved, Inc. -# Portions created by Everything Solved, Inc. are Copyright (C) 2007 -# Everything Solved, Inc. All Rights Reserved. -# -# Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> - -use strict; -use warnings; -use Bugzilla; -my $dispatch = Bugzilla->hook_args->{dispatch}; -$dispatch->{Example} = "extensions::example::lib::WSExample"; |