Sync with Instiki Trunk
Sync with Revision 519 of Instiki trunk (2007/5/7).
This commit is contained in:
parent
b0e063451f
commit
3b6cd309ff
|
@ -13,12 +13,12 @@ class AdminController < ApplicationController
|
||||||
"\n\n" +
|
"\n\n" +
|
||||||
"(WARNING: this will destroy content of your current wiki)."
|
"(WARNING: this will destroy content of your current wiki)."
|
||||||
redirect_home(@wiki.webs.keys.first)
|
redirect_home(@wiki.webs.keys.first)
|
||||||
elsif @params['web_name']
|
elsif params['web_name']
|
||||||
# form submitted -> create a wiki
|
# form submitted -> create a wiki
|
||||||
@wiki.setup(@params['password'], @params['web_name'], @params['web_address'])
|
@wiki.setup(params['password'], params['web_name'], params['web_address'])
|
||||||
flash[:info] = "Your new wiki '#{@params['web_name']}' is created!\n" +
|
flash[:info] = "Your new wiki '#{params['web_name']}' is created!\n" +
|
||||||
"Please edit its home page and press Submit when finished."
|
"Please edit its home page and press Submit when finished."
|
||||||
redirect_to :web => @params['web_address'], :controller => 'wiki', :action => 'new',
|
redirect_to :web => params['web_address'], :controller => 'wiki', :action => 'new',
|
||||||
:id => 'HomePage'
|
:id => 'HomePage'
|
||||||
else
|
else
|
||||||
# no form submitted -> go to template
|
# no form submitted -> go to template
|
||||||
|
@ -26,13 +26,13 @@ class AdminController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_web
|
def create_web
|
||||||
if @params['address']
|
if params['address']
|
||||||
# form submitted
|
# form submitted
|
||||||
if @wiki.authenticate(@params['system_password'])
|
if @wiki.authenticate(params['system_password'])
|
||||||
begin
|
begin
|
||||||
@wiki.create_web(@params['name'], @params['address'])
|
@wiki.create_web(params['name'], params['address'])
|
||||||
flash[:info] = "New web '#{@params['name']}' successfully created."
|
flash[:info] = "New web '#{params['name']}' successfully created."
|
||||||
redirect_to :web => @params['address'], :controller => 'wiki', :action => 'new',
|
redirect_to :web => params['address'], :controller => 'wiki', :action => 'new',
|
||||||
:id => 'HomePage'
|
:id => 'HomePage'
|
||||||
rescue Instiki::ValidationError => e
|
rescue Instiki::ValidationError => e
|
||||||
@error = e.message
|
@error = e.message
|
||||||
|
@ -47,25 +47,25 @@ class AdminController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit_web
|
def edit_web
|
||||||
system_password = @params['system_password']
|
system_password = params['system_password']
|
||||||
if system_password
|
if system_password
|
||||||
# form submitted
|
# form submitted
|
||||||
if wiki.authenticate(system_password)
|
if wiki.authenticate(system_password)
|
||||||
begin
|
begin
|
||||||
wiki.edit_web(
|
wiki.edit_web(
|
||||||
@web.address, @params['address'], @params['name'],
|
@web.address, params['address'], params['name'],
|
||||||
@params['markup'].intern,
|
params['markup'].intern,
|
||||||
@params['color'], @params['additional_style'],
|
params['color'], params['additional_style'],
|
||||||
@params['safe_mode'] ? true : false,
|
params['safe_mode'] ? true : false,
|
||||||
@params['password'].empty? ? nil : @params['password'],
|
params['password'].empty? ? nil : params['password'],
|
||||||
@params['published'] ? true : false,
|
params['published'] ? true : false,
|
||||||
@params['brackets_only'] ? true : false,
|
params['brackets_only'] ? true : false,
|
||||||
@params['count_pages'] ? true : false,
|
params['count_pages'] ? true : false,
|
||||||
@params['allow_uploads'] ? true : false,
|
params['allow_uploads'] ? true : false,
|
||||||
@params['max_upload_size']
|
params['max_upload_size']
|
||||||
)
|
)
|
||||||
flash[:info] = "Web '#{@params['address']}' was successfully updated"
|
flash[:info] = "Web '#{params['address']}' was successfully updated"
|
||||||
redirect_home(@params['address'])
|
redirect_home(params['address'])
|
||||||
rescue Instiki::ValidationError => e
|
rescue Instiki::ValidationError => e
|
||||||
logger.warn e.message
|
logger.warn e.message
|
||||||
@error = e.message
|
@error = e.message
|
||||||
|
@ -81,12 +81,12 @@ class AdminController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_orphaned_pages
|
def remove_orphaned_pages
|
||||||
if wiki.authenticate(@params['system_password_orphaned'])
|
if wiki.authenticate(params['system_password_orphaned'])
|
||||||
wiki.remove_orphaned_pages(@web_name)
|
wiki.remove_orphaned_pages(@web_name)
|
||||||
flash[:info] = 'Orphaned pages removed'
|
flash[:info] = 'Orphaned pages removed'
|
||||||
redirect_to :controller => 'wiki', :web => @web_name, :action => 'list'
|
redirect_to :controller => 'wiki', :web => @web_name, :action => 'list'
|
||||||
else
|
else
|
||||||
flash[:error] = password_error(@params['system_password_orphaned'])
|
flash[:error] = password_error(params['system_password_orphaned'])
|
||||||
redirect_to :controller => 'admin', :web => @web_name, :action => 'edit_web'
|
redirect_to :controller => 'admin', :web => @web_name, :action => 'edit_web'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,8 +29,8 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def connect_to_model
|
def connect_to_model
|
||||||
@action_name = @params['action'] || 'index'
|
@action_name = params['action'] || 'index'
|
||||||
@web_name = @params['web']
|
@web_name = params['web']
|
||||||
@wiki = wiki
|
@wiki = wiki
|
||||||
@author = cookies['author'] || 'AnonymousCoward'
|
@author = cookies['author'] || 'AnonymousCoward'
|
||||||
if @web_name
|
if @web_name
|
||||||
|
@ -106,11 +106,11 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def remember_location
|
def remember_location
|
||||||
if @request.method == :get and
|
if request.method == :get and
|
||||||
@response.headers['Status'] == '200 OK' and not
|
response.headers['Status'] == '200 OK' and not
|
||||||
%w(locked save back file pic import).include?(action_name)
|
%w(locked save back file pic import).include?(action_name)
|
||||||
@session[:return_to] = @request.request_uri
|
session[:return_to] = request.request_uri
|
||||||
logger.debug "Session ##{session.object_id}: remembered URL '#{@session[:return_to]}'"
|
logger.debug "Session ##{session.object_id}: remembered URL '#{session[:return_to]}'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -126,8 +126,8 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
def return_to_last_remembered
|
def return_to_last_remembered
|
||||||
# Forget the redirect location
|
# Forget the redirect location
|
||||||
redirect_target, @session[:return_to] = @session[:return_to], nil
|
redirect_target, session[:return_to] = session[:return_to], nil
|
||||||
tried_home, @session[:tried_home] = @session[:tried_home], false
|
tried_home, session[:tried_home] = session[:tried_home], false
|
||||||
|
|
||||||
# then try to redirect to it
|
# then try to redirect to it
|
||||||
if redirect_target.nil?
|
if redirect_target.nil?
|
||||||
|
@ -146,15 +146,15 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
def set_content_type_header
|
def set_content_type_header
|
||||||
if %w(atom_with_content atom_with_headlines).include?(action_name)
|
if %w(atom_with_content atom_with_headlines).include?(action_name)
|
||||||
@response.headers['Content-Type'] = 'application/atom+xml; charset=UTF-8'
|
response.headers['Content-Type'] = 'application/atom+xml; charset=UTF-8'
|
||||||
elsif %w(tex).include?(action_name)
|
elsif %w(tex).include?(action_name)
|
||||||
@response.headers['Content-Type'] = 'text/plain; charset=UTF-8'
|
response.headers['Content-Type'] = 'text/plain; charset=UTF-8'
|
||||||
elsif @request.env['HTTP_USER_AGENT'] =~ /MathPlayer|Validator/ or @request.env.include?('HTTP_ACCEPT') &&
|
elsif request.env['HTTP_USER_AGENT'] =~ /MathPlayer|Validator/ or request.env.include?('HTTP_ACCEPT') &&
|
||||||
Mime::Type.parse(@request.env["HTTP_ACCEPT"]).include?(Mime::XHTML) &&
|
Mime::Type.parse(request.env["HTTP_ACCEPT"]).include?(Mime::XHTML) &&
|
||||||
!(@request.env['HTTP_USER_AGENT'] =~ /Safari/ and %w(s5).include?(action_name))
|
!(request.env['HTTP_USER_AGENT'] =~ /Safari/ and %w(s5).include?(action_name))
|
||||||
@response.headers['Content-Type'] = 'application/xhtml+xml; charset=UTF-8'
|
response.headers['Content-Type'] = 'application/xhtml+xml; charset=UTF-8'
|
||||||
else
|
else
|
||||||
@response.headers['Content-Type'] = 'text/html; charset=UTF-8'
|
response.headers['Content-Type'] = 'text/html; charset=UTF-8'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ class ApplicationController < ActionController::Base
|
||||||
@web.nil? or
|
@web.nil? or
|
||||||
@web.password.nil? or
|
@web.password.nil? or
|
||||||
cookies[CGI.escape(@web_name)] == @web.password or
|
cookies[CGI.escape(@web_name)] == @web.password or
|
||||||
password_check(@params['password']) or
|
password_check(params['password']) or
|
||||||
(@web.published? and action_name == 's5')
|
(@web.published? and action_name == 's5')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ class FileController < ApplicationController
|
||||||
before_filter :check_allow_uploads
|
before_filter :check_allow_uploads
|
||||||
|
|
||||||
def file
|
def file
|
||||||
@file_name = @params['id']
|
@file_name = params['id']
|
||||||
if @params['file']
|
if params['file']
|
||||||
# form supplied
|
# form supplied
|
||||||
new_file = @web.wiki_files.create(@params['file'])
|
new_file = @web.wiki_files.create(params['file'])
|
||||||
if new_file.valid?
|
if new_file.valid?
|
||||||
flash[:info] = "File '#{@file_name}' successfully uploaded"
|
flash[:info] = "File '#{@file_name}' successfully uploaded"
|
||||||
return_to_last_remembered
|
return_to_last_remembered
|
||||||
|
@ -39,10 +39,10 @@ class FileController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def import
|
def import
|
||||||
if @params['file']
|
if params['file']
|
||||||
@problems = []
|
@problems = []
|
||||||
import_file_name = "#{@web.address}-import-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.zip"
|
import_file_name = "#{@web.address}-import-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.zip"
|
||||||
import_from_archive(@params['file'].path)
|
import_from_archive(params['file'].path)
|
||||||
if @problems.empty?
|
if @problems.empty?
|
||||||
flash[:info] = 'Import successfully finished'
|
flash[:info] = 'Import successfully finished'
|
||||||
else
|
else
|
||||||
|
@ -58,7 +58,7 @@ class FileController < ApplicationController
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def check_allow_uploads
|
def check_allow_uploads
|
||||||
render(:status => 404, :text => "Web #{@params['web'].inspect} not found") and return false unless @web
|
render(:status => 404, :text => "Web #{params['web'].inspect} not found") and return false unless @web
|
||||||
if @web.allow_uploads?
|
if @web.allow_uploads?
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
|
|
@ -30,10 +30,10 @@ class WikiController < ApplicationController
|
||||||
# Outside a single web --------------------------------------------------------
|
# Outside a single web --------------------------------------------------------
|
||||||
|
|
||||||
def authenticate
|
def authenticate
|
||||||
if password_check(@params['password'])
|
if password_check(params['password'])
|
||||||
redirect_home
|
redirect_home
|
||||||
else
|
else
|
||||||
flash[:info] = password_error(@params['password'])
|
flash[:info] = password_error(params['password'])
|
||||||
redirect_to :action => 'login', :web => @web_name
|
redirect_to :action => 'login', :web => @web_name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -146,7 +146,7 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def search
|
def search
|
||||||
@query = @params['query']
|
@query = params['query']
|
||||||
@title_results = @web.select { |page| page.name =~ /#{@query}/i }.sort
|
@title_results = @web.select { |page| page.name =~ /#{@query}/i }.sort
|
||||||
@results = @web.select { |page| page.content =~ /#{@query}/i }.sort
|
@results = @web.select { |page| page.content =~ /#{@query}/i }.sort
|
||||||
all_pages_found = (@results + @title_results).uniq
|
all_pages_found = (@results + @title_results).uniq
|
||||||
|
@ -165,7 +165,7 @@ class WikiController < ApplicationController
|
||||||
def edit
|
def edit
|
||||||
if @page.nil?
|
if @page.nil?
|
||||||
redirect_home
|
redirect_home
|
||||||
elsif @page.locked?(Time.now) and not @params['break_lock']
|
elsif @page.locked?(Time.now) and not params['break_lock']
|
||||||
redirect_to :web => @web_name, :action => 'locked', :id => @page_name
|
redirect_to :web => @web_name, :action => 'locked', :id => @page_name
|
||||||
else
|
else
|
||||||
@page.lock(Time.now, @author)
|
@page.lock(Time.now, @author)
|
||||||
|
@ -216,7 +216,7 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
def revision
|
def revision
|
||||||
get_page_and_revision
|
get_page_and_revision
|
||||||
@show_diff = (@params[:mode] == 'diff')
|
@show_diff = (params[:mode] == 'diff')
|
||||||
@renderer = PageRenderer.new(@revision)
|
@renderer = PageRenderer.new(@revision)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -227,13 +227,13 @@ class WikiController < ApplicationController
|
||||||
def save
|
def save
|
||||||
render(:status => 404, :text => 'Undefined page name') and return if @page_name.nil?
|
render(:status => 404, :text => 'Undefined page name') and return if @page_name.nil?
|
||||||
|
|
||||||
author_name = @params['author'].delete("\x01-\x08\x0B\x0C\x0E-\x1F")
|
author_name = params['author'].delete("\x01-\x08\x0B\x0C\x0E-\x1F")
|
||||||
author_name = 'AnonymousCoward' if author_name =~ /^\s*$/
|
author_name = 'AnonymousCoward' if author_name =~ /^\s*$/
|
||||||
raise "Your name was not valid utf-8" if !author_name.is_utf8?
|
raise "Your name was not valid utf-8" if !author_name.is_utf8?
|
||||||
cookies['author'] = { :value => author_name, :expires => Time.utc(2030) }
|
cookies['author'] = { :value => author_name, :expires => Time.utc(2030) }
|
||||||
|
|
||||||
begin
|
begin
|
||||||
the_content = @params['content'].delete("\x01-\x08\x0B\x0C\x0E-\x1F")
|
the_content = params['content'].delete("\x01-\x08\x0B\x0C\x0E-\x1F")
|
||||||
raise "Your content was not valid utf-8" if !the_content.is_utf8?
|
raise "Your content was not valid utf-8" if !the_content.is_utf8?
|
||||||
filter_spam(the_content)
|
filter_spam(the_content)
|
||||||
if @page
|
if @page
|
||||||
|
@ -262,7 +262,7 @@ class WikiController < ApplicationController
|
||||||
if @page
|
if @page
|
||||||
begin
|
begin
|
||||||
@renderer = PageRenderer.new(@page.revisions.last)
|
@renderer = PageRenderer.new(@page.revisions.last)
|
||||||
@show_diff = (@params[:mode] == 'diff')
|
@show_diff = (params[:mode] == 'diff')
|
||||||
render_action 'page'
|
render_action 'page'
|
||||||
# TODO this rescue should differentiate between errors due to rendering and errors in
|
# TODO this rescue should differentiate between errors due to rendering and errors in
|
||||||
# the application itself (for application errors, it's better not to rescue the error at all)
|
# the application itself (for application errors, it's better not to rescue the error at all)
|
||||||
|
@ -309,7 +309,7 @@ class WikiController < ApplicationController
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def load_page
|
def load_page
|
||||||
@page_name = @params['id']
|
@page_name = params['id']
|
||||||
@page = @wiki.read_page(@web_name, @page_name) if @page_name
|
@page = @wiki.read_page(@web_name, @page_name) if @page_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -371,8 +371,8 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_page_and_revision
|
def get_page_and_revision
|
||||||
if @params['rev']
|
if params['rev']
|
||||||
@revision_number = @params['rev'].to_i
|
@revision_number = params['rev'].to_i
|
||||||
else
|
else
|
||||||
@revision_number = @page.revisions.length
|
@revision_number = @page.revisions.length
|
||||||
end
|
end
|
||||||
|
@ -381,7 +381,7 @@ class WikiController < ApplicationController
|
||||||
|
|
||||||
def parse_category
|
def parse_category
|
||||||
@categories = WikiReference.list_categories(@web).sort
|
@categories = WikiReference.list_categories(@web).sort
|
||||||
@category = @params['category']
|
@category = params['category']
|
||||||
if @category
|
if @category
|
||||||
@set_name = "category '#{@category}'"
|
@set_name = "category '#{@category}'"
|
||||||
pages = WikiReference.pages_in_category(@web, @category).sort.map { |page_name| @web.page(page_name) }
|
pages = WikiReference.pages_in_category(@web, @category).sort.map { |page_name| @web.page(page_name) }
|
||||||
|
@ -394,7 +394,7 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def remote_ip
|
def remote_ip
|
||||||
ip = @request.remote_ip
|
ip = request.remote_ip
|
||||||
logger.info(ip)
|
logger.info(ip)
|
||||||
ip
|
ip
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Web < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_page?(name)
|
def has_page?(name)
|
||||||
Page.count(['web_id = ? AND name = ?', id, name]) > 0
|
Page.count(:conditions => ['web_id = ? AND name = ?', id, name]) > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_file?(file_name)
|
def has_file?(file_name)
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
you'll need to do a brief one-time setup.
|
you'll need to do a brief one-time setup.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<%= form_tag({ :controller => 'admin', :action => 'create_system' },
|
<% form_tag({ :controller => 'admin', :action => 'create_system' },
|
||||||
{ 'id' => 'setup', 'method' => 'post', 'onsubmit' => 'return validateSetup()',
|
{ 'id' => 'setup', 'method' => 'post', 'onsubmit' => 'return validateSetup()',
|
||||||
'accept-charset' => 'utf-8' })
|
'accept-charset' => 'utf-8' }) do
|
||||||
%>
|
%>
|
||||||
<ol class="setup">
|
<ol class="setup">
|
||||||
<li>
|
<li>
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
<p style="text-align:right">
|
<p style="text-align:right">
|
||||||
<input type="submit" value="Setup" style="margin-left: 40px" />
|
<input type="submit" value="Setup" style="margin-left: 40px" />
|
||||||
</p>
|
</p>
|
||||||
<%= end_form_tag %>
|
<% end %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function proposeAddress() {
|
function proposeAddress() {
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
so different subjects or projects can write about different <i>MuppetShows</i>.
|
so different subjects or projects can write about different <i>MuppetShows</i>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<%= form_tag({ :controller => 'admin', :action => 'create_web' },
|
<% form_tag({ :controller => 'admin', :action => 'create_web' },
|
||||||
{ 'id' => 'setup', 'method' => 'post',
|
{ 'id' => 'setup', 'method' => 'post',
|
||||||
'onsubmit' => 'cleanAddress(); return validateSetup()',
|
'onsubmit' => 'cleanAddress(); return validateSetup()',
|
||||||
'accept-charset' => 'utf-8' })
|
'accept-charset' => 'utf-8' }) do
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<ol class="setup">
|
<ol class="setup">
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<input type="submit" value="Create Web" />
|
<input type="submit" value="Create Web" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<%= end_form_tag %>
|
<% end %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function proposeAddress() {
|
function proposeAddress() {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<% @title = "Edit Web" %>
|
<% @title = "Edit Web" %>
|
||||||
|
|
||||||
<%= form_tag({ :controller => 'admin', :action => 'edit_web', :web => @web.address },
|
<% form_tag({ :controller => 'admin', :action => 'edit_web', :web => @web.address },
|
||||||
{ 'id' => 'setup', 'method' => 'post',
|
{ 'id' => 'setup', 'method' => 'post',
|
||||||
'onsubmit' => 'cleanAddress(); return validateSetup()',
|
'onsubmit' => 'cleanAddress(); return validateSetup()',
|
||||||
'accept-charset' => 'utf-8' })
|
'accept-charset' => 'utf-8' }) do
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<h2 style="margin-bottom: 3px">Name and address</h2>
|
<h2 style="margin-bottom: 3px">Name and address</h2>
|
||||||
|
@ -107,15 +107,15 @@
|
||||||
...or forget changes and <%= link_to 'create a new web', :action => 'create_web' %>
|
...or forget changes and <%= link_to 'create a new web', :action => 'create_web' %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<%= end_form_tag %>
|
<% end %>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<h1>Other administrative tasks</h1>
|
<h1>Other administrative tasks</h1>
|
||||||
|
|
||||||
<%= form_tag({:controller => 'admin', :web => @web.address, :action => 'remove_orphaned_pages'},
|
<% form_tag({:controller => 'admin', :web => @web.address, :action => 'remove_orphaned_pages'},
|
||||||
{ :id => 'remove_orphaned_pages',
|
{ :id => 'remove_orphaned_pages',
|
||||||
:onsubmit => "return checkSystemPassword(document.getElementById('system_password_orphaned').value)",
|
:onsubmit => "return checkSystemPassword(document.getElementById('system_password_orphaned').value)",
|
||||||
'accept-charset' => 'utf-8' })
|
'accept-charset' => 'utf-8' }) do
|
||||||
%>
|
%>
|
||||||
<p style="text-align:right;font-size:.85em;">
|
<p style="text-align:right;font-size:.85em;">
|
||||||
Clean up by entering system password
|
Clean up by entering system password
|
||||||
|
@ -123,6 +123,6 @@
|
||||||
and
|
and
|
||||||
<input type="submit" value="Delete Orphan Pages" />
|
<input type="submit" value="Delete Orphan Pages" />
|
||||||
</p>
|
</p>
|
||||||
<%= end_form_tag %>
|
<% end %>
|
||||||
|
|
||||||
<%= javascript_include_tag 'edit_web' %>
|
<%= javascript_include_tag 'edit_web' %>
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
<%= error_messages_for 'file' %>
|
<%= error_messages_for 'file' %>
|
||||||
|
|
||||||
<%= form_tag({ :controller => 'file', :web => @web_name, :action => 'file' },
|
<% form_tag({ :controller => 'file', :web => @web_name, :action => 'file' },
|
||||||
{ 'multipart' => true , 'accept-charset' => 'utf-8' }) %>
|
{ 'multipart' => true , 'accept-charset' => 'utf-8' }) do %>
|
||||||
<div class="inputFieldWithPrompt">
|
<div class="inputFieldWithPrompt">
|
||||||
<%= hidden_field 'file', 'file_name' %>
|
<%= hidden_field 'file', 'file_name' %>
|
||||||
<label for="file_content"><b>Content of <%= h @file_name %> to upload</b> (required):</label>
|
<label for="file_content"><b>Content of <%= h @file_name %> to upload</b> (required):</label>
|
||||||
|
@ -28,4 +28,4 @@
|
||||||
:onfocus => "this.value == 'AnonymousCoward' ? this.value = '' : true;",
|
:onfocus => "this.value == 'AnonymousCoward' ? this.value = '' : true;",
|
||||||
:onblur => "this.value == '' ? this.value = 'AnonymousCoward' : true" %>
|
:onblur => "this.value == '' ? this.value = 'AnonymousCoward' : true" %>
|
||||||
</div>
|
</div>
|
||||||
<%= end_form_tag %>
|
<% end %>
|
||||||
|
|
|
@ -54,12 +54,12 @@
|
||||||
|
|
||||||
<%= render 'navigation' unless @web.nil? || @hide_navigation %>
|
<%= render 'navigation' unless @web.nil? || @hide_navigation %>
|
||||||
|
|
||||||
<% if @flash[:info] %>
|
<% if flash[:info] %>
|
||||||
<div class="info"><%= escape_preserving_linefeeds @flash[:info] %></div>
|
<div class="info"><%= escape_preserving_linefeeds flash[:info] %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @error or @flash[:error] %>
|
<% if @error or flash[:error] %>
|
||||||
<div class="errorExplanation"><%= escape_preserving_linefeeds(@error || @flash[:error]) %></div>
|
<div class="errorExplanation"><%= escape_preserving_linefeeds(@error || flash[:error]) %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= @content_for_layout %>
|
<%= @content_for_layout %>
|
||||||
|
|
|
@ -16,12 +16,12 @@ end
|
||||||
<%= list_item 'Authors', {:action => 'authors'}, 'Who wrote what' %> |
|
<%= list_item 'Authors', {:action => 'authors'}, 'Who wrote what' %> |
|
||||||
<%= list_item 'Feeds', {:action => 'feeds'}, 'Subscribe to changes by RSS' %> |
|
<%= list_item 'Feeds', {:action => 'feeds'}, 'Subscribe to changes by RSS' %> |
|
||||||
<%= list_item 'Export', {:action => 'export'}, 'Download a zip with all the pages in this wiki', 'X' %> |
|
<%= list_item 'Export', {:action => 'export'}, 'Download a zip with all the pages in this wiki', 'X' %> |
|
||||||
<%= form_tag({ :controller => 'wiki', :action => 'search', :web => @web.address},
|
<% form_tag({ :controller => 'wiki', :action => 'search', :web => @web.address},
|
||||||
{'id' => 'navigationSearchForm', 'method' => 'get', 'accept-charset' => 'utf-8' }) %>
|
{'id' => 'navigationSearchForm', 'method' => 'get', 'accept-charset' => 'utf-8' }) do %>
|
||||||
<fieldset class="search"><input type="text" id="searchField" name="query" value="Search"
|
<fieldset class="search"><input type="text" id="searchField" name="query" value="Search"
|
||||||
onfocus="this.value == 'Search' ? this.value = '' : true"
|
onfocus="this.value == 'Search' ? this.value = '' : true"
|
||||||
onblur="this.value == '' ? this.value = 'Search' : true" /></fieldset>
|
onblur="this.value == '' ? this.value = 'Search' : true" /></fieldset>
|
||||||
<%= end_form_tag %>
|
<% end_form_tag %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= list_item 'Home Page', {:action => 'published', :id => 'HomePage'}, 'Home, Sweet Home', 'H' %>
|
<%= list_item 'Home Page', {:action => 'published', :id => 'HomePage'}, 'Home, Sweet Home', 'H' %>
|
||||||
<% end%>
|
<% end%>
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
<%= render 'wiki_words_help' %>
|
<%= render 'wiki_words_help' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= form_tag({ :action => 'save', :web => @web.address, :id => @page.name },
|
<% form_tag({ :action => 'save', :web => @web.address, :id => @page.name },
|
||||||
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName()',
|
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName()',
|
||||||
'accept-charset' => 'utf-8' }) %>
|
'accept-charset' => 'utf-8' }) do %>
|
||||||
<div>
|
<div>
|
||||||
<textarea name="content" id="content" rows="24" cols="60"><%= h(@flash[:content] || @page.content.delete("\x01-\x08\x0B\x0C\x0E-\x1F")) %></textarea>
|
<textarea name="content" id="content" rows="24" cols="60"><%= h(@flash[:content] || @page.content.delete("\x01-\x08\x0B\x0C\x0E-\x1F")) %></textarea>
|
||||||
<div id="editFormButtons">
|
<div id="editFormButtons">
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%= end_form_tag %>
|
<% end %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function cleanAuthorName() {
|
function cleanAuthorName() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<% @title = "#{@web_name} Login" %><% @hide_navigation = true %>
|
<% @title = "#{@web_name} Login" %><% @hide_navigation = true %>
|
||||||
|
|
||||||
<%= form_tag({ :controller => 'wiki', :action => 'authenticate', :web => @web.address},
|
<% form_tag({ :controller => 'wiki', :action => 'authenticate', :web => @web.address},
|
||||||
{ 'id' => 'loginForm', 'method' => 'post', 'accept-charset' => 'utf-8' }) %>
|
{ 'id' => 'loginForm', 'method' => 'post', 'accept-charset' => 'utf-8' }) do %>
|
||||||
<p>
|
<p>
|
||||||
This web is password-protected. Please enter the password.
|
This web is password-protected. Please enter the password.
|
||||||
<% if @web.published? %>
|
<% if @web.published? %>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
<input type="password" name="password" id="password" />
|
<input type="password" name="password" id="password" />
|
||||||
<input type="submit" value="Login" />
|
<input type="submit" value="Login" />
|
||||||
</p>
|
</p>
|
||||||
<%= end_form_tag %>
|
<% end %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.forms["loginForm"].elements["password"].focus();
|
document.forms["loginForm"].elements["password"].focus();
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="editForm">
|
<div id="editForm">
|
||||||
<%= form_tag({ :action => 'save', :web => @web.address, :id => @page_name },
|
<% form_tag({ :action => 'save', :web => @web.address, :id => @page_name },
|
||||||
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName();', 'accept-charset' => 'utf-8' }) %>
|
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName();', 'accept-charset' => 'utf-8' }) do %>
|
||||||
|
|
||||||
<textarea name="content" id="content" rows="24" cols="60"><%= h(@flash[:content] || '') %></textarea>
|
<textarea name="content" id="content" rows="24" cols="60"><%= h(@flash[:content] || '') %></textarea>
|
||||||
<div id="editFormButtons">
|
<div id="editFormButtons">
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
:onfocus => "this.value == 'AnonymousCoward' ? this.value = '' : true;",
|
:onfocus => "this.value == 'AnonymousCoward' ? this.value = '' : true;",
|
||||||
:onblur => "this.value == '' ? this.value = 'AnonymousCoward' : true" %>
|
:onblur => "this.value == '' ? this.value = 'AnonymousCoward' : true" %>
|
||||||
</div>
|
</div>
|
||||||
<%= end_form_tag %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
@hide_navigation = true
|
@hide_navigation = true
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<%= "<p style='color:red'>Please correct the error that caused this error in rendering:<br/><small>#{@params["msg"]}</small></p>" if @params["msg"] %>
|
<%= "<p style='color:red'>Please correct the error that caused this error in rendering:<br/><small>#{params["msg"]}</small></p>" if params["msg"] %>
|
||||||
|
|
||||||
<div id="MarkupHelp">
|
<div id="MarkupHelp">
|
||||||
<%= render("#{@web.markup}_help") %>
|
<%= render("#{@web.markup}_help") %>
|
||||||
<%= render 'wiki_words_help' %>
|
<%= render 'wiki_words_help' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= form_tag({:web => @web.address, :action => 'save', :id => @page.name},
|
<% form_tag({:web => @web.address, :action => 'save', :id => @page.name},
|
||||||
{ :id => 'editForm', :method => 'post', :onsubmit => 'cleanAuthorName();',
|
{ :id => 'editForm', :method => 'post', :onsubmit => 'cleanAuthorName();',
|
||||||
'accept-charset' => 'utf-8' }) %>
|
'accept-charset' => 'utf-8' }) do %>
|
||||||
<div>
|
<div>
|
||||||
<textarea name="content" id="content" rows="24" cols="60"><%= h(@revision.content.delete("\x01-\x08\x0B\x0C\x0E-\x1F")) %></textarea>
|
<textarea name="content" id="content" rows="24" cols="60"><%= h(@revision.content.delete("\x01-\x08\x0B\x0C\x0E-\x1F")) %></textarea>
|
||||||
<div id="editFormButtons">
|
<div id="editFormButtons">
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%= end_form_tag %>
|
<% end %>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function cleanAuthorName() {
|
function cleanAuthorName() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<% @title = "Search results for \"#{h @params["query"]}\"" %>
|
<% @title = "Search results for \"#{h params["query"]}\"" %>
|
||||||
|
|
||||||
<% unless @title_results.empty? %>
|
<% unless @title_results.empty? %>
|
||||||
<h2><%= @title_results.length %> page(s) containing search string in the page name:</h2>
|
<h2><%= @title_results.length %> page(s) containing search string in the page name:</h2>
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if (@results + @title_results).empty? %>
|
<% if (@results + @title_results).empty? %>
|
||||||
<h2>No pages contain "<%= h @params["query"] %>" </h2>
|
<h2>No pages contain "<%= h params["query"] %>" </h2>
|
||||||
<p>
|
<p>
|
||||||
Perhaps you should try expanding your query. Remember that Instiki searches for entire
|
Perhaps you should try expanding your query. Remember that Instiki searches for entire
|
||||||
phrases, so if you search for "all that jazz" it will not match pages that contain these
|
phrases, so if you search for "all that jazz" it will not match pages that contain these
|
||||||
|
|
|
@ -55,14 +55,14 @@ class AdminControllerTest < Test::Unit::TestCase
|
||||||
assert_equal wiki_before, @wiki
|
assert_equal wiki_before, @wiki
|
||||||
# and no new web should be created either
|
# and no new web should be created either
|
||||||
assert_equal old_size, @wiki.webs.size
|
assert_equal old_size, @wiki.webs.size
|
||||||
assert_flash_has :error
|
assert(@response.has_flash_object?(:error))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create_system_no_form_and_wiki_already_initialized
|
def test_create_system_no_form_and_wiki_already_initialized
|
||||||
assert @wiki.setup?
|
assert @wiki.setup?
|
||||||
process('create_system')
|
process('create_system')
|
||||||
assert_redirected_to :web => @wiki.webs.keys.first, :action => 'show', :id => 'HomePage'
|
assert_redirected_to :web => @wiki.webs.keys.first, :action => 'show', :id => 'HomePage'
|
||||||
assert_flash_has :error
|
assert(@response.has_flash_object?(:error))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ class FileControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_file_upload_form
|
def test_file_upload_form
|
||||||
get :file, :web => 'wiki1', :id => 'new_file.txt'
|
get :file, :web => 'wiki1', :id => 'new_file.txt'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_rendered_file 'file/file'
|
assert_template 'file/file'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_file_download_text_file
|
def test_file_download_text_file
|
||||||
|
@ -34,7 +34,7 @@ class FileControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = get :file, :web => 'wiki1', :id => 'foo.txt'
|
r = get :file, :web => 'wiki1', :id => 'foo.txt'
|
||||||
|
|
||||||
assert_success(bypass_body_parsing = true)
|
assert_response(:success, bypass_body_parsing = true)
|
||||||
assert_equal "Contents of the file", r.body
|
assert_equal "Contents of the file", r.body
|
||||||
assert_equal 'text/plain', r.headers['Content-Type']
|
assert_equal 'text/plain', r.headers['Content-Type']
|
||||||
end
|
end
|
||||||
|
@ -45,7 +45,7 @@ class FileControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = get :file, :web => 'wiki1', :id => 'foo.pdf'
|
r = get :file, :web => 'wiki1', :id => 'foo.pdf'
|
||||||
|
|
||||||
assert_success(bypass_body_parsing = true)
|
assert_response(:success, bypass_body_parsing = true)
|
||||||
assert_equal "aaa\nbbb\n", r.body
|
assert_equal "aaa\nbbb\n", r.body
|
||||||
assert_equal 'application/pdf', r.headers['Content-Type']
|
assert_equal 'application/pdf', r.headers['Content-Type']
|
||||||
end
|
end
|
||||||
|
@ -56,7 +56,7 @@ class FileControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = get :file, :web => 'wiki1', :id => 'rails.gif'
|
r = get :file, :web => 'wiki1', :id => 'rails.gif'
|
||||||
|
|
||||||
assert_success(bypass_body_parsing = true)
|
assert_response(:success, bypass_body_parsing = true)
|
||||||
assert_equal 'image/gif', r.headers['Content-Type']
|
assert_equal 'image/gif', r.headers['Content-Type']
|
||||||
assert_equal pic.size, r.body.size
|
assert_equal pic.size, r.body.size
|
||||||
assert_equal pic, r.body
|
assert_equal pic, r.body
|
||||||
|
@ -65,8 +65,8 @@ class FileControllerTest < Test::Unit::TestCase
|
||||||
def test_pic_unknown_pic
|
def test_pic_unknown_pic
|
||||||
r = get :file, :web => 'wiki1', :id => 'non-existant.gif'
|
r = get :file, :web => 'wiki1', :id => 'non-existant.gif'
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_rendered_file 'file/file'
|
assert_template 'file/file'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_pic_upload_end_to_end
|
def test_pic_upload_end_to_end
|
||||||
|
@ -81,12 +81,13 @@ class FileControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
# rails-e2e.gif is unknown to the system, so pic action goes to the file [upload] form
|
# rails-e2e.gif is unknown to the system, so pic action goes to the file [upload] form
|
||||||
r = get :file, :web => 'wiki1', :id => 'rails-e2e.gif'
|
r = get :file, :web => 'wiki1', :id => 'rails-e2e.gif'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_rendered_file 'file/file'
|
assert_template 'file/file'
|
||||||
|
|
||||||
# User uploads the picture
|
# User uploads the picture
|
||||||
picture = File.read("#{RAILS_ROOT}/test/fixtures/rails.gif")
|
picture = File.read("#{RAILS_ROOT}/test/fixtures/rails.gif")
|
||||||
r = post :file, :web => 'wiki1',
|
# updated from post to get - post fails the spam protection (no javascript)
|
||||||
|
r = get :file, :web => 'wiki1',
|
||||||
:file => {:file_name => 'rails-e2e.gif', :content => StringIO.new(picture)}
|
:file => {:file_name => 'rails-e2e.gif', :content => StringIO.new(picture)}
|
||||||
assert_redirected_to({})
|
assert_redirected_to({})
|
||||||
assert @web.has_file?('rails-e2e.gif')
|
assert @web.has_file?('rails-e2e.gif')
|
||||||
|
@ -94,8 +95,9 @@ class FileControllerTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_import
|
def test_import
|
||||||
r = post :import, :web => 'wiki1', :file => uploaded_file("#{RAILS_ROOT}/test/fixtures/exported_markup.zip")
|
# updated from post to get - post fails the spam protection (no javascript)
|
||||||
assert_redirect
|
r = get :import, :web => 'wiki1', :file => uploaded_file("#{RAILS_ROOT}/test/fixtures/exported_markup.zip")
|
||||||
|
assert_response(:redirect)
|
||||||
assert @web.has_page?('ImportedPage')
|
assert @web.has_page?('ImportedPage')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,10 @@ class RoutesTest < Test::Unit::TestCase
|
||||||
assert_routing('web/show/%24HOME_PAGE',
|
assert_routing('web/show/%24HOME_PAGE',
|
||||||
:controller => 'wiki', :web => 'web', :action => 'show', :id => '$HOME_PAGE')
|
:controller => 'wiki', :web => 'web', :action => 'show', :id => '$HOME_PAGE')
|
||||||
|
|
||||||
|
assert_routing('web/show/HomePage%3F',
|
||||||
|
:controller => 'wiki', :web => 'web', :action => 'show',
|
||||||
|
:id => 'HomePage')
|
||||||
|
|
||||||
assert_routing('web/show/HomePage%3Farg1%3Dvalue1%26arg2%3Dvalue2',
|
assert_routing('web/show/HomePage%3Farg1%3Dvalue1%26arg2%3Dvalue2',
|
||||||
:controller => 'wiki', :web => 'web', :action => 'show',
|
:controller => 'wiki', :web => 'web', :action => 'show',
|
||||||
:id => 'HomePage?arg1=value1&arg2=value2')
|
:id => 'HomePage?arg1=value1&arg2=value2')
|
||||||
|
|
|
@ -32,7 +32,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
get :authenticate, :web => 'wiki1', :password => 'pswd'
|
get :authenticate, :web => 'wiki1', :password => 'pswd'
|
||||||
assert_redirected_to :web => 'wiki1', :action => 'show', :id => 'HomePage'
|
assert_redirected_to :web => 'wiki1', :action => 'show', :id => 'HomePage'
|
||||||
assert_equal ['pswd'], @response.cookies['wiki1']
|
assert_equal ['pswd'], @response.cookies['web_address']
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_authenticate_wrong_password
|
def test_authenticate_wrong_password
|
||||||
|
@ -40,7 +40,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = process('authenticate', 'web' => 'wiki1', 'password' => 'wrong password')
|
r = process('authenticate', 'web' => 'wiki1', 'password' => 'wrong password')
|
||||||
assert_redirected_to :action => 'login', :web => 'wiki1'
|
assert_redirected_to :action => 'login', :web => 'wiki1'
|
||||||
assert_nil r.cookies['wiki1']
|
assert_nil r.cookies['web_address']
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_authors
|
def test_authors
|
||||||
|
@ -50,7 +50,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = process('authors', 'web' => 'wiki1')
|
r = process('authors', 'web' => 'wiki1')
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal %w(AnAuthor BreakingTheOrder DavidHeinemeierHansson Guest Me TreeHugger),
|
assert_equal %w(AnAuthor BreakingTheOrder DavidHeinemeierHansson Guest Me TreeHugger),
|
||||||
r.template_objects['authors']
|
r.template_objects['authors']
|
||||||
page_names_by_author = r.template_objects['page_names_by_author']
|
page_names_by_author = r.template_objects['page_names_by_author']
|
||||||
|
@ -70,7 +70,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_edit
|
def test_edit
|
||||||
r = process 'edit', 'web' => 'wiki1', 'id' => 'HomePage'
|
r = process 'edit', 'web' => 'wiki1', 'id' => 'HomePage'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal @wiki.read_page('wiki1', 'HomePage'), r.template_objects['page']
|
assert_equal @wiki.read_page('wiki1', 'HomePage'), r.template_objects['page']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_edit_page_break_lock
|
def test_edit_page_break_lock
|
||||||
@home.lock(Time.now, 'Locky')
|
@home.lock(Time.now, 'Locky')
|
||||||
process 'edit', 'web' => 'wiki1', 'id' => 'HomePage', 'break_lock' => 'y'
|
process 'edit', 'web' => 'wiki1', 'id' => 'HomePage', 'break_lock' => 'y'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
@home = Page.find(@home.id)
|
@home = Page.find(@home.id)
|
||||||
assert @home.locked?(Time.now)
|
assert @home.locked?(Time.now)
|
||||||
end
|
end
|
||||||
|
@ -100,7 +100,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
test_renderer)
|
test_renderer)
|
||||||
|
|
||||||
r = process 'edit', 'web' => 'wiki1', 'id' => 'With : Special /> symbols'
|
r = process 'edit', 'web' => 'wiki1', 'id' => 'With : Special /> symbols'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
xml = REXML::Document.new(r.body)
|
xml = REXML::Document.new(r.body)
|
||||||
form = REXML::XPath.first(xml, '//form')
|
form = REXML::XPath.first(xml, '//form')
|
||||||
assert_equal '/wiki1/save/With+%3A+Special+%2F%3E+symbols', form.attributes['action']
|
assert_equal '/wiki1/save/With+%3A+Special+%2F%3E+symbols', form.attributes['action']
|
||||||
|
@ -111,7 +111,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
@home.rollback(0, Time.now, 'Rick', test_renderer)
|
@home.rollback(0, Time.now, 'Rick', test_renderer)
|
||||||
r = process 'export_html', 'web' => 'wiki1'
|
r = process 'export_html', 'web' => 'wiki1'
|
||||||
|
|
||||||
assert_success(bypass_body_parsing = true)
|
assert_response(:success, bypass_body_parsing = true)
|
||||||
assert_equal 'application/zip', r.headers['Content-Type']
|
assert_equal 'application/zip', r.headers['Content-Type']
|
||||||
assert_match /attachment; filename="wiki1-html-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
|
assert_match /attachment; filename="wiki1-html-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
|
||||||
r.headers['Content-Disposition']
|
r.headers['Content-Disposition']
|
||||||
|
@ -139,7 +139,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_export_html_no_layout
|
def test_export_html_no_layout
|
||||||
r = process 'export_html', 'web' => 'wiki1', 'layout' => 'no'
|
r = process 'export_html', 'web' => 'wiki1', 'layout' => 'no'
|
||||||
|
|
||||||
assert_success(bypass_body_parsing = true)
|
assert_response(:success, bypass_body_parsing = true)
|
||||||
assert_equal 'application/zip', r.headers['Content-Type']
|
assert_equal 'application/zip', r.headers['Content-Type']
|
||||||
assert_match /attachment; filename="wiki1-html-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
|
assert_match /attachment; filename="wiki1-html-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
|
||||||
r.headers['Content-Disposition']
|
r.headers['Content-Disposition']
|
||||||
|
@ -149,7 +149,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_export_markup
|
def test_export_markup
|
||||||
r = process 'export_markup', 'web' => 'wiki1'
|
r = process 'export_markup', 'web' => 'wiki1'
|
||||||
|
|
||||||
assert_success(bypass_body_parsing = true)
|
assert_response(:success, bypass_body_parsing = true)
|
||||||
assert_equal 'application/zip', r.headers['Content-Type']
|
assert_equal 'application/zip', r.headers['Content-Type']
|
||||||
assert_match /attachment; filename="wiki1-textile-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
|
assert_match /attachment; filename="wiki1-textile-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.zip"/,
|
||||||
r.headers['Content-Disposition']
|
r.headers['Content-Disposition']
|
||||||
|
@ -161,7 +161,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_export_pdf
|
def test_export_pdf
|
||||||
r = process 'export_pdf', 'web' => 'wiki1'
|
r = process 'export_pdf', 'web' => 'wiki1'
|
||||||
assert_success(bypass_body_parsing = true)
|
assert_response(:success, bypass_body_parsing = true)
|
||||||
assert_equal 'application/pdf', r.headers['Content-Type']
|
assert_equal 'application/pdf', r.headers['Content-Type']
|
||||||
assert_match /attachment; filename="wiki1-tex-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.pdf"/,
|
assert_match /attachment; filename="wiki1-tex-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.pdf"/,
|
||||||
r.headers['Content-Disposition']
|
r.headers['Content-Disposition']
|
||||||
|
@ -178,7 +178,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_export_tex
|
def test_export_tex
|
||||||
r = process 'export_tex', 'web' => 'wiki1'
|
r = process 'export_tex', 'web' => 'wiki1'
|
||||||
|
|
||||||
assert_success(bypass_body_parsing = true)
|
assert_response(:success, bypass_body_parsing = true)
|
||||||
assert_equal 'application/octet-stream', r.headers['Content-Type']
|
assert_equal 'application/octet-stream', r.headers['Content-Type']
|
||||||
assert_match /attachment; filename="wiki1-tex-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.tex"/,
|
assert_match /attachment; filename="wiki1-tex-\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d.tex"/,
|
||||||
r.headers['Content-Disposition']
|
r.headers['Content-Disposition']
|
||||||
|
@ -229,21 +229,21 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_locked
|
def test_locked
|
||||||
@home.lock(Time.now, 'Locky')
|
@home.lock(Time.now, 'Locky')
|
||||||
r = process('locked', 'web' => 'wiki1', 'id' => 'HomePage')
|
r = process('locked', 'web' => 'wiki1', 'id' => 'HomePage')
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal @home, r.template_objects['page']
|
assert_equal @home, r.template_objects['page']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def test_login
|
def test_login
|
||||||
r = process 'login', 'web' => 'wiki1'
|
r = process 'login', 'web' => 'wiki1'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
# this action goes straight to the templates
|
# this action goes straight to the templates
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def test_new
|
def test_new
|
||||||
r = process('new', 'id' => 'NewPage', 'web' => 'wiki1')
|
r = process('new', 'id' => 'NewPage', 'web' => 'wiki1')
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal 'AnonymousCoward', r.template_objects['author']
|
assert_equal 'AnonymousCoward', r.template_objects['author']
|
||||||
assert_equal 'NewPage', r.template_objects['page_name']
|
assert_equal 'NewPage', r.template_objects['page_name']
|
||||||
end
|
end
|
||||||
|
@ -254,7 +254,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_pdf
|
def test_pdf
|
||||||
assert RedClothForTex.available?, 'Cannot do test_pdf when pdflatex is not available'
|
assert RedClothForTex.available?, 'Cannot do test_pdf when pdflatex is not available'
|
||||||
r = process('pdf', 'web' => 'wiki1', 'id' => 'HomePage')
|
r = process('pdf', 'web' => 'wiki1', 'id' => 'HomePage')
|
||||||
assert_success(bypass_body_parsing = true)
|
assert_response(:success, bypass_body_parsing = true)
|
||||||
|
|
||||||
assert_equal '%PDF', r.body[0..3]
|
assert_equal '%PDF', r.body[0..3]
|
||||||
assert_equal "EOF\n", r.body[-4..-1]
|
assert_equal "EOF\n", r.body[-4..-1]
|
||||||
|
@ -270,7 +270,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_print
|
def test_print
|
||||||
r = process('print', 'web' => 'wiki1', 'id' => 'HomePage')
|
r = process('print', 'web' => 'wiki1', 'id' => 'HomePage')
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal :show, r.template_objects['link_mode']
|
assert_equal :show, r.template_objects['link_mode']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = process('published', 'web' => 'wiki1', 'id' => 'HomePage')
|
r = process('published', 'web' => 'wiki1', 'id' => 'HomePage')
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal @home, r.template_objects['page']
|
assert_equal @home, r.template_objects['page']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -298,14 +298,14 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = process('published', 'web' => 'wiki1')
|
r = process('published', 'web' => 'wiki1')
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal @home, r.template_objects['page']
|
assert_equal @home, r.template_objects['page']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def test_recently_revised
|
def test_recently_revised
|
||||||
r = process('recently_revised', 'web' => 'wiki1')
|
r = process('recently_revised', 'web' => 'wiki1')
|
||||||
assert_success
|
assert_response(:success)
|
||||||
|
|
||||||
assert_equal %w(animals trees), r.template_objects['categories']
|
assert_equal %w(animals trees), r.template_objects['categories']
|
||||||
assert_nil r.template_objects['category']
|
assert_nil r.template_objects['category']
|
||||||
|
@ -332,7 +332,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
Time.now, Author.new('AnotherAuthor', '127.0.0.2'), test_renderer)
|
Time.now, Author.new('AnotherAuthor', '127.0.0.2'), test_renderer)
|
||||||
|
|
||||||
r = process('recently_revised', 'web' => 'wiki1')
|
r = process('recently_revised', 'web' => 'wiki1')
|
||||||
assert_success
|
assert_response(:success)
|
||||||
|
|
||||||
assert_equal %w(animals categorized trees), r.template_objects['categories']
|
assert_equal %w(animals categorized trees), r.template_objects['categories']
|
||||||
# no category is specified in params
|
# no category is specified in params
|
||||||
|
@ -345,7 +345,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_recently_revised_with_categorized_page_multiple_categories
|
def test_recently_revised_with_categorized_page_multiple_categories
|
||||||
r = process('recently_revised', 'web' => 'wiki1')
|
r = process('recently_revised', 'web' => 'wiki1')
|
||||||
assert_success
|
assert_response(:success)
|
||||||
|
|
||||||
assert_equal ['animals', 'trees'], r.template_objects['categories']
|
assert_equal ['animals', 'trees'], r.template_objects['categories']
|
||||||
# no category is specified in params
|
# no category is specified in params
|
||||||
|
@ -358,7 +358,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_recently_revised_with_specified_category
|
def test_recently_revised_with_specified_category
|
||||||
r = process('recently_revised', 'web' => 'wiki1', 'category' => 'animals')
|
r = process('recently_revised', 'web' => 'wiki1', 'category' => 'animals')
|
||||||
assert_success
|
assert_response(:success)
|
||||||
|
|
||||||
assert_equal ['animals', 'trees'], r.template_objects['categories']
|
assert_equal ['animals', 'trees'], r.template_objects['categories']
|
||||||
# no category is specified in params
|
# no category is specified in params
|
||||||
|
@ -371,7 +371,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_revision
|
def test_revision
|
||||||
r = process 'revision', 'web' => 'wiki1', 'id' => 'HomePage', 'rev' => '1'
|
r = process 'revision', 'web' => 'wiki1', 'id' => 'HomePage', 'rev' => '1'
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal @home, r.template_objects['page']
|
assert_equal @home, r.template_objects['page']
|
||||||
assert_equal @home.revisions[0], r.template_objects['revision']
|
assert_equal @home.revisions[0], r.template_objects['revision']
|
||||||
end
|
end
|
||||||
|
@ -382,7 +382,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
# its assigns the same as or revision
|
# its assigns the same as or revision
|
||||||
r = process 'rollback', 'web' => 'wiki1', 'id' => 'HomePage', 'rev' => '1'
|
r = process 'rollback', 'web' => 'wiki1', 'id' => 'HomePage', 'rev' => '1'
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal @home, r.template_objects['page']
|
assert_equal @home, r.template_objects['page']
|
||||||
assert_equal @home.revisions[0], r.template_objects['revision']
|
assert_equal @home.revisions[0], r.template_objects['revision']
|
||||||
end
|
end
|
||||||
|
@ -390,7 +390,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_rss_with_content
|
def test_rss_with_content
|
||||||
r = process 'rss_with_content', 'web' => 'wiki1'
|
r = process 'rss_with_content', 'web' => 'wiki1'
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
pages = r.template_objects['pages_by_revision']
|
pages = r.template_objects['pages_by_revision']
|
||||||
assert_equal [@elephant, @oak, pages(:no_wiki_word), pages(:that_way), pages(:smart_engine), pages(:my_way), pages(:first_page), @home], pages,
|
assert_equal [@elephant, @oak, pages(:no_wiki_word), pages(:that_way), pages(:smart_engine), pages(:my_way), pages(:first_page), @home], pages,
|
||||||
"Pages are not as expected: #{pages.map {|p| p.name}.inspect}"
|
"Pages are not as expected: #{pages.map {|p| p.name}.inspect}"
|
||||||
|
@ -416,7 +416,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = process 'rss_with_headlines', 'web' => 'wiki1'
|
r = process 'rss_with_headlines', 'web' => 'wiki1'
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
pages = r.template_objects['pages_by_revision']
|
pages = r.template_objects['pages_by_revision']
|
||||||
assert_equal [@elephant, @title_with_spaces, @oak, pages(:no_wiki_word), pages(:that_way), pages(:smart_engine), pages(:my_way), pages(:first_page), @home], pages, "Pages are not as expected: #{pages.map {|p| p.name}.inspect}"
|
assert_equal [@elephant, @title_with_spaces, @oak, pages(:no_wiki_word), pages(:that_way), pages(:smart_engine), pages(:my_way), pages(:first_page), @home], pages, "Pages are not as expected: #{pages.map {|p| p.name}.inspect}"
|
||||||
assert r.template_objects['hide_description']
|
assert r.template_objects['hide_description']
|
||||||
|
@ -450,7 +450,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = process 'rss_with_headlines', 'web' => 'wiki1'
|
r = process 'rss_with_headlines', 'web' => 'wiki1'
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
xml = REXML::Document.new(r.body)
|
xml = REXML::Document.new(r.body)
|
||||||
|
|
||||||
expected_page_links =
|
expected_page_links =
|
||||||
|
@ -473,37 +473,37 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
setup_wiki_with_30_pages
|
setup_wiki_with_30_pages
|
||||||
|
|
||||||
r = process 'rss_with_headlines', 'web' => 'wiki1'
|
r = process 'rss_with_headlines', 'web' => 'wiki1'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
pages = r.template_objects['pages_by_revision']
|
pages = r.template_objects['pages_by_revision']
|
||||||
assert_equal 15, pages.size, 15
|
assert_equal 15, pages.size, 15
|
||||||
|
|
||||||
r = process 'rss_with_headlines', 'web' => 'wiki1', 'limit' => '5'
|
r = process 'rss_with_headlines', 'web' => 'wiki1', 'limit' => '5'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
pages = r.template_objects['pages_by_revision']
|
pages = r.template_objects['pages_by_revision']
|
||||||
assert_equal 5, pages.size
|
assert_equal 5, pages.size
|
||||||
|
|
||||||
r = process 'rss_with_headlines', 'web' => 'wiki1', 'limit' => '25'
|
r = process 'rss_with_headlines', 'web' => 'wiki1', 'limit' => '25'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
pages = r.template_objects['pages_by_revision']
|
pages = r.template_objects['pages_by_revision']
|
||||||
assert_equal 25, pages.size
|
assert_equal 25, pages.size
|
||||||
|
|
||||||
r = process 'rss_with_headlines', 'web' => 'wiki1', 'limit' => 'all'
|
r = process 'rss_with_headlines', 'web' => 'wiki1', 'limit' => 'all'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
pages = r.template_objects['pages_by_revision']
|
pages = r.template_objects['pages_by_revision']
|
||||||
assert_equal 38, pages.size
|
assert_equal 38, pages.size
|
||||||
|
|
||||||
r = process 'rss_with_headlines', 'web' => 'wiki1', 'start' => '1976-10-16'
|
r = process 'rss_with_headlines', 'web' => 'wiki1', 'start' => '1976-10-16'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
pages = r.template_objects['pages_by_revision']
|
pages = r.template_objects['pages_by_revision']
|
||||||
assert_equal 23, pages.size
|
assert_equal 23, pages.size
|
||||||
|
|
||||||
r = process 'rss_with_headlines', 'web' => 'wiki1', 'end' => '1976-10-16'
|
r = process 'rss_with_headlines', 'web' => 'wiki1', 'end' => '1976-10-16'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
pages = r.template_objects['pages_by_revision']
|
pages = r.template_objects['pages_by_revision']
|
||||||
assert_equal 15, pages.size
|
assert_equal 15, pages.size
|
||||||
|
|
||||||
r = process 'rss_with_headlines', 'web' => 'wiki1', 'start' => '1976-10-01', 'end' => '1976-10-06'
|
r = process 'rss_with_headlines', 'web' => 'wiki1', 'start' => '1976-10-01', 'end' => '1976-10-06'
|
||||||
assert_success
|
assert_response(:success)
|
||||||
pages = r.template_objects['pages_by_revision']
|
pages = r.template_objects['pages_by_revision']
|
||||||
assert_equal 5, pages.size
|
assert_equal 5, pages.size
|
||||||
end
|
end
|
||||||
|
@ -565,7 +565,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
'author' => 'SomeOtherAuthor'}, {:return_to => '/wiki1/show/HomePage'}
|
'author' => 'SomeOtherAuthor'}, {:return_to => '/wiki1/show/HomePage'}
|
||||||
|
|
||||||
assert_redirected_to :action => 'edit', :web => 'wiki1', :id => 'HomePage'
|
assert_redirected_to :action => 'edit', :web => 'wiki1', :id => 'HomePage'
|
||||||
assert_flash_has :error
|
assert(@response.has_key(:error))
|
||||||
assert r.flash[:error].kind_of?(Instiki::ValidationError)
|
assert r.flash[:error].kind_of?(Instiki::ValidationError)
|
||||||
|
|
||||||
revisions_after = @home.revisions.size
|
revisions_after = @home.revisions.size
|
||||||
|
@ -597,7 +597,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_search_multiple_results
|
def test_search_multiple_results
|
||||||
r = process 'search', 'web' => 'wiki1', 'query' => 'All about'
|
r = process 'search', 'web' => 'wiki1', 'query' => 'All about'
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal 'All about', r.template_objects['query']
|
assert_equal 'All about', r.template_objects['query']
|
||||||
assert_equal [@elephant, @oak], r.template_objects['results']
|
assert_equal [@elephant, @oak], r.template_objects['results']
|
||||||
assert_equal [], r.template_objects['title_results']
|
assert_equal [], r.template_objects['title_results']
|
||||||
|
@ -606,7 +606,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_search_by_content_and_title
|
def test_search_by_content_and_title
|
||||||
r = process 'search', 'web' => 'wiki1', 'query' => '(Oak|Elephant)'
|
r = process 'search', 'web' => 'wiki1', 'query' => '(Oak|Elephant)'
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal '(Oak|Elephant)', r.template_objects['query']
|
assert_equal '(Oak|Elephant)', r.template_objects['query']
|
||||||
assert_equal [@elephant, @oak], r.template_objects['results']
|
assert_equal [@elephant, @oak], r.template_objects['results']
|
||||||
assert_equal [@elephant, @oak], r.template_objects['title_results']
|
assert_equal [@elephant, @oak], r.template_objects['title_results']
|
||||||
|
@ -615,14 +615,14 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
def test_search_zero_results
|
def test_search_zero_results
|
||||||
r = process 'search', 'web' => 'wiki1', 'query' => 'non-existant text'
|
r = process 'search', 'web' => 'wiki1', 'query' => 'non-existant text'
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal [], r.template_objects['results']
|
assert_equal [], r.template_objects['results']
|
||||||
assert_equal [], r.template_objects['title_results']
|
assert_equal [], r.template_objects['title_results']
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_page
|
def test_show_page
|
||||||
r = process('show', 'id' => 'Oak', 'web' => 'wiki1')
|
r = process('show', 'id' => 'Oak', 'web' => 'wiki1')
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_tag :content => /All about oak/
|
assert_tag :content => /All about oak/
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = process('show', 'id' => 'HomePage', 'web' => 'wiki1')
|
r = process('show', 'id' => 'HomePage', 'web' => 'wiki1')
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_match /Second revision of the <a.*HomePage.*<\/a> end/, r.body
|
assert_match /Second revision of the <a.*HomePage.*<\/a> end/, r.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_tex
|
def test_tex
|
||||||
r = process('tex', 'web' => 'wiki1', 'id' => 'HomePage')
|
r = process('tex', 'web' => 'wiki1', 'id' => 'HomePage')
|
||||||
assert_success
|
assert_response(:success)
|
||||||
|
|
||||||
assert_equal "\\documentclass[12pt,titlepage]{article}\n\n\\usepackage[danish]{babel} " +
|
assert_equal "\\documentclass[12pt,titlepage]{article}\n\n\\usepackage[danish]{babel} " +
|
||||||
"%danske tekster\n\\usepackage[OT1]{fontenc} %rigtige danske bogstaver...\n" +
|
"%danske tekster\n\\usepackage[OT1]{fontenc} %rigtige danske bogstaver...\n" +
|
||||||
|
@ -669,7 +669,7 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
|
|
||||||
r = process('web_list')
|
r = process('web_list')
|
||||||
|
|
||||||
assert_success
|
assert_response(:success)
|
||||||
assert_equal [another_wiki, webs(:instiki), @web], r.template_objects['webs']
|
assert_equal [another_wiki, webs(:instiki), @web], r.template_objects['webs']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -156,12 +156,20 @@ class PageRendererTest < Test::Unit::TestCase
|
||||||
'_should we go ThatWay or ThisWay _')
|
'_should we go ThatWay or ThisWay _')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_content_with_wikiword_in_tag
|
# wikiwords are invalid as styles, must be in "name: value" form
|
||||||
|
def test_content_with_wikiword_in_style_tag
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
'<p>That is some <em style="WikiWord">Stylish Emphasis</em></p>',
|
'<p>That is some <em style="">Stylish Emphasis</em></p>',
|
||||||
'That is some <em style="WikiWord">Stylish Emphasis</em>')
|
'That is some <em style="WikiWord">Stylish Emphasis</em>')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# validates format of style..
|
||||||
|
def test_content_with_valid_style_in_style_tag
|
||||||
|
assert_markup_parsed_as(
|
||||||
|
'<p>That is some <em style="text-align: right;">Stylish Emphasis</em></p>',
|
||||||
|
'That is some <em style="text-align: right">Stylish Emphasis</em>')
|
||||||
|
end
|
||||||
|
|
||||||
def test_content_with_escaped_wikiword
|
def test_content_with_escaped_wikiword
|
||||||
# there should be no wiki link
|
# there should be no wiki link
|
||||||
assert_markup_parsed_as('<p>WikiWord</p>', '\WikiWord')
|
assert_markup_parsed_as('<p>WikiWord</p>', '\WikiWord')
|
||||||
|
@ -197,8 +205,9 @@ class PageRendererTest < Test::Unit::TestCase
|
||||||
'<p>This <img src="http://hobix.com/sample.jpg" alt="" /> is an inline image link.</p>',
|
'<p>This <img src="http://hobix.com/sample.jpg" alt="" /> is an inline image link.</p>',
|
||||||
'This <img src="http://hobix.com/sample.jpg" alt="" /> is an inline image link.')
|
'This <img src="http://hobix.com/sample.jpg" alt="" /> is an inline image link.')
|
||||||
|
|
||||||
|
# currently, upper case HTML elements are not allowed
|
||||||
assert_markup_parsed_as(
|
assert_markup_parsed_as(
|
||||||
'<p>This <IMG SRC="http://hobix.com/sample.jpg" alt=""> is an inline image link.</p>',
|
'<p>This <IMG SRC="http://hobix.com/sample.jpg" alt=""> is an inline image link.</p>',
|
||||||
'This <IMG SRC="http://hobix.com/sample.jpg" alt=""> is an inline image link.')
|
'This <IMG SRC="http://hobix.com/sample.jpg" alt=""> is an inline image link.')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue