Beginnings of a FileController (serving the file upload feature)
This commit is contained in:
parent
71407f9b9f
commit
12a34823a8
5 changed files with 83 additions and 26 deletions
|
@ -5,7 +5,6 @@ require 'redcloth_for_tex'
|
|||
class WikiController < ApplicationController
|
||||
|
||||
layout 'default', :except => [:rss_feed, :rss_with_headlines, :tex, :export_tex, :export_html]
|
||||
before_filter :pre_process
|
||||
|
||||
def index
|
||||
if @web_name
|
||||
|
@ -271,15 +270,6 @@ class WikiController < ApplicationController
|
|||
password_check(@params['password'])
|
||||
end
|
||||
|
||||
def check_authorization(action_name)
|
||||
if in_a_web? and
|
||||
not authorized? and
|
||||
not %w( login authenticate published ).include?(action_name)
|
||||
redirect_to :action => 'login'
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def convert_tex_to_pdf(tex_path)
|
||||
# TODO remove earlier PDF files with the same prefix
|
||||
# TODO handle gracefully situation where pdflatex is not available
|
||||
|
@ -329,10 +319,6 @@ class WikiController < ApplicationController
|
|||
@revision = @page.revisions[@params['rev'].to_i]
|
||||
end
|
||||
|
||||
def in_a_web?
|
||||
not @web_name.nil?
|
||||
end
|
||||
|
||||
def parse_category
|
||||
@categories = @web.categories
|
||||
@category = @params['category']
|
||||
|
@ -361,17 +347,6 @@ class WikiController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def pre_process
|
||||
@action_name = @params['action'] || 'index'
|
||||
@web_name = @params['web']
|
||||
@wiki = wiki
|
||||
@web = @wiki.webs[@web_name] unless @web_name.nil?
|
||||
@page_name = @params['id']
|
||||
@page = @wiki.read_page(@web_name, @page_name) unless @page_name.nil?
|
||||
@author = cookies['author'] || 'AnonymousCoward'
|
||||
check_authorization(@action_name)
|
||||
end
|
||||
|
||||
def redirect_show(page_name = @page_name, web = @web_name)
|
||||
redirect_to :web => web, :action => 'show', :id => CGI.escape(page_name)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue