From 2b11e4ce9253bf543bde87c16bd9b6d90446cff6 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Thu, 16 Aug 2012 16:26:46 -0400 Subject: Dashboard improvements --- extensions/MyDashboard/Extension.pm | 12 ++++ .../en/default/pages/mydashboard.html.tmpl | 27 ++++----- extensions/MyDashboard/web/js/mydashboard.js | 48 ++++++++------- .../en/default/pages/productdashboard.html.tmpl | 10 ++-- .../pages/productdashboard/components.html.tmpl | 68 +++++++++++----------- .../pages/productdashboard/duplicates.html.tmpl | 38 ++++++------ .../pages/productdashboard/popularity.html.tmpl | 39 +++++++------ .../pages/productdashboard/recents.html.tmpl | 39 ++++++------- .../pages/productdashboard/roadmap.html.tmpl | 22 +++---- .../pages/productdashboard/summary.html.tmpl | 29 ++++----- .../ProductDashboard/web/js/productdashboard.js | 12 ++-- 11 files changed, 185 insertions(+), 159 deletions(-) diff --git a/extensions/MyDashboard/Extension.pm b/extensions/MyDashboard/Extension.pm index d1bbc17f1..e5f022dec 100644 --- a/extensions/MyDashboard/Extension.pm +++ b/extensions/MyDashboard/Extension.pm @@ -187,6 +187,18 @@ sub _standard_saved_queries { ### Saved query definitions ### These are enabled through the userprefs.cgi UI + + if ($user->showmybugslink) { + my $query = Bugzilla->params->{mybugstemplate}; + $query =~ s/%userid%/$user->login/; + 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, diff --git a/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl b/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl index 50f31550e..ade7002be 100644 --- a/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl +++ b/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl @@ -17,22 +17,22 @@ yui = [ "datatable", "paginator", "autocomplete" ] javascript_urls = [ "extensions/MyDashboard/web/js/mydashboard.js", "extensions/MyDashboard/web/js/prod_comp_search.js" ] - onload = "showQuerySection();" + onload = "MD.showQuerySection();" %] @@ -49,7 +49,7 @@
Choose query: - [% FOREACH r = standard_results %] @@ -120,9 +120,8 @@
@@ -166,9 +165,8 @@
@@ -213,9 +211,8 @@ diff --git a/extensions/MyDashboard/web/js/mydashboard.js b/extensions/MyDashboard/web/js/mydashboard.js index 59b198cff..25529d8c8 100644 --- a/extensions/MyDashboard/web/js/mydashboard.js +++ b/extensions/MyDashboard/web/js/mydashboard.js @@ -6,7 +6,11 @@ * defined by the Mozilla Public License, v. 2.0. */ -var showQuerySection = function () { +YAHOO.namespace('MyDashboard'); + +var MD = YAHOO.MyDashboard; + +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++) { @@ -14,9 +18,9 @@ var showQuerySection = function () { selected_value = query_select.options[i].value; } } - for (var i = 0, l = full_query_list.length; i < l; i++) { - var query = full_query_list[i]; - if (selected_value == full_query_list[i]) { + 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'); } else { @@ -25,63 +29,63 @@ var showQuerySection = function () { } } -var query_column_defs = [ - { key:"id", label:"ID", sortable:true, sortOptions:{ sortFunction:sortBugIdLinks } }, +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 }, ]; -var query_fields = [ +MD.query_fields = [ { key:"id" }, { key:"updated" }, { key:"bug_status" }, { key:"summary" } ]; -var requestee_column_defs = [ +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 } ]; -var requestee_fields = [ +MD.requestee_fields = [ { key:"requester" }, { key:"flag" }, { key:"bug" }, { key:"created" } ]; -var requester_column_defs = [ +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 } ]; -var requester_fields = [ +MD.requester_fields = [ { key:"requestee" }, { key:"flag" }, { key:"bug" }, { key:"created" } ]; -function addStatListener (div_name, table_name, column_defs, fields, options) { +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); + this.myDataTable.subscribe("rowMouseoverEvent", this.myDataTable.onEventHighlightRow); + this.myDataTable.subscribe("rowMouseoutEvent", this.myDataTable.onEventUnhighlightRow); }; }); } // Custom sort handler to sort by bug id inside an anchor tag -var sortBugIdLinks = function(a, b, desc) { +MD.sortBugIdLinks = function (a, b, desc) { // Deal with empty values if (!YAHOO.lang.isValue(a)) { return (!YAHOO.lang.isValue(b)) ? 0 : 1; @@ -113,17 +117,17 @@ var sortBugIdLinks = function(a, b, desc) { } // Custom sort handler for bug severities -var sortBugSeverity = function(a, b, desc) { +MD.sortBugSeverity = function (a, b, desc) { // Deal with empty values if (!YAHOO.lang.isValue(a)) { - return (!YAHOO.lang.isValue(b)) ? 0 : 1; + return (!YAHOO.lang.isValue(b)) ? 0 : 1; } else if(!YAHOO.lang.isValue(b)) { return -1; } - var new_a = new Number(severities[YAHOO.lang.trim(a.getData('bug_severity'))]); - var new_b = new Number(severities[YAHOO.lang.trim(b.getData('bug_severity'))]); + 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); @@ -134,7 +138,7 @@ var sortBugSeverity = function(a, b, desc) { } // Custom sort handler for bug priorities -var sortBugPriority = function(a, b, desc) { +MD.sortBugPriority = function (a, b, desc) { // Deal with empty values if (!YAHOO.lang.isValue(a)) { return (!YAHOO.lang.isValue(b)) ? 0 : 1; @@ -143,8 +147,8 @@ var sortBugPriority = function(a, b, desc) { return -1; } - var new_a = new Number(priorities[YAHOO.lang.trim(a.getData('priority'))]); - var new_b = new Number(priorities[YAHOO.lang.trim(b.getData('priority'))]); + 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); diff --git a/extensions/ProductDashboard/template/en/default/pages/productdashboard.html.tmpl b/extensions/ProductDashboard/template/en/default/pages/productdashboard.html.tmpl index 9f537636f..a8096e391 100644 --- a/extensions/ProductDashboard/template/en/default/pages/productdashboard.html.tmpl +++ b/extensions/ProductDashboard/template/en/default/pages/productdashboard.html.tmpl @@ -11,21 +11,21 @@ [% filtered_product = product.name FILTER html %] [% PROCESS global/header.html.tmpl title = "Product Dashboard: $filtered_product" - style_urls = [ "skins/standard/buglist.css", - "js/yui/assets/skins/sam/paginator.css", + style_urls = [ "skins/standard/buglist.css", + "js/yui/assets/skins/sam/paginator.css", "extensions/ProductDashboard/web/styles/productdashboard.css" ] yui = [ "datatable", "paginator", "calendar" ] - javascript_urls = [ "js/util.js", "js/field.js", + javascript_urls = [ "js/util.js", "js/field.js", "extensions/ProductDashboard/web/js/productdashboard.js" ] %] @@ -121,21 +120,24 @@ diff --git a/extensions/ProductDashboard/template/en/default/pages/productdashboard/duplicates.html.tmpl b/extensions/ProductDashboard/template/en/default/pages/productdashboard/duplicates.html.tmpl index 36a820300..fc3403bc4 100644 --- a/extensions/ProductDashboard/template/en/default/pages/productdashboard/duplicates.html.tmpl +++ b/extensions/ProductDashboard/template/en/default/pages/productdashboard/duplicates.html.tmpl @@ -12,26 +12,28 @@ diff --git a/extensions/ProductDashboard/template/en/default/pages/productdashboard/popularity.html.tmpl b/extensions/ProductDashboard/template/en/default/pages/productdashboard/popularity.html.tmpl index 9c7c42563..b6b159155 100644 --- a/extensions/ProductDashboard/template/en/default/pages/productdashboard/popularity.html.tmpl +++ b/extensions/ProductDashboard/template/en/default/pages/productdashboard/popularity.html.tmpl @@ -12,27 +12,28 @@ diff --git a/extensions/ProductDashboard/template/en/default/pages/productdashboard/recents.html.tmpl b/extensions/ProductDashboard/template/en/default/pages/productdashboard/recents.html.tmpl index 4350e7472..470adef74 100644 --- a/extensions/ProductDashboard/template/en/default/pages/productdashboard/recents.html.tmpl +++ b/extensions/ProductDashboard/template/en/default/pages/productdashboard/recents.html.tmpl @@ -12,28 +12,27 @@ diff --git a/extensions/ProductDashboard/template/en/default/pages/productdashboard/roadmap.html.tmpl b/extensions/ProductDashboard/template/en/default/pages/productdashboard/roadmap.html.tmpl index fad1cafa5..26edb03af 100644 --- a/extensions/ProductDashboard/template/en/default/pages/productdashboard/roadmap.html.tmpl +++ b/extensions/ProductDashboard/template/en/default/pages/productdashboard/roadmap.html.tmpl @@ -8,18 +8,20 @@ diff --git a/extensions/ProductDashboard/template/en/default/pages/productdashboard/summary.html.tmpl b/extensions/ProductDashboard/template/en/default/pages/productdashboard/summary.html.tmpl index c1b0a8854..6d85b0175 100644 --- a/extensions/ProductDashboard/template/en/default/pages/productdashboard/summary.html.tmpl +++ b/extensions/ProductDashboard/template/en/default/pages/productdashboard/summary.html.tmpl @@ -8,21 +8,24 @@ diff --git a/extensions/ProductDashboard/web/js/productdashboard.js b/extensions/ProductDashboard/web/js/productdashboard.js index e7276b7b2..56bc451ff 100644 --- a/extensions/ProductDashboard/web/js/productdashboard.js +++ b/extensions/ProductDashboard/web/js/productdashboard.js @@ -6,7 +6,11 @@ * defined by the Mozilla Public License, v. 2.0. */ -function addStatListener (div_name, table_name, column_defs, fields, options) { +YAHOO.namespace('ProductDashboard'); + +var PD = YAHOO.ProductDashboard; + +PD.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)); @@ -20,7 +24,7 @@ function addStatListener (div_name, table_name, column_defs, fields, options) { } // Custom sort handler to sort by bug id inside an anchor tag -var sortBugIdLinks = function(a, b, desc) { +PD.sortBugIdLinks = function (a, b, desc) { // Deal with empty values if (!YAHOO.lang.isValue(a)) { return (!YAHOO.lang.isValue(b)) ? 0 : 1; @@ -52,7 +56,7 @@ var sortBugIdLinks = function(a, b, desc) { } // Custom sort handler for bug severities -var sortBugSeverity = function(a, b, desc) { +PD.sortBugSeverity = function (a, b, desc) { // Deal with empty values if (!YAHOO.lang.isValue(a)) { return (!YAHOO.lang.isValue(b)) ? 0 : 1; @@ -73,7 +77,7 @@ var sortBugSeverity = function(a, b, desc) { } // Custom sort handler for bug priorities -var sortBugPriority = function(a, b, desc) { +PD.sortBugPriority = function (a, b, desc) { // Deal with empty values if (!YAHOO.lang.isValue(a)) { return (!YAHOO.lang.isValue(b)) ? 0 : 1; -- cgit v1.2.3-24-g4f1b