mozilla
Your Search Results

    Template:BugTableList

    <%
    /*
     * Gets a list of bugs from Bugzilla
     * 
     * $0.params Search params (See http://www.bugzilla.org/docs/4.2/en/html/api/Bugzilla/WebService/Bug.html#search)
     * $0.columns Addtional columns to display (besides the first "id" column)
     * $0.name & $0.anchor (bothoptional) info for adding "doc-status-*" classes for detection in summary table
     *
     */
    
    var mdn = require("MDN:Common");
    var params = JSON.stringify($0.params);
    var columns = $0.columns;
    var name = $0.name;
    var anchor = $0.anchor;
    
    params = params.replace(/&amp;/g, "&");
    params = encodeURI(params);
    params = params.replace(/&/g, "%26");
    var url = 'https://bugzilla.mozilla.org/jsonrpc.cgi?method=Bug.search&params=' + params;
    
    //log.debug(url);
    var resource = mdn.fetchJSONResource(url);
    var bugList = resource.result;
    
    var classInfo = "";
    if (name && anchor) {   
        classInfo = ' class="doc-status-group-' + name + ' doc-status-value-' + bugList.bugs.length + ' doc-status-anchor-' + anchor +'"';
    }
    
    //log.debug(bugList);
    
    var bugPageURL = 'https://bugzilla.mozilla.org/show_bug.cgi?id=';
    
    %>
    
    <p<%-classInfo %>><strong>Found <%=bugList.bugs.length%> bugs.</strong></p>
    
    <table class="standard-table">
        <thead>
            <tr>
                <th>Bug</th>
                <% for (column in columns) { 
                    if (columns.hasOwnProperty(column)) { %>
                        <th><%= columns[column] %></th>
                    <% }
                } %>
            </tr>
        </thead>
    <tbody>
    
    
    <% for (var i=0; i < bugList.bugs.length; i++) { %>
    <tr>
        <td><a href="<%= bugPageURL + bugList.bugs[i].id %>"><%= bugList.bugs[i].id %></a></td>
        <% for (column in columns) { 
            if (columns.hasOwnProperty(column)) { %>
                <td><%=bugList.bugs[i][columns[column]]%></td>
            <% } 
        } %> 
    </tr>
    <% } %>
    
    </tbody>
    </table>
    Search for pages that use Template:BugTableList to see example use cases and how many pages use this macro.

    Document Tags and Contributors

    Contributors to this page: fscholz, teoli
    Last updated by: fscholz,