Mercurial > bzezpatch
changeset 7:7e455c3a7ad1
removing bugzilla.js since i will just extend the dashboard instead
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Wed, 02 Jun 2010 23:06:07 -0700 |
parents | 61a41c30ccae |
children | be87610d9abb |
files | static-files/bugzilla.js |
diffstat | 1 files changed, 0 insertions(+), 58 deletions(-) [+] |
line wrap: on
line diff
--- a/static-files/bugzilla.js Wed Jun 02 23:04:45 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -var Bugzilla = { - BASE_URL: "https://api-dev.bugzilla.mozilla.org/latest", - BASE_UI_URL: "https://bugzilla.mozilla.org", - DEFAULT_OPTIONS: { - method: "GET" - }, - getShowBugURL: function Bugzilla_getShowBugURL(id) { - return this.BASE_UI_URL + "/show_bug.cgi?id=" + id; - }, - queryString: function Bugzilla_queryString(data) { - var parts = []; - for (name in data) { - var values = data[name]; - if (!values.forEach) - values = [values]; - values.forEach( - function(value) { - parts.push(encodeURI(name) + "=" + encodeURI(value)); - }); - } - return parts.join("&"); - }, - ajax: function Bugzilla_ajax(options) { - var newOptions = {__proto__: this.DEFAULT_OPTIONS}; - for (name in options) - newOptions[name] = options[name]; - options = newOptions; - - function onLoad() { - var response = JSON.parse(xhr.responseText); - if (!response.error) - options.success(response); - // TODO: We should really call some kind of error callback - // if this didn't work. - } - - var xhr = options.xhr ? options.xhr : new XMLHttpRequest(); - var url = this.BASE_URL + options.url; - - if (options.data) - url = url + "?" + this.queryString(options.data); - xhr.open(options.method, url); - xhr.setRequestHeader("Accept", "application/json"); - xhr.setRequestHeader("Content-Type", "application/json"); - xhr.addEventListener("load", onLoad, false); - xhr.send(null); - return xhr; - }, - getBug: function Bugzilla_getBug(id, cb) { - return this.ajax({url: "/bug/" + id, - success: cb}); - }, - search: function Bugzilla_search(query, cb) { - return this.ajax({url: "/bug", - data: query, - success: cb}); - } -};