"user interface" to allow or prohibit file uploads (not working, just the UI element)

This commit is contained in:
Alexey Verkhovsky 2005-01-24 00:20:31 +00:00
parent a99e492f05
commit 8d8deb8e76
5 changed files with 35 additions and 11 deletions

View file

@ -148,7 +148,8 @@ class WikiController < ApplicationController
@params['password'].empty? ? nil : @params['password'],
@params['published'] ? true : false,
@params['brackets_only'] ? true : false,
@params['count_pages'] ? true : false
@params['count_pages'] ? true : false,
@params['allow_uploads'] ? true : false
)
redirect_show('HomePage', @params['address'])
else

View file

@ -6,7 +6,7 @@ require "zip/zip"
class Web
attr_accessor :name, :address, :password, :markup, :color, :safe_mode, :pages
attr_accessor :additional_style, :published, :brackets_only, :count_pages
attr_accessor :additional_style, :published, :brackets_only, :count_pages, :allow_uploads
def initialize(parent_wiki, name, address, password = nil)
@name, @address, @password, @safe_mode = name, address, password, false

View file

@ -75,7 +75,8 @@ module AbstractWikiService
end
def update_web(old_address, new_address, name, markup, color, additional_style, safe_mode = false,
password = nil, published = false, brackets_only = false, count_pages = false)
password = nil, published = false, brackets_only = false, count_pages = false,
allow_uploads = true)
if old_address != new_address
@webs[new_address] = @webs[old_address]
@webs.delete(old_address)
@ -88,8 +89,8 @@ module AbstractWikiService
web.name, web.markup, web.color, web.additional_style, web.safe_mode =
name, markup, color, additional_style, safe_mode
web.password, web.published, web.brackets_only, web.count_pages =
password, published, brackets_only, count_pages
web.password, web.published, web.brackets_only, web.count_pages, web.allow_uploads =
password, published, brackets_only, count_pages, allow_uploads
end
def write_page(web_address, page_name, content, written_on, author)

View file

@ -21,6 +21,8 @@
Turning safe mode on will strip HTML tags and stylesheet options from the content of all pages.
Turning on "brackets only" will require all wiki words to be as [[wiki word]] and WikiWord
won't work.
Turning "allow uploads" on will let wiki users to upload pictures and other files to the wiki
and include them on wiki pages.
Additions to the stylesheet take precedence over the existing styles.
<i>Hint:</i> View source on a page you want to style to find ID names on individual tags.
<a href="#" onClick="document.getElementById('additionalStyle').style.display='block';return false;">
@ -51,6 +53,8 @@
Brackets only
&nbsp;&nbsp;
<input type="checkbox" name="count_pages"<%= " CHECKED" if @web.count_pages %> /> Count pages
&nbsp;&nbsp;
<input type="checkbox" name="allow_uploads"<%= " CHECKED" if @web.allow_uploads %> /> Allow uploads
</small>
<textarea id="additionalStyle"

View file

@ -636,8 +636,8 @@ class WikiControllerTest < Test::Unit::TestCase
process('update_web', 'system_password' => 'pswd',
'web' => 'wiki1', 'address' => 'renamed_wiki1', 'name' => 'Renamed Wiki1',
'markup' => 'markdown', 'color' => 'blue', 'additional_style' => 'whatever',
'safe_mode' => 'y', 'password' => 'new_password', 'published' => 'y',
'brackets_only' => 'y', 'count_pages' => 'y')
'safe_mode' => 'on', 'password' => 'new_password', 'published' => 'on',
'brackets_only' => 'on', 'count_pages' => 'on', 'allow_uploads' => 'on')
assert_redirected_to :web => 'renamed_wiki1', :action => 'show', :id => 'HomePage'
assert_equal 'renamed_wiki1', @web.address
@ -649,8 +649,26 @@ class WikiControllerTest < Test::Unit::TestCase
assert @web.published
assert @web.brackets_only
assert @web.count_pages
assert @web.allow_uploads
end
def test_update_web_opposite_values
@wiki.system[:password] = 'pswd'
process('update_web', 'system_password' => 'pswd',
'web' => 'wiki1', 'address' => 'renamed_wiki1', 'name' => 'Renamed Wiki1',
'markup' => 'markdown', 'color' => 'blue', 'additional_style' => 'whatever',
'password' => 'new_password')
# safe_mode, published, brackets_only, count_pages, allow_uploads not set
# and should become false
assert_redirected_to :web => 'renamed_wiki1', :action => 'show', :id => 'HomePage'
assert !@web.safe_mode
assert !@web.published
assert !@web.brackets_only
assert !@web.count_pages
assert !@web.allow_uploads
end
def test_web_list
another_wiki = @wiki.create_web('Another Wiki', 'another_wiki')