diff --git a/app/models/web.rb b/app/models/web.rb index 78a8b0f4..efe903e3 100644 --- a/app/models/web.rb +++ b/app/models/web.rb @@ -7,6 +7,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, :allow_uploads + attr_accessor :max_upload_size def initialize(parent_wiki, name, address, password = nil) @wiki, @name, @address, @password = parent_wiki, name, address, password @@ -22,24 +23,13 @@ class Web @brackets_only = false @count_pages = false @allow_uploads = true + @max_upload_size = 100 end def add_page(page) @pages[page.name] = page end - def remove_pages(pages_to_be_removed) - pages.delete_if { |page_name, page| pages_to_be_removed.include?(page) } - end - - def select(&condition) - PageSet.new(self, @pages.values, condition) - end - - def revised_on - select.most_recent_revision - end - def authors select.authors end @@ -48,6 +38,32 @@ class Web select.map { |page| page.categories }.flatten.uniq.sort end + def has_page?(name) + pages[name] + end + + def has_file?(name) + wiki.file_yard(self).has_file?(name) + end + + def make_file_link(mode, name, text) + link = CGI.escape(name) + case mode + when :export + if has_file?(name) then "#{text}" + else "#{text}" end + when :publish + if has_file?(name) then "#{text}" + else "#{text}" end + else + if has_file?(name) + "#{text}" + else + "#{text}?" + end + end + end + # Create a link for the given page name and link text based # on the render mode in options and whether the page exists # in the this web. @@ -85,24 +101,6 @@ class Web end end - def make_file_link(mode, name, text) - link = CGI.escape(name) - case mode - when :export - if has_file?(name) then "#{text}" - else "#{text}" end - when :publish - if has_file?(name) then "#{text}" - else "#{text}" end - else - if has_file?(name) - "#{text}" - else - "#{text}?" - end - end - end - def make_pic_link(mode, name, text) link = CGI.escape(name) case mode @@ -118,12 +116,8 @@ class Web end end - def has_page?(name) - pages[name] - end - - def has_file?(name) - wiki.file_yard(self).has_file?(name) + def max_upload_size + @max_upload_size || 100 end # Clears the display cache for all the pages with references to @@ -137,6 +131,18 @@ class Web select.each { |page| page.revisions.each { |revision| revision.clear_display_cache } } end + def remove_pages(pages_to_be_removed) + pages.delete_if { |page_name, page| pages_to_be_removed.include?(page) } + end + + def revised_on + select.most_recent_revision + end + + def select(&condition) + PageSet.new(self, @pages.values, condition) + end + private # Returns an array of all the wiki words in any current revision def wiki_words @@ -152,4 +158,5 @@ class Web def wiki @wiki ||= WikiService.instance end + end \ No newline at end of file diff --git a/app/views/admin/edit_web.rhtml b/app/views/admin/edit_web.rhtml index 887bf5e9..e752b607 100644 --- a/app/views/admin/edit_web.rhtml +++ b/app/views/admin/edit_web.rhtml @@ -17,18 +17,6 @@
- /> Safe mode
-
+ />
+ Safe mode
+ - strip HTML tags and stylesheet options from the content of all pages
+
/>
Brackets only
-
- /> Count pages
-
- /> Allow uploads
+ - require all wiki words to be as [[wiki word]], WikiWord links won't be created
+
+ />
+ Count pages
+
+ />
+ Allow uploads of no more than
+
+ kbytes
+ -
+ let wiki users to upload pictures and other files and include or link to them on wiki pages
+
+
+