From 1e95913315c21a2ce181007d66294c5f1f975038 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Fri, 21 Dec 2012 17:13:17 -0500 Subject: - Converted several pages to use the new ProdCompSearch extension - Other MyDashboard improvements/fixes --- .../en/default/global/choose-product.html.tmpl | 22 ++++-- .../template/en/default/global/header.html.tmpl | 1 + extensions/BMO/web/js/prod_comp_search.js | 85 ---------------------- extensions/BMO/web/styles/prod_comp_search.css | 22 ------ 4 files changed, 17 insertions(+), 113 deletions(-) delete mode 100644 extensions/BMO/web/js/prod_comp_search.js delete mode 100644 extensions/BMO/web/styles/prod_comp_search.css (limited to 'extensions/BMO') diff --git a/extensions/BMO/template/en/default/global/choose-product.html.tmpl b/extensions/BMO/template/en/default/global/choose-product.html.tmpl index b9cd02cfc..c185989d1 100644 --- a/extensions/BMO/template/en/default/global/choose-product.html.tmpl +++ b/extensions/BMO/template/en/default/global/choose-product.html.tmpl @@ -39,11 +39,9 @@ [% h2 = "Which product would you like to have described?" %] [% END %] -[% yui = [ 'autocomplete' ] %] -[% javascript_urls = [ "js/field.js", "js/create_bug.js", - "extensions/BMO/web/js/prod_comp_search.js" ] %] -[% onload = "YAHOO.util.Dom.get('prod_comp_search').focus();" %] -[% style_urls.push("extensions/BMO/web/styles/prod_comp_search.css") %] +[% javascript_urls = [ "extensions/ProdCompSearch/web/js/prod_comp_search.js" ] %] +[% onload = "document.getElementById('prod_comp_search').focus();" %] +[% style_urls.push("extensions/ProdCompSearch/web/styles/prod_comp_search.css") %] [% DEFAULT title = "Choose a Product" %] [% PROCESS global/header.html.tmpl %] @@ -60,7 +58,19 @@

[% h2 FILTER html %]

-[% PROCESS "global/prod-comp-search.html.tmpl" %] + +
+ [% PROCESS prodcompsearch/form.html.tmpl + input_label = "Type to find product and component by name or description:" + %] +

or choose from the following selections

diff --git a/extensions/BMO/template/en/default/global/header.html.tmpl b/extensions/BMO/template/en/default/global/header.html.tmpl index c2e3de08c..0ef406e7c 100644 --- a/extensions/BMO/template/en/default/global/header.html.tmpl +++ b/extensions/BMO/template/en/default/global/header.html.tmpl @@ -78,6 +78,7 @@ [% SET starting_js_urls = [ "js/yui/yahoo-dom-event/yahoo-dom-event.js", "js/yui/cookie/cookie-min.js", + "js/yui3/yui/yui-min.js" ] %] diff --git a/extensions/BMO/web/js/prod_comp_search.js b/extensions/BMO/web/js/prod_comp_search.js deleted file mode 100644 index ada296f52..000000000 --- a/extensions/BMO/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 : "BMO.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/BMO/web/styles/prod_comp_search.css b/extensions/BMO/web/styles/prod_comp_search.css deleted file mode 100644 index 24c0a2cf8..000000000 --- a/extensions/BMO/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; -} -- cgit v1.2.3-24-g4f1b