summaryrefslogtreecommitdiffstats
path: root/extensions/ProductDashboard/web
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2012-08-07 20:32:38 +0200
committerDave Lawrence <dlawrence@mozilla.com>2012-08-07 20:32:38 +0200
commitcb14de16717a12c32632d15a95e34b36edb7d178 (patch)
treecbd0300bc3cb30c483e9d73ab9d8b1c0c99ca7b7 /extensions/ProductDashboard/web
parentb037f9bf0993f519375f6dfa0c514529d48b7f23 (diff)
downloadbugzilla-cb14de16717a12c32632d15a95e34b36edb7d178.tar.gz
bugzilla-cb14de16717a12c32632d15a95e34b36edb7d178.tar.xz
Initial checkin of Product Dashboard
Diffstat (limited to 'extensions/ProductDashboard/web')
-rw-r--r--extensions/ProductDashboard/web/images/spacer.gifbin0 -> 43 bytes
-rw-r--r--extensions/ProductDashboard/web/js/productdashboard.js94
-rw-r--r--extensions/ProductDashboard/web/styles/productdashboard.css12
3 files changed, 106 insertions, 0 deletions
diff --git a/extensions/ProductDashboard/web/images/spacer.gif b/extensions/ProductDashboard/web/images/spacer.gif
new file mode 100644
index 000000000..fc2560981
--- /dev/null
+++ b/extensions/ProductDashboard/web/images/spacer.gif
Binary files differ
diff --git a/extensions/ProductDashboard/web/js/productdashboard.js b/extensions/ProductDashboard/web/js/productdashboard.js
new file mode 100644
index 000000000..e7276b7b2
--- /dev/null
+++ b/extensions/ProductDashboard/web/js/productdashboard.js
@@ -0,0 +1,94 @@
+/* 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.
+ */
+
+function addStatListener (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);
+ };
+ });
+}
+
+// Custom sort handler to sort by bug id inside an anchor tag
+var 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
+var 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(severities[YAHOO.lang.trim(a.getData('bug_severity'))]);
+ var new_b = new Number(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
+var 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(priorities[YAHOO.lang.trim(a.getData('priority'))]);
+ var new_b = new Number(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);
+ }
+}
diff --git a/extensions/ProductDashboard/web/styles/productdashboard.css b/extensions/ProductDashboard/web/styles/productdashboard.css
new file mode 100644
index 000000000..8f431006a
--- /dev/null
+++ b/extensions/ProductDashboard/web/styles/productdashboard.css
@@ -0,0 +1,12 @@
+/* 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. */
+
+#product_dashboard_links {
+ float: right;
+ border: 1px solid;
+ padding-right: 25px;
+}