[bugzilla-gnome-org-extensions] initial import



commit 204133aaeb0a4600f7395abb1b0b13f0907e23d9
Author: Olav Vitters <olav vitters nl>
Date:   Wed Feb 29 10:45:29 2012 +0100

    initial import

 Config.pm                                   |   33 +++++++++++++++
 Extension.pm                                |   57 +++++++++++++++++++++++++++
 lib/Util.pm                                 |   34 ++++++++++++++++
 template/en/default/hook/README             |    5 ++
 template/en/default/productinterests/README |   16 +++++++
 web/README                                  |    7 +++
 6 files changed, 152 insertions(+), 0 deletions(-)
---
diff --git a/Config.pm b/Config.pm
new file mode 100644
index 0000000..54c24cb
--- /dev/null
+++ b/Config.pm
@@ -0,0 +1,33 @@
+# -*- 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 ProductInterests GNOME Bugzilla Extension.
+#
+# The Initial Developer of the Original Code is Olav Vitters
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Olav Vitters <olav vitters nl>
+
+package Bugzilla::Extension::ProductInterests;
+use strict;
+
+use constant NAME => 'ProductInterests';
+
+use constant REQUIRED_MODULES => [
+];
+
+use constant OPTIONAL_MODULES => [
+];
+
+__PACKAGE__->NAME;
diff --git a/Extension.pm b/Extension.pm
new file mode 100644
index 0000000..ec4e86d
--- /dev/null
+++ b/Extension.pm
@@ -0,0 +1,57 @@
+# -*- 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 ProductInterests GNOME Bugzilla Extension.
+#
+# The Initial Developer of the Original Code is Olav Vitters
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Olav Vitters <olav vitters nl>
+
+package Bugzilla::Extension::ProductInterests;
+use strict;
+use base qw(Bugzilla::Extension);
+
+our $VERSION = '0.01';
+
+BEGIN {
+        *Bugzilla::User::product_interests = \&product_interests;
+}
+
+
+sub product_interests {
+    my $self = shift;
+
+    return $self->{'product_int'} if defined $self->{'product_int'};
+    return [] unless $self->id;
+
+    my $product_ids = Bugzilla->dbh->selectcol_arrayref(
+        qq{SELECT products.id
+             FROM components
+       INNER JOIN products
+               ON components.product_id = products.id
+        LEFT JOIN watch
+               ON components.initialowner = watch.watched
+            WHERE products.isactive = '1'
+              AND (watch.watcher = ? OR components.initialowner = ?)
+         ORDER BY products.name}, 
+    undef, ($self->id, $self->id));
+
+    $self->{'product_int'} = Bugzilla::Product->new_from_list($product_ids);
+
+    return $self->{'product_int'};
+}
+
+
+__PACKAGE__->NAME;
diff --git a/lib/Util.pm b/lib/Util.pm
new file mode 100644
index 0000000..9d19c6c
--- /dev/null
+++ b/lib/Util.pm
@@ -0,0 +1,34 @@
+# -*- 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 ProductInterests GNOME Bugzilla Extension.
+#
+# The Initial Developer of the Original Code is YOUR NAME
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   YOUR NAME <YOUR EMAIL ADDRESS>
+
+package Bugzilla::Extension::ProductInterests::Util;
+use strict;
+use base qw(Exporter);
+our @EXPORT = qw(
+    
+);
+
+# This file can be loaded by your extension via 
+# "use Bugzilla::Extension::ProductInterests::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/hook/README b/template/en/default/hook/README
new file mode 100644
index 0000000..31391c4
--- /dev/null
+++ b/template/en/default/hook/README
@@ -0,0 +1,5 @@
+Template hooks go in this directory. Template hooks are called in normal
+GNOME 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
+GNOME Bugzilla directory to see that documentation.)
\ No newline at end of file
diff --git a/template/en/default/productinterests/README b/template/en/default/productinterests/README
new file mode 100644
index 0000000..94d904c
--- /dev/null
+++ b/template/en/default/productinterests/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('productinterests/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 GNOME Bugzilla or in 
+another extension, or your template might override that template. That's why
+we created this directory called 'productinterests' 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:
+
+<link href="extensions/Foo/web/style.css" rel="stylesheet" type="text/css">
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]