summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/MyDashboard/Extension.pm245
-rw-r--r--extensions/MyDashboard/lib/Queries.pm243
-rw-r--r--extensions/MyDashboard/lib/Util.pm6
-rw-r--r--extensions/MyDashboard/lib/WebService.pm48
-rw-r--r--extensions/MyDashboard/template/en/default/mydashboard/prod-comp-search.html.tmpl43
-rw-r--r--extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl203
-rw-r--r--extensions/MyDashboard/web/js/mydashboard.js435
-rw-r--r--extensions/MyDashboard/web/js/prod_comp_search.js85
-rw-r--r--extensions/MyDashboard/web/styles/mydashboard.css35
-rw-r--r--extensions/MyDashboard/web/styles/prod_comp_search.css22
10 files changed, 652 insertions, 713 deletions
diff --git a/extensions/MyDashboard/Extension.pm b/extensions/MyDashboard/Extension.pm
index 82c995442..036d1ce24 100644
--- a/extensions/MyDashboard/Extension.pm
+++ b/extensions/MyDashboard/Extension.pm
@@ -13,87 +13,12 @@ use base qw(Bugzilla::Extension);
use Bugzilla;
use Bugzilla::Constants;
-use Bugzilla::Search;
-use Bugzilla::Util;
-use Bugzilla::Status;
-use Bugzilla::Field;
use Bugzilla::Search::Saved;
-use Bugzilla::Extension::MyDashboard::Util qw(open_states closed_states
- quoted_open_states quoted_closed_states);
-use Bugzilla::Extension::MyDashboard::TimeAgo qw(time_ago);
-
-use DateTime;
+use Bugzilla::Extension::MyDashboard::Queries qw(QUERY_DEFS);
our $VERSION = BUGZILLA_VERSION;
-sub QUERY_DEFS {
- my $user = Bugzilla->user;
-
- my @query_defs = (
- {
- name => 'assignedbugs',
- heading => 'Assigned to You',
- description => 'The bug has been assigned to you and it is not resolved or closed yet.',
- params => {
- 'bug_status' => ['__open__'],
- 'emailassigned_to1' => 1,
- 'emailtype1' => 'exact',
- 'email1' => $user->login
- }
- },
- {
- name => 'newbugs',
- heading => 'New Reported by You',
- description => 'You reported the bug but nobody has accepted it yet.',
- params => {
- 'bug_status' => ['NEW'],
- 'emailreporter1' => 1,
- 'emailtype1' => 'exact',
- 'email1' => $user->login
- }
- },
- {
- name => 'inprogressbugs',
- heading => "In Progress Reported by You",
- description => 'You reported the bug, the developer accepted the bug and is hopefully working on it.',
- params => {
- 'bug_status' => [ map { $_->name } grep($_->name ne 'NEW' && $_->name ne 'MODIFIED', open_states()) ],
- 'emailreporter1' => 1,
- 'emailtype1' => 'exact',
- 'email1' => $user->login
- }
- },
- {
- name => 'openccbugs',
- heading => "You Are CC'd On",
- description => 'You are in the CC list of the bug, so you are watching it.',
- params => {
- 'bug_status' => ['__open__'],
- 'emailcc1' => 1,
- 'emailtype1' => 'exact',
- 'email1' => $user->login
- }
- },
- );
-
- if (Bugzilla->params->{'useqacontact'}) {
- push(@query_defs, {
- name => 'qacontactbugs',
- heading => 'You Are QA Contact',
- description => 'You are the qa contact on this bug and it is not resolved or closed yet.',
- params => {
- 'bug_status' => ['__open__'],
- 'emailqa_contact1' => 1,
- 'emailtype1' => 'exact',
- 'email1' => $user->login
- }
- });
- }
-
- return @query_defs;
-}
-
################
# Installation #
################
@@ -151,172 +76,10 @@ sub page_before_template {
return if $page ne 'mydashboard.html';
- # If we're using bug groups to restrict bug entry, we need to know who the
- # user is right from the start.
- my $user = Bugzilla->login(LOGIN_REQUIRED);
-
- # Switch to shadow db since we are just reading information
- Bugzilla->switch_to_shadow_db();
-
- _standard_saved_queries($vars);
- _flags_requested($vars);
-
- $vars->{'severities'} = get_legal_field_values('bug_severity');
-}
-
-sub _standard_saved_queries {
- my ($vars) = @_;
- my $dbh = Bugzilla->dbh;
- my $user = Bugzilla->user;
-
- # Default sort order
- my $order = ["changeddate desc", "bug_id"];
-
- # List of columns that we will be selecting. In the future this should be configurable
- # Share with buglist.cgi?
- my @select_columns = ('bug_id','product','bug_status','bug_severity','version', 'component','short_desc', 'changeddate');
-
- # Define the columns that can be selected in a query
- my $columns = Bugzilla::Search::COLUMNS;
-
- # Weed out columns that don't actually exist and detaint along the way.
- @select_columns = grep($columns->{$_} && trick_taint($_), @select_columns);
-
- ### Standard query definitions
- my @query_defs = QUERY_DEFS;
-
- ### Saved query definitions
- ### These are enabled through the userprefs.cgi UI
-
- if ($user->showmybugslink) {
- my $query = Bugzilla->params->{mybugstemplate};
- my $login = $user->login;
- $query =~ s/%userid%/$login/;
- $query =~ s/^buglist.cgi\?//;
- push(@query_defs, {
- name => 'mybugs',
- heading => "My Bugs",
- saved => 1,
- params => $query,
- });
- }
-
- foreach my $q (@{$user->queries}) {
- next if !$q->in_mydashboard;
- push(@query_defs, { name => $q->name,
- heading => $q->name,
- saved => 1,
- params => $q->url });
- }
-
- #my $date_now = DateTime->now(time_zone => Bugzilla->local_timezone);
-
- ### Collect the query results for display in the template
-
- my @results;
- foreach my $qdef (@query_defs) {
- my $params = new Bugzilla::CGI($qdef->{params});
-
- my $search = new Bugzilla::Search( fields => \@select_columns,
- params => scalar $params->Vars,
- order => $order );
- my $query = $search->sql();
-
- my $sth = $dbh->prepare($query);
- $sth->execute();
-
- my $rows = $sth->fetchall_arrayref();
-
- my @bugs;
- foreach my $row (@$rows) {
- my $bug = {};
- foreach my $column (@select_columns) {
- $bug->{$column} = shift @$row;
- #if ($column eq 'changeddate') {
- # my $date_then = datetime_from($bug->{$column});
- # $bug->{'updated'} = time_ago($date_then, $date_now);
- #}
- }
- push(@bugs, $bug);
- }
-
- $qdef->{bugs} = \@bugs;
- $qdef->{buffer} = $params->canonicalise_query();
-
- push(@results, $qdef);
- }
-
- $vars->{'results'} = \@results;
-}
-
-sub _flags_requested {
- my ($vars) = @_;
- my $user = Bugzilla->user;
- my $dbh = Bugzilla->dbh;
-
- my $attach_join_clause = "flags.attach_id = attachments.attach_id";
- if (Bugzilla->params->{insidergroup} && !$user->in_group(Bugzilla->params->{insidergroup})) {
- $attach_join_clause .= " AND attachments.isprivate < 1";
- }
-
- my $query =
- # Select columns describing each flag, the bug/attachment on which
- # it has been set, who set it, and of whom they are requesting it.
- " SELECT flags.id AS id,
- flagtypes.name AS type,
- flags.status AS status,
- flags.bug_id AS bug_id,
- bugs.short_desc AS bug_summary,
- flags.attach_id AS attach_id,
- attachments.description AS attach_summary,
- requesters.realname AS requester,
- requestees.realname AS requestee,
- " . $dbh->sql_date_format('flags.creation_date', '%Y:%m:%d') . " AS created
- FROM flags
- LEFT JOIN attachments
- ON ($attach_join_clause)
- INNER JOIN flagtypes
- ON flags.type_id = flagtypes.id
- INNER JOIN bugs
- ON flags.bug_id = bugs.bug_id
- LEFT JOIN profiles AS requesters
- ON flags.setter_id = requesters.userid
- LEFT JOIN profiles AS requestees
- ON flags.requestee_id = requestees.userid
- LEFT JOIN bug_group_map AS bgmap
- ON bgmap.bug_id = bugs.bug_id
- LEFT JOIN cc AS ccmap
- ON ccmap.who = " . $user->id . "
- AND ccmap.bug_id = bugs.bug_id ";
-
- # Limit query to pending requests and open bugs only
- $query .= " WHERE bugs.bug_status IN (" . join(',', quoted_open_states()) . ")
- AND flags.status = '?' ";
-
- # Weed out bug the user does not have access to
- $query .= " AND ((bgmap.group_id IS NULL)
- OR bgmap.group_id IN (" . $user->groups_as_string . ")
- OR (ccmap.who IS NOT NULL AND cclist_accessible = 1)
- OR (bugs.reporter = " . $user->id . " AND bugs.reporter_accessible = 1)
- OR (bugs.assigned_to = " . $user->id .") ";
- if (Bugzilla->params->{useqacontact}) {
- $query .= " OR (bugs.qa_contact = " . $user->id . ") ";
- }
- $query .= ") ";
-
- # Order the records (within each group).
- my $group_order_by = " GROUP BY flags.bug_id ORDER BY flags.creation_date, flagtypes.name";
+ # require user to be logged in for this page
+ Bugzilla->login(LOGIN_REQUIRED);
- my $requestee_list = $dbh->selectall_arrayref($query .
- " AND requestees.login_name = ? " .
- $group_order_by,
- { Slice => {} }, $user->login);
- $vars->{'requestee_list'} = $requestee_list;
- my $requester_list = $dbh->selectall_arrayref($query .
- " AND requesters.login_name = ? " .
- $group_order_by,
- { Slice => {} }, $user->login);
- $vars->{'requester_list'} = $requester_list;
+ $vars->{queries} = [ QUERY_DEFS ];
}
#########
diff --git a/extensions/MyDashboard/lib/Queries.pm b/extensions/MyDashboard/lib/Queries.pm
new file mode 100644
index 000000000..a0419c7b2
--- /dev/null
+++ b/extensions/MyDashboard/lib/Queries.pm
@@ -0,0 +1,243 @@
+# 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::MyDashboard::Queries;
+
+use strict;
+
+use Bugzilla;
+use Bugzilla::CGI;
+use Bugzilla::Search;
+
+use Bugzilla::Extension::MyDashboard::Util qw(open_states quoted_open_states);
+use Bugzilla::Extension::MyDashboard::TimeAgo qw(time_ago);
+
+use base qw(Exporter);
+our @EXPORT = qw(
+ QUERY_ORDER
+ SELECT_COLUMNS
+ QUERY_DEFS
+ query_bugs
+ query_flags
+);
+
+# Default sort order
+use constant QUERY_ORDER => ("changeddate desc", "bug_id");
+
+# List of columns that we will be selecting. In the future this should be configurable
+# Share with buglist.cgi?
+use constant SELECT_COLUMNS => qw(
+ bug_id
+ product
+ bug_status
+ bug_severity
+ version
+ component
+ short_desc
+ changeddate
+);
+
+sub QUERY_DEFS {
+ my $user = Bugzilla->user;
+
+ my @query_defs = (
+ {
+ name => 'assignedbugs',
+ heading => 'Assigned to You',
+ description => 'The bug has been assigned to you and it is not resolved or closed yet.',
+ params => {
+ 'bug_status' => ['__open__'],
+ 'emailassigned_to1' => 1,
+ 'emailtype1' => 'exact',
+ 'email1' => $user->login
+ }
+ },
+ {
+ name => 'newbugs',
+ heading => 'New Reported by You',
+ description => 'You reported the bug but nobody has accepted it yet.',
+ params => {
+ 'bug_status' => ['NEW'],
+ 'emailreporter1' => 1,
+ 'emailtype1' => 'exact',
+ 'email1' => $user->login
+ }
+ },
+ {
+ name => 'inprogressbugs',
+ heading => "In Progress Reported by You",
+ description => 'You reported the bug, the developer accepted the bug and is hopefully working on it.',
+ params => {
+ 'bug_status' => [ map { $_->name } grep($_->name ne 'NEW' && $_->name ne 'MODIFIED', open_states()) ],
+ 'emailreporter1' => 1,
+ 'emailtype1' => 'exact',
+ 'email1' => $user->login
+ }
+ },
+ {
+ name => 'openccbugs',
+ heading => "You Are CC'd On",
+ description => 'You are in the CC list of the bug, so you are watching it.',
+ params => {
+ 'bug_status' => ['__open__'],
+ 'emailcc1' => 1,
+ 'emailtype1' => 'exact',
+ 'email1' => $user->login
+ }
+ },
+ );
+
+ if (Bugzilla->params->{'useqacontact'}) {
+ push(@query_defs, {
+ name => 'qacontactbugs',
+ heading => 'You Are QA Contact',
+ description => 'You are the qa contact on this bug and it is not resolved or closed yet.',
+ params => {
+ 'bug_status' => ['__open__'],
+ 'emailqa_contact1' => 1,
+ 'emailtype1' => 'exact',
+ 'email1' => $user->login
+ }
+ });
+ }
+
+ if ($user->showmybugslink) {
+ my $query = Bugzilla->params->{mybugstemplate};
+ my $login = $user->login;
+ $query =~ s/%userid%/$login/;
+ $query =~ s/^buglist.cgi\?//;
+ push(@query_defs, {
+ name => 'mybugs',
+ heading => "My Bugs",
+ saved => 1,
+ params => $query,
+ });
+ }
+
+ foreach my $q (@{$user->queries}) {
+ next if !$q->in_mydashboard;
+ push(@query_defs, { name => $q->name,
+ heading => $q->name,
+ saved => 1,
+ params => $q->url });
+ }
+
+ return @query_defs;
+}
+
+sub query_bugs {
+ my $qdef = shift;
+ my $dbh = Bugzilla->dbh;
+
+ my $params = new Bugzilla::CGI($qdef->{params});
+
+ my $search = new Bugzilla::Search( fields => [ SELECT_COLUMNS ],
+ params => scalar $params->Vars,
+
+ order => [ QUERY_ORDER ]);
+
+ my $query = $search->sql();
+ my $sth = $dbh->prepare($query);
+ $sth->execute();
+ my $rows = $sth->fetchall_arrayref();
+
+ my @bugs;
+ foreach my $row (@$rows) {
+ my $bug = {};
+ foreach my $column (SELECT_COLUMNS) {
+ $bug->{$column} = shift @$row;
+ #if ($column eq 'changeddate') {
+ # my $date_then = datetime_from($bug->{$column});
+ # $bug->{'updated'} = time_ago($date_then, $date_now);
+ #}
+ }
+ push(@bugs, $bug);
+ }
+
+ return (\@bugs, $params->canonicalise_query());
+}
+
+sub query_flags {
+ my $type = shift;
+ my $user = Bugzilla->user;
+ my $dbh = Bugzilla->dbh;
+
+ ($type ne 'requestee' || $type ne 'requester')
+ || ThrowCodeError('param_required', { param => 'type' });
+
+ my $attach_join_clause = "flags.attach_id = attachments.attach_id";
+ if (Bugzilla->params->{insidergroup} && !$user->in_group(Bugzilla->params->{insidergroup})) {
+ $attach_join_clause .= " AND attachments.isprivate < 1";
+ }
+
+ my $query =
+ # Select columns describing each flag, the bug/attachment on which
+ # it has been set, who set it, and of whom they are requesting it.
+ " SELECT flags.id AS id,
+ flagtypes.name AS type,
+ flags.status AS status,
+ flags.bug_id AS bug_id,
+ bugs.short_desc AS bug_summary,
+ flags.attach_id AS attach_id,
+ attachments.description AS attach_summary,
+ requesters.realname AS requester,
+ requestees.realname AS requestee,
+ " . $dbh->sql_date_format('flags.creation_date', '%Y:%m:%d') . " AS created
+ FROM flags
+ LEFT JOIN attachments
+ ON ($attach_join_clause)
+ INNER JOIN flagtypes
+ ON flags.type_id = flagtypes.id
+ INNER JOIN bugs
+ ON flags.bug_id = bugs.bug_id
+ LEFT JOIN profiles AS requesters
+ ON flags.setter_id = requesters.userid
+ LEFT JOIN profiles AS requestees
+ ON flags.requestee_id = requestees.userid
+ LEFT JOIN bug_group_map AS bgmap
+ ON bgmap.bug_id = bugs.bug_id
+ LEFT JOIN cc AS ccmap
+ ON ccmap.who = " . $user->id . "
+ AND ccmap.bug_id = bugs.bug_id ";
+
+ # Limit query to pending requests and open bugs only
+ $query .= " WHERE bugs.bug_status IN (" . join(',', quoted_open_states()) . ")
+ AND flags.status = '?' ";
+
+ # Weed out bug the user does not have access to
+ $query .= " AND ((bgmap.group_id IS NULL)
+ OR bgmap.group_id IN (" . $user->groups_as_string . ")
+ OR (ccmap.who IS NOT NULL AND cclist_accessible = 1)
+ OR (bugs.reporter = " . $user->id . " AND bugs.reporter_accessible = 1)
+ OR (bugs.assigned_to = " . $user->id .") ";
+ if (Bugzilla->params->{useqacontact}) {
+ $query .= " OR (bugs.qa_contact = " . $user->id . ") ";
+ }
+ $query .= ") ";
+
+ # Order the records (within each group).
+ my $group_order_by = " GROUP BY flags.bug_id ORDER BY flags.creation_date, flagtypes.name";
+
+ if ($type eq 'requestee') {
+ return $dbh->selectall_arrayref($query .
+ " AND requestees.login_name = ? " .
+ $group_order_by,
+ { Slice => {} }, $user->login);
+ }
+
+ if ($type eq 'requester') {
+ return $dbh->selectall_arrayref($query .
+ " AND requesters.login_name = ? " .
+ $group_order_by,
+ { Slice => {} }, $user->login);
+ }
+
+ return undef;
+}
+
+
+1;
diff --git a/extensions/MyDashboard/lib/Util.pm b/extensions/MyDashboard/lib/Util.pm
index ce5db005f..fa7cf83b0 100644
--- a/extensions/MyDashboard/lib/Util.pm
+++ b/extensions/MyDashboard/lib/Util.pm
@@ -9,6 +9,10 @@ package Bugzilla::Extension::MyDashboard::Util;
use strict;
+use Bugzilla::CGI;
+use Bugzilla::Search;
+use Bugzilla::Status;
+
use base qw(Exporter);
@Bugzilla::Extension::MyDashboard::Util::EXPORT = qw(
open_states
@@ -17,8 +21,6 @@ use base qw(Exporter);
quoted_closed_states
);
-use Bugzilla::Status;
-
our $_open_states;
sub open_states {
$_open_states ||= Bugzilla::Status->match({ is_open => 1, isactive => 1 });
diff --git a/extensions/MyDashboard/lib/WebService.pm b/extensions/MyDashboard/lib/WebService.pm
index 78285ca06..853ef2baf 100644
--- a/extensions/MyDashboard/lib/WebService.pm
+++ b/extensions/MyDashboard/lib/WebService.pm
@@ -11,8 +11,18 @@ use warnings;
use base qw(Bugzilla::WebService);
+use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Util qw(detaint_natural trick_taint);
+use Bugzilla::WebService::Util qw(validate);
+
+use Bugzilla::Extension::MyDashboard::Queries qw(QUERY_DEFS query_bugs query_flags);
+
+use constant READ_ONLY => qw(
+ prod_comp_search
+ run_bug_query
+ run_flag_query
+);
sub prod_comp_search {
my ($self, $params) = @_;
@@ -80,6 +90,44 @@ sub prod_comp_search {
return { products => $products };
}
+sub run_bug_query {
+ my($self, $params) = @_;
+ my $user = Bugzilla->login(LOGIN_REQUIRED);
+
+ defined $params->{query}
+ || ThrowCodeError('param_required',
+ { function => 'MyDashboard.run_bug_query',
+ param => 'query' });
+
+ my $result;
+ foreach my $qdef (QUERY_DEFS) {
+ next if $qdef->{name} ne $params->{query};
+ my ($bugs, $query_string) = query_bugs($qdef);
+ $query_string =~ s/^POSTDATA=&//;
+ $qdef->{bugs} = $bugs;
+ $qdef->{buffer} = $query_string;
+ $result = $qdef;
+ last;
+ }
+
+ return { result => $result };
+}
+
+sub run_flag_query {
+ my ($self, $params) =@_;
+ my $user = Bugzilla->login(LOGIN_REQUIRED);
+
+ defined $params->{type}
+ || ThrowCodeError('param_required',
+ { function => 'MyDashboard.run_flag_query',
+ param => 'type' });
+
+ my $type = $params->{type};
+ my $results = query_flags($type);
+
+ return { result => { $type => $results }};
+}
+
1;
__END__
diff --git a/extensions/MyDashboard/template/en/default/mydashboard/prod-comp-search.html.tmpl b/extensions/MyDashboard/template/en/default/mydashboard/prod-comp-search.html.tmpl
deleted file mode 100644
index 98daedf1e..000000000
--- a/extensions/MyDashboard/template/en/default/mydashboard/prod-comp-search.html.tmpl
+++ /dev/null
@@ -1,43 +0,0 @@
-[%# 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.
- #%]
-
-<div id="prod_comp_search_main">
- <div id="prod_comp_search_autocomplete">
- <div id="prod_comp_search_label">
- File [% terms.Bug %]:
- <img id="prod_comp_throbber" src="extensions/BMO/web/images/throbber.gif"
- class="hidden" width="16" height="11">
- </div>
- <input id="prod_comp_search" type="text" size="60">
- <div id="prod_comp_search_autocomplete_container"></div>
- </div>
-</div>
-<script type="text/javascript">
- if(typeof(YAHOO.bugzilla.prodCompSearch) !== 'undefined'
- && YAHOO.bugzilla.prodCompSearch != null)
- {
- YAHOO.bugzilla.prodCompSearch.init(
- "prod_comp_search",
- "prod_comp_search_autocomplete_container",
- "[% format FILTER js %]",
- "[% cloned_bug_id FILTER js %]");
- [% IF target == "describecomponents.cgi" %]
- YAHOO.bugzilla.prodCompSearch.autoComplete.itemSelectEvent.subscribe(function (e, args) {
- var oData = args[2];
- var url = "describecomponents.cgi?product=" + encodeURIComponent(oData[0]) +
- "&component=" + encodeURIComponent(oData[1]) +
- "#" + encodeURIComponent(oData[1]);
- var format = YAHOO.bugzilla.prodCompSearch.format;
- if (format) {
- url += "&format=" + encodeURIComponent(format);
- }
- window.location.href = url;
- });
- [% END %]
- }
-</script>
diff --git a/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl b/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl
index 60c3be668..b85ba3cc8 100644
--- a/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl
+++ b/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl
@@ -10,53 +10,34 @@
[% PROCESS global/header.html.tmpl
title = "My Dashboard"
- style_urls = [ "skins/standard/buglist.css",
- "js/yui/assets/skins/sam/paginator.css",
- "extensions/MyDashboard/web/styles/mydashboard.css",
+ style_urls = [ "extensions/MyDashboard/web/styles/mydashboard.css",
"extensions/MyDashboard/web/styles/prod_comp_search.css" ]
- yui = [ "datatable", "paginator", "autocomplete" ]
- javascript_urls = [ "extensions/MyDashboard/web/js/mydashboard.js",
- "extensions/MyDashboard/web/js/prod_comp_search.js" ]
- onload = "MD.showQuerySection();"
%]
-<script type="text/javascript">
-<!--
- [%# Set up severities list for proper sorting %]
- MD.severities = new Array();
- [% sort_count = 0 %]
- [% FOREACH s = severities %]
- MD.severities['[% s FILTER js %]'] = [% sort_count FILTER js %];
- [% sort_count = sort_count + 1 %]
- [% END %]
-
- MD.full_query_list = [];
- [% FOREACH r = results %]
- MD.full_query_list.push('[% r.name FILTER js %]');
- [% END %]
--->
-</script>
-
-[% standard_results = [] %]
-[% saved_results = [] %]
-[% FOREACH r = results %]
- [% standard_results.push(r) IF !r.saved %]
- [% saved_results.push(r) IF r.saved %]
+[% standard_queries = [] %]
+[% saved_queries = [] %]
+[% FOREACH q = queries %]
+ [% standard_queries.push(q) IF !q.saved %]
+ [% saved_queries.push(q) IF q.saved %]
[% END %]
+<script src="http://yui.yahooapis.com/3.7.3/build/yui/yui-min.js"></script>
+[%# These need to load after yui-min.js %]
+<script type="text/javascript" src="[% 'extensions/MyDashboard/web/js/mydashboard.js' FILTER mtime FILTER html %]"></script>
+
<div id="mydashboard">
- <div class="yui-skin-sam">
+ <div class="yui3-skin-sam">
<div id="left">
<div id="query_list_container">
Choose query:
- <select id="query" name="query" onchange="MD.showQuerySection();">
+ <select id="query" name="query">
<optgroup id="standard_queries" label="Standard">
- [% FOREACH r = standard_results %]
+ [% FOREACH r = standard_queries %]
<option value="[% r.name FILTER html %]">[% r.heading FILTER html %]</option>
[% END%]
</optgroup>
<optgroup id="saved_queries" label="Saved">
- [% FOREACH r = saved_results %]
+ [% FOREACH r = saved_queries %]
<option value="[% r.name FILTER html %]">[% r.heading FILTER html %]</option>
[% END %]
</optgroup>
@@ -66,157 +47,49 @@
</small>
</div>
- [% FOREACH r = standard_results %]
- [% PROCESS query_results r = r %]
- [% END %]
-
- [% FOREACH r = saved_results %]
- [% PROCESS query_results r = r %]
- [% END %]
+ <div id="query_container">
+ <div class="query_heading"></div>
+ <div class="query_description"></div>
+ <span class="items_found" id="query_bugs_found">0 bugs found</span>
+ | <a class="refresh" href="javascript:void(0);" id="query_refresh">Refresh</a>
+ <span class="status">Loading...</span>
+ <div id="query_pagination_top"></div>
+ <div id="query_table"></div>
+ </div>
</div>
<div id="right">
- <div id="file_bug_container">
- [% PROCESS "mydashboard/prod-comp-search.html.tmpl" %]
+ <div id="prod_comp_search_main">
+ <div id="prod_comp_search_label">
+ File [% terms.Bug %]:
+ <img id="prod_comp_throbber" src="extensions/BMO/web/images/throbber.gif"
+ class="bz_default_hidden" width="16" height="11">
+ </div>
+ <input id="prod_comp_search" type="text" size="60">
</div>
<div id="requestee_container">
<div class="query_heading">
Flags Requested of You
</div>
- <span class="flags_found">
- [% requestee_list.size FILTER html %]&nbsp;flags found
- </span>
- <div id="requestee_table_container">
- <table id="requestee_table" cellspacing="0" cellpadding="3" width="100%">
- <thead>
- <tr bgcolor="#dedede">
- <th>Requester</th>
- <th>Flag</th>
- <th>[% terms.Bug %]</th>
- <th>Created</th>
- </tr>
- </thead>
- <tbody>
- [% FOREACH request = requestee_list %]
- <tr class="bz_bugitem [%+ loop.count() % 2 == 0 ? "bz_row_odd" : "bz_row_even" %]">
- <td>[% request.requester FILTER html %]</td>
- <td>[% request.type FILTER html %][% request.status FILTER html %]</td>
- <td>
- [% IF request.attach_id %]
- <a href="[% urlbase FILTER none %]attachment.cgi?action=edit&id=[% request.attach_id FILTER uri %]">
- [% request.attach_id FILTER html %]: [%+ request.attach_summary FILTER html %]</a>
- [% ELSE %]
- <a href="[% urlbase FILTER none %]show_bug.cgi?id=[% request.bug_id FILTER uri %]">
- [% request.bug_id FILTER html %]: [%+ request.bug_summary FILTER html %]</a>
- [% END %]
- </td>
- <td>[% request.created FILTER time('%Y:%m:%d') FILTER html %]</td>
- </tr>
- [% END %]
- </tbody>
- </table>
- </div>
+ <span class="items_found" id="requestee_flags_found">0 flags found</span>
+ | <a class="refresh" href="javascript:void(0);" id="requestee_refresh">Refresh</a>
+ <span class="status">Loading...</span>
+ <div id="requestee_table"></div>
</div>
- <script>
- <!--
- MD.addStatListener("requestee_table_container", "requestee_table",
- MD.requestee_column_defs, MD.requestee_fields,
- { paginator: new YAHOO.widget.Paginator({ rowsPerPage: 25, alwaysVisible: false }) });
- -->
- </script>
<div id="requester_container">
<div class="query_heading">
Flags You Have Requested
</div>
- <span class="flags_found">
- [% requester_list.size FILTER html %]&nbsp;flags found
- </span>
- <div id="requester_table_container">
- <table id="requester_table" cellspacing="0" cellpadding="3" width="100%">
- <thead bgcolor="#dedede">
- <tr>
- <th>Requestee</th>
- <th>Flag</th>
- <th>[% terms.Bug %]</th>
- <th>Created</th>
- </tr>
- </thead>
- <tbody>
- [% FOREACH request = requester_list %]
- <tr class="bz_bugitem [%+ loop.count() % 2 == 0 ? "bz_row_odd" : "bz_row_even" %]">
- <td>[% request.requestee FILTER html %]</td>
- <td>[% request.type FILTER html %][% request.status FILTER html %]</td>
- <td>
- [% IF request.attach_id %]
- <a href="[% urlbase FILTER none %]attachment.cgi?action=edit&id=[% request.attach_id FILTER uri %]">
- [% request.attach_id FILTER html %]: [%+ request.attach_summary FILTER html %]</a>
- [% ELSE %]
- <a href="[% urlbase FILTER none %]show_bug.cgi?id=[% request.bug_id FILTER uri %]">
- [% request.bug_id FILTER html %]: [%+ request.bug_summary FILTER html %]</a>
- [% END %]
- </td>
- <td>[% request.created FILTER time('%Y:%m:%d') FILTER html %]</td>
- </tr>
- [% END %]
- </tbody>
- </table>
- </div>
+ <span class="items_found" id="requester_flags_found">0 flags found</span>
+ | <a class="refresh" href="javascript:void(0);" id="requester_refresh">Refresh</a>
+ <span class="status">Loading...</span>
+ <div id="requester_table"></div>
</div>
- <script>
- <!--
- MD.addStatListener("requester_table_container", "requester_table",
- MD.requester_column_defs, MD.requester_fields,
- { paginator: new YAHOO.widget.Paginator({ rowsPerPage: 25, alwaysVisible: false }) });
- -->
- </script>
</div>
<div style="clear:both;"></div>
</div>
</div>
[% PROCESS global/footer.html.tmpl %]
-
-[% BLOCK query_results %]
- <div id="[% r.name FILTER html %]_container" class="bz_default_hidden">
- [% IF r.description %]
- <div class="query_description">
- [% r.description FILTER html %]
- </div>
- [% END %]
- <span class="bugs_found">
- <a href="[% urlbase FILTER none %]buglist.cgi?[% r.buffer FILTER none %]">
- [% r.bugs.size FILTER html %]&nbsp;[% terms.bugs %] found</a>
- </span>
- <div id="[% r.name FILTER html %]_table_container">
- <table id="[% r.name FILTER html %]_table" cellspacing="0" cellpadding="3" width="100%">
- <thead>
- <tr>
- <th>ID</th>
- <th>Updated</th>
- <th>Status</th>
- <th>Summary</th>
- </tr>
- </thead>
- <tbody>
- [% FOREACH bug = r.bugs %]
- <tr class="bz_bugitem [%+ loop.count() % 2 == 0 ? "bz_row_odd" : "bz_row_even" %]">
- <td align="center"><a href="show_bug.cgi?id=[% bug.bug_id FILTER uri %]">[% bug.bug_id FILTER html %]</a></td>
- <td align="center">[% bug.changeddate FILTER time('%Y:%m:%d') FILTER html %]</td>
- <td align="center">[% bug.bug_status FILTER html %]</td>
- <td>[% bug.short_desc FILTER html %]</td>
- </tr>
- [% END %]
- </tbody>
- </table>
- </div>
- <script>
- <!--
- MD.addStatListener("[% r.name FILTER js %]_table_container", "[% r.name FILTER js %]_table",
- MD.query_column_defs, MD.query_fields,
- { paginator: new YAHOO.widget.Paginator({ rowsPerPage: 25, alwaysVisible: false }) });
- -->
- </script>
- </div>
-[% END %]
diff --git a/extensions/MyDashboard/web/js/mydashboard.js b/extensions/MyDashboard/web/js/mydashboard.js
index 25529d8c8..1383c28e5 100644
--- a/extensions/MyDashboard/web/js/mydashboard.js
+++ b/extensions/MyDashboard/web/js/mydashboard.js
@@ -6,154 +6,301 @@
* defined by the Mozilla Public License, v. 2.0.
*/
-YAHOO.namespace('MyDashboard');
+// Main query code
+YUI().use("node", "datatable", "datatable-sort", "json-stringify",
+ "datatable-datasource", "datasource-io", "datasource-jsonschema",
+ "gallery-paginator-view", "gallery-datatable-paginator", function (Y) {
+ var counter = 0,
+ dataSource = null,
+ dataTable = null;
-var MD = YAHOO.MyDashboard;
+ var updateQueryTable = function(query_name) {
+ if (!query_name) return;
-MD.showQuerySection = function () {
- var query_select = YAHOO.util.Dom.get('query');
- var selected_value = '';
- for (var i = 0, l = query_select.options.length; i < l; i++) {
- if (query_select.options[i].selected) {
- selected_value = query_select.options[i].value;
+ counter = counter + 1;
+
+ var callback = {
+ success: function(e) {
+ if (e.response) {
+ Y.one("#query_container .query_description").setHTML(e.response.meta.description);
+ Y.one("#query_container .query_heading").setHTML(e.response.meta.heading);
+ Y.one("#query_bugs_found").setHTML(
+ '<a href="buglist.cgi?' + e.response.meta.buffer +
+ '">' + e.response.results.length + ' bugs found</a>');
+ Y.one("#query_container .status").addClass('bz_default_hidden');
+ dataTable.set('data', e.response.results);
+ dataTable.render("#query_table");
+ }
+ },
+ failure: function(o) {
+ var resp = o.responseText;
+ alert("IO request failed : " + resp);
+ }
+ };
+
+ var json_object = {
+ version: "1.1",
+ method: "MyDashboard.run_bug_query",
+ id: counter,
+ params: { query : query_name }
+ };
+
+ var stringified = Y.JSON.stringify(json_object);
+
+ Y.one("#query_container .status").removeClass('bz_default_hidden');
+
+ dataSource.sendRequest({
+ request: stringified,
+ cfg: {
+ method: "POST",
+ headers: { 'Content-Type': 'application/json' }
+ },
+ callback: callback
+ });
+ };
+
+ dataSource = new Y.DataSource.IO({ source: 'jsonrpc.cgi' });
+ dataTable = new Y.DataTable({
+ columns: [
+ { key:"bug_id", label:"Bug", sortable:true,
+ formatter: '<a href="show_bug.cgi?id={value}" target="_blank">{value}</a>', allowHTML: true },
+ { key:"changeddate", label:"Updated", sortable:true },
+ { key:"bug_status", label:"Status", sortable:true },
+ { key:"short_desc", label:"Summary", sortable:true },
+ ],
+ strings: {
+ emptyMessage: 'No query data found.',
+ },
+ paginator: new Y.PaginatorView({
+ container: '#query_pagination_top'
+ })
+ });
+
+ dataTable.plug(Y.Plugin.DataTableSort);
+
+ dataTable.plug(Y.Plugin.DataTableDataSource, {
+ datasource: dataSource,
+ initialRequest: updateQueryTable("assignedbugs"),
+ });
+
+ dataSource.plug(Y.Plugin.DataSourceJSONSchema, {
+ schema: {
+ resultListLocator: "result.result.bugs",
+ resultFields: ["bug_id", "changeddate", "bug_status", "short_desc"],
+ metaFields: {
+ description: "result.result.description",
+ heading: "result.result.heading",
+ buffer: "result.result.buffer"
+ }
+ }
+ });
+
+ Y.one('#query').on('change', function(e) {
+ var index = e.target.get('selectedIndex');
+ var selected_value = e.target.get("options").item(index).getAttribute('value');
+ updateQueryTable(selected_value);
+ });
+
+ Y.one('#query_refresh').on('click', function(e) {
+ var query_select = Y.one('#query');
+ var index = query_select.get('selectedIndex');
+ var selected_value = query_select.get("options").item(index).getAttribute('value');
+ updateQueryTable(selected_value);
+ });
+});
+
+// Flag tables
+YUI().use("node", "datatable", "datatable-sort", "json-stringify",
+ "datatable-datasource", "datasource-io", "datasource-jsonschema", function (Y) {
+ // Common
+ var counter = 0;
+ var dataSource = {
+ requestee: null,
+ requester: null
+ };
+ var dataTable = {
+ requestee: null,
+ requester: null
+ };
+
+ var updateFlagTable = function (type) {
+ if (!type) return;
+
+ counter = counter + 1;
+
+ var callback = {
+ success: function(e) {
+ if (e.response) {
+ Y.one("#" + type + "_flags_found").setHTML(
+ e.response.results.length + ' flags found');
+ Y.one("#" + type + "_container .status").addClass('bz_default_hidden');
+ dataTable[type].set('data', e.response.results);
+ dataTable[type].render("#" + type + "_table");
+ }
+ },
+ failure: function(o) {
+ var resp = o.responseText;
+ alert("IO request failed : " + resp);
+ }
+ };
+
+ var json_object = {
+ version: "1.1",
+ method: "MyDashboard.run_flag_query",
+ id: counter,
+ params: { type : type }
+ };
+
+ var stringified = Y.JSON.stringify(json_object);
+
+ Y.one("#" + type + "_container .status").removeClass('bz_default_hidden');
+
+ dataSource[type].sendRequest({
+ request: stringified,
+ cfg: {
+ method: "POST",
+ headers: { 'Content-Type': 'application/json' }
+ },
+ callback: callback
+ });
+ };
+
+ // Requestee
+ dataSource.requestee = new Y.DataSource.IO({ source: 'jsonrpc.cgi' });
+ dataTable.requestee = new Y.DataTable({
+ columns: [
+ { key:"requester", label:"Requester", sortable:true },
+ { key:"flag", label:"Flag", sortable:true },
+ { key:"bug_id", label:"Bug", sortable:true,
+ formatter: '<a href="show_bug.cgi?id={value}" target="_blank">{value}</a>', allowHTML: true },
+ { key:"changeddate", label:"Updated", sortable:true },
+ { key:"created", label:"Created", sortable:true }
+ ],
+ strings: {
+ emptyMessage: 'No flag data found.',
}
- }
- for (var i = 0, l = MD.full_query_list.length; i < l; i++) {
- var query = MD.full_query_list[i];
- if (selected_value == MD.full_query_list[i]) {
- YAHOO.util.Dom.removeClass(query + '_container', 'bz_default_hidden');
+ });
+
+ dataTable.requestee.plug(Y.Plugin.DataTableSort);
+
+ dataTable.requestee.plug(Y.Plugin.DataTableDataSource, {
+ datasource: dataSource,
+ initialRequest: updateFlagTable("requestee"),
+ });
+
+ dataSource.requestee.plug(Y.Plugin.DataSourceJSONSchema, {
+ schema: {
+ resultListLocator: "result.result.requestee",
+ resultFields: ["requester", "flag", "bug_id", "created"]
}
- else {
- YAHOO.util.Dom.addClass(query + '_container', 'bz_default_hidden');
+ });
+
+ dataTable.requestee.render("#requestee_table");
+
+ Y.one('#requestee_refresh').on('click', function(e) {
+ updateFlagTable('requestee');
+ });
+
+ // Requester
+ dataSource.requester = new Y.DataSource.IO({ source: 'jsonrpc.cgi' });
+ dataTable.requester = new Y.DataTable({
+ columns: [
+ { key:"requestee", label:"Requestee", sortable:true },
+ { key:"flag", label:"Flag", sortable:true },
+ { key:"bug_id", label:"Bug", sortable:true,
+ formatter: '<a href="show_bug.cgi?id={value}" target="_blank">{value}</a>', allowHTML: true },
+ { key:"created", label:"Created", sortable:true }
+ ],
+ strings: {
+ emptyMessage: 'No flag data found.',
}
- }
-}
-
-MD.query_column_defs = [
- { key:"id", label:"ID", sortable:true, sortOptions:{ sortFunction: MD.sortBugIdLinks } },
- { key:"updated", label:"Updated", sortable:true },
- { key:"bug_status", label:"Status", sortable:true },
- { key:"summary", label:"Summary", sortable:true },
-];
-
-MD.query_fields = [
- { key:"id" },
- { key:"updated" },
- { key:"bug_status" },
- { key:"summary" }
-];
-
-MD.requestee_column_defs = [
- { key:"requester", label:"Requester", sortable:true },
- { key:"flag", label:"Flag", sortable:true },
- { key:"bug", label:"Bug", sortable:true },
- { key:"created", label:"Created", sortable:true }
-];
-
-MD.requestee_fields = [
- { key:"requester" },
- { key:"flag" },
- { key:"bug" },
- { key:"created" }
-];
-
-MD.requester_column_defs = [
- { key:"requestee", label:"Requestee", sortable:true },
- { key:"flag", label:"Flag", sortable:true },
- { key:"bug", label:"Bug", sortable:true },
- { key:"created", label:"Created", sortable:true }
-];
-
-MD.requester_fields = [
- { key:"requestee" },
- { key:"flag" },
- { key:"bug" },
- { key:"created" }
-];
-
-MD.addStatListener = function (div_name, table_name, column_defs, fields, options) {
- YAHOO.util.Event.addListener(window, "load", function() {
- YAHOO.example.StatsFromMarkup = new function() {
- this.myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get(table_name));
- this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
- this.myDataSource.responseSchema = { fields:fields };
- this.myDataTable = new YAHOO.widget.DataTable(div_name, column_defs, this.myDataSource, options);
- this.myDataTable.subscribe("rowMouseoverEvent", this.myDataTable.onEventHighlightRow);
- this.myDataTable.subscribe("rowMouseoutEvent", this.myDataTable.onEventUnhighlightRow);
+ });
+
+ dataTable.requester.plug(Y.Plugin.DataTableSort);
+
+ dataTable.requester.plug(Y.Plugin.DataTableDataSource, {
+ datasource: dataSource,
+ initialRequest: updateFlagTable("requester"),
+ });
+
+ dataSource.requester.plug(Y.Plugin.DataSourceJSONSchema, {
+ schema: {
+ resultListLocator: "result.result.requester",
+ resultFields: ["requestee", "flag", "bug_id", "created"]
+ }
+ });
+
+ Y.one('#requester_refresh').on('click', function(e) {
+ updateFlagTable('requester');
+ });
+});
+
+YUI().use("node", "json-stringify", "autocomplete", "autocomplete-highlighters",
+ "datasource-io", "datasource-jsonschema", function (Y) {
+ var counter = 0,
+ format = '',
+ cloned_bug_id = '',
+ dataSource = null,
+ autoComplete = null;
+
+ var generateRequest = function (enteredText) {
+ counter = counter + 1;
+ var json_object = {
+ version: "1.1",
+ method : "MyDashboard.prod_comp_search",
+ id : counter,
+ params : { search: enteredText }
};
+ Y.one("#prod_comp_throbber").removeClass('bz_default_hidden');
+ return Y.JSON.stringify(json_object);
+ };
+
+ var resultListFormat = function(oResultData, enteredText, sResultMatch) {
+ return Y.Lang.escapeHTML(oResultData[0]) + " :: " +
+ Y.Lang.escapeHTML(oResultData[1]);
+ };
+
+ var dataSource = new Y.DataSource.IO({
+ source: 'jsonrpc.cgi',
+ connTimeout: 30000,
+ connMethodPost: true,
+ connXhrMode: 'cancelStaleRequests',
+ maxCacheEntries: 5,
+ responseSchema: {
+ resultsList : "result.products",
+ metaFields : { error: "error", jsonRpcId: "id"},
+ fields : [ "product", "component" ]
+ }
});
-}
-
-// Custom sort handler to sort by bug id inside an anchor tag
-MD.sortBugIdLinks = function (a, b, desc) {
- // Deal with empty values
- if (!YAHOO.lang.isValue(a)) {
- return (!YAHOO.lang.isValue(b)) ? 0 : 1;
- }
- else if(!YAHOO.lang.isValue(b)) {
- return -1;
- }
- // Now we need to pull out the ID text and convert to Numbers
- // First we do 'a'
- var container = document.createElement("bug_id_link");
- container.innerHTML = a.getData("id");
- var anchors = container.getElementsByTagName("a");
- var text = anchors[0].textContent;
- if (text === undefined) text = anchors[0].innerText;
- var new_a = new Number(text);
- // Then we do 'b'
- container.innerHTML = b.getData("id");
- anchors = container.getElementsByTagName("a");
- text = anchors[0].textContent;
- if (text == undefined) text = anchors[0].innerText;
- var new_b = new Number(text);
-
- if (!desc) {
- return YAHOO.util.Sort.compare(new_a, new_b);
- }
- else {
- return YAHOO.util.Sort.compare(new_b, new_a);
- }
-}
-
-// Custom sort handler for bug severities
-MD.sortBugSeverity = function (a, b, desc) {
- // Deal with empty values
- if (!YAHOO.lang.isValue(a)) {
- return (!YAHOO.lang.isValue(b)) ? 0 : 1;
- }
- else if(!YAHOO.lang.isValue(b)) {
- return -1;
- }
-
- var new_a = new Number(MD.severities[YAHOO.lang.trim(a.getData('bug_severity'))]);
- var new_b = new Number(MD.severities[YAHOO.lang.trim(b.getData('bug_severity'))]);
-
- if (!desc) {
- return YAHOO.util.Sort.compare(new_a, new_b);
- }
- else {
- return YAHOO.util.Sort.compare(new_b, new_a);
- }
-}
-
-// Custom sort handler for bug priorities
-MD.sortBugPriority = function (a, b, desc) {
- // Deal with empty values
- if (!YAHOO.lang.isValue(a)) {
- return (!YAHOO.lang.isValue(b)) ? 0 : 1;
- }
- else if(!YAHOO.lang.isValue(b)) {
- return -1;
- }
-
- var new_a = new Number(MD.priorities[YAHOO.lang.trim(a.getData('priority'))]);
- var new_b = new Number(MD.priorities[YAHOO.lang.trim(b.getData('priority'))]);
-
- if (!desc) {
- return YAHOO.util.Sort.compare(new_a, new_b);
- }
- else {
- return YAHOO.util.Sort.compare(new_b, new_a);
- }
-}
+
+ Y.one('#prod_comp_search').plug(Y.Plugin.AutoComplete, {
+ resultHighlighter: 'phraseMatch',
+ source: dataSource,
+ minQueryLength: 3,
+ queryDelay: 0.05,
+ generateRequest: generateRequest,
+ formatResult: resultListFormat,
+ maxResultsDisplayed: 25,
+ suppressInputUpdate: true,
+ doBeforeLoadData: function(sQuery, oResponse, oPayload) {
+ Y.one("#prod_comp_throbber").addClass('bz_default_hidden');
+ return true;
+ }
+ });
+
+// autoComplete.textboxFocusEvent.subscribe(function () {
+// var input = Y.one(field);
+// if (input.value && input.value.length > 3) {
+// sendQuery(input.value);
+// }
+// });
+//
+// autoComplete.itemSelectEvent.subscribe(function (e, args) {
+// var oData = args[2];
+// var url = "enter_bug.cgi?product=" + encodeURIComponent(oData[0]) +
+// "&component=" + encodeURIComponent(oData[1]);
+// autoComplete.dataReturnEvent.subscribe(function(type, args) {
+// args[0].autoHighlight = args[2].length == 1;
+// });
+// });
+});
diff --git a/extensions/MyDashboard/web/js/prod_comp_search.js b/extensions/MyDashboard/web/js/prod_comp_search.js
deleted file mode 100644
index 06b4c601f..000000000
--- a/extensions/MyDashboard/web/js/prod_comp_search.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/* 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.
- */
-
-YAHOO.bugzilla.prodCompSearch = {
- counter : 0,
- format : '',
- cloned_bug_id : '',
- dataSource : null,
- autoComplete: null,
- generateRequest : function (enteredText) {
- YAHOO.bugzilla.prodCompSearch.counter = YAHOO.bugzilla.prodCompSearch.counter + 1;
- YAHOO.util.Connect.setDefaultPostHeader('application/json', true);
- var json_object = {
- method : "MyDashboard.prod_comp_search",
- id : YAHOO.bugzilla.prodCompSearch.counter,
- params : [ {
- search : decodeURIComponent(enteredText)
- } ]
- };
- YAHOO.util.Dom.removeClass('prod_comp_throbber', 'hidden');
- return YAHOO.lang.JSON.stringify(json_object);
- },
- resultListFormat : function(oResultData, enteredText, sResultMatch) {
- return YAHOO.lang.escapeHTML(oResultData[0]) + " :: " +
- YAHOO.lang.escapeHTML(oResultData[1]);
- },
- init_ds : function(){
- this.dataSource = new YAHOO.util.XHRDataSource("jsonrpc.cgi");
- this.dataSource.connTimeout = 30000;
- this.dataSource.connMethodPost = true;
- this.dataSource.connXhrMode = "cancelStaleRequests";
- this.dataSource.maxCacheEntries = 5;
- this.dataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
- this.dataSource.responseSchema = {
- resultsList : "result.products",
- metaFields : { error: "error", jsonRpcId: "id"},
- fields : [ "product", "component" ]
- };
- },
- init : function(field, container, format, cloned_bug_id) {
- if (this.dataSource == null)
- this.init_ds();
- this.format = format;
- this.cloned_bug_id = cloned_bug_id;
- this.autoComplete = new YAHOO.widget.AutoComplete(field, container, this.dataSource);
- this.autoComplete.generateRequest = this.generateRequest;
- this.autoComplete.formatResult = this.resultListFormat;
- this.autoComplete.minQueryLength = 3;
- this.autoComplete.autoHighlight = false;
- this.autoComplete.queryDelay = 0.05;
- this.autoComplete.useIFrame = true;
- this.autoComplete.maxResultsDisplayed = 25;
- this.autoComplete.suppressInputUpdate = true;
- this.autoComplete.doBeforeLoadData = function(sQuery, oResponse, oPayload) {
- YAHOO.util.Dom.addClass('prod_comp_throbber', 'hidden');
- return true;
- };
- this.autoComplete.textboxFocusEvent.subscribe(function () {
- var input = YAHOO.util.Dom.get(field);
- if (input.value && input.value.length > 3) {
- this.sendQuery(input.value);
- }
- });
- this.autoComplete.itemSelectEvent.subscribe(function (e, args) {
- var oData = args[2];
- var url = "enter_bug.cgi?product=" + encodeURIComponent(oData[0]) +
- "&component=" + encodeURIComponent(oData[1]);
- var format = YAHOO.bugzilla.prodCompSearch.format;
- if (format)
- url += "&format=" + encodeURIComponent(format);
- var cloned_bug_id = YAHOO.bugzilla.prodCompSearch.cloned_bug_id;
- if (cloned_bug_id)
- url += "&cloned_bug_id=" + encodeURIComponent(cloned_bug_id);
- window.location.href = url;
- });
- this.autoComplete.dataReturnEvent.subscribe(function(type, args) {
- args[0].autoHighlight = args[2].length == 1;
- });
- }
-}
diff --git a/extensions/MyDashboard/web/styles/mydashboard.css b/extensions/MyDashboard/web/styles/mydashboard.css
index 98524e4a0..eda65ecfa 100644
--- a/extensions/MyDashboard/web/styles/mydashboard.css
+++ b/extensions/MyDashboard/web/styles/mydashboard.css
@@ -5,11 +5,11 @@
* This Source Code Form is "Incompatible With Secondary Licenses", as
* defined by the Mozilla Public License, v. 2.0. */
-#mydashboard .yui-skin-sam .yui-dt table {
- width:100%;
+#mydashboard .yui3-skin-sam .yui3-datatable-table {
+ width: 100%;
}
-#mydashboard .query_heading {
+.query_heading {
font-size: 18px;
font-weight: strong;
padding-bottom: 5px;
@@ -17,18 +17,13 @@
color: rgb(72, 72, 72);
}
-#mydashboard .query_description {
+.query_description {
font-size: 90%;
font-style: italic;
padding-bottom: 5px;
color: rgb(109, 117, 129);
}
-#mydashboard .bugs_found,
-#mydashboard .flags_found {
- font-size: 80%;
-}
-
#mydashboard_container {
margin: 0 auto;
}
@@ -43,8 +38,13 @@
width: 40%;
}
-#file_bug_container {
- text-align: left;
+.items_found, .refresh, .status {
+ font-size: 80%;
+}
+
+.status {
+ color: red;
+ float: right;
}
#query_list_container {
@@ -57,3 +57,16 @@
border: 1px solid rgb(116,126,147);
padding: 10px;
}
+
+#prod_comp_search_main {
+ width: 400px;
+ margin-right: auto;
+ margin-left: auto;
+ text-align: left;
+}
+
+#prod_comp_search_main li.yui-ac-highlight a {
+ text-decoration: none;
+ color: #FFFFFF;
+ display: block;
+}
diff --git a/extensions/MyDashboard/web/styles/prod_comp_search.css b/extensions/MyDashboard/web/styles/prod_comp_search.css
deleted file mode 100644
index 24c0a2cf8..000000000
--- a/extensions/MyDashboard/web/styles/prod_comp_search.css
+++ /dev/null
@@ -1,22 +0,0 @@
-/* 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. */
-
-#prod_comp_search_main {
- width: 400px;
- margin-right: auto;
- margin-left: auto;
-}
-
-#prod_comp_search_main .hidden {
- display: none;
-}
-
-#prod_comp_search_main li.yui-ac-highlight a {
- text-decoration: none;
- color: #FFFFFF;
- display: block;
-}