diff options
Diffstat (limited to 'extensions/MyDashboard/web')
-rw-r--r-- | extensions/MyDashboard/web/js/mydashboard.js | 126 | ||||
-rw-r--r-- | extensions/MyDashboard/web/js/prod_comp_search.js | 85 | ||||
-rw-r--r-- | extensions/MyDashboard/web/styles/mydashboard.css | 90 | ||||
-rw-r--r-- | extensions/MyDashboard/web/styles/prod_comp_search.css | 22 |
4 files changed, 323 insertions, 0 deletions
diff --git a/extensions/MyDashboard/web/js/mydashboard.js b/extensions/MyDashboard/web/js/mydashboard.js new file mode 100644 index 000000000..64a421113 --- /dev/null +++ b/extensions/MyDashboard/web/js/mydashboard.js @@ -0,0 +1,126 @@ +/* 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. + */ + +var 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; + } + } + 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]) { + YAHOO.util.Dom.removeClass(query + '_container', 'bz_default_hidden'); + } + else { + YAHOO.util.Dom.addClass(query + '_container', 'bz_default_hidden'); + } + } +} + +var query_column_defs = [ + { key:"id", label:"ID", sortable:true, sortOptions:{ sortFunction:sortBugIdLinks } }, + { key:"updated", label:"Updated", sortable:false }, + { key:"bug_status", label:"Status", sortable:true }, + { key:"summary", label:"Summary", sortable:true }, +]; +var query_fields = [ + { key:"id" }, + { key:"updated" }, + { key:"bug_status" }, + { key:"summary" } +]; + +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/MyDashboard/web/js/prod_comp_search.js b/extensions/MyDashboard/web/js/prod_comp_search.js new file mode 100644 index 000000000..06b4c601f --- /dev/null +++ b/extensions/MyDashboard/web/js/prod_comp_search.js @@ -0,0 +1,85 @@ +/* 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 new file mode 100644 index 000000000..7000afa65 --- /dev/null +++ b/extensions/MyDashboard/web/styles/mydashboard.css @@ -0,0 +1,90 @@ +/* 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. */ + +#mydashboard .yui-skin-sam .yui-dt table { + width:100%; +} +#mydashboard #query-links { + display: table; + padding-left: 1ex; + padding-right:1ex; +} +#mydashboard #links-standard, +#mydashboard #links-saved, +#mydashboard #links-special { + display: table-row; + list-style-type: none; +} +#mydashboard .label { + display: table-cell; + white-space: nowrap; + vertical-align: top; + padding-right: 1ex; + font-weight: bold; +} +#mydashboard .links { + display: table-cell; + vertical-align: top; +} +#mydashboard .separator { + color: #000000; +} +#mydashboard .query_heading { + font-size: 18px; + font-weight: strong; + color: rgb(72, 72, 72); +} +#mydashboard .query_description { + font-size: 90%; + font-style: italic; + padding-bottom: 5px; + color: rgb(109, 117, 129); +} +#mydashboard .bug_list, +#mydashboard .back_top { + font-size: 80%; +} +#mydashboard table { + margin-bottom: 10px; + +} +#mydashboard hr { + color: #000; + background-color: #000; + border: 0; + height: 1px; + width: 100%; +} + +#mydashboard_container { + margin: 0 auto; +} + +#left { + float: left; + width: 58%; +} + +#right { + float: right; + width: 40%; +} + +#file_bug_container { + text-align: left; +} + +#query_list_container { + text-align:center; +} + +#file_bug_container, +#query_list_container { + margin-bottom: 10px; + border: 1px solid rgb(116,126,147); + padding: 10px; +} diff --git a/extensions/MyDashboard/web/styles/prod_comp_search.css b/extensions/MyDashboard/web/styles/prod_comp_search.css new file mode 100644 index 000000000..24c0a2cf8 --- /dev/null +++ b/extensions/MyDashboard/web/styles/prod_comp_search.css @@ -0,0 +1,22 @@ +/* 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; +} |