-Robert
---------------------------------
I will apologize if this isn't the proper newsgroup for this posting
but I wanted to incorporate one of the changes I have made into the
existing codebase and from what I could tell this appears to be the
appropriate place. If I have assumed incorrectly then please (gently)
steer me in the right direction.
I attempted to find items related to this in Bugzilla and couldn't
find any open issues and wasn't too sure how to go about adding this -
was it a bug? an enhancement? what?
This enhancement (as I will refer to it) to the search-panel.js file
addresses this issue as commented in the existing version of the
released file, contained in the showMoreResultsFunction
// XXX check if we are in basic search mode
Obviously someone was going to work on this at some point but it
wasn't a major problem and was probably very LOW on the priority list.
It was something that I wanted to use so I coded it myself.
Modifications are pretty straight forward I think and I tried to make
it very clear in the comments where the modifications are.
The main issue was that the Next/Previous results buttons on the
search tab would only select the URL for the search engine selected in
the BASIC search engine list regardless of whether or not you were in
advanced mode. Precautions also needed to be taken if multiple search
engines were selected in the current category (doesn't work).
Included below is the edited version of the showMoreResults function
that works with both BASIC and ADVANCED search modes. I would like to
follow the proper procedure for reporting this via Bugzilla so if
someone could give me a few pointers on how to properly record this in
Bugzilla that would be helpful. It also wasn't obvious after browsing
though mozilla.org as to which module this would be part of and who
the module-owner is that I should also report this to.
Any help in these matters would be greatly appreciated. Thanks for
your patience.
-Robert
------------------------------
source code included below
------------------------------
/**
* showMoreResults
*
* Run a query to show the next/previous page of search results for
the
* current search term.
*
* @param direction : -1 => previous
* 1 => next
*/
function showMoreResults(direction)
{
// XXX check if we are in basic search mode
//
// Uncomment the following 3 lines to return original functionality.
//
// get search engine
// var engine = document.getElementById("basicEngineMenu").selectedItem;
// var engineURI = engine.id;
//
// BEGIN RF MODIFICATIONS
//
// Basically modified code from doSearch function.
// Some code from both functions could be refactored as a
// separate function to remove some of the duplicate code.
var searchMode = nsPreferences.getIntPref("browser.search.mode", 0);
var engineURI;
var engineURIs = [];
var foundEngine = false;
if (searchMode > 0) {
var itemNode;
var engineBox = document.getElementById("searchengines");
// in advanced search mode, get selected search engines
// (for the current search category)
for (var x = 0; x < engineBox.childNodes.length; ++x) {
itemNode = engineBox.childNodes[x];
if (itemNode.localName == "listitem" && itemNode.checked) {
engineURI = itemNode.id;
if (engineURI) {
engineURIs[engineURIs.length] = engineURI;
foundEngine = true;
}
}
}
// if more than one search engine selected in current
// search category then just return an alert message
if (engineURIs.length > 1) {
alert("Previous/Next buttons cannot operate when multiple search
engines are selected in the current search category.");
return;
}
}
else
{
var basicEngines = document.getElementById("basicEngineMenu");
engineURI = basicEngines.selectedItem.id;
if (engineURI) {
engineURIs[0] = engineURI;
foundEngine = true;
}
}
if (!foundEngine) {
alert(searchBundle.getString("enterstringandlocation"));
return;
}
//
// END RF MODIFICATIONS
//
// get search term
var searchTerm = document.getElementById("sidebar-search-text").value;
searchTerm = escape(searchTerm);
// change page number
if (direction > 0)
++gPageNumber;
else
--gPageNumber;
// get qualified URL
var searchService = Components.classes[ISEARCH_CONTRACTID].
getService(nsIInternetSearchService);
var whichButtons = new Object;
whichButtons.value = 0;
var searchURL = searchService.GetInternetSearchURL(engineURI,
searchTerm,
direction, gPageNumber, whichButtons);
doNavButtonEnabling(whichButtons.value, searchService, gPageNumber);
// load URL in navigator
loadURLInContent(searchURL);
}
[...]
> // load URL in navigator
> loadURLInContent(searchURL);
> }
1) Use http://www.mozilla.org/quality/help/bugzilla-helper.html to
search for a duplicate (or near enough) bug. If it isn't there, submit a
bug. Just follow the instructions, really.
2) Attach the patch
regards, Esben