Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 344
- Log:
Massive changeset which brings the old, ROOL customised Instiki
version up to date, but without any ROOL customisations in this
latest checked-in version (which is 0.19.1). This is deliberate,
so that it's easy to see the changes made for the ROOL version
in a subsequent changeset. The 'app/views/shared' directory is not
part of Instiki but is kept to maintain the change history with
updated ROOL customisations, some of which involve the same files
in that same directory.
- Author:
- rool
- Date:
- Sat Mar 19 19:52:13 +0000 2011
- Size:
- 5118 Bytes
1 | class AdminController < ApplicationController |
2 | |
3 | layout 'default' |
4 | cache_sweeper :web_sweeper |
5 | before_filter :dnsbl_check |
6 | |
7 | def create_system |
8 | if @wiki.setup? |
9 | flash[:error] = |
10 | "Wiki has already been created in '#{@wiki.storage_path}'. " + |
11 | "Shut down Instiki and delete this directory if you want to recreate it from scratch." + |
12 | "\n\n" + |
13 | "(WARNING: this will destroy content of your current wiki)." |
14 | redirect_home(@wiki.webs.keys.first) |
15 | elsif params['web_name'] |
16 | # form submitted -> create a wiki |
17 | @wiki.setup(params['password'], params['web_name'], params['web_address']) |
18 | flash[:info] = "Your new wiki '#{params['web_name']}' is created!\n" + |
19 | "Please edit its home page and press Submit when finished." |
20 | redirect_to :web => params['web_address'], :controller => 'wiki', :action => 'new', |
21 | :id => 'HomePage' |
22 | else |
23 | # no form submitted -> go to template |
24 | end |
25 | end |
26 | |
27 | def create_web |
28 | if params['address'] |
29 | return unless is_post |
30 | # form submitted |
31 | if @wiki.authenticate(params['system_password']) |
32 | begin |
33 | @wiki.create_web(params['name'], params['address']) |
34 | flash[:info] = "New web '#{params['name']}' successfully created." |
35 | redirect_to :web => params['address'], :controller => 'wiki', :action => 'new', |
36 | :id => 'HomePage' |
37 | rescue Instiki::ValidationError => e |
38 | @error = e.message |
39 | # and re-render the form again |
40 | end |
41 | else |
42 | flash[:error] = "System Password incorrect. Try again." |
43 | redirect_to :controller => 'admin', :action => 'create_web' |
44 | end |
45 | else |
46 | # no form submitted -> render template |
47 | end |
48 | end |
49 | |
50 | def edit_web |
51 | system_password = params['system_password'] |
52 | if system_password |
53 | return unless is_post |
54 | # form submitted |
55 | if wiki.authenticate(system_password) |
56 | begin |
57 | raise Instiki::ValidationError.new("Password for this Web didn't match") unless |
58 | (params['password'].empty? or params['password'] == params['password_check']) |
59 | wiki.edit_web( |
60 | @web.address, params['address'], params['name'], |
61 | params['markup'].intern, |
62 | params['color'], params['additional_style'], |
63 | params['safe_mode'] ? true : false, |
64 | params['password'].empty? ? nil : params['password'], |
65 | params['published'] ? true : false, |
66 | params['brackets_only'] ? true : false, |
67 | params['count_pages'] ? true : false, |
68 | params['allow_uploads'] ? true : false, |
69 | params['max_upload_size'] |
70 | ) |
71 | flash[:info] = "Web '#{params['address']}' was successfully updated" |
72 | redirect_home(params['address']) |
73 | rescue Instiki::ValidationError => e |
74 | logger.warn e.message |
75 | @error = e.message |
76 | # and re-render the same template again |
77 | end |
78 | else |
79 | @error = password_error(system_password) |
80 | # and re-render the same template again |
81 | end |
82 | else |
83 | # no form submitted - go to template |
84 | end |
85 | end |
86 | |
87 | def remove_orphaned_pages |
88 | return unless is_post |
89 | if wiki.authenticate(params['system_password_orphaned']) |
90 | wiki.remove_orphaned_pages(@web_name) |
91 | flash[:info] = 'Orphaned pages removed' |
92 | redirect_to :controller => 'wiki', :web => @web_name, :action => 'list' |
93 | else |
94 | flash[:error] = password_error(params['system_password_orphaned']) |
95 | redirect_to :controller => 'admin', :web => @web_name, :action => 'edit_web' |
96 | end |
97 | end |
98 | |
99 | def remove_orphaned_pages_in_category |
100 | return unless is_post |
101 | if wiki.authenticate(params['system_password_orphaned_in_category']) |
102 | category = params['category'] |
103 | wiki.remove_orphaned_pages_in_category(@web_name, category) |
104 | flash[:info] = "Orphaned pages in category \"#{category}\" removed" |
105 | redirect_to :controller => 'wiki', :web => @web_name, :action => 'list' |
106 | else |
107 | flash[:error] = password_error(params['system_password_orphaned_in_category']) |
108 | redirect_to :controller => 'admin', :web => @web_name, :action => 'edit_web' |
109 | end |
110 | end |
111 | |
112 | def delete_web |
113 | return unless is_post |
114 | if wiki.authenticate(params['system_password_delete_web']) |
115 | wiki.delete_web(@web_name) |
116 | flash[:info] = "Web \"#{@web_name}\" has been deleted." |
117 | redirect_to :controller => 'wiki', :action => 'web_list' |
118 | else |
119 | flash[:error] = password_error(params['system_password_delete_web']) |
120 | redirect_to :controller => 'admin', :web => @web_name, :action => 'edit_web' |
121 | end |
122 | end |
123 | |
124 | def delete_files |
125 | return unless is_post |
126 | some_deleted = false |
127 | if wiki.authenticate(params['system_password']) |
128 | params.each do |file, p| |
129 | if p == 'delete' |
130 | WikiFile.find_by_file_name(file).destroy |
131 | some_deleted = true |
132 | end |
133 | end |
134 | flash[:info] = "File(s) successfully deleted." if some_deleted |
135 | else |
136 | flash[:error] = password_error(params['system_password']) |
137 | end |
138 | redirect_to :back |
139 | end |
140 | |
141 | end |