'Get a bookmark link for a record in order to embed it in the
view, also renders a link to the duplicate bookmark list to
initiate the merge process from
@param r: the S3Request
@param tablename: the table name
@param record_id: the record ID'

@classmethod
def bookmark(cls, r, tablename, record_id):

    auth = current.auth
    system_roles = auth.get_system_roles()
    if (not auth.s3_has_role(system_roles.ADMIN)):
        return ''
    if (r.component and (not r.component.multiple)):
        return ''
    s3 = current.session.s3
    DEDUPLICATE = cls.DEDUPLICATE
    remove = (((DEDUPLICATE in s3) and (tablename in s3[DEDUPLICATE]) and (str(record_id) in s3[DEDUPLICATE][tablename]) and True) or False)
    mark = 'mark-deduplicate    action-lnk'
    unmark = 'unmark-deduplicate    action-lnk'
    deduplicate = 'deduplicate    action-lnk'
    if remove:
        mark += '    hide'
    else:
        unmark += '    hide'
        deduplicate += '    hide'
    T = current.T
    link = DIV(A(T('Mark    as    duplicate'), _class=mark), A(T('Unmark    as    duplicate'), _class=unmark), A('', _href=r.url(method='deduplicate', vars={}), _id='markDuplicateURL', _class='hide'), A(T('De-duplicate'), _href=r.url(method='deduplicate', target=0, vars={}), _class=deduplicate), _id='markDuplicate')
    return link
