Mercurial > moin > 1.9
changeset 1713:1f18d08ec3ba
better display of renamed pages on info/RC, show diff-link for deleted pages on RC
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sun, 07 Jan 2007 11:25:09 +0100 |
parents | ac830832ca26 |
children | 8f944671df08 |
files | MoinMoin/PageEditor.py MoinMoin/action/info.py MoinMoin/macro/RecentChanges.py MoinMoin/theme/__init__.py docs/CHANGES |
diffstat | 5 files changed, 47 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py Sat Jan 06 21:18:05 2007 +0100 +++ b/MoinMoin/PageEditor.py Sun Jan 07 11:25:09 2007 +0100 @@ -531,7 +531,7 @@ self.error = None # Save page text with a comment about the old name savetext = u"## page was renamed from %s\n%s" % (self.page_name, savetext) - newpage.saveText(savetext, 0, comment=comment, index=0) + newpage.saveText(savetext, 0, comment=comment, index=0, extra=self.page_name, action='SAVE/RENAME') if request.cfg.xapian_search: from MoinMoin.search.Xapian import Index
--- a/MoinMoin/action/info.py Sat Jan 06 21:18:05 2007 +0100 +++ b/MoinMoin/action/info.py Sun Jan 07 11:25:09 2007 +0100 @@ -119,7 +119,7 @@ for line in log.reverse(): rev = int(line.rev) actions = [] - if line.action in ['SAVE', 'SAVENEW', 'SAVE/REVERT', ]: + if line.action in ('SAVE', 'SAVENEW', 'SAVE/REVERT', 'SAVE/RENAME', ): size = page.size(rev=rev) if count == 0: # latest page actions.append(render_action(_('view'), {'action': 'show'})) @@ -135,8 +135,11 @@ lchecked = rchecked = '' diff = '<input type="radio" name="rev1" value="%d"%s><input type="radio" name="rev2" value="%d"%s>' % (rev, lchecked, rev, rchecked) comment = line.comment - if not comment and '/REVERT' in line.action: + if not comment: + if '/REVERT' in line.action: comment = _("Revert to revision %(rev)d.") % {'rev': int(line.extra)} + elif '/RENAME' in line.action: + comment = _("Renamed from '%(oldpagename)s'.") % {'oldpagename': line.extra} else: # ATT* rev = '-' diff = '-'
--- a/MoinMoin/macro/RecentChanges.py Sat Jan 06 21:18:05 2007 +0100 +++ b/MoinMoin/macro/RecentChanges.py Sun Jan 07 11:25:09 2007 +0100 @@ -26,21 +26,25 @@ def format_comment(request, line): comment = line.comment + action = line.action _ = request.getText - if line.action.startswith('ATT'): + if action.startswith('ATT'): filename = wikiutil.url_unquote(line.extra) - if line.action == 'ATTNEW': + if action == 'ATTNEW': comment = _("Upload of attachment '%(filename)s'.") % { 'filename': filename} - elif line.action == 'ATTDEL': + elif action == 'ATTDEL': comment = _("Attachment '%(filename)s' deleted.") % { 'filename': filename} - elif line.action == 'ATTDRW': + elif action == 'ATTDRW': comment = _("Drawing '%(filename)s' saved.") % { 'filename': filename} - elif '/REVERT' in line.action: - rev = int(line.extra) - comment = _("Revert to revision %(rev)d.") % {'rev': rev} + elif not comment: + if '/REVERT' in action: + rev = int(line.extra) + comment = _("Revert to revision %(rev)d.") % {'rev': rev} + elif '/RENAME' in action: + comment = _("Renamed from '%(oldpagename)s'.") % {'oldpagename': line.extra} return wikiutil.make_breakable(comment, _MAX_COMMENT_LENGTH) @@ -50,28 +54,37 @@ d = {} # dict for passing stuff to theme line = lines[0] pagename = line.pagename + rev = int(line.rev) tnow = time.time() is_new = lines[-1].action == 'SAVENEW' + is_renamed = lines[-1].action == 'SAVE/RENAME' # check whether this page is newer than the user's bookmark hilite = line.ed_time_usecs > (bookmark_usecs or line.ed_time_usecs) page = Page(request, pagename) html_link = '' if not page.exists(): - # indicate page was deleted - html_link = request.theme.make_icon('deleted') # TODO: we could link to the last existing rev here + img = request.theme.make_icon('deleted') + revbefore = rev - 1 + if revbefore and page.exists(rev=revbefore, domain='standard'): + # indicate page was deleted and show diff to last existing revision of it + html_link = page.link_to_raw(request, img, querystr={'action': 'diff'}, rel='nofollow') + else: + # just indicate page was deleted + html_link = img elif page.isConflict(): img = macro.formatter.smiley("/!\\") #img = request.theme.make_icon('help') html_link = page.link_to_raw(request, img, querystr={'action': 'edit'}, rel='nofollow') - elif is_new: - # show "NEW" icon if page was created after the user's bookmark - if hilite: + elif hilite: + # show special icons if change was after the user's bookmark + if is_new: img = request.theme.make_icon('new') - html_link = page.link_to_raw(request, img, rel='nofollow') - elif hilite: - # show "UPDATED" icon if page was edited after the user's bookmark - img = request.theme.make_icon('updated') + #html_link = page.link_to_raw(request, img, rel='nofollow') # XXX better use same code as for "renamed"? + elif is_renamed: + img = request.theme.make_icon('renamed') + else: + img = request.theme.make_icon('updated') html_link = page.link_to_raw(request, img, querystr={'action': 'diff', 'date': '%d' % bookmark_usecs}, rel='nofollow') else: # show "DIFF" icon else
--- a/MoinMoin/theme/__init__.py Sat Jan 06 21:18:05 2007 +0100 +++ b/MoinMoin/theme/__init__.py Sun Jan 07 11:25:09 2007 +0100 @@ -50,6 +50,7 @@ 'rss': (_("[RSS]"), "moin-rss.png", 36, 14), 'deleted': (_("[DELETED]"), "moin-deleted.png",60, 12), 'updated': (_("[UPDATED]"), "moin-updated.png",60, 12), + 'renamed': (_("[RENAMED]"), "moin-updated.png",60, 12), # XXX need new icon 'new': (_("[NEW]"), "moin-new.png", 31, 12), 'diffrc': (_("[DIFF]"), "moin-diff.png", 15, 11), # General
--- a/docs/CHANGES Sat Jan 06 21:18:05 2007 +0100 +++ b/docs/CHANGES Sun Jan 07 11:25:09 2007 +0100 @@ -276,6 +276,17 @@ page name as the default. This is a useful abbreviation for TwinPages in other wikis. * it is now supported to resize an image from within the gui editor + * we now log a rename action as SAVE/RENAME in edit-log and display + appropriate comments if the user did not supply an own comment. + We also use a different icon to display the rename action on RecentChanges. + TODO: add a different icon for "renamed", we currently just use the same + as for "updated" with different alt text, see theme/__init__.py. + * RecentChanges: + * if a change has happened after your bookmark, the updated/new/renamed + icon links to the bookmark diff. + * if a page does not exist any more (because it was deleted or renamed), + we link the deleted icon to the diff showing what was deleted (for the + delete action). For the rename action, we just show the deleted icon. Bugfixes: * on action "info" page, "revert" link will not be displayed for empty page