'Configure default action buttons
@param resource: the resource
@param r: the request, if specified, all action buttons will
be linked to the controller/function of this request
rather than to prefix/name of the resource
@param custom_actions: custom actions as list of dicts like
{"label":label, "url":url, "_class":class},
will be appended to the default actions
@ToDo: DRY with S3CRUD.action_buttons()'

@staticmethod
def defaultActionButtons(resource, custom_actions=None, r=None):

    from s3crud import S3CRUD
    s3 = current.response.s3
    auth = current.auth
    actions = s3.actions = None
    table = resource.table
    has_permission = auth.s3_has_permission
    ownership_required = auth.permission.ownership_required
    labels = s3.crud_labels
    args = ['[id]']
    if (r is not None):
        c = r.controller
        f = r.function
    else:
        c = resource.prefix
        f = resource.name
    tablename = resource.tablename
    get_config = current.s3db.get_config
    editable = get_config(tablename, 'editable', True)
    if (editable and has_permission('update', table) and (not ownership_required('update', table))):
        update_url = URL(c=c, f=f, args=(args + ['update']))
        S3CRUD.action_button(labels.UPDATE, update_url, icon='edit', _class='action-btn    edit')
    else:
        read_url = URL(c=c, f=f, args=args)
        S3CRUD.action_button(labels.READ, read_url, icon='file', _class='action-btn    read')
    deletable = get_config(tablename, 'deletable', True)
    if (deletable and has_permission('delete', table) and (not ownership_required('delete', table))):
        delete_url = URL(c=c, f=f, args=(args + ['delete']))
        S3CRUD.action_button(labels.DELETE, delete_url, icon='delete', _class='delete-btn')
    if custom_actions:
        actions = ((actions + custom_actions) if actions else custom_actions)
