From 549bd6b0e3fa182d3eff47e67d4f1ab2729dd21d Mon Sep 17 00:00:00 2001 From: Dexter Morgan Date: Thu, 21 Feb 2013 08:36:33 +0000 Subject: Add mageia extension, from Frederic Buclin --- Config.pm | 19 +++++++++++++ Extension.pm | 32 ++++++++++++++++++++++ lib/Util.pm | 20 ++++++++++++++ template/en/default/global/banner.html.tmpl | 18 ++++++++++++ template/en/default/hook/README | 5 ++++ .../default/hook/index-additional_links.html.tmpl | 13 +++++++++ template/en/default/mageia/README | 16 +++++++++++ web/README | 7 +++++ 8 files changed, 130 insertions(+) create mode 100644 Config.pm create mode 100644 Extension.pm create mode 100644 lib/Util.pm create mode 100644 template/en/default/global/banner.html.tmpl create mode 100644 template/en/default/hook/README create mode 100644 template/en/default/hook/index-additional_links.html.tmpl create mode 100644 template/en/default/mageia/README create mode 100644 web/README diff --git a/Config.pm b/Config.pm new file mode 100644 index 0000000..4dbbda1 --- /dev/null +++ b/Config.pm @@ -0,0 +1,19 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::Extension::Mageia; +use strict; + +use constant NAME => 'Mageia'; + +use constant REQUIRED_MODULES => [ +]; + +use constant OPTIONAL_MODULES => [ +]; + +__PACKAGE__->NAME; diff --git a/Extension.pm b/Extension.pm new file mode 100644 index 0000000..1ebd30b --- /dev/null +++ b/Extension.pm @@ -0,0 +1,32 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::Extension::Mageia; +use strict; +use base qw(Bugzilla::Extension); + +use Bugzilla::User; +use Bugzilla::Extension::Mageia::Util; + +use Email::Address; + +our $VERSION = '0.02'; + +sub mailer_before_send { + my ($self, $args) = @_; + my $email = $args->{email}; + + # Include the changer's name in the "From:" field. + if (my $changer = $email->header('X-Bugzilla-Who')) { + $changer = Bugzilla::User->new({ name => $changer }); + my $changer_name = $changer ? $changer->name : undef; + my $address = Email::Address->new($changer_name, $email->header('From')); + $email->header_set('From', $address->format); + } +} + +__PACKAGE__->NAME; diff --git a/lib/Util.pm b/lib/Util.pm new file mode 100644 index 0000000..7aa8b86 --- /dev/null +++ b/lib/Util.pm @@ -0,0 +1,20 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::Extension::Mageia::Util; +use strict; +use base qw(Exporter); +our @EXPORT = qw( + +); + +# This file can be loaded by your extension via +# "use Bugzilla::Extension::Mageia::Util". You can put functions +# used by your extension in here. (Make sure you also list them in +# @EXPORT.) + +1; \ No newline at end of file diff --git a/template/en/default/global/banner.html.tmpl b/template/en/default/global/banner.html.tmpl new file mode 100644 index 0000000..d06f794 --- /dev/null +++ b/template/en/default/global/banner.html.tmpl @@ -0,0 +1,18 @@ +[%# This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # + # This Source Code Form is "Incompatible With Secondary Licenses", as + # defined by the Mozilla Public License, v. 2.0. + #%] + + + +
diff --git a/template/en/default/hook/README b/template/en/default/hook/README new file mode 100644 index 0000000..e6c4add --- /dev/null +++ b/template/en/default/hook/README @@ -0,0 +1,5 @@ +Template hooks go in this directory. Template hooks are called in normal +Bugzilla templates like [% Hook.process('some-hook') %]. +More information about them can be found in the documentation of +Bugzilla::Extension. (Do "perldoc Bugzilla::Extension" from the main +Bugzilla directory to see that documentation.) \ No newline at end of file diff --git a/template/en/default/hook/index-additional_links.html.tmpl b/template/en/default/hook/index-additional_links.html.tmpl new file mode 100644 index 0000000..695cd1f --- /dev/null +++ b/template/en/default/hook/index-additional_links.html.tmpl @@ -0,0 +1,13 @@ +[%# This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # + # This Source Code Form is "Incompatible With Secondary Licenses", as + # defined by the Mozilla Public License, v. 2.0. + #%] + +[% UNLESS user.id %] +

+ Don't have an account on [% terms.Bugzilla %]? Click here to create one. +

+[% END %] \ No newline at end of file diff --git a/template/en/default/mageia/README b/template/en/default/mageia/README new file mode 100644 index 0000000..099d1a4 --- /dev/null +++ b/template/en/default/mageia/README @@ -0,0 +1,16 @@ +Normal templates go in this directory. You can load them in your +code like this: + +use Bugzilla::Error; +my $template = Bugzilla->template; +$template->process('mageia/some-template.html.tmpl') + or ThrowTemplateError($template->error()); + +That would be how to load a file called some-template.html.tmpl that +was in this directory. + +Note that you have to be careful that the full path of your template +never conflicts with a template that exists in Bugzilla or in +another extension, or your template might override that template. That's why +we created this directory called 'mageia' for you, so you +can put your templates in here to help avoid conflicts. \ No newline at end of file diff --git a/web/README b/web/README new file mode 100644 index 0000000..2345641 --- /dev/null +++ b/web/README @@ -0,0 +1,7 @@ +Web-accessible files, like JavaScript, CSS, and images go in this +directory. You can reference them directly in your HTML. For example, +if you have a file called "style.css" and your extension is called +"Foo", you would put it in "extensions/Foo/web/style.css", and then +you could link to it in HTML like: + + \ No newline at end of file -- cgit v1.2.1