/macros/RecentChanges
Type: /type/macro
description: Recent Changes
macro: value: $def with (author=None, type=None, limit=50)

$ _ = i18n.get_namespace('/macros/RecentChanges')

$ page = safeint(query_param('page', '0'))
$ ip = query_param('ip', None)

$ bot = query_param('bot') or None
$ bot = bot and bot.lower() == 'true'

$ changes = get_recent_changes(author=author, type=type, ip=ip, bot=bot, limit=limit, offset=page * limit)

$ show_users = (query_param('show_users', 'false').lower() == 'true')

<!--islist-->

<div id="bibliography">
    <div id="browse-rule"></div>
    <div id="biblio-form-body">

        <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tr>
                <td class="historyheader">$_.when</td>
                <td class="historyheader">$_.path</td>
                <td class="historyheader">$_.who</td>
                <td class="historyheader" width="100%">$_.what</td>
                <td class="historyheader">$_.actions</td>
            </tr>

            $for v in changes:
                $# ignore user registrations
                $if show_users or not v.key.startswith('/user/'):
                    <tr>
                    <td class="time" valign="top">$datestr(v.created)</td>
                    $# show book title/author name instead of key
                    $if v.thing.type.key == '/type/edition':
                        $ name = v.thing.title
                    $elif v.thing.type.key == '/type/author':
                        $ name = v.thing.name
                    $else:
                        $ name = v.key
                    <td class="path" valign="top"><div class="truncatepath"><a href="$homepath()$v.key" class="datalink" title="$v.key">$:macros.TruncateString(name, 35)</a></div></td>
                    $if v.author:
                        <td class="displayname" valign="top"><div class="truncatedisplayname"><a href="$homepath()$v.author.key" class="truncate" title="$v.author.displayname">$v.author.displayname</a></div></td>
                    $elif v.ip and v.ip != '127.0.0.1':
                        <td class="history" valign="top"><a href="/recentchanges?ip=$v.ip">$v.ip</a></td>
                    $else:
                        <td class="history" valign="top">$v.ip</td>
                    <td class="comment" valign="top">$v.comment</td>
                    <td class="buttons" valign="top">
                        <a href="$homepath()$v.key?m=view&v=$v.revision">$_.view</a> -
                        <a href="$homepath()$v.key?m=edit&v=$v.revision">$_.edit</a> - 
                        <a href="$homepath()$v.key?m=diff&b=$v.revision">$_.diff</a>
                    </td>
                    </tr>
        </table>
    </div>
</div>

<div class="copyright-footer">
$if page != 0:
    &larr; <a href="$:changequery(page=page - 1)" class="datalink" rel="nofollow">$_.newer</a>
    
$if len(changes) == limit:
    ... <a href="$:changequery(page=page + 1)" class="datalink" rel="nofollow">$_.older</a> &rarr;
</div>