'Get a list of unapproved records in this resource
@param r: the S3Request
@param attr: dictionary of parameters for the method handler'

def unapproved(self, r, **attr):

    session = current.session
    response = current.response
    s3 = response.s3
    resource = self.resource
    table = self.table
    representation = r.representation
    output = dict()
    _config = self._config
    orderby = _config('orderby', None)
    linkto = _config('linkto', None)
    list_fields = _config('list_fields')
    list_id = 'datatable'
    authorised = self._permitted()
    if (not authorised):
        r.unauthorised()
    get_vars = self.request.get_vars
    if (representation == 'aadata'):
        (start, limit) = self._limits(get_vars)
    else:
        start = None
        limit = (None if s3.no_sspag else 0)
    if (not linkto):
        linkto = self._linkto(r)
    if (not list_fields):
        fields = resource.readable_fields()
        list_fields = [f.name for f in fields]
    else:
        fields = [table[f] for f in list_fields if (f in table.fields)]
    if (not fields):
        fields = []
    if ((not fields) or (fields[0].name != table.fields[0])):
        fields.insert(0, table[table.fields[0]])
    if (list_fields[0] != table.fields[0]):
        list_fields.insert(0, table.fields[0])
    left = []
    distinct = False
    if r.interactive:
        resource.build_query(filter=s3.filter)
        response.view = self._view(r, 'list.html')
        crud_string = self.crud_string
        if r.component:
            title = crud_string(r.tablename, 'title_display')
        else:
            title = crud_string(self.tablename, 'title_list')
        output['title'] = title
        if s3.dataTable_pageLength:
            display_length = s3.dataTable_pageLength
        else:
            display_length = 25
        if (not s3.no_sspag):
            dt_pagination = 'true'
            if (not limit):
                limit = (2 * display_length)
            session.s3.filter = get_vars
            if (orderby is None):
                scol = (((len(list_fields) > 1) and '1') or '0')
                get_vars.update(iSortingCols='1', iSortCol_0=scol, sSortDir_0='asc')
                (q, orderby, left) = resource.datatable_filter(list_fields, get_vars)
                del get_vars['iSortingCols']
                del get_vars['iSortCol_0']
                del get_vars['sSortDir_0']
        else:
            dt_pagination = 'false'
        (dt, totalrows, ids) = resource.datatable(fields=list_fields, start=start, limit=limit, left=left, orderby=orderby, distinct=distinct)
        displayrows = totalrows
        if (dt is None):
            s3.no_formats = True
            datatable = current.T('No    records    to    review')
        else:
            dt_dom = s3.get('dataTable_dom', current.deployment_settings.get_ui_datatables_dom())
            datatable = dt.html(totalrows, displayrows, list_id, dt_pagination=dt_pagination, dt_pageLength=display_length, dt_dom=dt_dom)
            s3.actions = [{'label': s3_str(current.T('Review')), 'url': r.url(id='[id]', method='review'), '_class': 'action-btn'}]
        output['items'] = datatable
    elif (r.representation == 'aadata'):
        resource.build_query(filter=s3.filter, vars=session.s3.filter)
        (searchq, orderby, left) = resource.datatable_filter(list_fields, get_vars)
        if (searchq is not None):
            totalrows = resource.count()
            resource.add_filter(searchq)
        else:
            totalrows = None
        if (orderby is None):
            orderby = _config('orderby', None)
        if (totalrows != 0):
            (dt, displayrows, ids) = resource.datatable(fields=list_fields, start=start, limit=limit, left=left, orderby=orderby, distinct=distinct)
        else:
            (dt, displayrows) = (None, 0)
        if (totalrows is None):
            totalrows = displayrows
        draw = int((get_vars.draw or 0))
        if (dt is not None):
            output = dt.json(totalrows, displayrows, list_id, draw)
        else:
            output = ('{"recordsTotal":    %s,    "recordsFiltered":    0,"dataTable_id":    "%s",    "draw":    %s,    "data":    []}' % (totalrows, list_id, draw))
    else:
        r.error(415, current.ERROR.BAD_FORMAT)
    return output
