From 8d8deb8e766322e863ea9f5196b88e7d21390026 Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Mon, 24 Jan 2005 00:20:31 +0000 Subject: [PATCH] "user interface" to allow or prohibit file uploads (not working, just the UI element) --- app/controllers/wiki_controller.rb | 3 ++- app/models/web.rb | 4 ++-- app/models/wiki_service.rb | 13 +++++++------ app/views/wiki/edit_web.rhtml | 4 ++++ test/functional/wiki_controller_test.rb | 22 ++++++++++++++++++++-- 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 82ab703d..d3ce0f69 100755 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -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 diff --git a/app/models/web.rb b/app/models/web.rb index f3115017..3059e86b 100755 --- a/app/models/web.rb +++ b/app/models/web.rb @@ -6,8 +6,8 @@ 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 @pages = {} diff --git a/app/models/wiki_service.rb b/app/models/wiki_service.rb index 2c52a146..4156cd81 100755 --- a/app/models/wiki_service.rb +++ b/app/models/wiki_service.rb @@ -75,21 +75,22 @@ 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) @webs[new_address].address = new_address end - + web = @webs[new_address] web.refresh_revisions if settings_changed?(web, markup, safe_mode, brackets_only) - + 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) diff --git a/app/views/wiki/edit_web.rhtml b/app/views/wiki/edit_web.rhtml index b26619b3..8422bd50 100755 --- a/app/views/wiki/edit_web.rhtml +++ b/app/views/wiki/edit_web.rhtml @@ -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. Hint: View source on a page you want to style to find ID names on individual tags. @@ -51,6 +53,8 @@ Brackets only    /> Count pages +    + /> Allow uploads