Wiki Redirects and Page Renaming

Added the ability to rename existing pages.
[[!redirects Some Page Name]] redirects Wikilinks [[Some Page Name]] to
  the current page (assuming "Some Page Name" does not exist).
  Real pages trump redirects (though this may change, depending on 
  user feedback).
This commit is contained in:
Jacques Distler 2009-06-02 22:17:15 -05:00
parent 634f635f16
commit d7832ba262
16 changed files with 161 additions and 33 deletions

View file

@ -268,9 +268,13 @@ class WikiController < ApplicationController
raise Instiki::ValidationError.new('Your content was not valid utf-8.')
end
if @page
wiki.revise_page(@web_name, @page_name, the_content, Time.now,
new_name = params['new_name'] || @page_name
raise Instiki::ValidationError.new('Your new title was not valid utf-8.') unless new_name.is_utf8?
raise Instiki::ValidationError.new('A page named "' + new_name.escapeHTML + '" already exists.') if @page_name != new_name && @web.has_page?(new_name)
wiki.revise_page(@web_name, @page_name, new_name, the_content, Time.now,
Author.new(author_name, remote_ip), PageRenderer.new)
@page.unlock
@page_name = new_name
else
wiki.write_page(@web_name, @page_name, the_content, Time.now,
Author.new(author_name, remote_ip), PageRenderer.new)