FixRename

Renaming should be much easier

In other wikis (e.g. Confluence), renaming a page is done on the same page as editing it. It's as simple as clicking on the title of the page, and changing the name.

Foswiki handles a rename fairly gracefully. It's 3 clicks down though, under More topic actions -> Rename in this web -> Choose new name.

A user is more likely to accidentally rename a copy than they are to rename a given page.

I have a client that needs to rename over 100 pages: Foswiki is making it too hard.

We may be able to sponsor this work if it would be completed within the next week or so.

-- MartinCleaver - 03 Feb 2010

a "5 minute fix" to this problem is to change the current topic from pointing back to itself (which is useless, anyway) to rename instead:

Index: view.pattern.tmpl
===================================================================
--- view.pattern.tmpl   (revision 6221)
+++ view.pattern.tmpl   (working copy)
@@ -44,7 +44,7 @@

 %TMPL:DEF{"breadcrumb:annotation"}%%IF{"defined rev" then=" %MAKETEXT{"(revision [_1])" args="%URLPARAM{"rev"}%"}%" else=" <span class='patternRevInfo'>(%REVINFO{format="$date, $wikiusername"}%)</span>"}%%IF{"defined raw" then=" %MAKETEXT{"(raw view)"}%"}%%TMPL:END%

-%TMPL:DEF{"breadcrumb:currenttopic"}%%TMPL:P{"breadcrumb:separator"}%<a href="%SCRIPTURL{view}%/%WEB%/%TOPIC%" title='%MAKETEXT{"Topic revision:"}% %REVINFO{format="$rev ($date - $time)"}%'>%TMPL:P{"breadcrumb:topic"}%</a>%TMPL:P{"breadcrumb:annotation"}%%TMPL:END%
+%TMPL:DEF{"breadcrumb:currenttopic"}%%TMPL:P{"breadcrumb:separator"}%<a href="%SCRIPTURL{rename}%/%WEB%/%TOPIC%" title='%MAKETEXT{"Topic revision:"}% %REVINFO{format="$rev ($date - $time)"}%'>%TMPL:P{"breadcrumb:topic"}% %ICON{move}%</a>%TMPL:P{"breadcrumb:annotation"}%%TMPL:END%

 %{ DEPRECATED: beforetext and aftertext }%
 %{ compatibility transition older than 4.2: }%

or, better to create this file view.renametopic.tmpl and prepend renametopic to your SKIN (or use COVER):

%TMPL:INCLUDE{"view"}%
%TMPL:DEF{"breadcrumb:currenttopic"}%%TMPL:P{"breadcrumb:separator"}%<a href="%SCRIPTURL{rename}%/%WEB%/%TOPIC%" title='%MAKETEXT{"Topic revision:"}% %REVINFO{format="$rev ($date - $time)"}%'>%TMPL:P{"breadcrumb:topic"}% %ICON{move}%</a> %TMPL:P{"breadcrumb:annotation"}%%TMPL:END%

a more integrated rename ability would allow you to click on the name, type a new name in-place, and complete the rename. that's what this updated version of view.renametopic.tmpl does:

%TMPL:INCLUDE{"view"}%
%TMPL:DEF{"breadcrumb:currenttopic"}%%TMPL:P{"breadcrumb:separator"}%\
<span id="FixRename_TopicTitle"><a onclick="document.getElementById('FixRename_NewTopicTitle').style.display='inline'; document.getElementById('FixRename_TopicTitle').style.display='none'; return false;" href="%SCRIPTURL{rename}%/%WEB%/%TOPIC%" title='%MAKETEXT{"Topic revision:"}% %REVINFO{format="$rev ($date - $time)"}%'>%TMPL:P{"breadcrumb:topic"}% %ICON{move}%</a></span>\
<span id="FixRename_NewTopicTitle" style="display:none">\
 <form method="post" action="%SCRIPTURL{rename}%/%WEB%/%TOPIC%" ><input type="hidden" name="nonwikiword" value="on" /><input type="hidden" name="newweb" value="%WEB%" /><input type="hidden" name="action" value="rename" />\
  <input name="newtopic" class="jqFocus" type="text" size="20" value="%TOPIC%" />\
  <input class="foswikiSubmit" type="submit" value="Rename" /> \
  <input type="button" value="Cancel" onclick="document.getElementById('FixRename_TopicTitle').style.display='inline'; document.getElementById('FixRename_NewTopicTitle').style.display='none'; return false;" />\
</form></span>\
 %TMPL:P{"breadcrumb:annotation"}%%TMPL:END%

rename-in-place-1.png

rename-in-place-2.png

note that the link to rename is retained so that if javascript is disabled, at least you get a quick link to the rename topic page.

this code isn't quite production ready, but with a little more javascript code could be made bulletproof (deal with rename to another web? provide a checkbox to fix references or not? perhaps with a list of references populated by an ajax search query? don't try and perform a rename when the new topic name is the same as the old)

this can be seen live (for the moment) in the Sandbox web at http://www.cocomint.org/bin/view/Sandbox/TestTopic0

-- WillNorris - 08 Feb 2010

A rename option in the breadcrumb is unexpected and feels like a hack. What is the possibility to add this option on the Edit page?

  • maybe it is a separate edit page that should go away? evil grin -- WillNorris - 15 Feb 2010

-- ArthurClemens - 09 Feb 2010

Here's what EditMe does to couple TopicTitle with the TopicName.

rename on title change.png

Other CMSes do similar things.

-- MichaelDaum - 09 Feb 2010

Indeed, Confluence does change of topic name during edit. I think that's the most natural place for it. Implementing this might be tricky using the current rename call: it would have to be indicated in the parameters of the save REST call.

In some circumstances it might be handy to be able to rename from the page itself. That can be done with COVER, placed according to need.

-- MartinCleaver - 09 Feb 2010

Hm, I am using the last part of the breadcrumbs - the pointer to the topic itself - quite a lot to reload the page.

  • instead of the url bar or Ctrl+R? well, i always thought that bit of text should lead to the topic's backlinks, but no one seemed to agree with me about that. -- WillNorris - 15 Feb 2010

Renaming a topic by changing its title during edit is far better - a significant usability improvement.

-- MichaelDaum - 12 Feb 2010

I agree having the link to the same topic is useful. And changing topic name during edit is very natural. Still, Will's change fixes my client's usecase for renaming while viewing the topic.

So the question is how to take this forward for general consumption.

-- MartinCleaver - 12 Feb 2010

to support rename during edit, the edit/save cycle will have to support most, if not all, of the rename parameters. from rename,:

newtopic new topic name
breaklock  
attachment  
confirm if defined, requires a second level of confirmation
nonwikiword if defined, a non-wikiword is acceptable for the new topic name

only required if you can also move the topic to a new web (though it's a shame that newtopic can't take a web specifier)
newweb new web name
currentwebonly if defined, searches current web only for links to this topic

perhaps it will be good to consolidate the functionality in these scripts even more than they have been, perhaps it'll make a mess...

-- WillNorris - 15 Feb 2010

I've agreed with Will that the self-link to the topic should not be changed.

I understand this will be incorporated into the new skin that Arthur is working on.

-- MartinCleaver - 03 Mar 2010

As will wrote, some backend work is needed to make this happen from the edit page. So don't wait for the skin to work on it.

-- ArthurClemens - 03 Mar 2010

Renaming is more than just changing the name. It is also a user interaction listing the backlinks from other topics and clicking which ones to change. And the backlink search is not perfect or not always desired so we cannot just headlessly change all backlinks.

-- KennethLavrsen - 04 Mar 2010

I am not sure that the rename action is better on edit time. It is a different action than editing and is not clear to me that edit time it is the natural place for that action. For instance, when you are editing a word document (or any other document in any other system or context) you don't change the name of the document while editing (ok, you can make Save As but that would be another document). You edit in one place-time and change names in other place-time. Edit with the editor, change name with the file explorer. The name of the page is a meta data, it is in a higher level than the content. Rename a page while editing might be handy but they are actions at different levels put together. It is the content and the container being modified at the same time. So I think the option to keep it apart, in the breadcrumb or any place else, is a better, safer, more natural way.

In fact, when I want to change the name of the topic I am not thinking about the content, so why do I have to make a click on Edit, reload all the content, take the risk of accidentally modifying it, all just to change the name of the topic?

-- EnriqueCadalso - 16 Jul 2011

There normally is a difference between the name of a document and its title. While the first is more of a unique identifier (like the file name or record id), the second is more of a description of its content (like "13 ways of backing cakes without butter"). In that sense coming up with a topic title is quite likely part of the same cognitive process as editing the content, or even changing it while being in the middle (like changing it to "12 ways to make a fool out of yourself"). Unfortunately foswiki does not distinguish topic name from topic title. If it would, a lot of the need to rename a topic (like changing its file name or record id) would be satisfied by changing its title only, and leave its name as it is (like "Brainfart9347"). This wouldn't require to fix referential integrity either, an operation which is very fragile.

NatEditPlugin + DBCachePlugin already implement the TopicTitle feature. It would be good to make it a core feature.

-- MichaelDaum - 16 Jul 2011

It would be really useful to show the topic title as the text of links to the topic - or at least, for it to be easy to do this.

I did something like this with EasyMacroPlugin and a nasty formatted search, but it means my users do %LINKTO{DestinationTopic}% and it produces a link to DestinationTopic, and the text of the link is extracted from that topic. This means that if I change the page from "10 ways to make a fool of myself" to "12 ways to make a fool of myself", then the links on the referring pages are automatically correct when those pages are viewed, without having to touch those pages.

My approach is very sensitive to how the topics are formatted and I would not recommend it as a general solution. TopicTitle makes more sense.

BTW, what is the DBCacheContrib syntax for linking to a topic and using the TopicTitle as the link text? Is that short enough to be acceptable, and if not, should we introduce a "LINKTO"-type macro to the core to make this easier?

-- MichaelTempest - 20 Jul 2011

DBCachePlugin implements a wikiWordHandler. So any WikiWord link will be translated automatically. No extra syntax is needed.

-- MichaelDaum - 20 Jul 2011

I agree, we need to work on getting topic title into the core.

For what it's worth, SemanticLinksPlugin provides a skin template system for rendering links. So we write [[Species::AegCor]] and the Species topic has a template defined which makes the link render as [[$web.$topic][_%QUERY{"Genus"}% %QUERY{"Species"}%_ (%QUERY{"Authority"}%)]]

-- PaulHarvey - 20 Jul 2011
Topic revision: r18 - 20 Jul 2011, PaulHarvey
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy