MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla

Revision 465135 of Template:bug

  • Revision slug: Template:bug
  • Revision title: Template:bug
  • Revision id: 465135
  • Created:
  • Creator: trevorh
  • Is current revision? No
  • Comment Add table row capacity
Tags: 

Revision Content

<% /* * Inserts a link to a bug in Mozilla's Bugzilla database. * * $0 - The bug number to link to. As we follow resolved duplicate this may not be the number in the output. * $1 - Type of output, bug (default) or table * * http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Server/JSONRPC.html */ var mdn = require("MDN:Common"); var type = $1 || 'bug'; var desc = ''; var tipStatus = ''; var style = ''; var bugNumber = $0; var url = encodeURI('https://bugzilla.mozilla.org/jsonrpc.cgi?method=Bug.get¶ms=[ { "ids": [' + bugNumber + '], "include_fields":["summary","dupe_of","resolution"] } ]'); var bugzillaDetail = mdn.fetchJSONResource(url); if (bugzillaDetail.error != null) { if (bugzillaDetail.error.code == 102) { desc = "Access to this bug is restricted."; } else { desc = bugzillaDetail.error.message; tipStatus = "ERROR: "; } } else if (bugzillaDetail.result != null) { var bugDetail = bugzillaDetail.result.bugs[0]; while (bugDetail.dupe_of != null) { bugNumber = bugDetail.dupe_of; url = encodeURI('https://bugzilla.mozilla.org/jsonrpc.cgi?method=Bug.get¶ms=[ { "ids": [' + bugNumber + '], "include_fields":["summary","dupe_of","resolution"] } ]'); bugzillaDetail = mdn.fetchJSONResource(url); bugDetail = bugzillaDetail.result.bugs[0]; } if (bugDetail.resolution == "FIXED") { tipStatus = 'FIXED: '; style = "class='bug-resolved'"; } desc = bugDetail.summary; } var bugPageURL = 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + bugNumber; var s_bug = mdn.localString({ "en-US": "bug", "ca" : "errada", "cs" : "chyba", "ja" : "バグ", "pl" : "błąd" }); if (type == 'table'){ %> href="<%= bugPageURL %>"><%= bugNumber %> <%= desc %> <% } else { %> <%=s_bug%> <%= bugNumber %> <% } %>

Revision Source

<%
/*
 * Inserts a link to a bug in Mozilla's Bugzilla database.
 *
 * $0 - The bug number to link to. As we follow resolved duplicate this may not be the number in the output.
 * $1 - Type of output, bug (default) or table
 *
 * http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Server/JSONRPC.html
 */

var mdn = require("MDN:Common");

var type = $1 || 'bug';

var desc = '';
var tipStatus = '';
var style = '';
var bugNumber = $0;
var url = encodeURI('https://bugzilla.mozilla.org/jsonrpc.cgi?method=Bug.get&params=[ { "ids": [' +  bugNumber + '], "include_fields":["summary","dupe_of","resolution"] } ]');
var bugzillaDetail = mdn.fetchJSONResource(url);

if (bugzillaDetail.error != null) {
    if (bugzillaDetail.error.code == 102) {
        desc = "Access to this bug is restricted.";
    } else {
        desc = bugzillaDetail.error.message;
        tipStatus = "ERROR: ";
    }
} else if (bugzillaDetail.result != null) {
    var bugDetail = bugzillaDetail.result.bugs[0];
    while (bugDetail.dupe_of != null) {
        bugNumber = bugDetail.dupe_of;
        url = encodeURI('https://bugzilla.mozilla.org/jsonrpc.cgi?method=Bug.get&params=[ { "ids": [' +  bugNumber + '], "include_fields":["summary","dupe_of","resolution"] } ]');
        bugzillaDetail = mdn.fetchJSONResource(url);
        bugDetail = bugzillaDetail.result.bugs[0];
    }
    if (bugDetail.resolution == "FIXED") {
        tipStatus = 'FIXED: ';
        style = "class='bug-resolved'";
    }
    desc = bugDetail.summary;
}
var bugPageURL = 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + bugNumber;

var s_bug = mdn.localString({
    "en-US": "bug",
    "ca"   : "errada",
    "cs"   : "chyba",
    "ja"   : "バグ",
    "pl"   : "błąd"
});
if (type == 'table'){ %>
<tr>
    <td><a <%= style %> href="<%= bugPageURL %>"><%= bugNumber %></a></td>
    <td><%= desc %></td>
</tr>
<%
} else {
%>
<a href="<%= bugPageURL %>" title="<%= tipStatus + desc %>"><%=s_bug%>&nbsp;<%= bugNumber %></a>
<% } %>
Revert to this revision