From: cyeh%bluemartini.com <> Date: Thu, 1 Mar 2001 07:07:24 +0000 (+0000) Subject: fix for 69793: check in new files for QuickSearch X-Git-Tag: bugzilla-2.12~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b2994b0ce4cf27709b3742a2b63a680464662a0;p=thirdparty%2Fbugzilla.git fix for 69793: check in new files for QuickSearch patch contributed by franke@ags.uni-sb.de (Andreas Franke) Now add quicksearch functionality to the main index page. --- diff --git a/index.html b/index.html index 566a1053b6..3a1a76ff6c 100644 --- a/index.html +++ b/index.html @@ -76,11 +76,23 @@ But it all boils down to a choice of: Open a new Bugzilla account
Forget the currently stored login
Change password or user preferences
-
- bug #
- +

+ + + +

+ Enter a bug # or some search terms:
+ + + [Help] +
+ + diff --git a/localconfig.js b/localconfig.js new file mode 100644 index 0000000000..7cb01eb74a --- /dev/null +++ b/localconfig.js @@ -0,0 +1,75 @@ +// +// This file contains the installation specific values for QuickSearch. +// See quicksearch.js for more details. +// + +// the global bugzilla url + +var bugzilla = ""; +//var bugzilla = "http://bugzilla.mozilla.org/"; + +// Status and Resolution +// ===================== + +var statuses_open = new Array("UNCONFIRMED","NEW","ASSIGNED","REOPENED"); +var statuses_resolved = new Array("RESOLVED","VERIFIED","CLOSED"); +var resolutions = new Array("FIXED","INVALID","WONTFIX","LATER", + "REMIND","DUPLICATE","WORKSFORME","MOVED"); + +// Keywords +// ======== +// +// Enumerate all your keywords here. This is necessary to avoid +// "foo is not a legal keyword" errors. This makes it possible +// to include the keywords field in the search by default. + +var keywords = new Array( +// "foo", "bar", "baz" +); + +// Platforms +// ========= +// +// A list of words (substrings of platform values) +// that will automatically be translated to "platform:" +// E.g. if "mac" is defined as a platform, then searching +// for it will find all bugs with platform="Macintosh", +// but no other bugs with e.g. "mac" in the summary. + +var platforms = new Array( +"pc","sun","macintosh","mac" //shortcut added +//,"dec","hp","sgi" +//,"all" //this is a legal value for OpSys, too :( +//,"other" +); + +// Severities +// ========== +// +// A list of words (substrings of severity values) +// that will automatically be translated to "severity:" +// E.g with this default set of severities, searching for +// "blo,cri,maj" will find all severe bugs. + +var severities = new Array("blo","cri","maj","nor","min","tri","enh"); + +// Products and Components +// ======================= +// +// It is not necessary to list all products and components here. +// Instead, you can define a "blacklist" for some commonly used +// words or word fragments that occur in a product or component name +// but should _not_ trigger product/component search. + +var product_exceptions = new Array( +"row" // [Browser] + // ^^^ +,"new" // [MailNews] + // ^^^ +); + +var component_exceptions = new Array( +"hang" // [mozilla.org] Bugzilla: Component/Keyword Changes + // ^^^^ +); + diff --git a/quicksearch.html b/quicksearch.html new file mode 100644 index 0000000000..900180065b --- /dev/null +++ b/quicksearch.html @@ -0,0 +1,146 @@ + + + Bugzilla QuickSearch + + + + +If you are already familiar with the original +Bugzilla Query Form, +you may prefer this form. + + +

+ + + +

Bugzilla QuickSearch

+ +Type in one or more words (or word fragments) to search for: + + + +
+ + + + + + +
+
+ + + +

+

Getting Started

+ +
    +
  • This is case-insensitive search. +
      +
    •  table ,  Table  + and  TABLE  are all the same. +
    +
  • This is all words as substrings search.
    + Therefore you should use stems to get better results: +
      +
    • Use localiz instead of localize or + localization. +
    • Use bookmark instead of bookmarks or + bookmarking. +
    +
+ + +

Features

+ +
+ +

More Tips

+ +
    +
  • You can also use this tool to lookup a bug by its number. +
      +
    •  12345  +
    +
  • A comma-separated list of bug numbers gives you a list of these bugs. +
      +
    •  12345,23456,34567  +
    +
+ +

+By default, the following fields are searched: Summary, Keywords, Product, +Component, Status Whiteboard. If a word looks like a part of a URL, that field +is included in the search, too. +

+ +


+ +Use the powerful +Bugzilla Query Form +for advanced queries. + + + + + + + + diff --git a/quicksearch.js b/quicksearch.js new file mode 100644 index 0000000000..e14710c9a8 --- /dev/null +++ b/quicksearch.js @@ -0,0 +1,670 @@ +// +// This is the main JS file for QuickSearch. +// +// Derived from: +// +// * C. Begle's SimpleSearch tool: +// http://www.mozilla.org/quality/help/simplesearch.html +// http://www.mozilla.org/quality/help/bugreport.js +// +// * Jesse Ruderman's bugzilla search page: +// http://www.cs.hmc.edu/~jruderma/s/bugz.html +// +// Created by +// Andreas Franke + +function go_to (url) { + document.location.href = url; + //window.open(url, "other" ); +} + +function map(l, f) { + l1 = new Array(); + for (var i=0; i 0) + && ((s == l[0]) || member(s, l.slice(1))); +} + +function add(s, l) { + if (! member(s, l)) { + l.unshift(s); + } +} + +function addAll(l1, l2) { + for (var i=0; i "dependson" +// "OtherBugsDependingOnThis"--> "blocked" +//add_mapping("dependson", "dependson"); +//add_mapping("blocked", "blocked"); + +// Substring search doesn't make much sense for the following fields: +// "Attachment is patch" --> "attachments.ispatch" +// "Last changed date" --> "delta_ts" +// "Days since bug changed" --> "(to_days(now()) - to_days(bugs.delta_ts))" +//"groupset" +//"everconfirmed" +//"bug","bugid","bugno" --> "bug_id" +// "votes" --> "votes" +// "votes>5", "votes>=5", "votes=>5" works now, see below +// "votes:5" is interpreted as "votes>=5" + +function findIndex(array,value) { + for (var i=0; i= 0) return f2[i]; + return undefined; +} + +// `keywords' is defined externally + +function is_keyword(s) { + return member(s, keywords); +} + +// `platforms' is defined externally + +function is_platform(str) { + return member (str.toLowerCase(),platforms); +} + +// `severities' is defined externally + +function is_severity(str) { + return member(str.toLowerCase(),severities); +} + +// `product_exceptions' is defined externally + +function match_product(str) { + s = str.toLowerCase(); + return (s.length > 2) && (! member(s,product_exceptions)); +} + +// `component_exceptions are defined externally + +function match_component(str) { + s = str.toLowerCase(); + return (s.length > 2) && (! member(s,component_exceptions)); +} + +var status_and_resolution = ""; // for pretty debug output only; these vars +var charts = ""; // always hold the data from the last query + +// derived from http://www.mozilla.org/quality/help/bugreport.js + +function make_chart(expr, field, type, value) { + charts += "" + + "" + expr + "" + + "" + field + "" + + "" + type + "" + + "" + value + "" + + ""; + return "&field" + expr + "=" + field + + "&type" + expr + "=" + type + + "&value" + expr + "=" + escape(value).replace(/[+]/g,"%2B"); +} + +// returns true if at least one of comparelist had the prefix, false otherwise +function addPrefixMatches(prefix, comparelist, resultlist) { + var foundMatch = false; + for (var i=0; i "foo%20bar" + var parts = input.split('"'); + if ((parts.length % 2) != 1) { + alert('Unterminated quote'); + abort = true; + return undefined; + } + for (var i=1; i 0)) { + prefixesNotFoundError(failedPrefixes,statuses,resolutions); + abort = true; + } + return foundMatch; + } + + if (word[0] == "ALL") { + // special case: search for bugs regardless of status + addAll(statusResolved,bug_status); + word.shift(); + } else if (word[0] == "OPEN") { + // special case: search for open bugs only + word.shift(); + } else if (word[0].match("^[+][A-Z]+(,[A-Z]+)*$")) { + // e.g. +DUP,FIX + w0 = word.shift(); + prefixes = w0.substring(1).split(","); + if (! matchPrefixes(prefixes,statusResolved,resolutions)) { + word.unshift(w0); + } + } else if (word[0].match("^[A-Z]+(,[A-Z]+)*$")) { + // e.g. NEW,ASSI,REOP,FIX + bug_status = new Array(); // reset + w0 = word.shift(); + prefixes = w0.split(","); + if (! matchPrefixes(prefixes,statusAll,resolutions)) { + word.unshift(w0); + bug_status = statusOpen.reverse(); //reset to default bug_status + } + } else { + // default case: + // search for unresolved bugs only + // uncomment this to include duplicate bugs in the search + // add("DUPLICATE",resolution); + } + if (resolution.length > 0) { + resolution = resolution.reverse(); + resolution.unshift("---"); + addAll(statusResolved,bug_status); + } + bug_status = bug_status.reverse(); + bug_status = map(bug_status,escape); + searchURL += "?bug_status=" + bug_status.join("&bug_status="); + status_and_resolution += 'Status: '+bug_status+''; + + if (resolution.length > 0) { + resolution = map(resolution,escape); + searchURL += "&resolution=" + resolution.join("&resolution="); + status_and_resolution += '
'+'Resolution: '+resolution+''; + } + + // end of bug_status & resolution stuff + + var chart = 0; + var and = 0; + var or = 0; + + var negation = false; + + function negate_comparison_type(type) { + switch(type) { + case "substring": return "notsubstring"; + case "anywords": return "nowords"; + case "regexp": return "notregexp"; + default: + // e.g. "greaterthan" + alert("Can't negate comparison type: `" + type + "'"); + abort = true; + } + } + + function add_chart(field,type,value) { + // undo escaping for value: '"foo%20bar"' --> 'foo bar' + var parts = value.split('"'); + if ((parts.length % 2) != 1) { + alert('Internal error: unescaping failure'); + abort = true; + } + for (var i=1; ixx + if (w.match("^votes>[0-9]+$")) { + n = w.split(">")[1]; + add_chart("votes","greaterthan",n); + continue; + } + // votes>=xx, votes=>xx + if (w.match("^votes(>=|=>)[0-9]+$")) { + separator = w.match("^votes(>=|=>)[0-9]+$")[1]; + n = w.split(separator)[1]; + add_chart("votes","greaterthan",String(n-1)); + continue; + } + // really default case + if (match_product(w)) { + add_chart("product","substring",w); + } + if (match_component(w)) { + add_chart("component","substring",w); + } + if (is_keyword(w)) { + add_chart("keywords","substring",w); + if (w.length > 2) { + add_chart("short_desc","substring",w); + add_chart("status_whiteboard","substring",w); + } + } else { + add_chart("short_desc","substring",w); + add_chart("status_whiteboard","substring",w); + } + if (searchLong) + add_chart("longdesc","substring",w); + + // URL field (for IP addrs, host.names, scheme://urls) + if (w.match(/[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+/) + || w.match(/^[A-Za-z]+([.][A-Za-z]+)+/) + || w.match(/[:][\/][\/]/) + || w.match(/localhost/) + || w.match(/mailto[:]?/) + // || w.match(/[A-Za-z]+[:][0-9]+/) //host:port + ) + add_chart("bug_file_loc","substring",w); + } + } + } + + or = 0; + } + + //searchURL += "&cmdtype=doit"; + + if (abort == false) { + return searchURL; + } else { + return undefined; + } +} + +function unique_id () { + return (new Date()).getTime(); +} + +function ShowURL(mode) { + var input = document.f.id.value; + var searchURL = make_query_URL(bugzilla+"buglist.cgi", input, false); + if (searchURL != undefined) { + var pieces = searchURL.replace(/[\?]/g,"\n?").replace(/[\&]/g,"\n&"); + if (mode == "alert") { + alert(pieces); + } else { + var table = "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + charts + "" + + "
Chart-And-OrFieldTypeValue
"; + var html = '' + + '' + + '' + input + '' + + '' + + '' + + '' + + 'Submit Query' + + '' + + '

' + status_and_resolution + + '

' + table + + '

' +
+                             pieces.replace(/[\n]/g,"
") + + '
' + + '' + + ''; + var w = window.open("","preview_"+unique_id()); + w.document.write(html); + w.document.close(); + } + } +} + +// +// new interface: +// searchLong is a boolean now (not a checkbox/radiobutton) +// +function Search(url, input, searchLong) { + var inputstring = new String(input); + var word = inputstring.split(/[\s]+/); + + // Check for empty input + if ( word.length == 1 && word[0] == "" ) + return; + + // Check for potential Bugzilla-busting intensive queries + if ((searchLong!=false) && word.length > 4) { + var message = "Searching Descriptions for more than four words " + + "will take a very long time indeed. Please choose " + + "no more than four keywords for your query."; + alert(message); + return; + } + var searchURL = make_query_URL(url, inputstring, searchLong); + if (searchURL != undefined) { + go_to(searchURL); + //window.open(searchURL, "other" ); + } else { + return; + } +} + +// +// original interface, untested +// +//function SearchForBugs (input, searchRadio) { +// if (searchRadio[0].checked) { +// return Search(bugzilla + "buglist.cgi", input, false); +// } else { +// return Search(bugzilla + "buglist.cgi", input, true); +// } +//} + +// derived from http://www.cs.hmc.edu/~jruderma/s/bugz.html + +// QuickSearch combines lookup-by-bug-number and search +// in a single textbox. It's name must be document.f.id . +// +// type nothing: +// --> go to bugzilla front page +// type a number: +// --> go to that bug number +// type several numbers, separated by commas: +// --> go to a buglist of just those bug numbers +// type anything else: +// --> search summary, product, component, keywords, status whiteboard +// (and URL if it's an IP address, a host.name, or an absolute://URL) + +function QuickSearch () +{ + var input = document.f.id.value; + + if (input == "") + { + //once this _is_ on http://bugzilla.mozilla.org, it should just return; + go_to(bugzilla); + } + else if (input.match(/^[0-9, ]*$/)) + { + if (input.indexOf(",") == -1) { + // only _one_ bug number --> show_bug + go_to(bugzilla+"show_bug.cgi?id="+escape(input)); + } else { + // comma-separated bug numbers --> buglist + go_to(bugzilla+"buglist.cgi?bug_id="+escape(input) + + "&bugidtype=include&order=bugs.bug_id"); + } + } + else + { + Search(bugzilla+"buglist.cgi",input,false); + } + return; +} + +function LoadQuery() { + var input = document.f.id.value; + Search(bugzilla+"query.cgi",input,false); + return; +} + diff --git a/quicksearchhack.html b/quicksearchhack.html new file mode 100644 index 0000000000..f8c15bc5e8 --- /dev/null +++ b/quicksearchhack.html @@ -0,0 +1,350 @@ + + + Bugzilla QuickSearch (for Hackers) + + + + + + + +

Bugzilla QuickSearch (for Hackers)

+ +Type in one or more words (or word fragments) to search for: + + + +
+ + + + + + +
+
+
+ + + +

+This is a case-insensitive ``all words as substrings'' search; +words are separated by spaces. +By default, the following fields are relevant: Summary, Keywords, +Product, Component, Status Whiteboard. If you enter only a single +word, the URL field is included in the search, too. +

+The generic format for a ``word'' is + field1,...,fieldN:value1,...,valueM . +A bug qualifies if at least one of the values occurs as a substring in +at least one of the fields. +For example,  owner,reporter,qa:ibm,sun  +will give you bugs where the owner, reporter, or qa contact +has an email address that contains + ibm  or  sun . +If only  value1,...,valueM  is given, +the prefix (roughly) defaults to  summary,keywords,product,component,statuswhiteboard:  as noted above. +

+Here is a complete listing of available fields (the Shortcut column is just +for access speed): +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Searched by defaultShortcutField NameAliasesDescription
 UNCO,NEW,...,CLOS,
FIX,DUP,... (as first word)
status Status + ("bug_status") +
 resolution Resolution
 as-isplatform Platform ("rep_platform")
  osopsysOS ("op_sys")
 p1,p2 or p1-2prioritypriPriority
 blo,cri,...,enhseveritysevSeverity ("bug_severity")
 @ownerassignedtoassignee, ownerAssignee ("assigned_to")
  reporterrepReporter (email)
  qaqacontactQA Contact (email) ("qa_contact")
  cc CC (email)
yes:areaproductprodProduct (enum)
yescomponentcompComponent
  versionverVersion (enum)
  milestonetarget, targetmilestoneTarget Milestone ("target_milestone")
yes summaryshortdescBug Summary (short text)("short_desc")
  descriptiondesc, longdescBug Description / Comments (long text)
one-word queries only url URL ("bug_file_loc")
yes statuswhiteboardsw, whiteboardStatus Whiteboard ("status_whiteboard")
yes!keywordkeywordskwKeywords
  attachmentdescattachdescAttachment Description ("attachments.description")
  attachmentdataattachdataAttachment Data ("attachments.thedata")
  attachmentmimetypeattachmimetypeAttachment mime-type ("attachments.mimetype")
+ +

+Examples for some useful abbreviations: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SyntaxSemantics and Examples
:areaproduct,component:area
sevseverity:sev
blo,cri,majsevere bugs
enhenhancement requests
plevelpriority:level
p1very high-priority bugs
p1-2high-priority bugs
@ownerassignedto:owner
!keywordkeywords:keyword
+ +

+More information can be found in the +"Features" section +on the introductory page. + + + +