summaryrefslogtreecommitdiffstats
path: root/extensions/BMO
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-09-03 05:59:39 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-09-03 05:59:39 +0200
commita6c5ec6f935a9bd17e99f5b3190b1af9eb350018 (patch)
treeedf4fc7d162825f28a67fe555f42c21b841bb5d4 /extensions/BMO
parent3cc9c7365577f62e1b7c0693225dffb6f153b92f (diff)
downloadbugzilla-a6c5ec6f935a9bd17e99f5b3190b1af9eb350018.tar.gz
bugzilla-a6c5ec6f935a9bd17e99f5b3190b1af9eb350018.tar.xz
Bug 1196508: Intern Request Metric Dashboard
Diffstat (limited to 'extensions/BMO')
-rw-r--r--extensions/BMO/Extension.pm4
-rw-r--r--extensions/BMO/lib/Reports/Internship.pm119
-rw-r--r--extensions/BMO/template/en/default/bug/create/comment-intern.txt.tmpl6
-rw-r--r--extensions/BMO/template/en/default/bug/create/create-intern.html.tmpl6
-rw-r--r--extensions/BMO/template/en/default/hook/reports/menu-end.html.tmpl6
-rw-r--r--extensions/BMO/template/en/default/pages/internship_dashboard.html.tmpl50
-rw-r--r--extensions/BMO/template/en/default/pages/recruiting_dashboard.html.tmpl2
7 files changed, 188 insertions, 5 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index cc439eeed..f4e16d416 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -202,6 +202,10 @@ sub page_before_template {
require Bugzilla::Extension::BMO::Reports::Recruiting;
Bugzilla::Extension::BMO::Reports::Recruiting::report($vars);
}
+ elsif ($page eq 'internship_dashboard.html') {
+ require Bugzilla::Extension::BMO::Reports::Internship;
+ Bugzilla::Extension::BMO::Reports::Internship::report($vars);
+ }
elsif ($page eq 'email_queue.html') {
print Bugzilla->cgi->redirect('view_job_queue.cgi');
}
diff --git a/extensions/BMO/lib/Reports/Internship.pm b/extensions/BMO/lib/Reports/Internship.pm
new file mode 100644
index 000000000..cad403d09
--- /dev/null
+++ b/extensions/BMO/lib/Reports/Internship.pm
@@ -0,0 +1,119 @@
+# 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::BMO::Reports::Internship;
+use strict;
+use warnings;
+
+use Bugzilla::Error;
+use Bugzilla::Bug;
+use Bugzilla::Product;
+use Bugzilla::Component;
+
+sub report {
+ my ($vars) = @_;
+ my $user = Bugzilla->user;
+
+ $user->in_group('hr')
+ || ThrowUserError('auth_failure', { group => 'hr',
+ action => 'run',
+ object => 'internship_dashboard' });
+
+ my $product = Bugzilla::Product->check({ name => 'Recruiting', cache => 1 });
+ my $component = Bugzilla::Component->new({ product => $product, name => 'Intern', cache => 1 });
+
+ # find all open internship bugs
+ my $bugs = Bugzilla::Bug->match({
+ product_id => $product->id,
+ component_id => $component->id,
+ resolution => '',
+ });
+
+ # filter bugs based on visibility and re-bless
+ $user->visible_bugs($bugs);
+ $bugs = [
+ map { bless($_, 'InternshipBug') }
+ grep { $user->can_see_bug($_->id) }
+ @$bugs
+ ];
+
+ $vars->{bugs} = $bugs;
+}
+
+1;
+
+package InternshipBug;
+use strict;
+use warnings;
+
+use base qw(Bugzilla::Bug);
+
+use Bugzilla::Comment;
+use Bugzilla::Util qw(trim);
+
+sub _extract {
+ my ($self) = @_;
+ return if exists $self->{internship_data};
+ $self->{internship_data} = {};
+
+ # we only need the first comment
+ my $comment = Bugzilla::Comment->match({
+ bug_id => $self->id,
+ LIMIT => 1,
+ })->[0]->body;
+
+ # extract just what we need
+ # changing the comment will break this
+
+ if ($comment =~ /Hiring Manager:\s+(.+)\nTeam:\n/s) {
+ $self->{internship_data}->{hiring_manager} = trim($1);
+ }
+ if ($comment =~ /\nVP Authority:\s+(.+)\nProduct Line:\n/s) {
+ $self->{internship_data}->{scvp} = trim($1);
+ }
+ if ($comment =~ /\nProduct Line:\s+(.+)\nLevel 1/s) {
+ $self->{internship_data}->{product_line} = trim($1);
+ }
+ if ($comment =~ /\nBusiness Need:\s+(.+)\nPotential Project:\n/s) {
+ $self->{internship_data}->{business_need} = trim($1);
+ }
+ if ($comment =~ /\nName:\s+(.+)$/s) {
+ $self->{internship_data}->{intern_name} = trim($1);
+ }
+}
+
+sub hiring_manager {
+ my ($self) = @_;
+ $self->_extract();
+ return $self->{internship_data}->{hiring_manager};
+}
+
+sub scvp {
+ my ($self) = @_;
+ $self->_extract();
+ return $self->{internship_data}->{scvp};
+}
+
+sub business_need {
+ my ($self) = @_;
+ $self->_extract();
+ return $self->{internship_data}->{business_need};
+}
+
+sub product_line {
+ my ($self) = @_;
+ $self->_extract();
+ return $self->{internship_data}->{product_line};
+}
+
+sub intern_name {
+ my ($self) = @_;
+ $self->_extract();
+ return $self->{internship_data}->{intern_name};
+}
+
+1;
diff --git a/extensions/BMO/template/en/default/bug/create/comment-intern.txt.tmpl b/extensions/BMO/template/en/default/bug/create/comment-intern.txt.tmpl
index 33bcf6764..5f30b4168 100644
--- a/extensions/BMO/template/en/default/bug/create/comment-intern.txt.tmpl
+++ b/extensions/BMO/template/en/default/bug/create/comment-intern.txt.tmpl
@@ -21,6 +21,9 @@ Cost Center:
VP Authority:
[%+ cgi.param('vp_authority') %]
+Product Line:
+[%+ cgi.param('product_line') %]
+
Level 1/Level 2:
[%+ cgi.param("level_1_or_2") %]
@@ -32,6 +35,9 @@ Other Location:
[%+ cgi.param("other_location") %]
[% END %]
+Onsite Mentorship:
+[%+ cgi.param('onsite') %]
+
[% IF cgi.param("possible_mentor") %]
Possible Mentor:
[%+ cgi.param("possible_mentor") %]
diff --git a/extensions/BMO/template/en/default/bug/create/create-intern.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-intern.html.tmpl
index b0fd8cf05..9c04abc7e 100644
--- a/extensions/BMO/template/en/default/bug/create/create-intern.html.tmpl
+++ b/extensions/BMO/template/en/default/bug/create/create-intern.html.tmpl
@@ -258,10 +258,8 @@ $(document).ready(function() {
</label>
<textarea required name="job_description"
id="job_description" cols="80" rows="10"
- placeholder="Please add link to Mana or copy and paste a JD.
- (if you are looking for multiple types interns please
- include a job description for each)">
- </textarea>
+ placeholder="Please add link to Mana or copy and paste a JD. (if you are looking for multiple types interns please include a job description for each)"
+ ></textarea>
</div>
<div class="row">
diff --git a/extensions/BMO/template/en/default/hook/reports/menu-end.html.tmpl b/extensions/BMO/template/en/default/hook/reports/menu-end.html.tmpl
index 991a685be..b561221a8 100644
--- a/extensions/BMO/template/en/default/hook/reports/menu-end.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/reports/menu-end.html.tmpl
@@ -65,6 +65,12 @@
<a href="[% urlbase FILTER none %]page.cgi?id=recruiting_dashboard.html">Recruiting Dashboard</a>
</strong> - Dashboard for open requested requisitions.
</li>
+ <li>
+ <strong>
+ <a href="[% urlbase FILTER none %]page.cgi?id=internship_dashboard.html">Internship Dashboard</a>
+ </strong> - Dashboard for open intern requisitions.
+ </li>
+
[% END %]
</ul>
diff --git a/extensions/BMO/template/en/default/pages/internship_dashboard.html.tmpl b/extensions/BMO/template/en/default/pages/internship_dashboard.html.tmpl
new file mode 100644
index 000000000..d3571697d
--- /dev/null
+++ b/extensions/BMO/template/en/default/pages/internship_dashboard.html.tmpl
@@ -0,0 +1,50 @@
+[%# 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.
+ #%]
+
+[% PROCESS global/variables.none.tmpl %]
+[% INCLUDE global/header.html.tmpl
+ title = "Internship Dashboard"
+ style_urls = [ "extensions/BMO/web/styles/reports.css" ]
+ style = "#report td { vertical-align: top; }"
+%]
+
+<h1>Internship Dashboard</h1>
+
+[% IF bugs.size %]
+ <table border="0" cellspacing="0" id="report" class="hover" width="100%">
+ <tr id="report-header">
+ <th>[% terms.Bug %]</th>
+ <th>Summary</th>
+ <th>Status</th>
+ <th>Hiring Manager</th>
+ <th>SCVP</th>
+ <th>Product Line</th>
+ <th>Business Need</th>
+ <th>Name</th>
+ </tr>
+
+ [% FOREACH bug = bugs %]
+ <tr class="report_item [% loop.count % 2 == 1 ? "report_row_odd" : "report_row_even" %]">
+ <td>[% bug.id FILTER bug_link(bug) FILTER none %]</td>
+ <td>[% bug.short_desc FILTER html %]</td>
+ <td>[% bug.bug_status FILTER html %]</td>
+ <td>[% bug.hiring_manager FILTER html %]</td>
+ <td>[% bug.scvp FILTER html %]</td>
+ <td>[% bug.product_line FILTER html FILTER html %]</td>
+ <td>[% bug.business_need FILTER html FILTER html_line_break %]</td>
+ <td>[% bug.intern_name FILTER html FILTER html %]</td>
+ </tr>
+ [% END %]
+ </table>
+[% ELSE %]
+ <p>
+ No open intern requisitions.
+ </p>
+[% END %]
+
+[% INCLUDE global/footer.html.tmpl %]
diff --git a/extensions/BMO/template/en/default/pages/recruiting_dashboard.html.tmpl b/extensions/BMO/template/en/default/pages/recruiting_dashboard.html.tmpl
index 8eeae3b87..ef0704ae2 100644
--- a/extensions/BMO/template/en/default/pages/recruiting_dashboard.html.tmpl
+++ b/extensions/BMO/template/en/default/pages/recruiting_dashboard.html.tmpl
@@ -13,7 +13,7 @@
style = "#report td { vertical-align: top; }"
%]
-<h1>Recuriting Dashboard</h1>
+<h1>Recruiting Dashboard</h1>
[% IF bugs.size %]
<table border="0" cellspacing="0" id="report" class="hover" width="100%">